:root {
  --night: #071528;
  --night-2: #102842;
  --ink: #f5eddc;
  --muted: #adbed0;
  --paper: #ead7b7;
  --amber: #ffc96b;
  --amber-2: #ff9d4f;
  --signal: #7ee3d7;
  --danger: #f07474;
  --panel: rgba(7, 18, 34, .88);
  --line: rgba(220, 236, 244, .2);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--night); color: var(--ink); overflow: hidden; }
body { min-height: 100svh; overscroll-behavior: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.skip-link { position: fixed; z-index: 999; left: 1rem; top: -4rem; padding: .8rem 1rem; background: #fff; color: #111; }
.skip-link:focus { top: 1rem; }

.app { position: relative; width: 100%; height: 100svh; isolation: isolate; }
.world, .world__image, .world__grade, .world__grain, .world__weather { position: absolute; inset: 0; }
.world { z-index: -2; overflow: hidden; background: var(--night); }
.world__image { width: 100%; height: 100%; object-fit: cover; object-position: center 45%; transform: scale(1.025); filter: saturate(.78) brightness(.48) contrast(1.1); }
.world__grade { background: radial-gradient(circle at 55% 44%, transparent 0 25%, rgba(4, 11, 24, .18) 56%, rgba(2, 7, 18, .86) 100%), linear-gradient(90deg, rgba(3, 11, 24, .72), transparent 48%, rgba(3, 11, 24, .32)); }
.world__grain { opacity: .13; mix-blend-mode: soft-light; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E"); }
.world__weather { opacity: .22; background-image: linear-gradient(105deg, transparent 0 49%, rgba(197, 225, 237, .35) 50%, transparent 51%); background-size: 68px 92px; animation: drizzle 2.2s linear infinite; }
@keyframes drizzle { to { transform: translate(-68px, 92px); } }

.screen { position: absolute; inset: 0; z-index: 1; display: none; opacity: 0; }
.screen.is-active { display: flex; animation: screen-in .65s var(--ease) both; }
@keyframes screen-in { from { opacity: 0; transform: scale(1.015); } to { opacity: 1; transform: none; } }

/* Boot */
.screen--boot { align-items: center; justify-content: center; padding: clamp(1.5rem, 5vw, 5rem); text-align: center; background: linear-gradient(180deg, rgba(4, 12, 26, .12), rgba(4, 12, 26, .66)); }
.brand-lockup { transform: translateY(-3vh); text-shadow: 0 4px 30px rgba(0, 0, 0, .7); }
.brand-kicker, .eyebrow { margin: 0 0 1rem; color: var(--amber); font-size: .75rem; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }
.brand-lockup h1 { margin: 0; font-family: "Noto Serif TC", "Songti TC", serif; font-size: clamp(3.4rem, 10vw, 8.6rem); line-height: .82; letter-spacing: -.07em; }
.brand-lockup h1 span { display: block; }
.brand-lockup h1 small { display: block; margin-top: .38em; color: var(--amber); font-family: inherit; font-size: .38em; font-weight: 700; letter-spacing: .34em; text-indent: .34em; }
.brand-subtitle { margin: 2.2rem auto 0; max-width: 32rem; color: #d4dde4; font-size: clamp(.95rem, 2vw, 1.15rem); line-height: 1.9; letter-spacing: .05em; }
.press-start { position: absolute; left: 50%; bottom: clamp(4.8rem, 12vh, 8rem); display: flex; align-items: center; gap: .8rem; transform: translateX(-50%); border: 0; background: none; cursor: pointer; font-weight: 800; letter-spacing: .12em; text-shadow: 0 2px 10px #000; white-space: nowrap; }
.press-start__pulse { width: .72rem; height: .72rem; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 0 rgba(255, 201, 107, .55); animation: pulse 1.7s ease-out infinite; }
@keyframes pulse { 65%, 100% { box-shadow: 0 0 0 1.1rem rgba(255, 201, 107, 0); } }
.boot-footer { position: absolute; left: clamp(1rem, 4vw, 3rem); right: clamp(1rem, 4vw, 3rem); bottom: 1.3rem; display: flex; justify-content: space-between; color: rgba(228, 237, 242, .55); font-size: .68rem; font-weight: 700; letter-spacing: .1em; }

/* Menu */
.screen--menu { flex-direction: column; padding: clamp(1rem, 3vw, 2.6rem) clamp(1rem, 5vw, 5rem) clamp(1.2rem, 4vw, 3.8rem); background: linear-gradient(90deg, rgba(4, 13, 27, .88) 0 36%, rgba(4, 13, 27, .32) 68%, rgba(4, 13, 27, .74)); }
.menu-header { display: flex; align-items: center; justify-content: space-between; }
.mini-brand span { display: block; font-family: "Noto Serif TC", serif; font-size: 1.35rem; font-weight: 900; letter-spacing: .04em; }
.mini-brand small { display: block; margin-top: .2rem; color: var(--amber); font-size: .58rem; font-weight: 900; letter-spacing: .18em; }
.menu-actions { display: flex; gap: .55rem; }
.icon-button { min-width: 3.9rem; padding: .65rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(7, 20, 37, .68); color: #d9e4e9; font-size: .74rem; font-weight: 800; cursor: pointer; backdrop-filter: blur(12px); }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--amber); color: var(--amber); outline: none; }
.menu-layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(22rem, 31rem); gap: clamp(2rem, 7vw, 8rem); align-items: end; min-height: 0; padding-top: clamp(2rem, 8vh, 7rem); }
.chapter-copy { align-self: center; max-width: 45rem; padding-bottom: 2vh; }
.chapter-copy h2 { margin: 0; font-family: "Noto Serif TC", serif; font-size: clamp(2.6rem, 5.5vw, 6.5rem); line-height: 1.06; letter-spacing: -.05em; text-shadow: 0 4px 35px #020913; }
.chapter-copy h2 em { color: var(--amber); font-style: normal; }
.chapter-copy > p:not(.eyebrow, .chapter-objective) { max-width: 39rem; margin: 1.6rem 0 0; color: #d1dbe1; font-size: clamp(.92rem, 1.45vw, 1.08rem); line-height: 1.85; text-shadow: 0 2px 12px #000; }
.chapter-objective { display: flex; align-items: center; gap: .9rem; margin: 1.7rem 0 0; color: #eef2ed; font-size: .86rem; font-weight: 750; }
.chapter-objective span { padding: .35rem .58rem; border: 1px solid rgba(255, 201, 107, .55); color: var(--amber); font-size: .65rem; letter-spacing: .1em; }
.chapter-objective b { font-weight: 750; }
.mission-panel { align-self: end; padding: clamp(1rem, 2.2vw, 1.7rem); border: 1px solid var(--line); border-radius: 1.2rem; background: rgba(6, 17, 32, .84); box-shadow: 0 22px 70px rgba(0, 0, 0, .38); backdrop-filter: blur(20px) saturate(1.2); }
.track-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.track-number { color: rgba(255,255,255,.16); font-family: Georgia, serif; font-size: 3.3rem; line-height: 1; font-weight: 900; }
.track-label { color: var(--signal); font-size: .58rem; font-weight: 900; letter-spacing: .18em; }
.track-card h3 { margin: .23rem 0; font-size: 1.05rem; }
.track-card p { margin: 0; color: var(--muted); font-size: .7rem; }
.track-wave { height: 2rem; display: flex; align-items: center; gap: 3px; }
.track-wave i { width: 3px; height: 25%; border-radius: 2px; background: var(--amber); animation: wave 1.2s ease-in-out infinite alternate; }
.track-wave i:nth-child(2), .track-wave i:nth-child(6) { height: 70%; animation-delay: -.3s; }
.track-wave i:nth-child(3), .track-wave i:nth-child(5) { height: 42%; animation-delay: -.8s; }
.track-wave i:nth-child(4) { height: 100%; animation-delay: -.5s; }
@keyframes wave { to { transform: scaleY(.35); opacity: .45; } }
.chapter-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: .85rem 0 1rem; }
.chapter-tabs button { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .42rem; min-width: 0; padding: .55rem .45rem; border: 1px solid transparent; border-radius: .55rem; background: rgba(255,255,255,.025); color: var(--muted); cursor: pointer; }
.chapter-tabs button:hover:not(:disabled), .chapter-tabs button:focus-visible { border-color: rgba(126,227,215,.45); outline: none; }
.chapter-tabs button.is-active { border-color: rgba(255,201,107,.5); background: rgba(255,201,107,.08); color: var(--ink); }
.chapter-tabs button:disabled { opacity: .3; cursor: not-allowed; }
.chapter-tabs button:disabled::after { content: "LOCK"; position: absolute; right: .3rem; top: .22rem; color: rgba(255,255,255,.4); font-size: .38rem; font-weight: 900; letter-spacing: .08em; }
.chapter-tabs span { color: var(--amber); font-family: Georgia, serif; font-size: .72rem; font-weight: 900; }
.chapter-tabs b { overflow: hidden; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.difficulty-picker { display: grid; gap: .45rem; margin: 1.05rem 0; padding: 0; border: 0; }
.difficulty-picker legend { margin-bottom: .55rem; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.difficulty-option { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; padding: .7rem .8rem; border: 1px solid transparent; border-radius: .65rem; cursor: pointer; transition: .2s var(--ease); }
.difficulty-option:hover { background: rgba(255,255,255,.04); }
.difficulty-option:has(input:checked) { border-color: rgba(255, 201, 107, .55); background: rgba(255, 201, 107, .09); }
.difficulty-option input { position: absolute; opacity: 0; }
.difficulty-option span { display: grid; grid-template-columns: 3.4rem 1fr; align-items: baseline; }
.difficulty-option b { color: #fff; font-size: .92rem; }
.difficulty-option small { color: var(--muted); font-size: .68rem; }
.difficulty-option strong { display: grid; width: 1.7rem; height: 1.7rem; place-items: center; border-radius: 50%; background: rgba(255,255,255,.07); color: var(--amber); font-size: .7rem; }
.primary-button, .secondary-button, .text-button { width: 100%; border: 0; cursor: pointer; }
.primary-button { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem; border-radius: .7rem; background: var(--amber); color: #172033; font-weight: 950; box-shadow: 0 9px 30px rgba(255, 165, 69, .18); }
.primary-button:hover, .primary-button:focus-visible { background: #ffdaa0; outline: 3px solid rgba(255, 201, 107, .25); }
.primary-button small { font-size: .58rem; letter-spacing: .1em; opacity: .66; }
.secondary-button { padding: .85rem; border: 1px solid var(--line); border-radius: .7rem; background: transparent; font-weight: 800; }
.secondary-button:hover, .secondary-button:focus-visible { border-color: var(--amber); outline: none; }
.text-button { padding: .6rem; background: transparent; color: var(--muted); }
.best-line { display: flex; justify-content: space-between; margin-top: .75rem; color: var(--muted); font-size: .66rem; }
.best-line strong { color: var(--signal); }

/* Game */
.screen--game { flex-direction: column; background: rgba(2, 8, 18, .28); touch-action: manipulation; user-select: none; }
.hud { position: relative; z-index: 4; display: grid; grid-template-columns: 1fr minmax(10rem, 25vw) auto auto; align-items: center; gap: clamp(.7rem, 2vw, 2rem); min-height: 5.2rem; padding: max(.75rem, env(safe-area-inset-top)) clamp(.8rem, 3vw, 2.4rem) .75rem; border-bottom: 1px solid var(--line); background: rgba(4, 13, 27, .8); backdrop-filter: blur(18px); }
.hud__chapter small, .hud__stats small { display: block; color: var(--amber); font-size: .54rem; font-weight: 900; letter-spacing: .15em; }
.hud__chapter strong { display: block; margin-top: .2rem; font-size: .93rem; }
.hud__warmth { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .65rem; color: var(--muted); font-size: .6rem; font-weight: 800; }
.meter { height: .36rem; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.meter i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--amber-2), var(--amber), var(--signal)); transform-origin: left; transition: transform .3s var(--ease); }
.hud__stats { display: flex; gap: clamp(.8rem, 2vw, 1.8rem); }
.hud__stats strong { display: block; margin-top: .15rem; font-variant-numeric: tabular-nums; font-size: 1.1rem; letter-spacing: .04em; }
.pause-button { width: 2.5rem; height: 2.5rem; border: 1px solid var(--line); border-radius: 50%; background: rgba(0,0,0,.2); cursor: pointer; }
.signal-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#signal-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.room-node { position: absolute; z-index: 2; width: clamp(4.3rem, 9vw, 7.3rem); height: clamp(5.4rem, 12vh, 8.8rem); border: 1px solid rgba(222, 234, 239, .18); border-radius: .55rem; background: linear-gradient(180deg, rgba(14, 35, 54, .84), rgba(5, 16, 31, .9)); box-shadow: inset 0 0 30px rgba(2, 9, 20, .45), 0 14px 35px rgba(0,0,0,.25); overflow: hidden; transition: .16s var(--ease); }
.room-node img { position: absolute; inset: 14% 3% -10%; width: 94%; height: 95%; object-fit: contain; filter: saturate(.72) brightness(.68); transition: .18s var(--ease); }
.room-node b, .room-number { position: absolute; z-index: 2; font-size: .62rem; font-weight: 900; letter-spacing: .1em; text-shadow: 0 2px 7px #000; }
.room-node b { left: .45rem; bottom: .4rem; }
.room-number { right: .45rem; top: .38rem; color: rgba(236,242,244,.55); }
.room-node i { position: absolute; inset: 0; background: radial-gradient(circle at 50% 65%, rgba(255, 201, 107, .42), transparent 58%); opacity: 0; }
.room-node.is-live { border-color: rgba(255, 201, 107, .78); box-shadow: 0 0 38px rgba(255, 177, 75, .22), inset 0 0 30px rgba(255, 177, 75, .12); transform: scale(1.045); }
.room-node.is-live img { filter: saturate(1) brightness(1); }
.room-node.is-live i { animation: node-flash .42s ease-out; }
@keyframes node-flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.room-node--cat { left: clamp(.8rem, 5vw, 5rem); top: clamp(.8rem, 4vh, 3rem); }
.room-node--raccoon { right: clamp(.8rem, 5vw, 5rem); top: clamp(.8rem, 4vh, 3rem); }
.room-node--shiba { left: clamp(.8rem, 5vw, 5rem); bottom: clamp(1.2rem, 5vh, 3.5rem); }
.room-node--otter { right: clamp(.8rem, 5vw, 5rem); bottom: clamp(1.2rem, 5vh, 3.5rem); }
.receiver { position: absolute; z-index: 2; left: 50%; top: 50%; display: grid; width: clamp(5rem, 10vw, 7.4rem); height: clamp(5rem, 10vw, 7.4rem); place-items: center; transform: translate(-50%, -50%); border: 1px solid rgba(126, 227, 215, .4); border-radius: 50%; background: radial-gradient(circle, rgba(19, 52, 70, .92), rgba(3, 14, 27, .92) 66%); box-shadow: 0 0 0 1rem rgba(126, 227, 215, .025), 0 0 0 2.1rem rgba(126, 227, 215, .02); }
.receiver::before, .receiver::after { content: ""; position: absolute; inset: 12%; border: 1px dashed rgba(126,227,215,.3); border-radius: 50%; animation: spin 8s linear infinite; }
.receiver::after { inset: 26%; border-style: solid; animation-direction: reverse; animation-duration: 5s; }
@keyframes spin { to { transform: rotate(1turn); } }
.receiver span { z-index: 1; color: var(--signal); font-family: Georgia, serif; font-size: 1.25rem; font-weight: 900; letter-spacing: .08em; }
.receiver i { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 40px rgba(126,227,215,.25); opacity: 0; }
.receiver.is-hit i { animation: receiver-hit .45s ease-out; }
@keyframes receiver-hit { 0% { opacity: 1; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.55); } }
.judgement { position: absolute; z-index: 5; left: 50%; top: calc(50% + clamp(3.5rem, 9vw, 6rem)); display: grid; justify-items: center; transform: translateX(-50%); pointer-events: none; opacity: 0; }
.judgement strong { font-family: Georgia, serif; font-size: clamp(1.2rem, 3vw, 2rem); font-style: italic; letter-spacing: .05em; text-shadow: 0 4px 16px #000; }
.judgement small { margin-top: .15rem; color: #d7e0e4; font-size: .62rem; font-weight: 800; }
.judgement.show { animation: judgement .55s var(--ease) both; }
.judgement.perfect strong { color: var(--amber); }
.judgement.great strong { color: var(--signal); }
.judgement.good strong { color: #c2cce8; }
.judgement.miss strong { color: var(--danger); }
@keyframes judgement { 0% { opacity: 0; transform: translate(-50%, .8rem) scale(.8); } 28%, 70% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -.5rem) scale(.96); } }
.combo-display { position: absolute; z-index: 3; left: 50%; top: 50%; display: grid; justify-items: center; transform: translate(-50%, -50%); pointer-events: none; }
.combo-display strong { font: 900 clamp(1.7rem, 4vw, 3.4rem)/1 Georgia, serif; text-shadow: 0 3px 16px #000; opacity: .2; }
.combo-display small { color: var(--muted); font-size: .5rem; font-weight: 900; letter-spacing: .18em; opacity: .45; }
.count-in { position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 900 clamp(5rem, 16vw, 12rem)/1 Georgia, serif; color: var(--amber); text-shadow: 0 8px 40px #000; pointer-events: none; }
.radio-caption { position: absolute; z-index: 6; left: 50%; bottom: 5.6rem; display: flex; align-items: center; gap: .8rem; width: min(35rem, calc(100% - 11rem)); min-height: 3rem; padding: .7rem .9rem; transform: translateX(-50%); border: 1px solid var(--line); border-radius: .55rem; background: rgba(4, 14, 28, .82); backdrop-filter: blur(12px); box-shadow: 0 12px 35px rgba(0,0,0,.25); }
.radio-caption__speaker { flex: 0 0 auto; color: var(--amber); font-size: .7rem; font-weight: 900; }
.radio-caption p { margin: 0; color: #dce5e8; font-size: .76rem; line-height: 1.45; }
.tap-zone { position: absolute; z-index: 7; right: clamp(.75rem, 2vw, 1.5rem); bottom: max(.75rem, env(safe-area-inset-bottom)); display: grid; width: clamp(5.4rem, 9vw, 7.2rem); height: clamp(3.6rem, 6vw, 4.8rem); place-items: center; border: 1px solid rgba(255,201,107,.5); border-radius: .75rem; background: rgba(8, 20, 35, .82); box-shadow: inset 0 0 24px rgba(255, 201, 107, .08); cursor: pointer; backdrop-filter: blur(12px); }
.tap-zone:active { transform: scale(.95); background: rgba(255,201,107,.22); }
.tap-zone span { font-weight: 900; }
.tap-zone small { color: var(--muted); font-size: .44rem; font-weight: 800; letter-spacing: .08em; }

/* Results */
.screen--result { align-items: center; justify-content: center; padding: 1rem; background: rgba(2, 8, 18, .67); backdrop-filter: blur(8px); }
.result-card { width: min(37rem, 100%); max-height: calc(100svh - 2rem); overflow: auto; padding: clamp(1.4rem, 4vw, 2.6rem); border: 1px solid var(--line); border-radius: 1.2rem; background: rgba(7, 18, 34, .94); box-shadow: 0 30px 90px rgba(0,0,0,.5); text-align: center; }
.result-rank { color: var(--amber); font: 900 clamp(4.5rem, 12vw, 8rem)/.9 Georgia, serif; font-style: italic; text-shadow: 0 0 40px rgba(255,201,107,.22); }
.result-card h2 { margin: .8rem 0 .45rem; font-family: "Noto Serif TC", serif; font-size: clamp(1.6rem, 4vw, 2.5rem); }
.result-card > p:not(.eyebrow, .leaderboard-status) { margin: 0 auto; max-width: 29rem; color: var(--muted); line-height: 1.65; }
.result-score { display: flex; align-items: baseline; justify-content: space-between; margin: 1.3rem 0 .7rem; padding: .9rem 0; border-block: 1px solid var(--line); }
.result-score span { color: var(--muted); font-size: .75rem; }
.result-score strong { font: 900 2rem/1 Georgia, serif; color: var(--amber); }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.result-grid div { padding: .75rem .35rem; border-radius: .55rem; background: rgba(255,255,255,.035); }
.result-grid span { display: block; color: var(--muted); font-size: .6rem; }
.result-grid strong { display: block; margin-top: .35rem; font-size: 1rem; }
.leaderboard-status { min-height: 1.2rem; margin: .75rem 0; color: var(--signal); font-size: .7rem; font-weight: 800; }
.result-board { margin: 0 0 .85rem; padding: .75rem; border: 1px solid var(--line); border-radius: .7rem; background: rgba(2, 9, 20, .55); text-align: left; }
.result-board > header { display: flex; align-items: baseline; justify-content: space-between; padding: 0 .35rem .45rem; border-bottom: 1px solid var(--line); }
.result-board > header span { color: var(--amber); font-size: .58rem; font-weight: 900; letter-spacing: .14em; }
.result-board > header small { color: var(--muted); font-size: .58rem; }
.result-board .lb-list { gap: 0; padding-top: .25rem; }
.result-board .lb-row { padding: .3rem .4rem; background: transparent; font-size: .72rem; }
.result-board .lb-row + .lb-row { border-top: 1px solid rgba(255,255,255,.045); }
.result-board .lb-rank { color: var(--amber); }
.result-board .lb-score { color: var(--signal); font-family: Georgia, serif; }
.result-board .lb-mine { border-radius: .35rem; background: rgba(126,227,215,.09); outline-color: rgba(126,227,215,.28); }
.result-board .lb-empty { margin: 0; padding: .65rem .4rem .35rem; color: var(--muted); font-size: .68rem; text-align: center; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.board-link { display: inline-block; margin-top: .9rem; color: var(--muted); font-size: .7rem; text-decoration: underline; text-underline-offset: .2rem; }

/* Shared leaderboard identity prompt, tuned to Tailwave's console UI. */
body #lb-name-overlay { background: rgba(2,7,17,.86); backdrop-filter: blur(14px); }
body .lb-name-box { border-color: var(--line); border-radius: 1rem; background: rgba(7,18,34,.97); box-shadow: 0 30px 90px rgba(0,0,0,.55); color: var(--ink); }
body .lb-name-box h3 { font-family: "Noto Serif TC", serif; font-size: 1.45rem; }
body .lb-name-hint { color: var(--muted); line-height: 1.55; }
body #lb-name-input { border-color: var(--line); background: rgba(2,9,20,.78); color: var(--ink); outline-color: var(--signal); }
body .lb-name-actions button { min-height: 2.7rem; padding-inline: 1rem; border: 1px solid var(--line); font-weight: 800; }
body #lb-name-ok { background: var(--amber); color: #071321; }
body #lb-name-cancel { background: rgba(255,255,255,.05); color: var(--muted); }

/* Modals */
.modal { position: fixed; z-index: 50; inset: 0; background: rgba(2, 7, 17, .78); backdrop-filter: blur(12px); }
.modal[hidden] { display: none; }
.story-frame { position: absolute; inset: clamp(1rem, 5vw, 4rem); overflow: hidden; border: 1px solid var(--line); border-radius: 1rem; background: linear-gradient(110deg, rgba(5, 15, 29, .96), rgba(10, 28, 45, .9)); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.story-frame::before { content: ""; position: absolute; inset: 0; background: url("assets/art/apartment-night.webp") center/cover; opacity: .14; mix-blend-mode: luminosity; }
.story-time { position: absolute; z-index: 2; left: 1.4rem; top: 1.2rem; color: var(--signal); font-size: .65rem; font-weight: 900; letter-spacing: .16em; }
.story-portrait { position: absolute; z-index: 1; left: 4%; bottom: -12%; width: 43%; height: 92%; transition: opacity .25s; }
.story-portrait img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 20px 30px rgba(0,0,0,.4)); }
.story-dialogue { position: absolute; z-index: 3; left: 38%; right: 5%; bottom: 8%; padding: clamp(1.2rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: .85rem; background: rgba(5, 15, 28, .91); box-shadow: 0 18px 60px rgba(0,0,0,.35); }
.story-dialogue > span { color: var(--amber); font-size: .78rem; font-weight: 900; letter-spacing: .1em; }
.story-dialogue p { min-height: 3.5em; margin: .8rem 0 1.1rem; font-family: "Noto Serif TC", serif; font-size: clamp(1rem, 2.1vw, 1.4rem); line-height: 1.7; }
.story-dialogue button { display: block; margin-left: auto; border: 0; background: none; color: var(--signal); font-size: .76rem; font-weight: 900; cursor: pointer; }
.story-dialogue button small { margin-left: .55rem; color: var(--muted); font-size: .55rem; }
.story-skip { position: absolute; z-index: 4; right: 1.2rem; top: 1rem; border: 0; background: transparent; color: var(--muted); font-size: .68rem; cursor: pointer; }
.story-progress { position: absolute; z-index: 3; left: 38%; right: 5%; bottom: 4%; display: flex; gap: .35rem; }
.story-progress i { flex: 1; height: 2px; background: rgba(255,255,255,.12); }
.story-progress i.is-active { background: var(--amber); }
.pause-modal, .settings-modal { display: grid; place-items: center; padding: 1rem; }
.pause-card, .settings-card { width: min(27rem, 100%); max-height: calc(100svh - 2rem); overflow: auto; padding: 2rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); box-shadow: 0 25px 80px rgba(0,0,0,.5); text-align: center; }
.pause-card > p { margin: 0; color: var(--amber); font-size: .7rem; font-weight: 900; letter-spacing: .15em; }
.pause-card h2, .settings-card h2 { margin: .6rem 0; font-family: "Noto Serif TC", serif; font-size: 2rem; }
.pause-card > span, .settings-card > p:not(.eyebrow) { display: block; margin-bottom: 1.3rem; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.pause-card button + button { margin-top: .55rem; }
.settings-card { text-align: left; }
.settings-card label { display: grid; grid-template-columns: 1fr auto; gap: .55rem; margin: 1.2rem 0; font-size: .8rem; font-weight: 800; }
.settings-card output { color: var(--signal); }
.settings-card input { grid-column: 1 / -1; width: 100%; accent-color: var(--amber); }
.calibration-tool { margin: 1.1rem 0; padding: .8rem; border: 1px solid var(--line); border-radius: .75rem; background: rgba(2,9,20,.5); }
.calibration-tool > header { display: flex; justify-content: space-between; color: var(--amber); font-size: .64rem; font-weight: 900; letter-spacing: .1em; }
.calibration-tool > header small { color: var(--signal); font-variant-numeric: tabular-nums; }
.calibration-stage { position: relative; display: grid; min-height: 4.5rem; margin: .7rem 0; padding: .7rem .8rem .7rem 3.25rem; align-items: center; overflow: hidden; border-radius: .55rem; background: rgba(255,255,255,.035); }
.calibration-stage i { position: absolute; left: 1.05rem; width: 1.3rem; height: 1.3rem; border: 2px solid var(--signal); border-radius: 50%; box-shadow: 0 0 0 0 rgba(126,227,215,.3); }
.calibration-stage.is-pulse i { animation: calibration-pulse .3s ease-out; background: var(--signal); }
.calibration-stage.is-tap { background: rgba(255,201,107,.09); }
.calibration-stage p { margin: 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.calibration-tool button + button { margin-top: .5rem; }
.calibration-tool button:disabled { cursor: default; opacity: .42; }
@keyframes calibration-pulse { from { transform: scale(.7); box-shadow: 0 0 0 0 rgba(126,227,215,.55); } to { transform: scale(1); box-shadow: 0 0 0 1.4rem rgba(126,227,215,0); } }

@media (max-width: 780px) {
  .world__image { object-position: 55% center; }
  .boot-footer span:nth-child(2) { display: none; }
  .screen--menu { overflow: auto; background: linear-gradient(180deg, rgba(4,13,27,.48), rgba(4,13,27,.96) 55%); }
  .menu-layout { display: flex; flex-direction: column; align-items: stretch; gap: 1.4rem; padding-top: 15vh; }
  .chapter-copy { align-self: auto; }
  .chapter-copy > p:not(.eyebrow, .chapter-objective) { display: none; }
  .chapter-objective { font-size: .76rem; }
  .mission-panel { align-self: auto; }
  .hud { grid-template-columns: 1fr auto auto; min-height: 4.4rem; }
  .hud__warmth { position: absolute; left: .8rem; right: .8rem; bottom: .28rem; grid-template-columns: auto 1fr; }
  .hud__stats div:nth-child(2) { display: none; }
  .room-node { width: 3.65rem; height: 4.6rem; }
  .room-node b { font-size: .5rem; }
  .room-number { font-size: .48rem; }
  .room-node--shiba, .room-node--otter { bottom: 5rem; }
  .receiver { width: 4.8rem; height: 4.8rem; }
  .radio-caption { left: .7rem; right: 6.5rem; bottom: max(.7rem, env(safe-area-inset-bottom)); width: auto; transform: none; min-height: 3.6rem; }
  .radio-caption p { font-size: .68rem; }
  .tap-zone { width: 5.2rem; height: 3.6rem; }
  .story-frame { inset: .7rem; }
  .story-portrait { left: -6%; bottom: 20%; width: 62%; height: 72%; opacity: .65; }
  .story-dialogue { left: 5%; right: 5%; bottom: 6%; }
  .story-progress { left: 5%; right: 5%; bottom: 2.5%; }
  .result-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-height: 680px) and (orientation: landscape) {
  .menu-layout { padding-top: 1rem; }
  .chapter-copy h2 { font-size: clamp(2rem, 6vw, 4.3rem); }
  .chapter-copy > p:not(.eyebrow, .chapter-objective) { display: none; }
  .difficulty-option { padding-block: .48rem; }
  .mission-panel { padding: .85rem; }
  .result-card { padding: 1rem 1.5rem; }
  .result-rank { font-size: 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .world__weather { display: none; }
}
