/* ============================================================
   暮羽中 · cheathero — "a page of galgame in a design magazine"
   paper · ink · halftone · one blue-violet accent (blue hour)
   ============================================================ */

:root {
  --paper: #efe9df;
  --paper-2: #f7f3ec;
  --ink: #1a1820;
  --ink-2: #4a4652;
  --dim: #8a8490;
  --line: rgba(26, 24, 32, 0.16);
  --accent: #5b5bd6;
  --accent-ink: #f7f3ec;
  --sun: #5b5bd6;
  --shadow: #1a1820;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --latin: "Instrument Serif", "Noto Serif SC", serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.6, 0, .8, .2);
  color-scheme: light;
}
:root[data-theme="night"] {
  --paper: #121219;
  --paper-2: #1a1a24;
  --ink: #ebe5d9;
  --ink-2: #c4bdcc;
  --dim: #7d7890;
  --line: rgba(235, 229, 217, 0.14);
  --accent: #8b8cff;
  --accent-ink: #121219;
  --sun: #e9e1cf;
  --shadow: #000;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color .8s var(--ease), color .8s var(--ease);
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.dim { color: var(--dim); }
[hidden] { display: none !important; }

/* paper grain */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
  opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .1  0 0 0 0 .09  0 0 0 0 .12  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
:root[data-theme="night"] .grain { mix-blend-mode: screen; opacity: .18; }

/* ---------- the blue-hour sun (halftone disc) ---------- */
.sun {
  position: fixed; left: 50%; top: 0; z-index: 0; pointer-events: none;
  width: min(68vh, 92vw); aspect-ratio: 1;
  transform: translate(-50%, var(--sun-y, 6vh));
  transition: transform 2.4s var(--ease);
}
.sun-disc {
  width: 100%; height: 100%; border-radius: 50%;
  background-image: radial-gradient(circle, var(--sun) 1.6px, transparent 1.9px);
  background-size: 7px 7px;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0 50%, rgba(0,0,0,.55) 62%, transparent 71%);
          mask-image: radial-gradient(circle at 50% 50%, #000 0 50%, rgba(0,0,0,.55) 62%, transparent 71%);
  opacity: .5;
  animation: sun-breathe 9s ease-in-out infinite;
}
:root[data-theme="night"] .sun-disc {
  /* a full halftone moon right behind her head: doubles as a backlight for the black hair */
  opacity: .34;
  background-size: 6px 6px;
}
:root[data-theme="night"] .sun::after {
  content: ""; position: absolute; inset: 8%; border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 140, 255, .16), transparent 68%);
}
@keyframes sun-breathe { 50% { transform: scale(1.025); } }

/* ---------- top bar ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  padding: 22px 32px; pointer-events: none;
}
.top > * { pointer-events: auto; }
.top-mid { padding-top: 1px; }
.status { justify-self: end; display: grid; gap: 5px; text-align: right; font-size: 10.5px; }
.st-row { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.st-row b { font-weight: 500; }
.batt { position: relative; width: 34px; height: 11px; border: 1px solid currentColor; border-radius: 2px; padding: 1px; }
.batt::after { content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; background: currentColor; border-radius: 0 1px 1px 0; }
.batt i { display: block; height: 100%; width: var(--b, 50%); background: currentColor; transition: width 1s var(--ease); }
.batt.low i { background: #e5484d; }
.hp { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ping 2s infinite; }
.hp.off { background: var(--dim); animation: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }

/* ---------- stage ---------- */
.stage {
  position: fixed; inset: 0; z-index: 1;
  display: grid; grid-template-columns: minmax(300px, 1fr) minmax(420px, 720px) minmax(300px, 1fr);
}
.intro {
  align-self: start; padding: max(96px, 12vh) 0 0 48px; max-width: 420px;
  position: relative; z-index: 3;
}
.kicker { margin: 0 0 18px; }
.name {
  margin: 0; font-weight: 900; line-height: .92; letter-spacing: -.02em;
  font-size: clamp(56px, min(7vw, 9.6vh), 112px);
  display: flex; flex-direction: column;
}
.name span { display: block; transform-origin: left bottom; }
.latin {
  margin: 14px 0 0; font-family: var(--latin); font-style: italic; font-size: clamp(28px, 2.6vw, 40px);
  color: var(--accent); line-height: 1;
}
.rule { width: 44px; height: 1.5px; background: var(--ink); margin: 20px 0 18px; transform-origin: left; }
.role { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.tag { margin: 0 0 22px; font-size: 15px; color: var(--ink-2); }
.links { display: grid; gap: 0; border-top: 1px solid var(--line); }
.links a, .links button {
  display: grid; grid-template-columns: 28px 64px 1fr; align-items: baseline; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid var(--line); text-align: left;
  position: relative; overflow: hidden;
}
.links .lk { font-size: 15px; font-weight: 600; transition: transform .45s var(--ease); }
.links a > :last-child, .links button > :last-child { text-transform: none; letter-spacing: .02em; transition: color .3s; }
.links a::before, .links button::before {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1.5px; width: 100%;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease);
}
.links a:hover::before, .links button:hover::before, .links a:focus-visible::before, .links button:focus-visible::before { transform: scaleX(1); transform-origin: left; }
.links a:hover .lk, .links button:hover .lk { transform: translateX(6px); }
.links a:hover > :last-child, .links button:hover > :last-child { color: var(--accent); }

.rei-wrap { position: relative; height: 100%; z-index: 2; }
#rei { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
:root[data-theme="night"] #rei { filter: brightness(.88) saturate(.9); }

.side-note { align-self: stretch; display: flex; flex-direction: column; justify-content: center; align-items: flex-end; padding: 130px 34px 18vh 0; gap: 18px; }
.vert { writing-mode: vertical-rl; margin: 0; font-size: 13px; letter-spacing: .35em; color: var(--ink-2); line-height: 1; }
.side-coord { writing-mode: vertical-rl; }

/* ---------- visual-novel layer ---------- */
.vn {
  position: fixed; z-index: 10; left: 50%; bottom: 28px; transform: translateX(-50%);
  width: min(820px, calc(100vw - 64px));
}
.box {
  position: relative; min-height: 168px;
  background: color-mix(in srgb, var(--paper-2) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1.5px solid var(--ink);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 30px 34px 0;
  display: flex; flex-direction: column;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.nametag {
  position: absolute; left: -1.5px; top: -17px; height: 32px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px 0 14px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 16px; letter-spacing: .1em;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  padding-right: 22px;
}
.nametag .mono { font-size: 10px; opacity: .85; }
.line {
  margin: 0; min-height: 66px; font-size: 19px; line-height: 1.75; letter-spacing: .02em;
  padding-right: 24px;
}
.line .ch { opacity: 0; display: inline; animation: ch-in .28s var(--ease) forwards; }
@keyframes ch-in { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: blur(0); } }
.line a, .line .copy {
  color: var(--accent); border-bottom: 1.5px solid currentColor; cursor: pointer;
  font-family: inherit;
}
.line .copy { font-family: var(--mono); font-size: .85em; letter-spacing: 0; }
.line a:hover, .line .copy:hover { background: var(--accent); color: var(--accent-ink); }
.next {
  position: absolute; right: 30px; top: 92px; width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--accent);
  opacity: 0; transition: opacity .2s;
}
.next.on { opacity: 1; animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }

.thinking {
  position: absolute; left: 34px; top: 34px; display: flex; gap: 5px; align-items: center;
  color: var(--accent); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.thinking.on { opacity: 1; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: dot 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes dot { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.ask {
  display: flex; align-items: center; gap: 10px;
  margin: 14px -34px 0; padding: 0 16px 0 34px; height: 46px;
  border-top: 1px solid var(--line);
}
.ask .prompt { color: var(--accent); font-size: 15px; }
.ask input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 15px; font-family: var(--serif); height: 100%;
}
.ask input::placeholder { color: var(--dim); }
.ask button { padding: 6px 10px; border: 1px solid var(--line); transition: background .2s, color .2s, border-color .2s; }
.ask button:hover, .ask button:focus-visible { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ask:focus-within { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.sys {
  display: flex; gap: 0; width: fit-content; margin: 0 0 0 auto; padding: 4px 6px;
  background: var(--paper-2); border: 1.5px solid var(--ink); border-top: 0;
  box-shadow: 6px 6px 0 var(--shadow);
}
.sys a, .sys button {
  position: relative; padding: 5px 9px; font-size: 10.5px; letter-spacing: .14em; color: var(--ink-2);
  transition: color .2s, background .2s;
}
.sys a:hover, .sys button:hover, .sys button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); }
.sys [data-tip]::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); right: 0;
  white-space: nowrap; font-family: var(--serif); text-transform: none; letter-spacing: .02em; font-size: 12px;
  background: var(--ink); color: var(--paper); padding: 5px 9px;
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .2s, transform .25s var(--ease);
}
.sys [data-tip]:hover::after { opacity: 1; transform: none; }

/* galgame choices */
.choices {
  position: absolute; right: -10px; bottom: calc(100% + 30px);
  width: min(380px, 100%); display: grid; gap: 10px;
}
.choice {
  position: relative; display: grid; grid-template-columns: 34px 1fr auto; align-items: center;
  width: 100%; padding: 12px 18px; text-align: left; font-size: 16px;
  background: color-mix(in srgb, var(--paper-2) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1.5px solid var(--ink); overflow: hidden;
  opacity: 0; transform: translateY(14px);
  animation: choice-in .55s var(--ease) forwards; animation-delay: calc(var(--i) * 70ms);
  transition: color .35s var(--ease), box-shadow .35s var(--ease), translate .35s var(--ease);
}
.choice::before {
  content: ""; position: absolute; inset: 0; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease); z-index: -1;
}
.choice { isolation: isolate; }
.choice .mono { color: var(--dim); transition: color .35s; }
.choice .arrow { font-family: var(--mono); opacity: 0; transform: translateX(-8px); transition: opacity .3s, transform .4s var(--ease); }
.choice:hover, .choice:focus-visible { color: var(--accent-ink); box-shadow: 4px 4px 0 var(--shadow); translate: -2px -2px; outline: none; }
.choice:hover::before, .choice:focus-visible::before { transform: scaleX(1); }
.choice:hover .mono, .choice:focus-visible .mono { color: var(--accent-ink); }
.choice:hover .arrow, .choice:focus-visible .arrow { opacity: 1; transform: none; }
.choice.out { animation: choice-out .3s var(--ease-in) forwards; animation-delay: calc(var(--i) * 30ms); }
.choice.picked { color: var(--accent-ink); }
.choice.picked::before { transform: scaleX(1); }
@keyframes choice-in { to { opacity: 1; transform: none; } }
@keyframes choice-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-8px); } }

/* ---------- title screen ---------- */
.title {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; align-content: center; gap: 0;
  background: var(--paper);
  transition: opacity .9s var(--ease) .5s, visibility 0s 1.4s;
}
.title.out { opacity: 0; visibility: hidden; pointer-events: none; }
.t-pre { margin: 0 0 2vh; animation: rise 1s var(--ease) .1s both; }
.t-big {
  display: flex; align-items: center; gap: 4vw;
  font-weight: 900; font-size: min(34vh, 26vw); line-height: 1;
}
.t-big span { display: block; }
.t-mu { animation: rise 1.2s var(--ease) .15s both; }
.t-li {
  color: transparent; animation: rise 1.2s var(--ease) .3s both;
  background-image: radial-gradient(circle, var(--accent) 2.1px, transparent 2.5px);
  background-size: 7px 7px;
  -webkit-background-clip: text; background-clip: text;
}
.t-slash { width: 2px; height: .9em; background: var(--ink); transform: rotate(18deg); animation: grow 1s var(--ease) .5s both; }
.title.out .t-mu { transition: transform 1s var(--ease), opacity .8s; transform: translateX(-30vw); opacity: 0; }
.title.out .t-li { transition: transform 1s var(--ease), opacity .8s; transform: translateX(30vw); opacity: 0; }
.title.out .t-slash, .title.out .t-sub, .title.out .t-menu, .title.out .t-pre, .title.out .t-foot { transition: opacity .4s; opacity: 0; }
.t-sub { margin: 3vh 0 4.5vh; display: grid; gap: 8px; text-align: center; font-weight: 400; font-size: 16px; animation: rise 1s var(--ease) .55s both; }
.t-menu { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; min-width: 300px; animation: rise 1s var(--ease) .7s both; }
.t-menu button {
  width: 100%; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; text-align: left;
  padding: 12px 6px; font-size: 18px; border-bottom: 1px solid var(--line); position: relative;
  transition: padding .4s var(--ease), color .3s;
}
.t-menu button::before { content: "▶"; position: absolute; left: -22px; font-size: 11px; color: var(--accent); opacity: 0; transform: translateX(-6px); transition: opacity .3s, transform .4s var(--ease); }
.t-menu button:hover, .t-menu button:focus-visible { padding-left: 14px; color: var(--accent); outline: none; }
.t-menu button:hover::before, .t-menu button:focus-visible::before { opacity: 1; transform: none; }
.t-foot { position: absolute; bottom: 28px; left: 0; right: 0; text-align: center; text-transform: none; letter-spacing: .04em; animation: rise 1s var(--ease) 1s both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: rotate(18deg) scaleY(0); } to { transform: rotate(18deg) scaleY(1); } }

/* scene entrance (after START) */
body.pre .intro > *, body.pre .top, body.pre .vn, body.pre .side-note { opacity: 0; }
body.enter .intro > * { animation: rise 1s var(--ease) both; animation-delay: calc(.5s + var(--d, 0s)); }
body.enter .name span { animation: name-in 1.1s var(--ease) both; animation-delay: calc(.45s + var(--d, 0s)); }
body.enter .top, body.enter .side-note { animation: fade 1.2s var(--ease) 1s both; }
body.enter .vn { animation: vn-in 1s var(--ease) .9s both; }
body.enter #rei { animation: rei-in 1.4s var(--ease) .3s both; }
@keyframes name-in { from { opacity: 0; transform: translateY(40%) skewY(6deg); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 0 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vn-in { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes rei-in { from { opacity: 0; transform: translateY(40px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* ---------- panels ---------- */
.panel {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade .3s var(--ease);
}
.panel-in {
  width: min(620px, 100%); max-height: min(78vh, 720px); overflow: auto;
  background: var(--paper-2); border: 1.5px solid var(--ink); box-shadow: 8px 8px 0 var(--shadow);
  padding: 0 28px 26px; animation: pop .45s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.panel-h {
  position: sticky; top: 0; display: flex; align-items: baseline; gap: 12px;
  padding: 20px 0 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line); background: var(--paper-2);
}
.panel-h > span:nth-child(2) { font-size: 18px; font-weight: 600; }
.close { margin-left: auto; color: var(--dim); }
.close:hover { color: var(--accent); }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 15px; line-height: 1.7; }
.log li .who { font-family: var(--mono); font-size: 11px; padding-top: 4px; color: var(--accent); }
.log li.you .who { color: var(--dim); }
.log li.you { color: var(--ink-2); }
.log .empty { color: var(--dim); display: block; }
.cfg { display: grid; gap: 4px; margin-bottom: 22px; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.seg { display: flex; border: 1.5px solid var(--ink); }
.seg button { padding: 6px 12px; font-size: 13px; transition: background .2s, color .2s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.cfg-label { margin: 0 0 8px; }
.card {
  margin: 0; padding: 16px 18px; white-space: pre; overflow-x: auto;
  text-transform: none; letter-spacing: 0; font-size: 12px; line-height: 1.8;
  background: var(--ink); color: var(--paper); border-left: 3px solid var(--accent);
}

/* ---------- plain-text profile (SKIP) ---------- */
.profile {
  position: fixed; inset: 0; z-index: 45; overflow: auto;
  background: var(--paper); display: grid; place-items: center; padding: 72px 16px;
  animation: wipe .7s var(--ease);
}
@keyframes wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.profile-in { width: min(640px, 100%); }
.profile h2 { font-size: clamp(44px, 7vw, 80px); font-weight: 900; margin: 18px 0 10px; line-height: 1; }
.profile h2 em { font-family: var(--latin); font-weight: 400; color: var(--accent); font-size: .5em; margin-left: .2em; }
.p-lede { font-size: 18px; margin: 0 0 34px; color: var(--ink-2); }
.profile dl { display: grid; grid-template-columns: 90px 1fr; margin: 0; border-top: 1.5px solid var(--ink); }
.profile dt, .profile dd { padding: 16px 0; border-bottom: 1px solid var(--line); margin: 0; }
.profile dt { color: var(--dim); padding-top: 21px; }
.profile dd { font-size: 16px; line-height: 1.8; }
.profile dd a, .profile dd button { border-bottom: 1px solid var(--line); transition: color .2s, border-color .2s; }
.profile dd a:hover, .profile dd button:hover { color: var(--accent); border-color: var(--accent); }
.p-note { margin: 28px 0; color: var(--ink-2); }
.p-back { padding: 10px 14px; border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--shadow); transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.p-back:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow); }

/* ---------- cursor + toast ---------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none;
  width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  border: 1.5px solid var(--accent); opacity: 0;
  transition: width .35s var(--ease), height .35s var(--ease), margin .35s var(--ease), opacity .3s, background .3s;
}
.cursor.on { opacity: .9; }
.cursor.big { width: 54px; height: 54px; margin: -27px 0 0 -27px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cursor.face { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-style: dashed; animation: spin 6s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
@media (hover: none) { .cursor { display: none; } }

.toast {
  position: fixed; left: 50%; top: 22px; z-index: 80; transform: translate(-50%, -70px);
  background: var(--ink); color: var(--paper); padding: 9px 14px; text-transform: none; letter-spacing: .04em;
  visibility: hidden; transition: transform .5s var(--ease), visibility 0s .5s;
}
.toast.on { transform: translate(-50%, 0); visibility: visible; transition: transform .5s var(--ease); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- music: mini player, 音乐鉴赏 panel, beat ---------- */
.sun-disc { scale: calc(1 + var(--beat, 0) * .07); }
.top-left { display: flex; align-items: flex-start; }
.np { display: flex; align-items: center; gap: 12px; animation: fade .6s var(--ease); }
.np-toggle {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border: 1.5px solid var(--ink); background: var(--paper-2); box-shadow: 3px 3px 0 var(--shadow);
  transition: background .2s, color .2s, transform .25s var(--ease), box-shadow .25s var(--ease);
}
.np-toggle:hover { background: var(--ink); color: var(--paper); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--shadow); }
.np-toggle svg, .mu-btns svg { width: 12px; height: 12px; fill: currentColor; }
.i-pause { display: none; }
.is-playing .i-play { display: none; }
.is-playing .i-pause { display: inline; }
.np-info {
  display: grid; grid-template-columns: auto auto 1fr; grid-template-areas: "bars label label" "title title artist";
  column-gap: 8px; row-gap: 2px; align-items: baseline; text-align: left; max-width: 300px;
}
.np-bars { grid-area: bars; display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; align-self: center; }
.np-bars i { width: 2px; height: calc(15% + var(--h, 0) * 85%); background: var(--accent); transition: height .08s linear; }
.np-label { grid-area: label; font-size: 9.5px; }
.np-title { grid-area: title; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { grid-area: artist; font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-info:hover .np-title { color: var(--accent); }

.music-in { width: min(780px, 100%); max-height: min(86vh, 760px); }
.mu-sub { font-size: 10px; }
.mu-body { display: grid; grid-template-columns: 236px 1fr; gap: 26px; padding: 10px 0 20px; }
.mu-cover {
  position: relative; aspect-ratio: 1; overflow: hidden; isolation: isolate;
  background: var(--ink); color: var(--paper); padding: 18px;
  display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: 6px 6px 0 var(--accent);
}
:root[data-theme="night"] .mu-cover { background: #0b0b10; color: #ebe5d9; outline: 1.5px solid var(--line); }
.mu-disc {
  position: absolute; z-index: -1; width: 130%; aspect-ratio: 1; right: -52%; top: -38%; border-radius: 50%;
  background-image: radial-gradient(circle, var(--accent) 1.7px, transparent 2.1px); background-size: 7px 7px;
  -webkit-mask-image: radial-gradient(circle, #000 0 22%, transparent 22.5% 25%, #000 25.5% 62%, transparent 71%);
          mask-image: radial-gradient(circle, #000 0 22%, transparent 22.5% 25%, #000 25.5% 62%, transparent 71%);
  animation: spin 24s linear infinite; animation-play-state: paused;
  scale: calc(1 + var(--beat, 0) * .05);
}
.is-playing .mu-disc { animation-play-state: running; }
.mu-no { position: absolute; left: 18px; top: 16px; margin: 0; color: var(--accent); }
.mu-cover-title { margin: 0; font-family: var(--latin); font-style: italic; font-size: 38px; line-height: 1; word-break: break-word; }
.mu-cover-artist { margin: 8px 0 0; font-size: 10px; opacity: .75; }
.mu-side { display: flex; flex-direction: column; min-width: 0; }
.mu-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); max-height: 196px; overflow: auto; }
.mu-list button {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: baseline; gap: 10px;
  padding: 11px 4px; white-space: nowrap; text-align: left; border-bottom: 1px solid var(--line); position: relative;
  transition: color .2s, padding .35s var(--ease);
}
.mu-list button:hover { padding-left: 10px; color: var(--accent); }
.mu-list .t { font-size: 15px; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-list .t small { font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: .06em; color: var(--dim); margin-left: 8px; text-transform: uppercase; }
.mu-list [aria-current="true"] { color: var(--accent); }
.mu-list [aria-current="true"] .mono:first-child::before { content: "▶ "; }
.mu-note { margin-top: 16px; padding: 12px 16px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.mu-who { font-family: var(--mono); font-size: 10px; color: var(--accent); letter-spacing: .1em; }
.mu-note p { margin: 4px 0 0; font-size: 15px; line-height: 1.8; min-height: 3.6em; }
.mu-note p span { display: block; }
.mu-wave { position: relative; height: 58px; cursor: pointer; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); outline-offset: 4px; }
.mu-wave canvas { width: 100%; height: 100%; display: block; }
.mu-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; }
.mu-time { min-width: 96px; font-size: 11px; }
.mu-btns { display: flex; align-items: center; gap: 8px; }
.mu-btns button { width: 36px; height: 36px; display: grid; place-items: center; border: 1.5px solid var(--ink); transition: background .2s, color .2s, transform .25s var(--ease); }
.mu-btns button:hover { background: var(--ink); color: var(--paper); }
.mu-btns .mu-play { width: 46px; height: 46px; background: var(--ink); color: var(--paper); box-shadow: 4px 4px 0 var(--accent); }
.mu-btns .mu-play:hover { transform: translate(-1px, -1px); background: var(--accent); color: var(--accent-ink); }
.mu-btns .mu-play svg { width: 15px; height: 15px; }
.mu-vol { display: flex; align-items: center; gap: 8px; font-size: 10px; min-width: 96px; justify-content: flex-end; }
.mu-vol input { width: 90px; accent-color: var(--accent); }

/* ---------- responsive ---------- */
@media (min-width: 1240px) {
  .choices { right: -150px; }
}
@media (max-height: 820px) and (min-width: 761px) {
  .intro { padding-top: 72px; }
  .tag, .kicker, .side-coord { display: none; }
  .name { font-size: clamp(48px, 8.4vh, 96px); }
  .rule { margin: 14px 0 12px; }
  .links a, .links button { padding: 7px 0; }
  .box { min-height: 150px; padding-top: 26px; }
  .line { min-height: 54px; }
  .next { top: 80px; }
}
@media (max-width: 1100px) {
  .stage { grid-template-columns: minmax(260px, 1fr) minmax(360px, 520px) 60px; }
  .side-note { padding-right: 18px; }
  .side-coord { display: none; }
  .top-mid { display: none; }
  .top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  body { overflow: hidden; }
  .top { padding: 14px 16px; grid-template-columns: 1fr auto; }
  .status { font-size: 9.5px; gap: 3px; }
  .status .st-row:nth-child(n+3) { display: none; }
  .stage { display: block; }
  .intro { position: fixed; left: 16px; top: 46px; padding: 0; max-width: none; z-index: 4; }
  .intro .kicker, .intro .rule, .intro .tag, .intro .links { display: none; }
  .name { flex-direction: row; font-size: 38px; }
  .latin { font-size: 22px; margin-top: 6px; }
  .role { font-size: 12px; margin-top: 8px; }
  .rei-wrap { position: fixed; left: 0; right: 0; top: 64px; bottom: 0; }
  .side-note { display: none; }
  .sun { width: 120vw; }
  .vn { width: calc(100vw - 32px); bottom: 16px; }
  .box { padding: 26px 18px 0; min-height: 150px; box-shadow: 4px 4px 0 var(--shadow); }
  .line { font-size: 16px; min-height: 56px; }
  .next { right: 16px; top: 78px; }
  .thinking { left: 18px; top: 30px; }
  .ask { margin: 10px -18px 0; padding: 0 8px 0 18px; }
  .sys { justify-content: space-between; width: 100%; box-shadow: 4px 4px 0 var(--shadow); }
  .sys a, .sys button { padding: 5px 6px; font-size: 9.5px; letter-spacing: .08em; }
  .sys [data-tip]::after { display: none; }
  .choices { gap: 7px; bottom: calc(100% + 16px); right: 0; width: 100%; }
  .choice { padding: 9px 14px; font-size: 14px; }
  .t-big { font-size: 30vw; }
  .t-sub { font-size: 14px; padding: 0 16px; }
  .t-foot { padding: 0 16px; }
}

@media (max-width: 760px) {
  .np { gap: 8px; }
  .np-info { grid-template-areas: "bars title"; grid-template-columns: auto 1fr; max-width: 46vw; }
  .np-label, .np-artist { display: none; }
  .np-title { font-size: 12px; }
  .np-toggle { width: 26px; height: 26px; box-shadow: 2px 2px 0 var(--shadow); }
  .intro { top: 58px; }
  .mu-body { grid-template-columns: 1fr; gap: 16px; }
  .mu-cover { aspect-ratio: 2.2 / 1; padding: 14px; }
  .mu-cover-title { font-size: 30px; }
  .mu-vol { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
