/* ==========================================================================
   말씀 놀이터 — Direction A "밤바다 등불" (Night-Sea Lantern)
   Shared design tokens + scene primitives. Fonts are local (app/assets/fonts, SIL OFL). Copied from design/A_night_lantern/tokens.css for the real app.
   ========================================================================== */

@font-face { font-family: "BlackHanSans"; src: url("../assets/fonts/BlackHanSans-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "GowunBatang"; src: url("../assets/fonts/GowunBatang-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../assets/fonts/Pretendard-SemiBold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../assets/fonts/Pretendard-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Pretendard"; src: url("../assets/fonts/Pretendard-Black.otf") format("opentype"); font-weight: 900; font-display: swap; }

:root {
  /* ---- Palette: night sea ------------------------------------------- */
  --abyss:      #040A1C;   /* deepest water */
  --night-900:  #071331;
  --night-800:  #0B1C44;
  --night-700:  #12285C;
  --night-600:  #1B3775;
  --night-500:  #2A4C93;
  --mist:       #8FA6D6;   /* secondary text on navy */
  --foam:       #EAF1FF;   /* primary text on navy */

  /* ---- Palette: lantern light --------------------------------------- */
  --gold-100:   #FFF6DC;
  --gold-200:   #FFE7A6;
  --gold-300:   #FFD36B;
  --gold-400:   #FFBE3D;   /* key light */
  --gold-500:   #F29A1E;
  --ember:      #E8701A;
  --gold-ink:   #3A2300;   /* text on gold */

  /* ---- Choice colours (always paired with a shape) ------------------- */
  --c-circle:   #FF7B6E;   /* ●  coral   */
  --c-circle-d: #B8403A;
  --c-tri:      #37D6BE;   /* ▲  sea jade */
  --c-tri-d:    #12857A;
  --c-square:   #9A93FF;   /* ■  iris    */
  --c-square-d: #5148C2;

  /* ---- Feedback ----------------------------------------------------- */
  --ok:         var(--gold-400);
  --ok-glow:    rgba(255, 190, 61, .55);
  --miss:       #FF6B7D;
  --up:         #5CF0A8;
  --down:       #FF8A8A;

  /* ---- Surfaces ----------------------------------------------------- */
  --glass:        linear-gradient(180deg, rgba(42, 76, 147, .55), rgba(11, 28, 68, .72));
  --glass-strong: linear-gradient(180deg, rgba(45, 82, 158, .78), rgba(13, 32, 76, .9));
  --glass-line:   rgba(160, 190, 255, .22);
  --glass-hi:     rgba(255, 255, 255, .14);
  --gold-fill:    linear-gradient(180deg, #FFE48F 0%, #FFC24A 48%, #F29A1E 100%);

  /* ---- Type --------------------------------------------------------- */
  --font-display: "BlackHanSans", "Pretendard", sans-serif;
  --font-ui:      "Pretendard", system-ui, sans-serif;
  --font-verse:   "Pretendard", system-ui, sans-serif;   /* V3: scripture in the UI face (panel2 #6) */

  /* phone scale (1.25 major third, rounded) */
  --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 14px; --fs-base: 16px; --fs-md: 18px;
  --fs-lg: 22px;  --fs-xl: 26px; --fs-2xl: 32px; --fs-3xl: 40px; --fs-4xl: 52px;
  /* board scale (projector: min 28px at 1080p) */
  --bs-sm: 28px; --bs-md: 36px; --bs-lg: 46px; --bs-xl: 60px; --bs-2xl: 84px; --bs-hero: 168px;

  /* ---- Radii -------------------------------------------------------- */
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-xl: 30px; --r-pill: 999px;

  /* ---- Space (4pt) -------------------------------------------------- */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;

  /* ---- Shadows & glows ---------------------------------------------- */
  --sh-card:  0 1px 0 var(--glass-hi) inset, 0 0 0 1px var(--glass-line) inset, 0 18px 40px -12px rgba(0, 4, 20, .75), 0 4px 10px rgba(0, 4, 20, .4);
  --sh-lift:  0 1px 0 var(--glass-hi) inset, 0 0 0 1px var(--glass-line) inset, 0 28px 60px -14px rgba(0, 4, 20, .85), 0 8px 18px rgba(0, 4, 20, .5);
  --sh-press: 0 1px 0 var(--glass-hi) inset, 0 0 0 1px var(--glass-line) inset, 0 6px 14px -6px rgba(0, 4, 20, .8);
  --glow-gold:   0 0 0 2px var(--gold-300), 0 0 24px 4px rgba(255, 190, 61, .45), 0 0 80px 10px rgba(255, 160, 40, .22);
  --glow-gold-s: 0 0 18px rgba(255, 196, 80, .55);
  --text-glow:   0 0 18px rgba(255, 200, 90, .55), 0 2px 0 rgba(90, 50, 0, .35);

  /* ---- Motion ------------------------------------------------------- */
  --ease-out:    cubic-bezier(.16, 1, .3, 1);       /* expo-out: arrivals */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);      /* swaps, rank moves */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);   /* overshoot: pops, picks */
  --ease-snap:   cubic-bezier(.2, .9, .1, 1.25);    /* tap release */
  --ease-in:     cubic-bezier(.55, 0, 1, .45);      /* exits */
  --d-tap: 120ms; --d-fast: 220ms; --d-base: 420ms; --d-slow: 700ms; --d-reveal: 900ms; --d-rank: 1100ms;
  --d-tick: 1000ms;
}


/* ==========================================================================
   Scene: sky gradient, stars, moon, light rays, parallax waves
   ========================================================================== */
.scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.scene .sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 60% at 50% 118%, rgba(242, 154, 30, .22) 0%, rgba(242, 154, 30, 0) 55%),
    radial-gradient(80% 50% at 78% 8%, rgba(120, 150, 255, .18) 0%, rgba(120, 150, 255, 0) 60%),
    linear-gradient(180deg, #050B22 0%, #0A1A45 44%, #10265E 70%, #0A1A45 100%);
}
.scene .stars { position: absolute; inset: 0 0 35% 0; }
.scene .stars i {
  position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px 1px rgba(200, 220, 255, .7);
  animation: twinkle var(--tw, 4s) ease-in-out var(--dl, 0s) infinite;
}
@keyframes twinkle { 0%, 100% { opacity: var(--o, .8); transform: scale(1); } 50% { opacity: .15; transform: scale(.6); } }

/* crescent: transparent disc + inset light; size via font-size (1em = diameter) */
.scene .moon {
  position: absolute; width: 1em; height: 1em; border-radius: 50%; transform: rotate(-24deg);
  box-shadow: inset .2em -.06em 0 0 #FFE9B4;
  filter: drop-shadow(0 0 .18em rgba(255, 220, 140, .75)) drop-shadow(0 0 .7em rgba(255, 200, 100, .35));
}

.scene .rays {
  position: absolute; left: 50%; top: -20%; width: 160%; aspect-ratio: 1; transform: translateX(-50%);
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 210, 120, .07) 0deg 6deg, rgba(255, 210, 120, 0) 6deg 18deg);
  -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 70%);
          mask: radial-gradient(closest-side, #000 10%, transparent 70%);
  animation: rays-spin 60s linear infinite;
  mix-blend-mode: screen;
}
@keyframes rays-spin { to { transform: translateX(-50%) rotate(360deg); } }

.scene .sea { position: absolute; left: 0; right: 0; bottom: 0; }
.scene .wave { position: absolute; left: 0; bottom: 0; width: 200%; display: block; animation: drift var(--spd, 18s) linear infinite; }
.scene .wave path { fill: var(--fill); stroke: rgba(150, 185, 255, .22); stroke-width: 2; vector-effect: non-scaling-stroke; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.scene .bob, .hero-bob { animation: bob 4.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2.5deg); } }

/* lantern flame flicker */
.flame { animation: flicker 2.6s ease-in-out infinite; transform-origin: 50% 85%; }
@keyframes flicker { 0%, 100% { transform: scale(1, 1); opacity: 1; } 30% { transform: scale(.94, 1.06); opacity: .92; } 60% { transform: scale(1.04, .95); opacity: 1; } 80% { transform: scale(.97, 1.03); opacity: .95; } }
.halo { animation: halo 3.2s ease-in-out infinite; }
@keyframes halo { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }

/* ==========================================================================
   Shared components
   ========================================================================== */
.card { background: var(--glass); border-radius: var(--r-lg); box-shadow: var(--sh-card); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: var(--r-pill); font: 700 var(--fs-sm)/1 var(--font-ui); letter-spacing: -.01em;
  background: rgba(10, 26, 69, .6); box-shadow: 0 0 0 1px var(--glass-line) inset; color: var(--foam);
}
.chip--gold { background: linear-gradient(180deg, rgba(255, 211, 107, .22), rgba(242, 154, 30, .12)); box-shadow: 0 0 0 1px rgba(255, 211, 107, .55) inset; color: var(--gold-200); }

.btn-gold {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; cursor: pointer; color: var(--gold-ink); background: var(--gold-fill);
  font: 900 var(--fs-lg)/1 var(--font-ui); letter-spacing: -.02em;
  border-radius: var(--r-lg);
  box-shadow: 0 2px 0 rgba(255, 255, 255, .6) inset, 0 -3px 0 rgba(160, 80, 0, .35) inset, 0 8px 0 #9A5A06, 0 16px 30px -6px rgba(242, 154, 30, .55);
  transition: transform var(--d-tap) var(--ease-out), box-shadow var(--d-tap) var(--ease-out);
}
.btn-gold:active, .btn-gold.is-pressed { transform: translateY(6px); box-shadow: 0 2px 0 rgba(255, 255, 255, .6) inset, 0 -3px 0 rgba(160, 80, 0, .35) inset, 0 2px 0 #9A5A06, 0 6px 14px -4px rgba(242, 154, 30, .5); }

.shape { display: inline-block; flex: none; }


/* ==========================================================================
   App scene layers (scene.js): ship between wave bands, week themes
   ========================================================================== */
.scene { position: fixed; }
.scene .moon { font-size: 64px; right: 12%; top: 7%; }
.scene .sea { height: 150px; }
.scene .ship-x { position: absolute; right: 9%; bottom: 46px; width: 120px; height: 110px; z-index: 1; overflow: visible; }
.scene .wave-1, .scene .wave-2 { z-index: 2; }
.scene .fish-x { position: absolute; right: 4%; bottom: 0; width: 300px; height: 86px; z-index: 2; opacity: .9; animation: fish 14s ease-in-out infinite; }
@keyframes fish { 0%, 100% { transform: translateX(0) translateY(6px); } 50% { transform: translateX(-30px) translateY(0); } }
.scene .storm { position: absolute; left: 0; right: 0; top: 0; height: 30%; }
.scene .storm i { position: absolute; top: -6%; width: 46%; height: 70%; border-radius: 50%; background: radial-gradient(closest-side, rgba(6, 14, 40, .9), rgba(6, 14, 40, 0)); animation: drift-c 40s ease-in-out infinite alternate; }
.scene .storm i:nth-child(1) { left: -8%; } .scene .storm i:nth-child(2) { left: 30%; top: -14%; animation-duration: 55s; } .scene .storm i:nth-child(3) { left: 64%; animation-duration: 47s; }
@keyframes drift-c { to { transform: translateX(6%); } }
.scene .sc-scrolls svg { position: absolute; width: 60px; opacity: .55; top: calc(12% + var(--i) * 9%); left: calc(8% + var(--i) * 19%); filter: drop-shadow(0 0 12px rgba(255, 210, 120, .45)); animation: float-s 9s ease-in-out calc(var(--i) * -1.7s) infinite; }
@keyframes float-s { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(4deg); } }
.scene .sc-lanterns svg { position: absolute; bottom: -60px; width: 30px; opacity: .7; animation: rise-l 26s linear calc(var(--i) * -3.7s) infinite; }
@keyframes rise-l { from { transform: translateY(0) translateX(0); opacity: 0; } 8% { opacity: .75; } 85% { opacity: .55; } to { transform: translateY(-110vh) translateX(30px); opacity: 0; } }
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -.12em; flex: none; }
.font-display { font-family: var(--font-display); font-weight: 400; }

/* ==========================================================================
   dept-1 scenes (assets/art/scene_*.svg, inlined by scene.js): parts move with transform/opacity only.
   Elements that carry a transform attribute move with the independent 'translate' property so their placement stays.
   ========================================================================== */
body > .scene-art { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
body > .scene-art.is-in { animation: art-in .7s var(--ease-out) both; }
@keyframes art-in { from { opacity: 0; } }
body.has-art > .scene { display: none; }
.scene-art svg { display: block; width: 100%; height: 100%; }
.scene-art .wave-1, .scene-art .wave-2, .scene-art .wave-3 { transform-box: fill-box; animation: drift 40s linear infinite; }
.scene-art .wave-2 { animation-duration: 26s; } .scene-art .wave-3 { animation-duration: 18s; }
.scene-art .bob-wrap { transform-box: fill-box; transform-origin: 50% 90%; animation: bob 4.6s ease-in-out infinite; }
.scene-art .star { animation: tw 4s ease-in-out calc(var(--i, 0) * -0.37s) infinite; }
@keyframes tw { 50% { opacity: .25; } }
.scene-art .lantern-glow { animation: glow 3.2s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .65; } }
.scene-art .fl { animation: fl 9s ease-in-out calc(var(--i, 0) * -0.7s) infinite; }
@keyframes fl { 50% { translate: 0 -14px; } }
.scene-art .fish { animation: fsh 12s ease-in-out infinite; }
@keyframes fsh { 50% { translate: -40px 6px; } }
.scene-art .lightning { opacity: 0; animation: bolt 6s linear infinite; }
@keyframes bolt { 0%, 84%, 100% { opacity: 0; } 86%, 90% { opacity: 1; } 88% { opacity: .2; } }
.scene-art .rain { animation: rain .9s linear infinite; }
@keyframes rain { from { translate: 0 -20px; } to { translate: -6px 20px; } }
.scene-art .scroll-main { animation: glow 4s ease-in-out infinite; }
.scene-art .flame, .emblem .flame { transform-box: fill-box; transform-origin: 50% 85%; }
.emblem { display: inline-block; width: 1.9rem; height: 3.1rem; flex: none; }
.emblem svg { display: block; width: 100%; height: 100%; overflow: visible; }
.emblem .lantern-glow { opacity: .55; }
.ico-line { fill: none; }

/* utilities */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; } }
