/* ==========================================================================
   THE HEARTHMENDER'S TABLE — Cozy Pastel Storybook Video Game Stylesheet
   Zero external CSS dependencies · Offline-First PWA · Desktop / iPad / Mobile
   ========================================================================== */

:root {
  /* Warm Pastel Cozy Fantasy Tokens */
  --cream: #FFF8F0;
  --cream-deep: #F9EDE1;
  --parchment: #FCF3E8;
  --blush: #F9D5D3;
  --blush-soft: #FCE8E6;
  --berry: #C85A70;
  --berry-dark: #9D3D52;
  --peach: #FDE2C8;
  --sage: #A8C6A0;
  --sage-deep: #6C8E64;
  --cocoa: #4A3531;
  --cocoa-soft: #755851;
  --cocoa-outline: #5B3F39;
  --gold: #E6B85C;
  --gold-deep: #BA842A;
  --lavender: #B8A9D9;
  --lavender-soft: #EFEAF9;

  --surface: rgba(255, 250, 244, 0.92);
  --surface-strong: #FFFBF6;
  --border-soft: rgba(91, 63, 57, 0.14);
  --border-med: rgba(91, 63, 57, 0.24);
  --shadow-soft: 0 10px 30px rgba(74, 53, 49, 0.10);
  --shadow-card: 0 14px 36px rgba(74, 53, 49, 0.14);
  --shadow-lifted: 0 22px 48px rgba(74, 53, 49, 0.22);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-ornate: 'Cinzel', 'Playfair Display', Georgia, serif;
  --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-hand: 'Caveat', cursive;

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-pill: 999px;
  --fs-scale: 1;
}

/* Candlelight Evening Theme (Warm cozy dark-amber sanctuary) */
html[data-theme="candlelight"] {
  --cream: #2B2021;
  --cream-deep: #221819;
  --parchment: #362829;
  --blush: #5B373D;
  --blush-soft: #432B2E;
  --peach: #4D362D;
  --cocoa: #FAF0E6;
  --cocoa-soft: #DFC8BD;
  --cocoa-outline: #E8C7A8;
  --surface: rgba(49, 36, 37, 0.94);
  --surface-strong: #3A2A2C;
  --border-soft: rgba(250, 232, 208, 0.14);
  --border-med: rgba(250, 232, 208, 0.26);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.36);
  --shadow-card: 0 18px 44px rgba(0, 0, 0, 0.48);
}

html.large-font {
  --fs-scale: 1.15;
}

html.reduced-motion *,
html.reduced-motion *::before,
html.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: clip;
  background: var(--cream);
  color: var(--cocoa);
  font-family: var(--font-ui);
  font-size: calc(16px * var(--fs-scale));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  background-image:
    radial-gradient(circle at 15% 15%, rgba(249, 213, 211, 0.42), transparent 42%),
    radial-gradient(circle at 85% 20%, rgba(253, 226, 200, 0.44), transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(230, 184, 92, 0.16), transparent 50%);
  background-attachment: fixed;
}

html[data-theme="candlelight"] body {
  background-image:
    radial-gradient(circle at 20% 10%, rgba(230, 184, 92, 0.16), transparent 44%),
    radial-gradient(circle at 85% 85%, rgba(200, 90, 112, 0.18), transparent 45%);
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ==========================================================================
   APP SHELL & TOP COZY HUD BAR
   ========================================================================== */
.app-shell {
  min-height: 100dvh;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.hud-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
  background: linear-gradient(180deg, rgba(255, 248, 240, 0.94), rgba(255, 248, 240, 0.78));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1.5px solid var(--border-soft);
}

html[data-theme="candlelight"] .hud-bar {
  background: linear-gradient(180deg, rgba(43, 32, 33, 0.94), rgba(43, 32, 33, 0.78));
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  border: 1.5px solid var(--border-med);
  box-shadow: 0 3px 10px rgba(74, 53, 49, 0.08);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--cocoa);
  transition: transform 0.16s cubic-bezier(.34,1.56,.64,1), box-shadow 0.16s ease, background 0.16s ease;
}

button.hud-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(74, 53, 49, 0.14);
}

button.hud-pill:active {
  transform: translateY(0) scale(0.96);
}

.hud-pill--icon {
  width: 40px;
  padding: 0;
  justify-content: center;
}

.hud-pill--accent {
  background: linear-gradient(135deg, var(--berry), #DA6E84);
  color: #FFF8F0;
  border-color: rgba(91, 63, 57, 0.25);
}

.hud-pill--stars {
  background: linear-gradient(135deg, #FFF3D4, #FCE4B3);
  color: #6B4716;
  border-color: rgba(186, 132, 42, 0.45);
}

html[data-theme="candlelight"] .hud-pill--stars {
  background: linear-gradient(135deg, #533C1D, #6C4D22);
  color: #FFE7AC;
}

.hud-pill--stars.pop {
  animation: starPop 0.55s cubic-bezier(.34,1.56,.64,1);
}

@keyframes starPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.22) rotate(-4deg); }
  100% { transform: scale(1); }
}

.hud-pill--night {
  background: var(--blush-soft);
  border-color: rgba(200, 90, 112, 0.28);
  font-family: var(--font-display);
  font-style: italic;
  max-width: min(270px, 44vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hud-night-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hud-icon svg {
  width: 18px;
  height: 18px;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: min(1180px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 18px 18px 42px;
  position: relative;
}

.stage.stage--fullbleed {
  max-width: none;
  padding: 0;
}

/* Animate entrance ONLY on actual screen navigation — prevents in-page re-render jumps! */
.stage.stage--enter .desk-wrap,
.stage.stage--enter .story-layout,
.stage.stage--enter .tasting-card,
.stage.stage--enter .journal-book,
.stage.stage--enter .epilogue-card {
  animation: fadeSlideUp 0.36s ease;
}

/* ==========================================================================
   3D STORYBOOK PAGE-TURN TRANSITION (Zero post-turn flash)
   ========================================================================== */
.page-turn-curtain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  perspective: 1600px;
  visibility: hidden;
  opacity: 0;
}

.page-turn-curtain.is-turning {
  visibility: visible;
  opacity: 1;
}

.page-turn-leaf {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #F6E6D4 0%, #FFF8F0 45%, #F4DFCC 100%);
  transform-origin: left center;
  transform: rotateY(90deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
  opacity: 0;
  box-shadow: -20px 0 60px rgba(74, 53, 49, 0.30);
  display: flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="candlelight"] .page-turn-leaf {
  background: linear-gradient(90deg, #352527 0%, #443133 48%, #2E2022 100%);
}

.page-turn-curtain.is-turning .page-turn-leaf {
  animation: pageTurnSweep 0.62s cubic-bezier(.42, 0, .24, 1) forwards;
}

.page-turn-crest {
  font-size: 3.2rem;
  color: var(--gold);
  opacity: 0.72;
}

@keyframes pageTurnSweep {
  0%   { transform: rotateY(88deg); opacity: 0; }
  16%  { opacity: 1; }
  46%  { transform: rotateY(0deg); opacity: 1; }
  60%  { transform: rotateY(-8deg); opacity: 1; }
  88%  { opacity: 0.86; }
  100% { transform: rotateY(-96deg); opacity: 0; }
}

/* ==========================================================================
   BUTTONS & SHARED COZY UI PRIMITIVES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.96rem;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.18s ease, background 0.18s ease;
  border: 1.5px solid transparent;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

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

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

.btn--primary {
  background: linear-gradient(135deg, var(--berry), #DE6E83);
  color: #FFF9F2;
  border-color: rgba(91, 63, 57, 0.24);
  box-shadow: 0 8px 22px rgba(200, 90, 112, 0.30);
}

.btn--primary:hover:not(:disabled) {
  box-shadow: 0 12px 28px rgba(200, 90, 112, 0.40);
}

.btn--gold {
  background: linear-gradient(135deg, #F0C66E, #D99B38);
  color: #3D2618;
  border-color: rgba(91, 63, 57, 0.22);
  box-shadow: 0 8px 22px rgba(217, 155, 56, 0.32);
}

.btn--soft {
  background: var(--surface-strong);
  color: var(--cocoa);
  border-color: var(--border-med);
  box-shadow: 0 4px 12px rgba(74, 53, 49, 0.08);
}

.btn--ghost {
  background: transparent;
  color: var(--cocoa-soft);
  border-color: var(--border-soft);
}

.btn--danger {
  background: #B8424F;
  color: #FFF8F0;
}

.btn--sm {
  padding: 8px 15px;
  font-size: 0.85rem;
}

.btn--lg {
  padding: 15px 30px;
  font-size: 1.06rem;
}

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

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--blush-soft);
  color: var(--berry-dark);
  border: 1px solid rgba(200, 90, 112, 0.24);
}

html[data-theme="candlelight"] .pill-tag {
  color: #FBD6D3;
}

.pill-tag--gold {
  background: linear-gradient(135deg, #FFF3D4, #FBE2AA);
  color: #704910;
  border-color: rgba(186, 132, 42, 0.42);
  white-space: nowrap;
}

html[data-theme="candlelight"] .pill-tag--gold {
  background: linear-gradient(135deg, #533C1D, #6B4C23);
  color: #FFE7AC;
  border-color: rgba(230, 184, 92, 0.55);
}

.pill-tag--sage {
  background: rgba(168, 198, 160, 0.28);
  color: #3D5B37;
  border-color: rgba(108, 142, 100, 0.36);
}

html[data-theme="candlelight"] .pill-tag--sage {
  color: #C7E2C0;
}

.card-paper {
  background: var(--surface);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
}

/* ==========================================================================
   SCREEN 1: BELLAMERE ANIMATED HERO TITLE COVER
   ========================================================================== */
.title-screen {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  overflow: hidden;
  background: #23171A;
}

.title-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/art/hero-bellamere.webp') center / cover no-repeat;
  transform: scale(1.03);
  animation: slowKenBurns 24s ease-in-out infinite alternate;
  filter: saturate(1.06);
}

@keyframes slowKenBurns {
  0% { transform: scale(1.02) translate(0, 0); }
  100% { transform: scale(1.08) translate(-1.2%, -0.8%); }
}

.title-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(36, 22, 24, 0.20) 0%, rgba(28, 17, 19, 0.72) 85%),
    linear-gradient(180deg, rgba(28, 17, 22, 0.34) 0%, rgba(28, 17, 22, 0.14) 40%, rgba(24, 14, 16, 0.78) 100%);
}

.title-fireflies {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.firefly {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFF6C8 0%, #E6B85C 55%, transparent 100%);
  box-shadow: 0 0 14px 4px rgba(230, 184, 92, 0.65);
  animation: fireflyDrift var(--dur, 9s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

@keyframes fireflyDrift {
  0%, 100% { transform: translate(0, 0) scale(0.7); opacity: 0; }
  25% { opacity: 0.9; }
  50% { transform: translate(var(--dx, 35px), var(--dy, -48px)) scale(1.15); opacity: 1; }
  80% { opacity: 0.6; }
}

.title-lang-bar {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: 20px;
  z-index: 5;
  display: flex;
  gap: 6px;
  background: rgba(38, 24, 26, 0.68);
  padding: 5px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 242, 222, 0.25);
  backdrop-filter: blur(10px);
}

.lang-chip {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  color: #FBE9DC;
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease;
}

.lang-chip.is-active {
  background: linear-gradient(135deg, #F0C66E, #E0A443);
  color: #352116;
}

.title-card {
  position: relative;
  z-index: 4;
  max-width: 650px;
  width: 100%;
  text-align: center;
  padding: 36px 32px 32px;
  border-radius: 32px;
  background: rgba(42, 26, 28, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 234, 200, 0.28);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  color: #FFF8F0;
}

.title-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  background: rgba(230, 184, 92, 0.20);
  border: 1px solid rgba(230, 184, 92, 0.45);
  color: #FFE4A6;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.title-heading {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5.2vw, 3.55rem);
  line-height: 1.08;
  margin: 0 0 10px;
  color: #FFF9F2;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.4);
}

.title-sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.32rem);
  color: #FAD9D6;
  margin: 0 0 18px;
}

.title-pitch {
  font-size: 0.98rem;
  color: rgba(255, 244, 232, 0.88);
  max-width: 520px;
  margin: 0 auto 26px;
  line-height: 1.62;
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 18px;
}

.title-lantern-btn {
  padding: 16px 34px;
  font-size: 1.08rem;
  background: linear-gradient(135deg, #F6CF7B, #DF9D3A);
  color: #362014;
  border-radius: var(--radius-pill);
  font-weight: 700;
  box-shadow: 0 0 32px rgba(230, 184, 92, 0.55), 0 10px 26px rgba(0, 0, 0, 0.35);
  animation: lanternPulse 2.8s ease-in-out infinite;
}

@keyframes lanternPulse {
  0%, 100% { box-shadow: 0 0 24px rgba(230, 184, 92, 0.45), 0 10px 24px rgba(0, 0, 0, 0.32); }
  50% { box-shadow: 0 0 42px rgba(246, 207, 123, 0.78), 0 12px 30px rgba(0, 0, 0, 0.38); }
}

.title-meta {
  font-size: 0.8rem;
  color: rgba(255, 236, 220, 0.68);
  letter-spacing: 0.03em;
}

/* ==========================================================================
   SCREEN 2: LIVING BELLAMERE DESK HUB & WAX-SEALED ENVELOPES
   ========================================================================== */
.desk-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Living Window Panorama Overlooking Bellamere */
.bellamere-window {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border-med);
  box-shadow: var(--shadow-card);
  min-height: 200px;
  display: flex;
  align-items: flex-end;
  padding: 20px 24px;
  background: #2C2434;
}

.bellamere-window-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/art/hero-bellamere.webp') center 38% / cover no-repeat;
  transition: filter 1s ease, transform 1s ease;
}

/* Apathy Fog visually lifts night by night (data-warmth="0" .. "5") */
.bellamere-window[data-warmth="0"] .bellamere-window-bg { filter: saturate(0.45) brightness(0.68) hue-rotate(-14deg); }
.bellamere-window[data-warmth="1"] .bellamere-window-bg { filter: saturate(0.62) brightness(0.78) hue-rotate(-8deg); }
.bellamere-window[data-warmth="2"] .bellamere-window-bg { filter: saturate(0.78) brightness(0.86) hue-rotate(-4deg); }
.bellamere-window[data-warmth="3"] .bellamere-window-bg { filter: saturate(0.92) brightness(0.94); }
.bellamere-window[data-warmth="4"] .bellamere-window-bg { filter: saturate(1.06) brightness(1.02); }
.bellamere-window[data-warmth="5"] .bellamere-window-bg,
.bellamere-window[data-warmth="6"] .bellamere-window-bg { filter: saturate(1.18) brightness(1.08); }

.bellamere-fog-layer {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 60%, rgba(162, 168, 206, 0.56), transparent 65%),
    radial-gradient(ellipse at 75% 45%, rgba(138, 146, 186, 0.52), transparent 60%);
  transition: opacity 1s ease;
  pointer-events: none;
}

.bellamere-window[data-warmth="0"] .bellamere-fog-layer { opacity: 0.92; }
.bellamere-window[data-warmth="1"] .bellamere-fog-layer { opacity: 0.72; }
.bellamere-window[data-warmth="2"] .bellamere-fog-layer { opacity: 0.52; }
.bellamere-window[data-warmth="3"] .bellamere-fog-layer { opacity: 0.30; }
.bellamere-window[data-warmth="4"] .bellamere-fog-layer { opacity: 0.12; }
.bellamere-window[data-warmth="5"] .bellamere-fog-layer,
.bellamere-window[data-warmth="6"] .bellamere-fog-layer { opacity: 0; }

.bellamere-window-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(24, 18, 26, 0.12) 0%, rgba(30, 19, 22, 0.78) 100%);
}

.bellamere-lanterns {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sky-lantern {
  position: absolute;
  bottom: -20px;
  width: 14px;
  height: 18px;
  border-radius: 6px 6px 4px 4px;
  background: radial-gradient(circle at 50% 60%, #FFF7CE, #E6B85C 65%, #D3794B);
  box-shadow: 0 0 16px 4px rgba(246, 207, 123, 0.65);
  animation: lanternRise var(--dur, 12s) linear infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes lanternRise {
  0% { transform: translateY(0) translateX(0) scale(0.75); opacity: 0; }
  15% { opacity: 0.95; }
  85% { opacity: 0.85; }
  100% { transform: translateY(-240px) translateX(var(--dx, 18px)) scale(1.05); opacity: 0; }
}

.bellamere-window-content {
  position: relative;
  z-index: 3;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  color: #FFF8F0;
}

.bellamere-status-title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  margin: 0 0 4px;
}

.bellamere-status-sub {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 242, 232, 0.86);
  max-width: 560px;
}

.warmth-meter {
  min-width: 230px;
  background: rgba(34, 22, 24, 0.68);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 232, 200, 0.25);
  backdrop-filter: blur(8px);
}

.warmth-meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: #FFE4A6;
  margin-bottom: 7px;
}

.warmth-bar {
  height: 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.warmth-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #C85A70, #F0C66E, #FFF0B8);
  transition: width 0.8s cubic-bezier(.34,1.56,.64,1);
}

/* Diegetic Desk Shelf (Lantern + Teacup + Keepsake Tokens + Stats) */
.desk-props-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
}

.desk-interactive-props {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.desk-prop-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--cream-deep);
  border: 1.5px solid var(--border-med);
  font-size: 0.84rem;
  font-weight: 600;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.desk-prop-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(74, 53, 49, 0.12);
}

.desk-prop-btn svg {
  width: 24px;
  height: 24px;
}

.desk-keepsakes-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.keepsake-chip {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFF7E4, #FDE2C8);
  border: 1.5px solid rgba(186, 132, 42, 0.55);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(186, 132, 42, 0.22);
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1);
}

.keepsake-chip:hover {
  transform: scale(1.16) rotate(-5deg);
}

.keepsake-chip svg {
  width: 28px;
  height: 28px;
}

.desk-stats-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--cream-deep);
  border: 1px solid var(--border-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.stat-chip strong {
  font-size: 0.92rem;
}

/* Wax-Sealed Envelopes Grid */
.envelopes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 18px;
}

.envelope-card {
  position: relative;
  border-radius: 22px;
  background: linear-gradient(165deg, var(--surface-strong) 0%, var(--parchment) 100%);
  border: 1.5px solid var(--border-med);
  box-shadow: var(--shadow-soft);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: transform 0.24s cubic-bezier(.34,1.56,.64,1), box-shadow 0.24s ease, border-color 0.24s ease;
}

.envelope-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  background: linear-gradient(180deg, rgba(249, 213, 211, 0.45), transparent);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: none;
}

html[data-theme="candlelight"] .envelope-card::before {
  background: linear-gradient(180deg, rgba(230, 184, 92, 0.14), transparent);
}

.envelope-card.is-next {
  border-color: var(--berry);
  box-shadow: 0 12px 32px rgba(200, 90, 112, 0.22);
}

.envelope-card.is-next:hover {
  transform: translateY(-5px) rotate(-0.5deg);
}

.envelope-card.is-done:hover {
  transform: translateY(-4px);
}

.envelope-card.is-locked {
  opacity: 0.62;
  filter: grayscale(0.28);
}

.envelope-card.is-secret-bonus {
  background: linear-gradient(155deg, #FFF7E2 0%, #FCE7C6 55%, #F8D5CE 100%);
  border: 2px solid var(--gold);
  box-shadow: 0 14px 36px rgba(217, 155, 56, 0.28);
}

html[data-theme="candlelight"] .envelope-card.is-secret-bonus {
  background: linear-gradient(155deg, #433223 0%, #3A2929 100%);
}

.envelope-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.wax-seal-badge {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.22), 0 6px 14px rgba(74, 53, 49, 0.22);
  border: 2px solid rgba(255, 248, 240, 0.45);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
}

.envelope-card:not(.is-locked):hover .wax-seal-badge {
  transform: scale(1.09) rotate(-8deg);
}

.wax-seal-badge.is-cracking {
  animation: waxCrackPop 0.42s ease forwards;
}

@keyframes waxCrackPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.24) rotate(10deg); }
  100% { transform: scale(0.88) rotate(-6deg); opacity: 0.7; }
}

.wax-seal-badge svg {
  width: 34px;
  height: 34px;
}

.envelope-night-num {
  font-family: var(--font-ornate);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--berry);
  font-weight: 700;
}

.envelope-title {
  font-family: var(--font-display);
  font-size: 1.28rem;
  margin: 2px 0 0;
  line-height: 1.2;
}

.envelope-chars {
  font-size: 0.88rem;
  color: var(--cocoa-soft);
  margin: 0;
}

.envelope-snippet {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--cocoa-soft);
  margin: 4px 0 6px;
  line-height: 1.48;
  flex: 1;
}

.envelope-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-med);
}

.epilogue-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(246, 207, 123, 0.28), rgba(249, 213, 211, 0.42));
  border: 2px solid var(--gold);
  box-shadow: var(--shadow-soft);
}

/* ==========================================================================
   SCREEN 3: RESTAURANT STORY + HEARTHMENDER'S PALATE (AROMA WISPS)
   ========================================================================== */
.story-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  min-width: 0;
}

.scene-stage {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border-med);
  box-shadow: var(--shadow-card);
  aspect-ratio: 16 / 9;
  max-height: 440px;
  width: 100%;
  background: #2C2122;
}

.scene-stage-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.8s ease;
}

.scene-stage-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(30, 19, 22, 0.14) 0%, rgba(30, 19, 22, 0.68) 100%);
  pointer-events: none;
}

.scene-top-bar {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.scene-location-pill {
  background: rgba(34, 22, 24, 0.72);
  color: #FFF8F0;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 234, 200, 0.30);
  backdrop-filter: blur(8px);
  font-family: var(--font-display);
  font-size: 0.96rem;
}

/* Interactive Hearthmender's Palate Aroma Wisps */
.aroma-wisp {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 248, 228, 0.92) 0%, var(--wisp-color, rgba(230, 184, 92, 0.62)) 52%, transparent 74%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 26px var(--wisp-color, rgba(230, 184, 92, 0.65));
  animation: wispFloat 3.4s ease-in-out infinite;
  transition: transform 0.2s ease, opacity 0.25s ease;
}

.aroma-wisp:hover {
  transform: translate(-50%, -50%) scale(1.18);
}

.aroma-wisp.is-tasted {
  opacity: 0.76;
  border: 2px solid #FFF8F0;
}

.aroma-wisp svg {
  width: 22px;
  height: 22px;
  color: #4A3531;
}

@keyframes wispFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-9px); }
}

.palate-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--lavender-soft), var(--blush-soft));
  border: 1.5px solid rgba(184, 169, 217, 0.45);
}

html[data-theme="candlelight"] .palate-bar {
  background: linear-gradient(135deg, rgba(84, 68, 108, 0.35), rgba(91, 55, 61, 0.4));
}

.palate-clue-box {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border-left: 4px solid var(--gold);
  box-shadow: var(--shadow-soft);
  animation: fadeSlideUp 0.25s ease;
}

.palate-clue-title {
  font-weight: 700;
  color: var(--berry);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

/* Visual-Novel Character Dialogue Bubble */
.dialogue-panel {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  align-items: start;
  padding: 22px 24px;
}

.avatar-medallion {
  position: relative;
  width: 106px;
  height: 106px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, var(--gold), var(--berry));
  box-shadow: 0 10px 26px rgba(74, 53, 49, 0.22);
  flex-shrink: 0;
  animation: gentleBreathe 4.2s ease-in-out infinite;
}

@keyframes gentleBreathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.avatar-medallion.is-speaking {
  box-shadow: 0 0 0 6px rgba(230, 184, 92, 0.32), 0 12px 30px rgba(200, 90, 112, 0.32);
}

.avatar-medallion.mood-fog img {
  filter: saturate(0.74) contrast(0.95);
}

.avatar-medallion.mood-warm img {
  filter: saturate(1.12) brightness(1.04);
}

.avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--blush-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: filter 0.6s ease;
}

.avatar-mood-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-strong);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(74, 53, 49, 0.18);
  font-size: 0.95rem;
}

.dialogue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.dialogue-speaker {
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--berry-dark);
}

html[data-theme="candlelight"] .dialogue-speaker {
  color: #F6C2C4;
}

.dialogue-atmosphere {
  font-size: 0.93rem;
  color: var(--cocoa-soft);
  margin: 0 0 12px;
  font-style: italic;
}

.dialogue-quote {
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.56;
  margin: 0 0 12px;
  color: var(--cocoa);
}

.dialogue-followup {
  font-size: 0.95rem;
  color: var(--cocoa-soft);
  margin: 0 0 16px;
}

.choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.choice-btn {
  text-align: left;
  padding: 15px 17px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1.5px solid var(--border-med);
  box-shadow: 0 4px 14px rgba(74, 53, 49, 0.06);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), border-color 0.18s ease, box-shadow 0.18s ease;
}

.choice-btn:hover {
  transform: translateY(-3px);
  border-color: var(--berry);
  box-shadow: 0 10px 24px rgba(200, 90, 112, 0.16);
}

.choice-btn-label {
  font-weight: 700;
  color: var(--cocoa);
  font-size: 0.95rem;
}

.choice-btn-sub {
  font-size: 0.82rem;
  color: var(--cocoa-soft);
}

.course-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
  margin-top: 14px;
}

.course-pick-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 2px solid var(--border-med);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), border-color 0.22s ease, box-shadow 0.22s ease;
}

.course-pick-card:hover {
  transform: translateY(-5px);
  border-color: var(--gold);
  box-shadow: 0 18px 40px rgba(217, 155, 56, 0.24);
}

.course-pick-thumb {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--gold);
  background: var(--blush-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.course-pick-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   SCREEN 4: TOP-DOWN INTERACTIVE COZY VIDEO-GAME KITCHEN
   ========================================================================== */
.kitchen-shell {
  position: relative;
  border-radius: 30px;
  background:
    repeating-linear-gradient(90deg, rgba(140, 96, 70, 0.035) 0 42px, transparent 42px 84px),
    linear-gradient(160deg, #FDF1E5 0%, #F9E3D4 55%, #F6D8D4 100%);
  border: 2px solid var(--border-med);
  box-shadow: var(--shadow-card);
  padding: 18px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

html[data-theme="candlelight"] .kitchen-shell {
  background:
    repeating-linear-gradient(90deg, rgba(255, 224, 190, 0.03) 0 42px, transparent 42px 84px),
    linear-gradient(160deg, #3D2C2A 0%, #342426 60%, #2D2024 100%);
}

.kitchen-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

.kitchen-topbar {
  position: relative;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--border-soft);
  margin-bottom: 16px;
}

.kitchen-step-guide {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 210px;
}

.kitchen-step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--berry), #E07086);
  color: #FFF8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.92rem;
  flex-shrink: 0;
}

.kitchen-step-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--cocoa);
  line-height: 1.2;
}

.kitchen-step-hint {
  font-size: 0.84rem;
  color: var(--cocoa-soft);
}

.kitchen-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.kitchen-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-med);
  transition: transform 0.2s ease, background 0.2s ease;
}

.kitchen-dot.is-done {
  background: var(--sage-deep);
}

.kitchen-dot.is-active {
  background: var(--berry);
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(200, 90, 112, 0.22);
}

/* 3-Column Counter Layout (Left Tray | Woven Placemat Center | Right Tray) */
.kitchen-counter-grid {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(280px, 1fr) minmax(150px, 210px);
  gap: 16px;
  align-items: center;
  min-height: 390px;
}

.kitchen-shelf {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.ingredient-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 10px 10px;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 2px solid var(--border-soft);
  box-shadow: 0 6px 16px rgba(74, 53, 49, 0.09);
  cursor: grab;
  touch-action: none;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1), border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
}

.ingredient-tile:active {
  cursor: grabbing;
}

.ingredient-tile.is-next {
  border-color: var(--berry);
  box-shadow: 0 0 0 4px rgba(200, 90, 112, 0.16), 0 10px 22px rgba(200, 90, 112, 0.18);
  animation: gentlePromptBounce 2.2s ease-in-out infinite;
}

@keyframes gentlePromptBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.ingredient-tile.is-used {
  opacity: 0.42;
  filter: grayscale(0.35);
  cursor: default;
  animation: none;
}

.ingredient-tile.is-used::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sage-deep);
  color: #FFF8F0;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ingredient-tile-art {
  width: 74px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.ingredient-tile-art svg {
  width: 74px;
  height: 74px;
  filter: drop-shadow(0 5px 8px rgba(74, 53, 49, 0.16));
}

.ingredient-tile-name {
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  pointer-events: none;
}

/* Center Round Woven Crochet Pastel Placemat & Station */
.kitchen-center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: relative;
}

.woven-placemat {
  position: relative;
  width: min(350px, 84vw);
  height: min(350px, 84vw);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%,
      rgba(255, 248, 240, 0.78) 0 6px,
      rgba(249, 213, 211, 0.56) 6px 12px,
      rgba(253, 226, 200, 0.62) 12px 18px),
    radial-gradient(circle, #FFF7EE 0%, #F5D7CE 100%);
  border: 6px dashed rgba(200, 90, 112, 0.34);
  box-shadow:
    inset 0 0 28px rgba(74, 53, 49, 0.08),
    0 16px 38px rgba(74, 53, 49, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), box-shadow 0.22s ease, border-color 0.22s ease;
}

html[data-theme="candlelight"] .woven-placemat {
  background:
    repeating-radial-gradient(circle at 50% 50%,
      rgba(95, 70, 68, 0.82) 0 6px,
      rgba(78, 56, 58, 0.85) 6px 12px,
      rgba(108, 80, 72, 0.78) 12px 18px);
  border-color: rgba(230, 184, 92, 0.42);
}

.woven-placemat.is-drop-hover {
  transform: scale(1.04);
  border-color: var(--gold);
  box-shadow: 0 0 0 8px rgba(230, 184, 92, 0.26), 0 18px 42px rgba(74, 53, 49, 0.22);
}

.woven-placemat.is-squish {
  animation: vesselSquish 0.42s cubic-bezier(.34,1.56,.64,1);
}

@keyframes vesselSquish {
  0% { transform: scale(1); }
  35% { transform: scale(1.07, 0.94); }
  70% { transform: scale(0.98, 1.03); }
  100% { transform: scale(1); }
}

.vessel-stage {
  position: relative;
  width: 268px;
  height: 268px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.station-progress-bar {
  width: min(300px, 78vw);
  background: var(--surface-strong);
  border: 1.5px solid var(--border-med);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.station-progress-track {
  flex: 1;
  height: 11px;
  border-radius: var(--radius-pill);
  background: rgba(91, 63, 57, 0.12);
  overflow: hidden;
  position: relative;
}

.station-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--berry), var(--gold));
  width: 0%;
  transition: width 0.08s linear;
}

.sweet-spot-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 72%;
  width: 20%;
  background: rgba(246, 207, 123, 0.55);
  border-left: 2px solid #C88D2B;
  border-right: 2px solid #C88D2B;
  pointer-events: none;
}

.kitchen-assist-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
}

/* Floating Velocity-Tilting Drag Ghost */
.drag-ghost {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  width: 88px;
  height: 88px;
  margin-left: -44px;
  margin-top: -44px;
  filter: drop-shadow(0 18px 22px rgba(74, 53, 49, 0.34));
  will-change: transform;
}

.drag-ghost svg {
  width: 100%;
  height: 100%;
}

/* Interactive Spreader Canvas & Whisk Layer */
.spread-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  z-index: 8;
}

.floating-tool-cursor {
  position: absolute;
  width: 78px;
  height: 78px;
  pointer-events: none;
  z-index: 14;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 12px rgba(74, 53, 49, 0.24));
  transition: opacity 0.15s ease;
}

.free-garnish-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  cursor: pointer;
  touch-action: none;
}

.placed-garnish-item {
  position: absolute;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
  animation: garnishDrop 0.34s cubic-bezier(.34,1.56,.64,1);
  filter: drop-shadow(0 3px 5px rgba(74, 53, 49, 0.22));
}

@keyframes garnishDrop {
  0% { transform: translate(-50%, -85%) scale(1.45); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.toaster-vibrating, .blender-vibrating {
  animation: cozyBuzz 0.14s ease-in-out infinite alternate;
}

@keyframes cozyBuzz {
  0% { transform: translate(-1.5px, 0) rotate(-0.6deg); }
  100% { transform: translate(1.5px, -1px) rotate(0.6deg); }
}

.floating-pop-label {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  font-family: var(--font-hand);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--berry);
  text-shadow: 0 2px 8px rgba(255, 248, 240, 0.95);
  animation: floatUpFade 1s ease forwards;
}

@keyframes floatUpFade {
  0% { transform: translate(-50%, 0) scale(0.7); opacity: 0; }
  25% { transform: translate(-50%, -18px) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -56px) scale(0.95); opacity: 0; }
}

/* Phase B — Brass Alchemy Tray */
.alchemy-panel {
  position: relative;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeSlideUp 0.45s cubic-bezier(.34,1.56,.64,1);
}

.alchemy-stage-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--border-soft);
}

.alchemy-dish-preview {
  position: relative;
  width: 146px;
  height: 146px;
  border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--gold);
  box-shadow: 0 0 36px var(--alchemy-glow, rgba(230, 184, 92, 0.35));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: box-shadow 0.45s ease;
}

.alchemy-dish-preview img, .alchemy-dish-preview svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.alchemy-columns {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
}

.alchemy-tray-box {
  background: var(--surface);
  border: 1.5px solid var(--border-med);
  border-radius: var(--radius-md);
  padding: 16px;
}

.alchemy-tray-title {
  font-family: var(--font-display);
  font-size: 1.06rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alchemy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 10px;
}

.alchemy-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  padding: 11px 8px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 2px solid var(--border-soft);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), border-color 0.18s ease, box-shadow 0.18s ease;
}

.alchemy-option:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
}

.alchemy-option.is-selected {
  border-color: var(--berry);
  background: var(--blush-soft);
  box-shadow: 0 0 0 3px rgba(200, 90, 112, 0.22);
}

.alchemy-option svg {
  width: 56px;
  height: 56px;
}

.alchemy-option-name {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
}

.alchemy-option-tag {
  font-size: 0.72rem;
  color: var(--cocoa-soft);
  line-height: 1.25;
}

.resonance-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 2px solid var(--border-med);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.resonance-bar[data-resonance="secret"] {
  border-color: var(--gold);
  box-shadow: 0 0 28px rgba(230, 184, 92, 0.36);
}

.resonance-bar[data-resonance="warm"] {
  border-color: var(--berry);
  box-shadow: 0 0 22px rgba(200, 90, 112, 0.20);
}

.resonance-bar[data-resonance="curious"] {
  border-color: var(--lavender);
  box-shadow: 0 0 22px rgba(184, 169, 217, 0.28);
}

.resonance-flame {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.92rem;
}

/* ==========================================================================
   SCREEN 5: LIVE TASTING SHOWCASE & COUPLE REACTION
   ========================================================================== */
.tasting-card {
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.tasting-dish-showcase {
  position: relative;
  width: 248px;
  height: 248px;
  border-radius: 50%;
  padding: 7px;
  background: linear-gradient(135deg, var(--gold), var(--berry), var(--peach));
  box-shadow: 0 0 54px var(--alchemy-glow, rgba(230, 184, 92, 0.45)), 0 18px 40px rgba(74, 53, 49, 0.22);
}

.tasting-dish-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--cream);
}

.tasting-dish-inner img, .tasting-dish-inner > svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tasting-steam {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 60px;
  pointer-events: none;
  display: flex;
  justify-content: space-around;
}

.steam-curl {
  width: 10px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 250, 242, 0.72), transparent 72%);
  filter: blur(4px);
  animation: steamRise 3.2s ease-in-out infinite;
}

.steam-curl:nth-child(2) { animation-delay: 0.9s; }
.steam-curl:nth-child(3) { animation-delay: 1.8s; }

@keyframes steamRise {
  0% { transform: translateY(18px) scaleX(0.8); opacity: 0; }
  40% { opacity: 0.75; }
  100% { transform: translateY(-34px) scaleX(1.35); opacity: 0; }
}

.tasting-reaction-box {
  width: 100%;
  max-width: 740px;
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 18px;
  align-items: center;
  text-align: left;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1.5px solid var(--border-med);
}

.keepsake-gift-card {
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  padding: 15px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255, 243, 212, 0.65), rgba(249, 213, 211, 0.45));
  border: 1.5px solid rgba(186, 132, 42, 0.45);
}

html[data-theme="candlelight"] .keepsake-gift-card {
  background: linear-gradient(135deg, rgba(84, 62, 32, 0.55), rgba(86, 48, 54, 0.55));
}

.keepsake-gift-icon {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
}

.keepsake-gift-icon svg {
  width: 62px;
  height: 62px;
}

/* ==========================================================================
   SCREEN 6: COLLECTOR'S OPEN-BOOK JOURNAL & WAX SEAL RITUAL
   ========================================================================== */
.journal-book {
  display: grid;
  grid-template-columns: minmax(min(260px, 100%), 0.92fr) minmax(min(280px, 100%), 1.18fr);
  border-radius: 26px;
  overflow: hidden;
  border: 2px solid var(--border-med);
  box-shadow: var(--shadow-lifted);
  background: var(--surface-strong);
  min-width: 0;
  max-width: 100%;
}

.journal-page-left {
  padding: 26px 24px;
  background: linear-gradient(135deg, var(--parchment) 0%, var(--cream-deep) 100%);
  border-right: 2px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  min-width: 0;
}

.journal-page-right {
  padding: 26px 28px;
  background: var(--surface-strong);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.journal-polaroid {
  width: 184px;
  height: 184px;
  border-radius: 18px;
  padding: 8px;
  background: #FFFDF9;
  border: 1.5px solid rgba(91, 63, 57, 0.16);
  box-shadow: 0 10px 24px rgba(74, 53, 49, 0.14);
  transform: rotate(-1.5deg);
}

.journal-polaroid img, .journal-polaroid svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 11px;
}

.name-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.cozy-input, .cozy-textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-med);
  background: var(--cream);
  color: var(--cocoa);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.cozy-input:focus, .cozy-textarea:focus {
  outline: none;
  border-color: var(--berry);
  box-shadow: 0 0 0 3px rgba(200, 90, 112, 0.16);
}

.cozy-input--hand {
  font-family: var(--font-hand);
  font-size: 1.48rem;
  font-weight: 700;
}

.cozy-textarea--lined {
  min-height: 132px;
  resize: vertical;
  line-height: 1.75;
  background-image: repeating-linear-gradient(transparent 0 27px, rgba(91, 63, 57, 0.10) 27px 28px);
}

.whisper-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.whisper-chip {
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  background: var(--blush-soft);
  color: var(--cocoa);
  border: 1px solid rgba(200, 90, 112, 0.24);
  transition: transform 0.15s ease, background 0.15s ease;
}

.whisper-chip:hover {
  transform: translateY(-1px);
  background: var(--blush);
}

.stamps-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stamp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-soft);
  background: var(--cream);
  font-size: 0.8rem;
  font-weight: 600;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

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

.stamp-btn.is-selected {
  border-color: var(--berry);
  background: var(--blush-soft);
  transform: scale(1.04);
}

.oracle-slip {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--lavender-soft), var(--cream));
  border: 1.5px dashed rgba(184, 169, 217, 0.65);
  width: 100%;
  text-align: left;
  animation: fadeSlideUp 0.25s ease;
}

html[data-theme="candlelight"] .oracle-slip {
  background: rgba(74, 58, 94, 0.35);
}

/* Interactive Wax-Seal Stamp Button */
.wax-seal-ritual {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(249, 213, 211, 0.42), rgba(253, 226, 200, 0.50));
  border: 1.5px solid rgba(200, 90, 112, 0.34);
  margin-top: 6px;
}

.wax-stamp-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #B93F58, #D96075);
  color: #FFF8F0;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(185, 63, 88, 0.34);
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
}

.wax-stamp-trigger:hover {
  transform: scale(1.03);
}

.wax-stamp-trigger.is-sealed {
  background: linear-gradient(135deg, #D99B38, #F0C66E);
  color: #362014;
}

/* ==========================================================================
   SCREEN 7: EPILOGUE & KEEPSAKES
   ========================================================================== */
.epilogue-card {
  padding: 36px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.epilogue-medallion {
  width: 136px;
  height: 136px;
  animation: gentleBreathe 4s ease-in-out infinite;
}

.epilogue-body {
  max-width: 680px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.72;
}

.epilogue-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

/* ==========================================================================
   MODALS (2-PAGE GRIMOIRE, AUDIO MIXER, COMFORT & SAVE, LETTER)
   ========================================================================== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(34, 21, 22, 0.62);
  backdrop-filter: blur(7px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 920px;
  max-height: 90dvh;
  overflow-y: auto;
  border-radius: 28px;
  background: var(--surface-strong);
  border: 2px solid var(--border-med);
  box-shadow: 0 28px 74px rgba(0, 0, 0, 0.38);
  padding: 24px 26px;
  position: relative;
}

.modal-card--narrow {
  max-width: 540px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--border-soft);
  margin-bottom: 18px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.48rem;
  margin: 0;
}

.modal-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cream-deep);
  border: 1.5px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.grimoire-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.grimoire-tab {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.88rem;
  background: var(--cream-deep);
  border: 1.5px solid var(--border-soft);
  color: var(--cocoa-soft);
}

.grimoire-tab.is-active {
  background: var(--berry);
  color: #FFF8F0;
  border-color: var(--berry-dark);
}

.grimoire-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grimoire-page {
  background: var(--cream);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.grimoire-dish-thumb {
  width: 156px;
  height: 156px;
  margin: 0 auto 14px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--gold);
  background: var(--blush-soft);
  position: relative;
}

.grimoire-mini-thumb {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
  background: var(--blush-soft);
  flex-shrink: 0;
  position: relative;
}

.grimoire-dish-thumb img,
.grimoire-mini-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recipe-step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
}

.recipe-step-row:last-child {
  border-bottom: none;
}

.secret-slot {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border-med);
  background: var(--cream);
  margin-bottom: 10px;
}

.secret-slot.is-unlocked {
  border-style: solid;
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(255, 243, 212, 0.52), var(--cream));
}

/* Mixer Sliders & Comfort Toggles */
.mixer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-soft);
}

.mixer-row:last-child {
  border-bottom: none;
}

.mixer-slider {
  width: 180px;
  accent-color: var(--berry);
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-med);
  background: var(--cream-deep);
  font-weight: 600;
  font-size: 0.85rem;
}

.toggle-switch.is-on {
  background: var(--sage);
  color: #253821;
  border-color: var(--sage-deep);
}

/* Wax Letter Modal */
.letter-sheet {
  background: linear-gradient(165deg, #FFFBF3 0%, #F9ECDC 100%);
  color: #4A3531;
  border-radius: 18px;
  padding: 28px 28px 24px;
  border: 2px solid rgba(186, 132, 42, 0.35);
  box-shadow: inset 0 0 40px rgba(217, 155, 56, 0.12);
  font-family: var(--font-display);
}

.letter-greeting {
  font-family: var(--font-hand);
  font-size: 1.75rem;
  color: #9D3D52;
  margin: 0 0 12px;
}

.letter-body p {
  font-size: 1.04rem;
  line-height: 1.66;
  margin: 0 0 12px;
}

.letter-signoff {
  font-family: var(--font-hand);
  font-size: 1.55rem;
  margin: 14px 0 4px;
  color: #5B3F39;
}

.letter-ps {
  font-size: 0.88rem;
  font-style: italic;
  color: #7A5A52;
  margin-top: 8px;
}

/* Toast Stack */
.toast-stack {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 92vw;
}

.toast-item {
  background: rgba(54, 34, 36, 0.94);
  color: #FFF8F0;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(230, 184, 92, 0.55);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  font-size: 0.9rem;
  font-weight: 600;
  animation: fadeSlideUp 0.28s ease;
}

/* ==========================================================================
   RECTANGULAR ILLUSTRATED KEEPSAKE POSTCARD & HARDCOVER GRIMOIRE
   ========================================================================== */
.postcard-rect {
  width: 100%;
  max-width: 780px;
  display: grid;
  grid-template-columns: minmax(200px, 0.88fr) minmax(240px, 1.12fr);
  border-radius: 18px;
  background: linear-gradient(155deg, #FFFDF8 0%, #FDF2E4 58%, #FAEAE2 100%);
  border: 2px solid rgba(186, 132, 42, 0.48);
  box-shadow:
    inset 0 0 0 6px #FFFDF8,
    inset 0 0 0 7.5px rgba(200, 90, 112, 0.28),
    0 16px 38px rgba(74, 53, 49, 0.16);
  padding: 20px;
  gap: 20px;
  text-align: left;
  position: relative;
  color: #4A3531;
}

html[data-theme="candlelight"] .postcard-rect {
  background: linear-gradient(155deg, #3C2B2C 0%, #312324 62%, #2A1D20 100%);
  border-color: rgba(230, 184, 92, 0.52);
  box-shadow:
    inset 0 0 0 6px #3A2A2B,
    inset 0 0 0 7.5px rgba(230, 184, 92, 0.25),
    0 18px 42px rgba(0, 0, 0, 0.42);
  color: #FAF0E6;
}

.postcard-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-right: 18px;
  border-right: 1.5px dashed rgba(91, 63, 57, 0.24);
  min-width: 0;
}

html[data-theme="candlelight"] .postcard-left {
  border-right-color: rgba(250, 232, 208, 0.24);
}

.postcard-photo-frame {
  width: 100%;
  max-width: 224px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  padding: 6px;
  background: #FFFDF9;
  border: 2px solid var(--gold);
  box-shadow: 0 8px 20px rgba(74, 53, 49, 0.14);
  overflow: hidden;
  position: relative;
}

.postcard-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9px;
  display: block;
}

.postcard-right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.postcard-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.postcard-postmark {
  font-family: var(--font-ornate);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--berry);
  font-weight: 700;
}

html[data-theme="candlelight"] .postcard-postmark {
  color: #F6C2C4;
}

.postcard-stamp {
  width: 58px;
  height: 66px;
  border-radius: 8px;
  background: linear-gradient(155deg, #FFF8EC, #FCE2DB);
  border: 2px dotted rgba(200, 90, 112, 0.55);
  box-shadow: 0 4px 10px rgba(74, 53, 49, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
  transform: rotate(3deg);
  padding: 4px;
}

.postcard-stamp svg {
  width: 34px;
  height: 34px;
}

.postcard-stamp-code {
  font-size: 0.56rem;
  font-weight: 700;
  color: #8E3248;
  letter-spacing: 0.08em;
}

.postcard-greeting {
  font-family: var(--font-hand);
  font-size: 1.52rem;
  color: var(--berry-dark);
  margin: 0;
  line-height: 1.15;
}

html[data-theme="candlelight"] .postcard-greeting {
  color: #FFE4A6;
}

.postcard-note {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.96rem;
  line-height: 1.55;
  margin: 0;
}

.postcard-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.postcard-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(91, 63, 57, 0.22);
}

html[data-theme="candlelight"] .postcard-footer {
  border-top-color: rgba(250, 232, 208, 0.22);
}

/* Hardcover Illustrated Storybook Grimoire Modal */
.modal-card--grimoire {
  background: linear-gradient(160deg, #FBF2E6 0%, #F4E3CE 100%);
  border: 4px solid #75493E;
  box-shadow:
    inset 0 0 0 2px rgba(230, 184, 92, 0.55),
    0 28px 74px rgba(0, 0, 0, 0.44);
  overflow-y: auto;
  overflow-x: hidden;
}

html[data-theme="candlelight"] .modal-card--grimoire {
  background: linear-gradient(160deg, #362526 0%, #2C1E1F 100%);
  border-color: #9A6E4B;
}

.grimoire-ribbon {
  position: absolute;
  top: 0;
  right: 76px;
  width: 26px;
  height: 52px;
  background: linear-gradient(180deg, #C85A70, #9D3D52);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  box-shadow: 0 5px 12px rgba(74, 53, 49, 0.28);
  pointer-events: none;
}

.grimoire-spread--book {
  position: relative;
  background: linear-gradient(90deg, rgba(91, 63, 57, 0.04) 0%, transparent 46%, rgba(91, 63, 57, 0.10) 50%, transparent 54%, rgba(91, 63, 57, 0.04) 100%);
  padding: 6px;
  border-radius: 20px;
}

.grimoire-page--folio {
  position: relative;
  box-shadow: inset 0 0 22px rgba(186, 132, 42, 0.09), 0 4px 14px rgba(74, 53, 49, 0.08);
}

.grimoire-page-num {
  position: absolute;
  bottom: 10px;
  right: 16px;
  font-family: var(--font-ornate);
  font-size: 0.72rem;
  color: var(--cocoa-soft);
  opacity: 0.72;
}

.grimoire-postcards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

/* Interactive Quick-Start Banner & 4-Step Cozy Guide Modal */
.quickstart-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(253, 226, 200, 0.72), rgba(249, 213, 211, 0.62));
  border: 1.5px solid rgba(200, 90, 112, 0.35);
  box-shadow: var(--shadow-soft);
}

html[data-theme="candlelight"] .quickstart-banner {
  background: linear-gradient(135deg, rgba(84, 54, 42, 0.65), rgba(82, 45, 52, 0.65));
}

.guide-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 18px 14px;
  border-radius: var(--radius-md);
  background: var(--cream);
  border: 1.5px solid var(--border-soft);
}

.guide-illu {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blush-soft), var(--peach));
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(186, 132, 42, 0.22);
}

.guide-illu svg {
  width: 74px;
  height: 74px;
}

.guide-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.guide-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-med);
  border: none;
  padding: 0;
  transition: transform 0.2s ease, background 0.2s ease;
}

.guide-dot.is-active {
  background: var(--berry);
  transform: scale(1.3);
}

/* PWA Install & Offline Sanctuary Box */
.pwa-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--cream);
  border: 1.5px solid rgba(108, 142, 100, 0.38);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--sage-deep);
}

html[data-theme="candlelight"] .pwa-status-badge {
  color: #C7E2C0;
}

.ios-steps {
  font-size: 0.83rem;
  color: var(--cocoa-soft);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--parchment);
  border: 1px dashed var(--border-med);
  line-height: 1.45;
}

/* ==========================================================================
   RESPONSIVE: iPAD & MOBILE (Zero horizontal overflow guaranteed)
   ========================================================================== */
@media (max-width: 900px) {
  .kitchen-counter-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .kitchen-shelf {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .ingredient-tile {
    width: calc(33% - 8px);
    min-width: 94px;
    padding: 8px 6px;
  }
  .ingredient-tile-art, .ingredient-tile-art svg {
    width: 56px;
    height: 56px;
  }
  .alchemy-columns,
  .journal-book,
  .grimoire-spread,
  .postcard-rect {
    grid-template-columns: 1fr;
  }
  .journal-page-left {
    border-right: none;
    border-bottom: 2px solid var(--border-soft);
  }
  .postcard-left {
    border-right: none;
    border-bottom: 1.5px dashed rgba(91, 63, 57, 0.24);
    padding-right: 0;
    padding-bottom: 14px;
  }
  .grimoire-spread--book {
    background: none;
  }
}

@media (max-width: 640px) {
  .hud-bar {
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
    gap: 6px;
  }
  .hud-left, .hud-right {
    gap: 5px;
  }
  .hud-label {
    display: none;
  }
  .hud-pill {
    padding: 0 9px;
    height: 36px;
    font-size: 0.82rem;
    gap: 5px;
  }
  .hud-pill--icon {
    width: 36px;
  }
  .hud-pill--night {
    max-width: 132px;
    font-size: 0.78rem;
  }
  .envelopes-grid {
    grid-template-columns: 1fr;
  }
  .warmth-meter {
    min-width: 0;
    width: 100%;
  }
  .bellamere-window {
    padding: 16px;
    min-height: 175px;
  }
  .desk-props-strip {
    padding: 12px;
  }
  .scene-stage {
    aspect-ratio: 4 / 3;
    max-height: none;
  }
  .aroma-wisp {
    width: 44px;
    height: 44px;
  }
  .dialogue-panel,
  .tasting-reaction-box {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 18px 16px;
  }
  .dialogue-header {
    justify-content: center;
  }
  .stage {
    padding: 12px 12px 32px;
  }
  .title-card {
    padding: 26px 18px;
  }
  .modal-card {
    padding: 18px 16px;
    border-radius: 22px;
    max-height: 92dvh;
  }
  .journal-page-left,
  .journal-page-right {
    padding: 18px 16px;
  }
  .wax-seal-ritual {
    flex-direction: column;
    text-align: center;
  }
}

/* ==========================================================================
   DEDICATED PRINTABLE GRIMOIRE OF SAVED HEARTS (@media print)
   ========================================================================== */
.print-grimoire-root {
  display: none;
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.55in;
  }

  body {
    background: #FFFFFF !important;
    color: #3D2B27 !important;
  }

  .app-shell {
    display: none !important;
  }

  .print-grimoire-root {
    display: block !important;
  }

  .print-page {
    page-break-after: always;
    break-after: page;
    padding: 10px 0;
  }

  .print-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .print-cover-border {
    border: 2px double #C85A70;
    border-radius: 18px;
    padding: 36px 32px;
    text-align: center;
    background: #FFFBF6;
  }

  .print-eyebrow {
    font-family: 'Outfit', sans-serif;
    font-size: 10pt;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #C85A70;
    margin: 0 0 8px;
  }

  .print-book-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 32pt;
    margin: 0 0 6px;
    color: #4A3531;
  }

  .print-book-sub {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 13pt;
    color: #755851;
    margin: 0 0 22px;
  }

  .print-cover-art img {
    width: 100%;
    max-height: 3.1in;
    object-fit: cover;
    border-radius: 14px;
    border: 2px solid #E6B85C;
  }

  .print-cover-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 22px 0 18px;
  }

  .print-cover-stats > div {
    border: 1px solid #DFC8BD;
    border-radius: 10px;
    padding: 10px;
    background: #FFFFFF;
  }

  .print-cover-stats strong {
    display: block;
    font-size: 18pt;
    color: #C85A70;
  }

  .print-cover-stats span {
    font-size: 8.5pt;
    color: #6B504A;
  }

  .print-entry-header {
    border-bottom: 1.5px solid #E6B85C;
    padding-bottom: 10px;
    margin-bottom: 18px;
  }

  .print-dish-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22pt;
    margin: 4px 0;
    color: #4A3531;
  }

  .print-subtitle {
    font-size: 10.5pt;
    font-style: italic;
    color: #755851;
    margin: 0;
  }

  .print-entry-grid {
    display: grid;
    grid-template-columns: 2.3in 1fr;
    gap: 20px;
    align-items: start;
  }

  .print-dish-frame {
    text-align: center;
    padding: 12px;
    border: 1px solid #DFC8BD;
    border-radius: 14px;
    background: #FFFBF6;
  }

  .print-dish-frame img, .print-dish-svg-fallback svg {
    width: 1.85in;
    height: 1.85in;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #E6B85C;
  }

  .print-alchemy-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
    font-size: 8pt;
  }

  .print-alchemy-tags span {
    border: 1px solid #DFC8BD;
    border-radius: 99px;
    padding: 2px 8px;
  }

  .print-tier-badge {
    margin-top: 8px;
    font-weight: 700;
    font-size: 9pt;
    color: #C85A70;
  }

  .print-tier-badge.is-secret {
    color: #BA842A;
  }

  .print-quote {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-left: 3px solid #E6B85C;
    background: #FFFBF6;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 10.5pt;
  }

  .print-qa {
    margin-bottom: 12px;
  }

  .print-q {
    font-weight: 700;
    font-size: 9.5pt;
    color: #9D3D52;
    margin-bottom: 3px;
  }

  .print-a {
    font-size: 10pt;
    line-height: 1.5;
  }

  .print-free-note {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #E8D5C8;
    border-radius: 10px;
  }

  .print-free-note h4 {
    margin: 0 0 5px;
    font-size: 9.5pt;
    color: #755851;
  }

  .print-stamp-mark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 9pt;
    font-weight: 600;
  }

  .print-stamp-mark svg {
    width: 36px;
    height: 36px;
  }

  .print-medallion svg {
    width: 1.3in;
    height: 1.3in;
    margin: 10px 0;
  }

  .print-epilogue-body {
    text-align: left;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 10.5pt;
    line-height: 1.6;
  }

  .print-colophon {
    margin-top: 24px;
    font-size: 8.5pt;
    color: #8B6D65;
  }
}
