/* ==========================================================================
   The Canal Boat Bookseller ("The Willow & Quill")
   styles.css - Cozy British Canal Fantasy Aesthetics, Dynamic Visual Reactivity,
   Floating Motion, Oil-Lamp Night Mode, and Print-Ready Logbook Styling.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Typography & @font-face Declarations (100% Local WOFF2)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/caveat-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/cinzel-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel Decorative';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/cinzel-decorative-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Cinzel Decorative';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/cinzel-decorative-latin-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Kalam';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../assets/fonts/kalam-latin-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Kalam';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/kalam-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Kalam';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/kalam-latin-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/outfit-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/playfair-display-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/playfair-display-latin.woff2') format('woff2');
}

/* --------------------------------------------------------------------------
   2. Design Tokens & Visual Reactivity Variables
   -------------------------------------------------------------------------- */
:root {
  /* State Reactivity Ratios (Updated live via JavaScript) */
  --peace-ratio: 0.15;
  --warmth-ratio: 0.20;
  --tomes-ratio: 0.10;

  /* Canal Boat Color Palette */
  --c-forest-dark: #16291F;
  --c-forest-mid: #254234;
  --c-forest-light: #4A6E59;
  --c-sage-pale: #DDE8DF;
  --c-wood-dark: #2A1B10;
  --c-wood-warm: #4A301C;
  --c-wood-honey: #C6985C;
  --c-parchment: #FAF5EB;
  --c-parchment-pure: #FFFDF8;
  --c-parchment-border: #DECBB3;
  --c-terracotta: #C96D4B;
  --c-lamp-amber: #F59E0B;
  --c-lamp-glow: rgba(245, 158, 11, 0.45);
  --c-ink: #22201D;
  --c-ink-sub: #575249;

  /* Typography */
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-display: 'Cinzel Decorative', 'Cinzel', serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-hand: 'Caveat', 'Kalam', cursive;

  /* Radii & Shadows */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-pill: 9999px;
  --shadow-warm: 0 8px 24px rgba(42, 27, 16, 0.18);
  --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.35);
}

/* --------------------------------------------------------------------------
   3. Global Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--c-forest-dark);
  color: var(--c-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
}

/* --------------------------------------------------------------------------
   4. Floating Boat Motion & Oil-Lamp Mode
   -------------------------------------------------------------------------- */
@keyframes canalBoatFloat {
  0%, 100% {
    transform: rotate(-0.35deg) translateY(-1.5px);
  }
  50% {
    transform: rotate(0.4deg) translateY(2px);
  }
}

body.boat-motion-on .floating-cabin-stage {
  animation: canalBoatFloat 8s ease-in-out infinite;
  transform-origin: center 70%;
}

@media (prefers-reduced-motion: reduce) {
  body.boat-motion-on .floating-cabin-stage {
    animation: none !important;
  }
}

/* Oil-Lamp Night Mode */
body.oil-lamp-mode {
  filter: sepia(0.22) contrast(1.08) brightness(0.92);
}

body.oil-lamp-mode .fairy-bulb {
  box-shadow: 0 0 16px var(--c-lamp-amber), 0 0 32px var(--c-lamp-amber) !important;
}

/* Peace Glow Aura on Viewport */
.app-root-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 calc(40px * var(--peace-ratio)) rgba(138, 184, 158, calc(0.35 * var(--peace-ratio)));
}

/* --------------------------------------------------------------------------
   5. Fairy Garland & Warmth Reactivity Header
   -------------------------------------------------------------------------- */
.cabin-fairy-garland {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 32px;
  z-index: 100;
  pointer-events: none;
  border-bottom: 1px solid rgba(198, 152, 92, 0.25);
}

.fairy-wire {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 1px;
  background: #3B2A1E;
}

.fairy-bulb {
  position: relative;
  width: 8px;
  height: 12px;
  border-radius: 4px 4px 6px 6px;
  background: #FFE6A8;
  opacity: calc(0.25 + 0.75 * var(--warmth-ratio));
  box-shadow: 0 0 calc(8px * var(--warmth-ratio) + 2px) var(--c-lamp-amber);
  transition: opacity 0.5s ease, box-shadow 0.5s ease;
}

/* --------------------------------------------------------------------------
   6. Top HUD Header Bar
   -------------------------------------------------------------------------- */
.hud-header {
  position: relative;
  z-index: 80;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px 10px 24px;
  background: linear-gradient(180deg, rgba(22, 41, 31, 0.96) 0%, rgba(22, 41, 31, 0.82) 100%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(198, 152, 92, 0.3);
}

.hud-left-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.boat-brand-emblem {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.boat-brand-text {
  display: flex;
  flex-direction: column;
}

.boat-app-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--c-wood-honey);
  letter-spacing: 1.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.boat-app-sub {
  font-family: var(--font-hand);
  font-size: 15px;
  color: #C8D6C9;
}

/* Gauges Row */
.hud-center-gauges {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hud-gauge-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 25, 19, 0.75);
  border: 1px solid rgba(198, 152, 92, 0.35);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  color: #F7EFE1;
  font-size:14px;
}

.gauge-icon {
  font-size: 16px;
}

.gauge-label {
  font-size:14px;
  font-weight: 500;
  opacity: 0.85;
}

.gauge-bar-track {
  width: 64px;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.gauge-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease-out;
}

.gauge-peace .gauge-bar-fill {
  background: #62A87C;
}

.gauge-warmth .gauge-bar-fill {
  background: #E58E38;
}

/* Mini Bookshelf Gauge */
.hud-bookshelf-track {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 18px;
  padding: 0 4px;
  background: #3B2618;
  border-radius: 2px;
  border-bottom: 2px solid #C6985C;
}

.shelf-book {
  width: 4px;
  height: 14px;
  background: #5A3E2A;
  border-radius: 1px;
  transition: background 0.3s, height 0.3s;
}

.shelf-book.is-lit {
  background: #C6985C;
  box-shadow: 0 0 4px #F59E0B;
}

.gauge-val {
  font-size:14px;
  font-weight: 600;
  font-feature-settings: 'tnum';
}

/* HUD Right Actions */
.hud-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(198, 152, 92, 0.35);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  color: #F7EFE1;
  font-size:14px;
  font-weight: 500;
  transition: background 0.2s, transform 0.15s;
}

.hud-btn:hover {
  background: rgba(198, 152, 92, 0.25);
  transform: translateY(-1px);
}

.hud-btn.is-active {
  background: #C6985C;
  color: #1A0E08;
  border-color: #E2BC84;
}

/* --------------------------------------------------------------------------
   7. Main Waterway Map Stage & Controls
   -------------------------------------------------------------------------- */
.canal-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  height: calc(100vh - 68px);
  overflow: hidden;
  background: #172C21;
  touch-action: none;
}

.canal-map-world {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  cursor: grab;
  will-change: transform;
}

.canal-viewport:active .canal-map-world {
  cursor: grabbing;
}

.canal-map-art-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 2000px;
  height: 1115px;
  pointer-events: none;
}

.canal-map-img, .canal-map-svg {
  width: 2000px;
  height: 1115px;
  display: block;
}

/* Lock Markers */
.locks-markers-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 2000px;
  height: 1115px;
  pointer-events: auto;
}

.lock-marker-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  z-index: 20;
  outline: none;
  cursor: pointer;
}

.lock-pin-badge {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #3B2618;
  border: 3px solid #C6985C;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  transition: transform 0.25s, box-shadow 0.25s;
}

.lock-pin-num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #FFFDF8;
}

.lock-pin-label {
  margin-top: 8px;
  padding: 4px 10px;
  background: rgba(22, 41, 31, 0.92);
  border: 1px solid rgba(198, 152, 92, 0.4);
  border-radius: var(--r-sm);
  color: #FFFDF8;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.lock-pin-title {
  display: block;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
}

.lock-pin-sub {
  display: block;
  font-family: var(--font-hand);
  font-size:14px;
  color: #E2BC84;
}

.lock-marker-btn:hover .lock-pin-badge {
  transform: scale(1.15);
  border-color: #F59E0B;
  box-shadow: 0 0 16px #F59E0B;
}

.lock-marker-btn.is-current .lock-pin-badge {
  border-color: #62A87C;
  box-shadow: 0 0 20px #62A87C;
}

.lock-marker-btn.is-locked {
  opacity: 0.5;
  filter: grayscale(0.85);
  cursor: not-allowed;
}

.lock-pin-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #F59E0B;
  opacity: 0;
  animation: markerPulse 2.8s infinite;
  pointer-events: none;
}

.lock-marker-btn.is-current .lock-pin-pulse {
  border-color: #62A87C;
}

@keyframes markerPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Narrowboat Token */
.narrowboat-token {
  position: absolute;
  width: 176px;
  height: 88px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 25;
  transition: transform 0.2s ease-out;
}

.narrowboat-sprite-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.25s ease;
}

.narrowboat-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.narrowboat-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.boat-smoke-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.smoke-puff {
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(245, 245, 240, 0.7);
  border-radius: 50%;
  filter: blur(1.5px);
  animation: smokePuffAnim 1.2s ease-out forwards;
}

@keyframes smokePuffAnim {
  0% { transform: scale(0.6) translate(0, 0); opacity: 0.8; }
  50% { transform: scale(1.4) translate(-4px, -14px); opacity: 0.5; }
  100% { transform: scale(2.2) translate(-8px, -28px); opacity: 0; }
}

/* Ambient Weather Canvas */
.ambient-weather-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* Map Camera Buttons */
.map-camera-controls {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.map-ctrl-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(22, 41, 31, 0.9);
  border: 1px solid rgba(198, 152, 92, 0.45);
  color: #FFFDF8;
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  transition: background 0.2s, transform 0.15s;
}

.map-ctrl-btn:hover {
  background: #C6985C;
  color: #1A0E08;
  transform: scale(1.08);
}

/* --------------------------------------------------------------------------
   8. Modals, Dialogs, Overlays & Drawer Architecture
   -------------------------------------------------------------------------- */
.modal-backdrop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 25, 19, 0.82);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-sanctuary-window {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  background: var(--c-parchment);
  border: 2px solid var(--c-wood-honey);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-warm), 0 0 30px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPopIn {
  from { transform: scale(0.94) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #254234;
  color: #FFFDF8;
  border-bottom: 2px solid var(--c-wood-honey);
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
}

.modal-main-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--c-wood-honey);
  letter-spacing: 1px;
}

.modal-sub-title {
  font-family: var(--font-hand);
  font-size: 15px;
  color: #DDE8DF;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #FFFDF8;
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s, transform 0.15s;
}

.modal-close-btn:hover {
  background: #C96D4B;
  transform: rotate(90deg);
}

.modal-scrollable-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* --------------------------------------------------------------------------
   9. Lock Sanctuary 4-Step Stepper & Journey Flow
   -------------------------------------------------------------------------- */
.stepper-nav-bar {
  display: flex;
  background: #E8DECC;
  border-bottom: 1px solid var(--c-parchment-border);
}

.step-tab-btn {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border-bottom: 3px solid transparent;
  color: var(--c-ink-sub);
  transition: all 0.2s;
}

.step-tab-btn.is-active {
  background: var(--c-parchment);
  color: var(--c-forest-dark);
  border-bottom-color: var(--c-forest-mid);
  font-weight: 600;
}

.step-tab-num {
  font-size:14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.step-tab-name {
  font-family: var(--font-serif);
  font-size: 14px;
}

/* Step 1: Morning View & Fog Window */
.morning-scenery-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.scenery-card-frame {
  position: relative;
  width: 100%;
  height: 340px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--c-parchment-border);
  background: #172C21;
}

.scenery-video, .scenery-img, .scenery-fallback-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fog-scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.fog-controls-bar {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.fog-btn {
  padding: 6px 12px;
  background: rgba(22, 41, 31, 0.85);
  border: 1px solid var(--c-wood-honey);
  border-radius: var(--r-pill);
  color: #FFFDF8;
  font-size:14px;
}

/* Forage Flora Action */
.forage-flora-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #F0E8D8;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-md);
}

.flora-info-block {
  display: flex;
  flex-direction: column;
}

.flora-symbol-badge {
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--c-terracotta);
}

.flora-name-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--c-forest-dark);
}

.flora-desc-text {
  font-size:14px;
  color: var(--c-ink-sub);
  max-width: 580px;
}

/* --------------------------------------------------------------------------
   10. Matchmaker & Minigame Components (styles for js/minigames.js)
   -------------------------------------------------------------------------- */
.visitor-intro-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: #F4EDE0;
  border-radius: var(--r-md);
  border: 1px solid var(--c-parchment-border);
  margin-bottom: 24px;
}

.visitor-avatar-wrap {
  width: 224px;
  height: 168px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--c-wood-honey);
  box-shadow: 0 4px 14px rgba(22, 41, 31, 0.18);
  background: #243F31;
}

.visitor-avatar-img, .visitor-svg-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visitor-dialogue-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.visitor-role-badge {
  align-self: flex-start;
  padding: 2px 8px;
  background: var(--c-forest-mid);
  color: #FFFDF8;
  font-size:14px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.visitor-name {
  font-family: var(--font-serif);
  font-size: 19px;
  color: var(--c-forest-dark);
}

.visitor-speech {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 15px;
  color: var(--c-wood-warm);
  line-height: 1.5;
}

/* Tea Canisters Grid */
.tea-canisters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.tea-canister-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  background: #FFFDF8;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s;
}

.tea-canister-card input {
  display: none;
}

.tea-canister-card:hover {
  border-color: var(--c-wood-honey);
  transform: translateY(-2px);
}

.tea-canister-card.is-selected {
  border-color: var(--c-terracotta);
  background: #FAF0EB;
  box-shadow: 0 0 10px rgba(201, 109, 75, 0.25);
}

.tea-card-art {
  height: 136px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: #F5EDE0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

.tea-cup-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tea-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-forest-dark);
}

.tea-blend {
  font-size:14px;
  color: var(--c-ink-sub);
  margin-top: 4px;
  line-height: 1.4;
}

/* Hold-to-Steep Progress */
.tea-ritual-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #EDE4D0;
  border-radius: var(--r-md);
  margin-top: 12px;
}

.tea-steep-progress-bar {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
  overflow: hidden;
}

.tea-steep-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--c-terracotta);
  transition: width 0.05s linear;
}

.tea-steam-anim-box {
  display: flex;
  gap: 12px;
  font-size: 20px;
  color: var(--c-terracotta);
  opacity: 0.3;
}

.tea-steam-anim-box.is-steaming {
  opacity: 1;
  animation: steamRise 1s infinite alternate;
}

@keyframes steamRise {
  from { transform: translateY(0); opacity: 0.6; }
  to { transform: translateY(-8px); opacity: 1; }
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--c-forest-mid);
  color: #FFFDF8;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--r-pill);
  box-shadow: 0 4px 12px rgba(22, 41, 31, 0.25);
  transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--c-forest-light);
  transform: translateY(-1px);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: #FFFDF8;
  border: 1px solid var(--c-wood-honey);
  color: var(--c-wood-warm);
  font-family: var(--font-serif);
  font-size: 14px;
  border-radius: var(--r-pill);
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #F4EDE0;
}

.btn-text {
  font-size:14px;
  color: var(--c-ink-sub);
  text-decoration: underline;
}

/* Soul Chips */
.soul-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 20px 0;
}

.soul-chip-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #FFFDF8;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-pill);
  font-size:14px;
  transition: all 0.2s;
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #A0988A;
}

.soul-chip-btn.is-active {
  background: var(--c-wood-warm);
  color: #FFFDF8;
  border-color: var(--c-wood-warm);
}

.soul-chip-btn.is-active .chip-dot {
  background: var(--c-wood-honey);
}

/* Tomes Grid */
.tomes-bookshelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.tome-shelf-item {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: #FFFDF8;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s;
}

.tome-shelf-item:hover {
  transform: translateY(-3px);
  border-color: var(--c-wood-honey);
}

.tome-shelf-item.is-active {
  border-color: var(--c-wood-honey);
  box-shadow: 0 0 12px rgba(198, 152, 92, 0.4);
}

.tome-cover-wrap {
  height: 158px;
  border-radius: 4px;
  border: 2px solid #D4AF37;
  padding: 8px;
  color: #FFFDF8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.tome-cover-wrap.has-art {
  padding: 0;
}

.tome-cover-wrap.has-art .tome-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.tome-cover-wrap.has-art .tome-cover-fallback {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 18px 8px 7px;
  background: linear-gradient(to top, rgba(16, 12, 10, 0.9) 0%, rgba(16, 12, 10, 0.55) 65%, transparent 100%);
}

.tome-cover-wrap.has-art .tome-shelf-tag,
.tome-cover-wrap.has-art .tome-item-author {
  display: none;
}

.tome-shelf-tag {
  font-size:14px;
  text-transform: uppercase;
  opacity: 0.8;
}

.tome-item-title {
  font-family: var(--font-serif);
  font-size:14px;
  font-weight: 700;
  line-height: 1.3;
}

.tome-item-author {
  font-family: var(--font-hand);
  font-size:14px;
  opacity: 0.85;
}

.tome-item-desc {
  font-size:14px;
  color: var(--c-ink-sub);
  line-height: 1.4;
}

/* Marginalia Vault Shake Book */
.book-shake-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: #EDE4D0;
  border-radius: var(--r-md);
  margin-top: 16px;
}

.interactive-vintage-book {
  position: relative;
  width: 180px;
  height: 240px;
  background: #3B2618;
  border: 3px solid #C6985C;
  border-radius: 6px 14px 14px 6px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  display: flex;
  cursor: pointer;
  transform-origin: bottom center;
  transition: transform 0.2s;
}

.interactive-vintage-book:hover {
  transform: scale(1.03);
}

.interactive-vintage-book.shake-anim {
  animation: shakeOldBook 0.5s ease-in-out;
}

@keyframes shakeOldBook {
  0% { transform: rotate(0deg); }
  20% { transform: rotate(-5deg) translateY(-4px); }
  40% { transform: rotate(6deg) translateY(2px); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(3deg); }
  100% { transform: rotate(0deg); }
}

.vintage-book-spine {
  width: 22px;
  height: 100%;
  background: #25160D;
  border-right: 2px solid #C6985C;
}

.vintage-book-cover {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  color: #FFFDF8;
  text-align: center;
}

.cover-filigree {
  font-size: 24px;
  color: #C6985C;
  margin-bottom: 8px;
}

.cover-text {
  font-family: var(--font-serif);
  font-size:14px;
  font-weight: 700;
  line-height: 1.3;
}

.cover-shake-hint {
  font-family: var(--font-hand);
  font-size: 14px;
  color: #F59E0B;
  margin-top: 14px;
}

.dislodged-relic-card {
  width: 100%;
  max-width: 460px;
  padding: 20px;
  background: #FFFDF8;
  border: 1px dashed #C6985C;
  border-radius: var(--r-sm);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  display: none;
  animation: relicSlideDown 0.4s ease-out forwards;
}

.dislodged-relic-card.is-revealed {
  display: block;
}

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

.relic-stamp-date {
  font-family: monospace;
  font-size:14px;
  color: var(--c-terracotta);
  text-transform: uppercase;
}

.relic-title {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--c-forest-dark);
  margin: 4px 0 8px 0;
}

.relic-handwriting {
  font-family: var(--font-hand);
  font-size: 18px;
  color: #2D3A30;
  line-height: 1.5;
  margin: 12px 0;
}

/* Herbarium Press Grid */
.herbarium-workshop-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  margin-top: 16px;
}

.canvas-frame {
  width: 100%;
  max-width: 240px;
  background: #254234;
  padding: 8px;
  border-radius: var(--r-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.canvas-frame canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.herb-control-group {
  margin-bottom: 16px;
}

.ctrl-label {
  display: block;
  font-size:14px;
  font-weight: 600;
  color: var(--c-forest-dark);
  margin-bottom: 6px;
}

.paper-buttons-row, .ribbon-swatches-row, .sliders-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.paper-select-btn {
  padding: 6px 12px;
  background: #FFFDF8;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-pill);
  font-size:14px;
}

.paper-select-btn.is-active {
  background: var(--c-wood-warm);
  color: #FFFDF8;
  border-color: var(--c-wood-warm);
}

.ribbon-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #FFFDF8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.ribbon-swatch-btn.is-active {
  outline: 2px solid var(--c-lamp-amber);
}

.quote-dropdown, .custom-quote-input {
  width: 100%;
  padding: 8px 12px;
  background: #FFFDF8;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-sm);
  font-size:14px;
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   11. Step 4: Focus Desk & 3D Keepsake Card & Wax Seal Ceremony
   -------------------------------------------------------------------------- */
.focus-desk-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.prompt-banner-card {
  padding: 16px 20px;
  background: #F4EDE0;
  border-left: 4px solid var(--c-wood-honey);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.prompt-category-badge {
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--c-terracotta);
}

.prompt-text {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--c-forest-dark);
  margin-top: 4px;
  line-height: 1.45;
}

.reflection-textarea {
  width: 100%;
  height: 180px;
  padding: 16px;
  background: #FFFDF8;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-md);
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
}

.reflection-textarea:focus {
  outline: none;
  border-color: var(--c-wood-honey);
  box-shadow: 0 0 10px rgba(198, 152, 92, 0.2);
}

/* 3D Flip Keepsake Card */
.keepsake-3d-card-wrap {
  perspective: 1000px;
  width: 100%;
  max-width: 380px;
  height: 220px;
  margin: 10px auto;
}

.keepsake-3d-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.keepsake-3d-card.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--r-md);
  border: 2px solid var(--c-wood-honey);
  padding: 20px;
  box-shadow: var(--shadow-warm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.card-front {
  background: #F4EEE1;
}

.card-back {
  background: #254234;
  color: #FFFDF8;
  transform: rotateY(180deg);
}

.card-hint-pill {
  font-size:14px;
  color: var(--c-terracotta);
  margin-top: 8px;
}

/* Wax Seal Ceremony Bar */
.wax-seal-ceremony-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #EDE4D0;
  border-radius: var(--r-md);
  margin-top: 14px;
}

.wax-swatches-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wax-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #FFFDF8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  cursor: pointer;
}

.wax-btn.is-active {
  outline: 2px solid var(--c-lamp-amber);
}

/* Cabin Interior Atmosphere Banners */
.cabin-scene-banner {
  position: relative;
  width: 100%;
  height: 190px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--c-wood-honey);
  margin-bottom: 16px;
  background: #1B2E24;
}

.cabin-scene-banner.is-compact {
  height: 155px;
}

.cabin-banner-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cabin-banner-caption {
  position: absolute;
  bottom: 8px;
  right: 10px;
  padding: 4px 10px;
  background: rgba(14, 25, 19, 0.82);
  backdrop-filter: blur(4px);
  border-radius: var(--r-sm);
  font-family: var(--font-hand);
  font-size:14px;
  color: #F7EBD3;
  pointer-events: none;
  z-index: 2;
}

@media (max-width: 680px) {
  .visitor-intro-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .visitor-avatar-wrap {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    max-height: 220px;
  }
}

/* --------------------------------------------------------------------------
   12. Responsive Breakpoints (Desktop, iPad, Mobile)
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .hud-header {
    padding: 14px 16px;
  }
  .hud-center-gauges {
    display: none; /* Collapses to quick status */
  }
  .herbarium-workshop-grid {
    grid-template-columns: 1fr;
  }
  .canvas-frame {
    max-width: 180px;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .boat-app-sub {
    display: none;
  }
  .modal-sanctuary-window {
    max-height: 96vh;
    padding: 0;
  }
  .stepper-nav-bar {
    overflow-x: auto;
  }
}

/* Chapter Story Overlay */
.chapter-story-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 25, 19, 0.94);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.chapter-card-inner {
  max-width: 540px;
  background: var(--c-parchment);
  border: 3px solid var(--c-wood-honey);
  border-radius: var(--r-md);
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  animation: modalPopIn 0.4s ease-out;
}

.chapter-num-badge {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--c-terracotta);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.chapter-lock-name {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--c-forest-dark);
  margin: 8px 0 16px 0;
}

.chapter-threshold-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 17px;
  color: var(--c-wood-warm);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* Cabin Corners Grid in Step 2 */
.cabin-corners-selector {
  background: #F4EDE0;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-md);
  padding: 16px;
}

.corners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.corner-card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  background: #FFFDF8;
  border: 1px solid var(--c-parchment-border);
  border-radius: var(--r-sm);
  text-align: left;
  transition: all 0.2s;
  cursor: pointer;
}

.corner-card-btn:hover {
  border-color: var(--c-wood-honey);
  transform: translateY(-2px);
}

.corner-card-btn.is-active {
  border-color: var(--c-forest-mid);
  background: #E8F0EA;
  box-shadow: 0 0 10px rgba(37, 66, 52, 0.2);
}

.corner-label {
  font-family: var(--font-serif);
  font-size:14px;
  color: var(--c-forest-dark);
}

.corner-desc {
  font-size:14px;
  color: var(--c-ink-sub);
  margin: 4px 0;
  line-height: 1.35;
}

.corner-kind-tag {
  font-size:14px;
  text-transform: uppercase;
  color: var(--c-terracotta);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   13. Print Engine: Bound Canal Logbook PDF Export
   -------------------------------------------------------------------------- */
#printLogbookContainer {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 1.5cm;
  }

  body * {
    visibility: hidden;
  }

  #printLogbookContainer, #printLogbookContainer * {
    visibility: visible;
  }

  #printLogbookContainer {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    color: #1A1A1A;
    background: #FFFFFF;
    font-family: 'Playfair Display', Georgia, serif;
  }

  .print-page-break {
    page-break-before: always;
    break-before: page;
  }

  .print-avoid-break {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .print-header-banner {
    text-align: center;
    border-bottom: 2px solid #8B6534;
    padding-bottom: 18px;
    margin-bottom: 28px;
  }

  .print-logbook-title {
    font-size: 26pt;
    font-weight: 700;
  }

  .print-lock-card {
    border: 1px solid #CCC;
    padding: 20px;
    margin-bottom: 24px;
    background: #FAFAFA;
  }
}
