:root {
  --paper: #faf6ee;
  --paper-deep: #f3ecdd;
  --ink: #2b2b26;
  --ink-soft: #55574d;
  --sage-deep: #2f4a3a;
  --sage: #7c9a7e;
  --sage-soft: #e4ecdf;
  --blush: #eab8b0;
  --blush-deep: #a13f5e;
  --blush-soft: #fbe6e2;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Karla', -apple-system, 'Segoe UI', sans-serif;
  --font-fa: 'Geeza Pro', Tahoma, 'Segoe UI', Arial, sans-serif;
  --shadow-soft: 0 10px 30px rgba(47, 74, 58, 0.14);
  --shadow-lift: 0 18px 40px rgba(47, 74, 58, 0.2);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(124, 154, 126, 0.2), transparent 42%),
    radial-gradient(circle at 88% 78%, rgba(234, 184, 176, 0.25), transparent 48%),
    radial-gradient(circle, rgba(47, 74, 58, 0.06) 1px, transparent 1.6px);
  background-size: auto, auto, 26px 26px;
  background-attachment: fixed, fixed, fixed;
  background-repeat: no-repeat, no-repeat, repeat;
}

body.no-scroll {
  overflow: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  color: var(--sage-deep);
}

p {
  margin: 0;
}

button {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--blush-deep);
  outline-offset: 2px;
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
}

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise-in 0.7s var(--ease-spring) forwards;
    animation-delay: calc(var(--i, 0) * 90ms);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* header */

.site-header {
  padding: 2.75rem 1.25rem 1.5rem;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.flourish {
  --i: 0;
  letter-spacing: 0.4em;
  color: var(--blush-deep);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.cafe-name {
  --i: 1;
  font-size: clamp(2.1rem, 7vw, 3rem);
  cursor: default;
  user-select: none;
}

.tagline {
  --i: 1;
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.05rem;
}

/* menu grid */

.menu-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 8rem;
  display: grid;
  grid-template-columns: minmax(0, 420px);
  justify-content: center;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .menu-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 340px));
  }
}

.menu-card {
  appearance: none;
  border: none;
  text-align: left;
  background: var(--paper-deep);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  min-height: 44px;
}

.menu-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.menu-card:active {
  transform: translateY(-1px) scale(0.99);
}

.card-media {
  position: relative;
  height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-media-emoji {
  background:
    radial-gradient(circle at 30% 30%, var(--sage-soft), transparent 60%),
    radial-gradient(circle at 75% 70%, var(--blush-soft), transparent 55%),
    var(--paper);
}

.card-emoji {
  font-size: 3.5rem;
  filter: drop-shadow(0 6px 10px rgba(47, 74, 58, 0.18));
}

.steam {
  position: absolute;
  top: 18%;
  left: 50%;
  width: 2px;
  height: 2px;
  pointer-events: none;
}

.steam i {
  position: absolute;
  bottom: 0;
  width: 6px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  filter: blur(3px);
  opacity: 0;
}

.steam i:nth-child(1) {
  left: -10px;
}

.steam i:nth-child(2) {
  left: 0;
}

.steam i:nth-child(3) {
  left: 10px;
}

@media (prefers-reduced-motion: no-preference) {
  .steam i:nth-child(1) {
    animation: steam-rise 3.2s ease-in-out infinite;
    animation-delay: 0.1s;
  }
  .steam i:nth-child(2) {
    animation: steam-rise 3.6s ease-in-out infinite;
    animation-delay: 0.9s;
  }
  .steam i:nth-child(3) {
    animation: steam-rise 3s ease-in-out infinite;
    animation-delay: 1.6s;
  }
}

@keyframes steam-rise {
  0% {
    transform: translateY(0) scaleX(0.7);
    opacity: 0;
  }
  25% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(-26px) scaleX(1.15);
    opacity: 0;
  }
}

.card-body {
  padding: 1.1rem 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.badge-bundle {
  align-self: flex-start;
  background: var(--blush);
  color: var(--ink);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
}

.card-title {
  font-size: 1.25rem;
}

.card-description {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

.card-contents {
  color: var(--sage-deep);
  font-size: 0.85rem;
  font-style: italic;
}

.card-footer {
  margin-top: auto;
  padding-top: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.price {
  color: var(--blush-deep);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1rem;
}

.card-cta {
  font-size: 0.82rem;
  color: var(--sage-deep);
  font-weight: 600;
}

/* buttons */

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  min-height: 44px;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease, opacity 0.2s ease;
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:not(:disabled):active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--sage-deep);
  color: var(--paper);
  box-shadow: var(--shadow-soft);
}

.btn-accent {
  background: var(--blush-deep);
  color: var(--paper);
  box-shadow: var(--shadow-soft);
  font-size: 1.1rem;
}

.btn-ghost {
  background: transparent;
  color: var(--sage-deep);
  font-weight: 600;
}

/* extra chips */

.item-sheet-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.25rem 0;
}

.chip {
  appearance: none;
  border: 2px solid var(--sage-soft);
  background: var(--sage-soft);
  color: var(--sage-deep);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.chip-emoji {
  font-size: 1.05rem;
  line-height: 1;
}

.chip-label {
  font-weight: 700;
}

.chip.selected {
  background: var(--blush-deep);
  border-color: var(--blush-deep);
  color: var(--paper);
  box-shadow: 0 6px 16px rgba(161, 63, 94, 0.3);
}

@media (prefers-reduced-motion: no-preference) {
  .chip.pop {
    animation: chip-pop 0.35s var(--ease-spring);
  }
}

@keyframes chip-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}

/* tray pill */

.tray-pill {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.2rem;
  display: flex;
  justify-content: center;
  z-index: 40;
  padding: 0 1rem;
}

.tray-pill-button {
  appearance: none;
  border: none;
  background: var(--sage-deep);
  color: var(--paper);
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-lift);
}

.tray-pill-icon {
  font-size: 1.15rem;
}

.tray-pill-count {
  background: var(--blush-deep);
  color: var(--paper);
  border-radius: 999px;
  min-width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  padding: 0 0.4rem;
}

@media (prefers-reduced-motion: no-preference) {
  .tray-pill.bump .tray-pill-button {
    animation: pill-bump 0.4s var(--ease-spring);
  }
}

@keyframes pill-bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* sheets and overlays */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 43, 38, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 0;
}

.sheet-overlay.is-open {
  opacity: 1;
}

.sheet {
  background: var(--paper);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 26px 26px 0 0;
  padding: 1.5rem 1.4rem 2rem;
  position: relative;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-spring);
  box-shadow: 0 -12px 40px rgba(47, 74, 58, 0.25);
}

.sheet-overlay.is-open .sheet {
  transform: translateY(0);
}

@media (min-width: 720px) {
  .sheet-overlay {
    align-items: center;
  }
  .sheet {
    border-radius: var(--radius-lg);
    max-height: 84vh;
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    transition: transform 0.35s var(--ease-spring), opacity 0.3s ease;
  }
  .sheet-overlay.is-open .sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: var(--sage-soft);
  margin: 0 auto 0.75rem;
}

@media (min-width: 720px) {
  .sheet-handle {
    display: none;
  }
}

.sheet-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: var(--sage-soft);
  color: var(--sage-deep);
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* item sheet */

.item-sheet-head {
  text-align: center;
  margin-bottom: 0.6rem;
}

.item-sheet-emoji {
  font-size: 2.75rem;
  display: block;
}

.item-sheet-name {
  font-size: 1.5rem;
  margin-top: 0.3rem;
}

.item-sheet-description {
  color: var(--ink-soft);
  text-align: center;
  margin: 0.6rem 0 1rem;
}

.item-sheet-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.1rem 0;
}

.item-sheet-qty-label {
  font-weight: 700;
  color: var(--sage-deep);
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--sage-soft);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
}

.qty-btn {
  appearance: none;
  border: none;
  background: var(--paper);
  color: var(--sage-deep);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(47, 74, 58, 0.15);
}

.qty-value {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.item-sheet-note-label {
  display: block;
  font-weight: 700;
  color: var(--sage-deep);
  margin-bottom: 0.4rem;
}

.item-sheet-note {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  border: 2px solid var(--sage-soft);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  resize: vertical;
  background: var(--paper-deep);
  color: var(--ink);
  margin-bottom: 1.2rem;
}

.item-sheet-note:focus {
  border-color: var(--blush-deep);
  outline: none;
}

/* tray sheet */

.tray-title {
  font-size: 1.4rem;
  text-align: center;
  margin-bottom: 0.9rem;
}

.tray-empty {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  padding: 1.2rem 0;
}

.tray-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tray-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--paper-deep);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.tray-line-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tray-line-title {
  font-weight: 700;
  color: var(--sage-deep);
}

.tray-line-extras {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.tray-line-note {
  font-size: 0.85rem;
  color: var(--blush-deep);
  font-style: italic;
}

.tray-line-remove {
  appearance: none;
  border: none;
  background: var(--sage-soft);
  color: var(--sage-deep);
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.tray-error {
  background: var(--blush-soft);
  color: var(--blush-deep);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  text-align: center;
}

.btn-send {
  margin-bottom: 0.6rem;
}

.receipt-edge {
  position: relative;
}

.receipt-edge::before,
.receipt-edge::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 14px;
  background-image: radial-gradient(circle at 10px 0, transparent 9px, var(--paper) 9.5px);
  background-size: 20px 14px;
  background-repeat: repeat-x;
  pointer-events: none;
}

.receipt-edge::before {
  top: -1px;
}

.receipt-edge::after {
  bottom: -1px;
  transform: scaleY(-1);
}

/* confirmation */

.confirmation-screen {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.35s ease;
  overflow-y: auto;
}

.confirmation-screen.is-open {
  opacity: 1;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  left: var(--left, 50%);
  width: 8px;
  height: 14px;
  background: var(--color, var(--blush-deep));
  border-radius: 2px;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .confetti-piece {
    animation: confetti-fall var(--duration, 2s) var(--delay, 0s) ease-in forwards;
  }
}

@keyframes confetti-fall {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--drift, 0px), 90vh) rotate(var(--rotation, 180deg));
    opacity: 0;
  }
}

.confirmation-card {
  text-align: center;
  max-width: 420px;
  background: var(--paper-deep);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lift);
  position: relative;
  z-index: 1;
}

.confirmation-emoji {
  font-size: 2.5rem;
}

.confirmation-title {
  font-size: 1.9rem;
  margin-top: 0.5rem;
}

.confirmation-message {
  color: var(--ink-soft);
  margin-top: 0.5rem;
}

.confirmation-summary {
  margin: 1.3rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.confirmation-line {
  color: var(--sage-deep);
  font-weight: 600;
}

/* debug panel */

.debug-panel {
  position: fixed;
  right: 0.75rem;
  top: 0.75rem;
  width: min(300px, calc(100vw - 1.5rem));
  max-height: 46vh;
  overflow-y: auto;
  background: rgba(24, 28, 24, 0.94);
  color: #d9f0da;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.72rem;
  border-radius: var(--radius-md);
  padding: 0.9rem;
  z-index: 70;
  box-shadow: var(--shadow-lift);
}

.debug-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  color: #fff;
  font-size: 0.78rem;
}

.debug-panel.collapsed {
  width: auto;
}

.debug-panel.collapsed .debug-head {
  margin-bottom: 0;
}

.debug-toggle {
  background: none;
  border: 0;
  color: #fff;
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  padding: 0 0.25rem;
  cursor: pointer;
}

.debug-dry-run-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  cursor: pointer;
}

.debug-heading {
  color: #9fd9a4;
  margin-top: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.65rem;
}

.debug-json,
.debug-text {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 0.5rem;
  margin: 0.3rem 0;
  max-height: 140px;
  overflow-y: auto;
}

.debug-result {
  word-break: break-word;
  margin: 0.3rem 0 0.6rem;
}

.debug-copy {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.5rem;
}
