:root {
  --kraft: #EFE3CC;
  --kraft-dark: #E4D5B8;
  --ink: #211C19;
  --white: #FFFFFF;
  --grease: #7A7268;
  --red: #C8102E;
  --radius-sm: 6px;
  --font-display: 'Anton', sans-serif;
  --font-body: 'Work Sans', system-ui, sans-serif;
  --font-stamp: 'Special Elite', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--kraft);
  color: var(--ink);
  font-family: var(--font-body);
}

.frame {
  position: relative;
  min-height: 100vh;
}

/* ---- brand, top right ---- */

.brand {
  position: fixed;
  top: 36px;
  right: 43px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stamp-mark {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  border: 3px solid var(--red);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-stamp);
  font-size: 10px;
  line-height: 1.15;
  transform: rotate(-8deg);
  flex-shrink: 0;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 31px;
  letter-spacing: 0.01em;
  line-height: 1;
}

/* ---- side menu, left, vertically centered ---- */

.side-menu {
  position: fixed;
  left: 50px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
}

.menu-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.menu-link {
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 26px;
  text-decoration: none;
  color: var(--grease);
}

.menu-link svg {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.menu-link:hover svg,
.menu-link:focus-visible svg {
  opacity: 1;
}

.menu-link span {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.menu-divider {
  align-self: stretch;
  flex-shrink: 0;
}

/* ---- main stage ---- */

.stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 29px 18px;
  overflow-y: auto;
}

.panel-label-row {
  width: 504px;
  max-width: 92vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: rotate(-0.8deg);
}

.panel-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.panel-label .idx {
  font-family: var(--font-stamp);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--red);
}

.slice-toggle {
  display: flex;
  gap: 6px;
}

.slice-tab {
  width: 27px;
  height: 31px;
  border: none;
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-stamp);
  font-size: 13px;
  cursor: pointer;
  transform: rotate(-2deg);
}

.slice-tab:nth-child(2) { transform: rotate(2deg); }

.slice-tab.is-active {
  background: var(--red);
  color: var(--white);
}

/* ---- receipt ---- */

.receipt {
  position: relative;
  width: 504px;
  max-width: 92vw;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 20px 20px 27px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: 0 10px 24px rgba(33, 28, 25, 0.14);
  transform: rotate(-0.8deg);
}

.receipt-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-bottom: 9px;
  border-bottom: 2px dashed var(--kraft-dark);
}

.receipt-title {
  font-family: var(--font-stamp);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.receipt-sub {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--grease);
}

.tweet-identity {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tweet-avatar {
  width: 31px;
  height: 31px;
  border-radius: 999px;
  background: var(--kraft);
  border: 1.5px solid var(--ink);
  flex-shrink: 0;
}

.tweet-who {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tweet-name { font-weight: 700; font-size: 12px; }
.tweet-handle { font-size: 11px; color: var(--grease); }

.tweet-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

.carousel {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 55vh;
  border-radius: 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  min-height: 54px;
}

.carousel::-webkit-scrollbar { display: none; }

.slide {
  flex: 0 0 58%;
  scroll-snap-align: start;
  border-radius: 8px;
  background-repeat: no-repeat;
  background-color: var(--kraft-dark);
  cursor: pointer;
}

.slide-placeholder-label {
  position: absolute;
  font-family: var(--font-stamp);
  font-size: 9px;
  color: rgba(33, 28, 25, 0.55);
  padding: 7px;
}

.slide-download {
  position: absolute;
  left: 9px;
  bottom: 9px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.slide-download svg { width: 12px; height: 12px; }

.slide.is-revealed .slide-download,
.slide-download:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.line-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 4px;
  border-top: 2px dashed var(--kraft-dark);
  font-size: 11px;
}

.line-item {
  display: flex;
  justify-content: space-between;
}

.line-item.total {
  font-weight: 700;
  color: var(--red);
  padding-top: 5px;
  border-top: 1px solid var(--kraft-dark);
}

/* ---- stamp buttons ---- */

/* .stamp-row is absolutely positioned, so .stage's centering ignores
   its height -- this invisible spacer stands in for that footprint
   (stamp-row's margin-top + stamp-btn height, minus the gap .stage
   already adds before it) so top/bottom padding stay balanced. */
.stamp-spacer {
  height: 58px;
  visibility: hidden;
}

@media (max-height: 900px) {
  /* buttons float beside the card in this mode, no longer adding
     height below it, so no spacer is needed */
  .stamp-spacer {
    display: none;
  }
}

.stamp-row {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  margin-top: 22px;
  display: flex;
  gap: 14px;
}

@media (max-height: 900px) {
  .stamp-row {
    left: auto;
    top: auto;
    right: 100%;
    bottom: 0;
    transform: none;
    margin-top: 0;
    margin-right: 14px;
    flex-direction: column;
  }
}

.stamp-btn {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  background: var(--red);
  border: 2px solid var(--white);
  box-shadow: 0 7px 18px rgba(200, 16, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stamp-btn svg {
  width: 18px;
  height: 18px;
}

.stamp-btn:disabled { opacity: 0.5; cursor: progress; }

.photo-stamp { transform: rotate(-8deg); }
.download-stamp { transform: rotate(8deg); }

/* ---- responsive ---- */

@media (max-width: 720px) {
  .brand { display: none; }

  /* side menu becomes a footer: static in flow (moved to the end of
     .frame in HTML), centered, links stacked vertically as before */
  .side-menu {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    justify-content: center;
    margin: 36px 0 54px;
  }

  .menu-links {
    align-items: center;
    gap: 28px;
  }

  /* no room for the sidebar's divider in a footer layout */
  .menu-divider {
    display: none;
  }

  /* portfolio-footer treatment: icon trails the label, muted, always
     visible -- no hover on touch to reveal it */
  .menu-link {
    position: static;
    padding-left: 0;
    justify-content: center;
    gap: 8px;
  }

  .menu-link svg {
    position: static;
    transform: none;
    opacity: 1;
    order: 2;
    fill: var(--grease);
  }

  /* no room beside the card on narrow screens -- always sit below it,
     even if the max-height breakpoint below also matches */
  .stamp-row {
    left: 50%;
    top: 100%;
    right: auto;
    bottom: auto;
    transform: translateX(-50%);
    margin-top: 22px;
    margin-right: 0;
    flex-direction: row;
  }

  .stamp-spacer {
    display: block;
  }
}
