/* Story UI: pain meter, narrator, YOU tag, cinematic moments, chapter openers, recap stats. */

/* ---------- HUD additions ---------- */
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.hud-pain { display: flex; align-items: baseline; gap: 6px; padding: 5px 10px 5px 11px; border-radius: 999px; background: rgba(20, 4, 6, .45); border: 1px solid rgba(255, 106, 90, .35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: border-color .8s; }
.hud-pain b { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1; color: #ff6a5a; transition: color .8s; font-variant-numeric: tabular-nums; }
.hud-pain .hud-of { font-size: 11px; color: var(--dim); }
.hud-pain.relieved { border-color: rgba(243, 192, 106, .45); }
.hud-pain.relieved b { color: var(--gold); }
.hud-pain.bump { animation: painBump .9s ease; }
@keyframes painBump { 30% { transform: scale(1.18); } 100% { transform: scale(1); } }
#mute { position: fixed; z-index: 11; right: 16px; top: calc(var(--safe-t) + 116px); width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--faint); background: rgba(20, 4, 6, .45); color: var(--ink); display: grid; place-items: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: opacity .4s; }
#mute.off { color: var(--dim); }

/* narrator: story lines, like film subtitles */
#narrator { position: fixed; z-index: 12; left: 50%; bottom: calc(var(--safe-b) + 112px); transform: translate(-50%, 8px); width: min(88vw, 620px); text-align: center; pointer-events: none; opacity: 0; transition: opacity .45s, transform .45s; }
#narrator.on { opacity: 1; transform: translate(-50%, 0); }
#narrText { font-family: var(--serif); font-style: italic; font-size: clamp(19px, 2.6vw, 25px); line-height: 1.25; color: #fff4e6; text-shadow: 0 2px 18px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6); }

/* the "YOU" tag that finds your molecule */
#youTag { position: fixed; z-index: 9; left: 0; top: 0; pointer-events: none; font: 500 10px 'JetBrains Mono', monospace; letter-spacing: .22em; color: var(--gold); padding: 3px 8px; border: 1px solid rgba(243, 192, 106, .6); border-radius: 999px; background: rgba(20, 6, 4, .4); opacity: 0; transition: opacity .5s; white-space: nowrap; }
#youTag.on { opacity: 1; }
#youTag::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 14px; background: linear-gradient(rgba(243, 192, 106, .7), transparent); }

/* ---------- cinematic moment ---------- */
.lb { position: fixed; left: 0; right: 0; height: max(64px, 11vh); background: #050101; z-index: 1; transition: transform .7s cubic-bezier(.2, .8, .2, 1); display: flex; align-items: center; justify-content: center; padding: 0 20px; }
.lb-t { top: 0; transform: translateY(-101%); }
.lb-b { bottom: 0; transform: translateY(101%); justify-content: flex-end; }
#moment, #chapter { position: fixed; inset: 0; z-index: 20; }
#moment.hidden, #chapter.hidden { opacity: 1 !important; }
#moment:not(.hidden) .lb, #chapter:not(.hidden) .lb { transform: none; }
#moment::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 90% 70% at 10% 95%, rgba(8, 1, 2, .82), rgba(8, 1, 2, 0) 70%); transition: opacity .8s; }
#moment.hidden::before { opacity: 0; }
.mo-body { position: absolute; z-index: 2; left: max(22px, 6vw); right: 22px; bottom: calc(max(64px, 11vh) + 26px); max-width: 700px; transition: opacity .5s; }
#moment.hidden .mo-body { opacity: 0; }
.mo-k { display: flex; align-items: center; gap: 10px; font: 500 11px 'JetBrains Mono', monospace; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); }
.mo-badge { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 6px; background: var(--gold); color: #2a0c04; font-weight: 700; letter-spacing: .04em; font-size: 12px; }
.mo-word { font-family: var(--serif); font-size: clamp(54px, 12.5vw, 136px); line-height: .92; letter-spacing: -.015em; margin-top: 10px; white-space: nowrap; }
.mo-word span { display: inline-block; opacity: 0; transform: translateY(.25em) rotate(3deg); filter: blur(6px); transition: opacity .55s ease, transform .7s cubic-bezier(.2, .8, .2, 1), filter .6s ease;
  background: linear-gradient(180deg, #fff6e2 10%, #f3c06a 55%, #c98236 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mo-word.in span { opacity: 1; transform: none; filter: none; }
.mo-line { font-size: clamp(16px, 1.9vw, 20px); line-height: 1.4; max-width: 560px; margin-top: 14px; color: var(--ink); opacity: 0; transform: translateY(8px); transition: opacity .6s .35s, transform .6s .35s; text-shadow: 0 1px 14px rgba(0, 0, 0, .7); }
.mo-note { margin-top: 14px; max-width: 540px; padding-left: 12px; border-left: 2px solid var(--gold); font-size: 13.5px; line-height: 1.5; color: rgba(246, 239, 230, .72); opacity: 0; transition: opacity .6s .7s; }
.mo-note b { display: block; font: 500 10px 'JetBrains Mono', monospace; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 3px; }
#moment:not(.hidden) .mo-line { opacity: 1; transform: none; }
#moment:not(.hidden) .mo-note { opacity: 1; }
.mo-tap { font: 500 11px 'JetBrains Mono', monospace; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); opacity: 0; transition: opacity .5s; }
.mo-tap.on { opacity: 1; animation: tapPulse 1.6s ease-in-out infinite; }
@keyframes tapPulse { 50% { color: var(--gold); } }
.mo-chain { display: flex; gap: 6px; flex-wrap: nowrap; font: 500 10.5px 'JetBrains Mono', monospace; letter-spacing: .08em; }
.mo-chain i { font-style: normal; padding: 4px 8px; border-radius: 999px; border: 1px solid rgba(246, 239, 230, .12); color: rgba(246, 239, 230, .35); white-space: nowrap; transition: all .5s; }
.mo-chain i.done { color: rgba(243, 192, 106, .7); border-color: rgba(243, 192, 106, .25); }
.mo-chain i.now { color: #2a0c04; background: var(--gold); border-color: var(--gold); }
.mo-chain i em { font-style: normal; }

/* ---------- chapter opener ---------- */
#chapter::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 80% 60% at 50% 55%, rgba(8, 1, 2, .72), rgba(8, 1, 2, 0) 75%); transition: opacity .8s; }
#chapter.hidden::before { opacity: 0; }
.ch-body { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(90vw, 720px); text-align: center; }
.ch-body > * { opacity: 0; transform: translateY(14px); transition: opacity .7s, transform .8s cubic-bezier(.2, .8, .2, 1); }
#chapter:not(.hidden) .ch-body > * { opacity: 1; transform: none; }
#chapter:not(.hidden) .ch-title { transition-delay: .15s; }
#chapter:not(.hidden) .ch-line { transition-delay: .45s; }
#chapter:not(.hidden) .ch-goal { transition-delay: .8s; }
.ch-n { font: 500 11px 'JetBrains Mono', monospace; letter-spacing: .32em; text-transform: uppercase; color: var(--gold); }
.ch-title { font-family: var(--serif); font-size: clamp(50px, 11vw, 112px); line-height: .95; margin-top: 10px; text-shadow: 0 4px 40px rgba(0, 0, 0, .6); }
.ch-line { font-family: var(--serif); font-style: italic; font-size: clamp(19px, 2.6vw, 26px); line-height: 1.3; color: rgba(246, 239, 230, .88); margin: 14px auto 0; max-width: 560px; text-shadow: 0 2px 18px rgba(0, 0, 0, .8); }
.ch-goal { display: inline-flex; align-items: center; gap: 10px; margin-top: 22px; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(243, 192, 106, .5); background: rgba(20, 6, 4, .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ch-goal span { font: 500 10px 'JetBrains Mono', monospace; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.ch-goal b { font-weight: 500; font-size: 14px; }

/* title + recap extras */
.pain-txt { color: #ff7a6a; font-weight: 600; }
.rc-stats { display: flex; gap: 10px; flex-wrap: wrap; margin: -6px auto 16px; }
.rc-stats div { flex: 1 1 140px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--faint); background: rgba(255, 255, 255, .03); }
.rc-stats b { display: block; font-family: var(--serif); font-weight: 400; font-size: 28px; color: var(--gold); line-height: 1.1; }
.rc-stats span { font-size: 12px; color: var(--dim); }
#recap li .rc-badge { display: inline-block; min-width: 22px; padding: 0 5px; margin-right: 6px; border-radius: 5px; background: var(--gold); color: #2a0c04; text-align: center; letter-spacing: 0; }

@media (max-width: 560px) {
  .hud-dose { min-width: 96px; }
  .mo-chain i em { display: none; }
  .mo-body { bottom: calc(max(64px, 11vh) + 14px); }
  .mo-line { font-size: 15.5px; }
  .mo-note { font-size: 12.5px; }
  #narrator { bottom: calc(var(--safe-b) + 104px); }
}

body.cine #hud, body.cine #mute, body.cine #toast, body.cine #boost, body.cine #breath, body.cine #youTag { opacity: 0 !important; pointer-events: none; transition: opacity .4s; }
