/* HIDDEN X player styles. Forked from the Sitevue compliance training (CLEAR VISION); new parts at the end. */
:root {
  --ink: #221c3d;
  --ink-2: #4a4370;
  --paper: #fffaf6;
  --pink: #ff4f8b;
  --pink-soft: #ffe1ec;
  --teal: #1fc7b8;
  --teal-soft: #dcfaf6;
  --violet: #6c4ef2;
  --violet-soft: #ece7ff;
  --gold: #ffd23f;
  --red: #ff3b5c;
  --green: #18b47b;
  --night: #120e26;
  --night-2: #1d1740;
  --font-ui: 'M PLUS Rounded 1c', ui-rounded, 'Hiragino Maru Gothic ProN', 'Segoe UI', system-ui, sans-serif;
  --font-jp: 'Dela Gothic One', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
  --font-sfx: 'Bangers', 'Impact', 'Arial Black', sans-serif;
  --speaker: var(--pink);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  background-image: radial-gradient(rgba(255, 255, 255, .045) 1px, transparent 1.4px), radial-gradient(circle at 50% 0%, #2a1f5c 0%, var(--night) 60%);
  background-size: 14px 14px, 100% 100%;
  color: #fff;
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: inherit; }
.ico { width: 1.2em; height: 1.2em; flex: none; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.hud {
  height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px; position: relative; z-index: 20;
}
.hud-logo { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-sfx); font-size: 24px; letter-spacing: 1.5px; white-space: nowrap; }
.hud-logo b { color: var(--pink); font-weight: 400; }
.hud-logo small { font-family: var(--font-jp); font-size: 11px; color: #b9b0e8; letter-spacing: 0; }
.hud-progress { flex: 1; display: flex; gap: 4px; max-width: 520px; margin: 0 auto; }
.hud-progress .seg { flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.hud-progress .seg i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--pink)); border-radius: 99px; transition: width .4s ease; }
.hud-progress .seg.quiz i { background: linear-gradient(90deg, var(--gold), #ff9a3c); }
.hud-btns { display: flex; gap: 6px; }
.hbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 99px;
  background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .16); cursor: pointer; font-size: 13px; font-weight: 700; text-decoration: none;
}
.hbtn:hover { background: rgba(255, 255, 255, .18); }
.hbtn:focus-visible, .btn:focus-visible, .opt:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; cursor: pointer; text-decoration: none;
  font-weight: 800; font-size: 18px; padding: 14px 30px; border-radius: 99px; color: #fff; background: var(--pink);
  box-shadow: 0 5px 0 #c21f5a, 0 10px 24px rgba(255, 79, 139, .35); transition: transform .12s, box-shadow .12s, filter .2s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #c21f5a; }
.btn.secondary { background: #fff; color: var(--ink); box-shadow: 0 5px 0 #c9c2ea, 0 10px 24px rgba(0, 0, 0, .2); }
.btn.violet { background: var(--violet); box-shadow: 0 5px 0 #4a2fc0, 0 10px 24px rgba(108, 78, 242, .35); }
.btn.teal { background: var(--teal); box-shadow: 0 5px 0 #0f8f84, 0 10px 24px rgba(31, 199, 184, .35); }
.btn.small { font-size: 15px; padding: 10px 20px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- loading / errors ---------- */
.screen-center { min-height: calc(100vh - 56px); display: grid; place-items: center; padding: 24px; text-align: center; }
.loader { width: 64px; height: 64px; border-radius: 50%; border: 6px solid rgba(255, 255, 255, .15); border-top-color: var(--pink); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- title screen ---------- */
.title-screen { position: relative; min-height: calc(100vh - 56px); overflow: hidden; display: grid; place-items: center; padding: 24px 16px 40px; }
.title-bg { position: absolute; inset: 0; }
.title-bg svg { width: 100%; height: 100%; display: block; }
.title-cast { position: absolute; inset: auto 0 0 0; height: 74%; pointer-events: none; }
.title-cast .tc { position: absolute; bottom: -10%; height: 100%; aspect-ratio: 2/3; }
.title-cast .tc svg { width: 100%; height: 100%; }
.title-cast .tc.l { left: max(-4%, calc(50% - 640px)); animation: rise .9s .2s cubic-bezier(.2, .9, .3, 1) both; }
.title-cast .tc.r { right: max(-4%, calc(50% - 640px)); animation: rise .9s .35s cubic-bezier(.2, .9, .3, 1) both; }
.title-card {
  position: relative; z-index: 2; text-align: center; color: var(--ink); max-width: 640px; width: 100%;
  background: rgba(255, 255, 255, .86); backdrop-filter: blur(6px); border-radius: 28px; padding: 26px 28px 28px;
  border: 4px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); animation: pop .6s .1s cubic-bezier(.2, 1.4, .4, 1) both;
}
.title-vu { width: 108px; height: 104px; margin: -86px auto 0; animation: float 3s ease-in-out infinite; }
.title-vu svg { width: 100%; height: 100%; }
.logo-jp { font-family: var(--font-jp); color: var(--pink); font-size: 20px; letter-spacing: 6px; margin-top: 4px; }
.logo { font-family: var(--font-sfx); font-size: clamp(54px, 11vw, 92px); line-height: .9; letter-spacing: 3px; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 5px 5px 0 var(--pink), 9px 9px 0 var(--ink); margin: 2px 0 8px; }
.logo span { color: var(--teal); }
.title-sub { font-weight: 800; font-size: 16px; margin: 6px 0 4px; }
.title-meta { color: var(--ink-2); font-size: 14px; margin: 0 0 18px; }
.title-hello { font-size: 17px; margin: 0 0 6px; }
.title-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.title-links { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.tlink { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 700; font-size: 14px; background: none; border: 0; cursor: pointer; padding: 6px 10px; border-radius: 99px; text-decoration: none; }
.tlink:hover { background: var(--violet-soft); color: var(--ink); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; padding: 4px 12px; border-radius: 99px; background: var(--teal-soft); color: #0e7a70; margin-bottom: 8px; }
.status-pill.overdue { background: #ffe1e6; color: #c0183a; }

/* ---------- stage ---------- */
.stage-wrap { display: flex; justify-content: center; padding: 4px 16px 16px; }
.stage {
  position: relative; width: min(100%, calc((100vh - 92px) * 16 / 9)); aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden;
  container-type: size; background: #000; box-shadow: 0 0 0 3px rgba(255, 255, 255, .12), 0 20px 60px rgba(0, 0, 0, .5); user-select: none; cursor: pointer;
}
.layer { position: absolute; inset: 0; }
.bg-slot { position: absolute; inset: 0; transition: opacity .6s ease; }
.bg-slot svg { width: 100%; height: 100%; display: block; }
.fx-back, .fx-front { pointer-events: none; }
.chars { pointer-events: none; }

/* sprites */
.slot { position: absolute; bottom: -9%; height: 86%; aspect-ratio: 2 / 3; transform: translateX(-50%); transition: left .55s cubic-bezier(.2, .8, .2, 1), top .55s, height .55s, filter .35s, opacity .35s; z-index: 1; }
.slot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.slot[data-pos=left] { left: 24%; }
.slot[data-pos=center] { left: 50%; }
.slot[data-pos=right] { left: 76%; }
.slot[data-pos=float] { height: 40%; aspect-ratio: 300 / 290; top: 5%; bottom: auto; left: 50%; z-index: 3; }
.slot[data-pos=float].solo { height: 56%; top: 6%; }
.slot[data-pos=float] .float-inner { width: 100%; height: 100%; animation: float 3s ease-in-out infinite; }
.slot.listening { filter: brightness(.86) saturate(.9); }
.slot.speaking { z-index: 2; }
.slot.enter { animation: slotIn .5s cubic-bezier(.2, .9, .3, 1) both; }
.slot.exit { opacity: 0; }
.slot.hop .sprite-svg { animation: hop .45s ease; }
.slot.shudder .sprite-svg { animation: shudder .4s linear; }
.sprite-svg .breathe { transform-box: fill-box; transform-origin: 50% 100%; animation: breathe 4.5s ease-in-out infinite; }
.sprite-svg .hair-sway { transform-box: fill-box; transform-origin: 10% 10%; animation: sway 5s ease-in-out infinite; }
.sprite-svg .fx-sweat { animation: sweat 1.6s ease-in infinite; }
.sprite-svg .fx-vein { animation: vein .6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.sprite-svg .fx-pulse { animation: pulse 0.8s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.sprite-svg .vu-led { animation: blinkLed 1.4s steps(2) infinite; }
.sprite-boss .boss-body { transform-box: fill-box; transform-origin: center; animation: blob 3s ease-in-out infinite; }
.sprite-boss .orbit { transform-box: fill-box; transform-origin: center; animation: bob 2.4s ease-in-out infinite; }

/* video-call frame */
.slot.call { height: 66%; top: 7%; bottom: auto; aspect-ratio: 3 / 3.6; border-radius: 4cqw 4cqw 3cqw 3cqw; overflow: hidden; background: linear-gradient(#d9ecff, #efe6ff); border: .55cqw solid #fff; box-shadow: 0 0 0 .3cqw var(--ink), 0 1.4cqw 3cqw rgba(0, 0, 0, .35); }
.slot.call .sprite-svg { position: absolute; width: 132%; height: auto; left: -16%; top: 2%; }
.call-bar { position: absolute; left: 0; right: 0; top: 0; height: 13%; background: var(--ink); color: #fff; z-index: 2; display: flex; align-items: center; gap: .6cqw; padding: 0 1.2cqw; font-weight: 800; font-size: clamp(9px, 1.15cqw, 14px); }
.call-bar i { width: .8cqw; height: .8cqw; min-width: 7px; min-height: 7px; border-radius: 50%; background: var(--red); animation: blinkLed 1.2s steps(2) infinite; }
.slot.call[data-pos=right] { left: 77%; }
.slot.call[data-pos=left] { left: 23%; }

/* card shown: make room */
.stage.has-card .slot[data-pos=left] { left: 9%; }
.stage.has-card .slot[data-pos=right] { left: 91%; }
.stage.has-card .slot.call[data-pos=right] { left: 91.5%; height: 36%; top: 34%; }
.stage.has-card .slot.call[data-pos=left] { left: 8.5%; height: 36%; top: 34%; }
.stage.has-card .slot[data-pos=center] { opacity: .15; }
.stage.has-card .slot[data-pos=float] { left: 90%; top: 2%; height: 25%; }
.stage.has-card .slot { filter: brightness(.8); }
.stage.has-card .slot.speaking { filter: none; }

/* caption box */
.caption {
  position: absolute; top: 3%; left: 2.4%; z-index: 6; max-width: 60%; background: #fff; color: var(--ink); border: .3cqw solid var(--ink); border-width: max(2px, .3cqw);
  padding: .5em 1em; font-weight: 800; font-size: clamp(11px, 1.45cqw, 17px); transform: rotate(-1.2deg); box-shadow: .5cqw .5cqw 0 var(--ink); animation: captionIn .45s cubic-bezier(.2, 1.3, .4, 1) both;
}

/* dialogue */
.dialogue {
  position: absolute; left: 2.4%; right: 2.4%; bottom: 3%; z-index: 8; min-height: 22%;
  background: linear-gradient(180deg, rgba(255, 252, 249, .97), rgba(255, 246, 241, .97)); color: var(--ink);
  border-radius: 2cqw; border: max(3px, .35cqw) solid #fff; box-shadow: 0 0 0 max(3px, .3cqw) var(--speaker), 0 1.2cqw 3cqw rgba(0, 0, 0, .4);
  padding: 2.4cqw 3cqw 2.2cqw; font-size: clamp(14px, 2.05cqw, 24px); line-height: 1.5; font-weight: 700; transition: box-shadow .3s;
}
.dialogue.narrator { --speaker: #9a92c9; font-style: italic; }
.nametag {
  position: absolute; top: 0; left: 2.4cqw; transform: translateY(-62%) skewX(-8deg); background: var(--speaker); color: #fff; font-weight: 800;
  padding: .28em 1.1em; border-radius: 99px; border: max(2px, .3cqw) solid #fff; font-size: .82em; box-shadow: 0 .3cqw 0 rgba(0, 0, 0, .15); white-space: nowrap; transition: background .3s;
}
.nametag small { font-weight: 700; opacity: .85; margin-left: .55em; font-size: .78em; }
.dialogue-text { min-height: 3em; }
.dialogue-text .cursor { display: inline-block; width: .5em; }
.dlg-controls { position: absolute; right: 1.6cqw; bottom: 1.2cqw; display: flex; align-items: center; gap: .6cqw; }
.dlg-btn { display: inline-grid; place-items: center; width: max(30px, 3.6cqw); height: max(30px, 3.6cqw); border-radius: 50%; border: 0; cursor: pointer; background: var(--violet-soft); color: var(--ink); font-size: max(13px, 1.5cqw); }
.dlg-btn:hover { background: #ddd3ff; }
.dlg-btn.next { background: var(--speaker); color: #fff; animation: bob 1.1s ease-in-out infinite; }
.dlg-btn.next.waiting { animation: none; opacity: .55; }
.dlg-btn[disabled] { opacity: .35; cursor: default; }
.tap-hint { position: absolute; left: 3cqw; bottom: .9cqw; font-size: max(10px, 1.05cqw); color: #9a92c9; font-weight: 700; font-style: normal; }

/* ---------- cards ---------- */
.card {
  position: absolute; left: 50%; top: 4.5%; transform: translateX(-50%); z-index: 7; width: min(68%, 820px); max-height: 64%; overflow: auto;
  background: #fff; color: var(--ink); border-radius: 2cqw; border: max(3px, .35cqw) solid var(--ink); box-shadow: .8cqw .8cqw 0 var(--ink);
  padding: 1.8cqw 2.2cqw 2cqw; font-size: clamp(11.5px, 1.42cqw, 17px); cursor: default; animation: cardIn .5s cubic-bezier(.2, 1.25, .4, 1) both;
  scrollbar-width: thin;
}
.card-head { display: flex; align-items: center; gap: .8em; margin-bottom: 1em; flex-wrap: wrap; }
.card-title { font-weight: 800; font-size: 1.42em; line-height: 1.15; letter-spacing: .2px; }
.card-jp { font-family: var(--font-jp); color: var(--pink); font-size: 1em; letter-spacing: 1px; }
.card-ref { margin-left: auto; background: var(--ink); color: #fff; border-radius: 99px; padding: .2em .8em; font-weight: 800; font-size: .78em; white-space: nowrap; }
.card-items { display: grid; gap: .75em; }
.card-items.cols2 { grid-template-columns: 1fr 1fr; }
.item { display: flex; gap: .85em; align-items: flex-start; opacity: 0; animation: itemIn .45s cubic-bezier(.2, 1, .4, 1) forwards; animation-delay: calc(.25s + var(--i) * .14s); }
.ico-wrap { flex: none; width: 2.5em; height: 2.5em; border-radius: .8em; background: var(--pink-soft); color: var(--pink); display: grid; place-items: center; }
.ico-wrap .ico { width: 1.4em; height: 1.4em; }
.item:nth-child(4n+2) .ico-wrap { background: var(--teal-soft); color: #0e9488; }
.item:nth-child(4n+3) .ico-wrap { background: var(--violet-soft); color: var(--violet); }
.item:nth-child(4n+4) .ico-wrap { background: #fff3cc; color: #b07d00; }
.item h4 { margin: .1em 0 0; font-size: 1.04em; font-weight: 800; }
.item p { margin: .2em 0 0; line-height: 1.42; font-weight: 500; color: #3b3460; }
.card-foot { margin-top: 1em; padding-top: .8em; border-top: 2px dashed #e1dcf5; font-weight: 700; color: var(--ink-2); font-size: .95em; opacity: 0; animation: itemIn .45s forwards; animation-delay: calc(.4s + var(--n, 4) * .14s); }

.icon-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8em; }
.icon-tile { display: flex; flex-direction: column; align-items: center; gap: .45em; text-align: center; font-weight: 800; font-size: .95em; opacity: 0; animation: tileIn .45s cubic-bezier(.2, 1.6, .4, 1) forwards; animation-delay: calc(.2s + var(--i) * .12s); }
.icon-tile .ico-wrap { width: 3.6em; height: 3.6em; border-radius: 1.2em; }
.icon-tile .ico-wrap .ico { width: 1.9em; height: 1.9em; }

.steps { display: grid; gap: .8em; }
.step { display: flex; gap: .9em; align-items: flex-start; opacity: 0; animation: itemIn .45s forwards; animation-delay: calc(.25s + var(--i) * .2s); }
.step-n { flex: none; width: 2.2em; height: 2.2em; border-radius: 50%; display: grid; place-items: center; background: var(--pink); color: #fff; font-family: var(--font-sfx); font-size: 1.25em; letter-spacing: 1px; box-shadow: .2em .2em 0 var(--ink); }
.step:nth-child(2) .step-n { background: var(--teal); }
.step:nth-child(3) .step-n { background: var(--violet); }
.step h4 { margin: .15em 0 0; font-weight: 800; font-size: 1.05em; }
.step p { margin: .2em 0 0; line-height: 1.42; font-weight: 500; color: #3b3460; }

.checklist { display: grid; gap: .55em; }
.check { display: flex; align-items: center; gap: .8em; font-weight: 800; font-size: 1.06em; opacity: 0; animation: itemIn .4s forwards; animation-delay: calc(.2s + var(--i) * .2s); }
.check .box { flex: none; width: 1.7em; height: 1.7em; border-radius: .45em; border: 3px solid var(--ink); display: grid; place-items: center; background: #fff; }
.check .box svg { width: 1.2em; height: 1.2em; stroke: var(--green); stroke-width: 4; fill: none; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .35s ease forwards; animation-delay: calc(.45s + var(--i) * .2s); }
.check .num { font-family: var(--font-sfx); color: var(--pink); font-size: 1.2em; width: 1em; }

.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .98em; }
.tbl th { text-align: left; background: var(--ink); color: #fff; font-weight: 800; padding: .55em .7em; font-size: .9em; }
.tbl th:first-child { border-radius: .6em 0 0 0; }
.tbl th:last-child { border-radius: 0 .6em 0 0; }
.tbl td { padding: .6em .7em; border-bottom: 2px solid #eee9fb; font-weight: 700; vertical-align: top; }
.tbl tr { opacity: 0; animation: itemIn .4s forwards; animation-delay: calc(.2s + var(--i) * .18s); }
.tbl tr.hl td { background: #fff1c2; }
.tbl tr.hl td:first-child { box-shadow: inset .35em 0 0 var(--gold); }
.tbl td.amt { font-family: var(--font-sfx); font-size: 1.25em; letter-spacing: .5px; color: var(--violet); font-weight: 400; }

.flags { display: grid; gap: .5em; }
.flag { display: flex; align-items: center; gap: .7em; font-weight: 700; padding: .45em .7em; border-radius: .7em; background: #fff0f2; border: 2px solid #ffd0d8; opacity: 0; animation: flagIn .45s cubic-bezier(.2, 1.4, .4, 1) forwards; animation-delay: calc(.2s + var(--i) * .16s); }
.flag .ico { color: var(--red); width: 1.5em; height: 1.5em; animation: wave 1s ease-in-out infinite; transform-origin: 20% 90%; }

.chat { background: #f1f4ff; border-radius: 1.2em; padding: 1em; display: grid; gap: .7em; border: 2px solid #dfe4ff; }
.chat-head { display: flex; align-items: center; gap: .6em; font-weight: 800; }
.chat-av { width: 2.2em; height: 2.2em; border-radius: 50%; background: linear-gradient(135deg, #ffb36b, #ff4f8b); display: grid; place-items: center; color: #fff; font-weight: 800; }
.bubble { justify-self: start; background: #fff; border-radius: 1.1em 1.1em 1.1em .3em; padding: .65em 1em; max-width: 92%; font-weight: 600; box-shadow: 0 2px 0 #dfe4ff; opacity: 0; animation: bubbleIn .4s cubic-bezier(.2, 1.4, .4, 1) forwards; animation-delay: calc(.5s + var(--i) * 1.1s); }
.typing { justify-self: start; display: flex; gap: .3em; padding: .7em 1em; background: #fff; border-radius: 1em; animation: typingGone .01s forwards; animation-delay: calc(.45s + var(--n) * 1.1s); }
.typing i { width: .5em; height: .5em; border-radius: 50%; background: #9aa3d6; animation: dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

.ledger { border: 2px solid #dcd6f3; border-radius: 1em; overflow: hidden; }
.ledger-head { background: var(--violet); color: #fff; font-weight: 800; padding: .55em 1em; display: flex; justify-content: space-between; }
.ledger-row { display: grid; grid-template-columns: 8.5em 1fr; border-top: 2px solid #eee9fb; }
.ledger-row b { background: #f7f5ff; padding: .6em .9em; font-size: .9em; color: var(--ink-2); }
.ledger-row span { padding: .6em .9em; font-weight: 700; overflow: hidden; white-space: nowrap; border-right: 2px solid var(--violet); width: 0; animation: typeIn 1.2s steps(40) forwards, caret .6s step-end 3; animation-delay: calc(.3s + var(--i) * .9s); }
.ledger-row span.done { white-space: normal; }
.ledger-ok { margin-top: .8em; display: flex; align-items: center; gap: .6em; font-weight: 800; color: var(--green); opacity: 0; animation: itemIn .4s forwards; animation-delay: 4.2s; }

.contacts { display: grid; grid-template-columns: 1fr 1fr; gap: .8em; }
.contact { display: flex; gap: .8em; align-items: center; padding: .8em; border-radius: 1em; background: #f7f5ff; opacity: 0; animation: tileIn .45s cubic-bezier(.2, 1.4, .4, 1) forwards; animation-delay: calc(.2s + var(--i) * .15s); }
.contact h4 { margin: 0; font-weight: 800; font-size: 1em; }
.contact p { margin: .15em 0 0; font-weight: 700; color: var(--violet); word-break: break-word; font-size: .95em; }
.contact p.muted { color: #7b75a0; font-weight: 600; }

.card.dark { background: #1b1433; color: #fff; border-color: #fff; box-shadow: .8cqw .8cqw 0 var(--red); }
.card.dark .card-ref { background: var(--red); }
.stakes { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2em; }
.stakes h4 { margin: 0 0 .5em; font-family: var(--font-sfx); font-weight: 400; font-size: 1.5em; letter-spacing: 1px; color: var(--gold); }
.stakes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .45em; }
.stakes li { position: relative; padding-left: 1.3em; font-weight: 700; line-height: 1.35; opacity: 0; animation: itemIn .4s forwards; animation-delay: calc(.2s + var(--i) * .13s); }
.stakes li::before { content: ''; position: absolute; left: 0; top: .45em; width: .6em; height: .6em; background: var(--red); transform: rotate(45deg); }
.card.dark .card-foot { color: #ffd0d8; border-color: rgba(255, 255, 255, .2); }

.recap { margin: 0; padding: 0; list-style: none; counter-reset: r; display: grid; gap: .5em; }
.recap li { counter-increment: r; display: flex; gap: .7em; font-weight: 700; line-height: 1.38; opacity: 0; animation: itemIn .4s forwards; animation-delay: calc(.15s + var(--i) * .1s); }
.recap li::before { content: counter(r); flex: none; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; font-family: var(--font-sfx); font-size: .95em; }
.recap li:nth-child(even)::before { background: var(--teal); }

.card.kanji { background: none; border: 0; box-shadow: none; overflow: visible; top: 8%; width: 90%; text-align: center; }
.kanji-big { font-family: var(--font-jp); font-size: clamp(48px, 13cqw, 190px); line-height: 1; color: #fff; -webkit-text-stroke: max(4px, .5cqw) var(--ink); paint-order: stroke fill; text-shadow: .9cqw .9cqw 0 var(--pink); letter-spacing: .05em; }
.kanji-big span { display: inline-block; animation: slam .55s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: calc(.15s + var(--i) * .22s); }
.kanji-romaji { font-family: var(--font-sfx); font-size: clamp(18px, 3.4cqw, 44px); letter-spacing: .25em; color: var(--ink); margin-top: .3em; animation: itemIn .5s 1.2s both; }
.kanji-meaning { display: inline-block; margin-top: .4em; background: var(--ink); color: #fff; padding: .35em 1.1em; border-radius: 99px; font-weight: 800; font-size: clamp(13px, 2cqw, 24px); animation: itemIn .5s 1.5s both; }

/* ---------- effects ---------- */
.speedlines { position: absolute; inset: 0; width: 100%; height: 100%; }
.speedlines g { animation: flick .24s steps(1) infinite; opacity: 0; }
.speedlines g:nth-child(2) { animation-delay: .08s; }
.speedlines g:nth-child(3) { animation-delay: .16s; }
.flash { position: absolute; inset: 0; background: #fff; z-index: 30; pointer-events: none; animation: flash .5s ease-out forwards; }
.stage.shake { animation: shake .45s linear; }
.aura { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, transparent 35%, rgba(52, 18, 92, .62) 100%); animation: auraPulse 1.8s ease-in-out infinite; }
.redalert { position: absolute; inset: 0; box-shadow: inset 0 0 10cqw rgba(255, 40, 70, .8); animation: redPulse .7s ease-in-out infinite alternate; }
.redalert::before, .redalert::after { content: ''; position: absolute; left: 0; right: 0; height: 3.2%; background: repeating-linear-gradient(-45deg, var(--gold) 0 1.6cqw, var(--ink) 1.6cqw 3.2cqw); animation: tape 1s linear infinite; background-size: 4.5cqw 100%; }
.redalert::before { top: 0; } .redalert::after { bottom: 0; }
.sfx {
  position: absolute; z-index: 9; font-family: var(--font-jp); font-size: clamp(26px, 6.6cqw, 92px); line-height: 1; color: #fff; white-space: nowrap;
  -webkit-text-stroke: max(3px, .45cqw) var(--ink); paint-order: stroke fill; text-shadow: .5cqw .5cqw 0 var(--pink); transform: translate(-50%, 0) rotate(-9deg);
  animation: sfxPop .5s cubic-bezier(.2, 1.7, .4, 1) both; pointer-events: none;
}
.sfx.small { font-size: clamp(20px, 4.2cqw, 58px); z-index: 10; }
.sfx.dark { color: #b98bff; -webkit-text-stroke-color: #120a24; text-shadow: .5cqw .5cqw 0 #120a24; }
.sfx .w { display: inline-block; animation: wobble 1.4s .5s ease-in-out infinite; }
.sfx small { display: block; width: max-content; margin: .25em auto 0; font-family: var(--font-sfx); font-size: .3em; letter-spacing: 1.5px; color: var(--ink); background: #fff; -webkit-text-stroke: 0; text-shadow: none; padding: .1em .55em; border-radius: 99px; transform: rotate(6deg); }
.sparkle { position: absolute; width: 4cqw; height: 4cqw; z-index: 9; pointer-events: none; animation: twinkle 1.2s ease-in-out both; }
.sparkle svg { width: 100%; height: 100%; }
.glint { position: absolute; width: 9cqw; height: 9cqw; z-index: 9; pointer-events: none; animation: glint .9s ease-out both; }
.petal { position: absolute; top: -6%; width: 1.6cqw; height: 1.2cqw; border-radius: 80% 0 80% 0; background: linear-gradient(135deg, #ffd6e6, #ff8fb8); opacity: .9; animation: fall linear infinite; z-index: 5; }
.rain { position: absolute; inset: -20% 0 0 0; z-index: 5; pointer-events: none; background-image: linear-gradient(100deg, transparent 0 46%, rgba(200, 215, 255, .5) 49%, transparent 52%); background-size: 2.4cqw 9cqw; animation: rain .45s linear infinite; opacity: .55; }
.rain.r2 { background-size: 3.6cqw 14cqw; animation-duration: .7s; opacity: .35; }
.cutin { position: absolute; left: 0; right: 0; top: 28%; height: 26%; z-index: 12; overflow: hidden; background: #0e0a1e; border-top: max(3px, .4cqw) solid #fff; border-bottom: max(3px, .4cqw) solid #fff; animation: cutIn 1.8s cubic-bezier(.2, .8, .2, 1) both; pointer-events: none; }
.cutin svg.crop { position: absolute; inset: 0; width: 100%; height: 100%; }
.cutin .speedlines { opacity: .5; }

/* episode eyecatch */
.eyecatch { position: absolute; inset: 0; z-index: 20; overflow: hidden; cursor: pointer; }
.eyecatch .pa, .eyecatch .pb { position: absolute; inset: 0; }
.eyecatch .pa { clip-path: polygon(0 0, 100% 0, 100% 40%, 0 64%); animation: fromLeft .55s cubic-bezier(.2, .9, .2, 1) both; }
.eyecatch .pb { clip-path: polygon(0 64%, 100% 40%, 100% 100%, 0 100%); animation: fromRight .55s .08s cubic-bezier(.2, .9, .2, 1) both; }
.eyecatch .dots { position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .22) 18%, transparent 20%); background-size: 1.6cqw 1.6cqw; mix-blend-mode: overlay; }
.eyecatch .ec-text { position: absolute; inset: 0 34% 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .4cqw; }
.ec-num { font-family: var(--font-jp); font-size: 10cqw; line-height: 1; color: #fff; -webkit-text-stroke: .5cqw var(--ink); paint-order: stroke fill; text-shadow: .8cqw .8cqw 0 var(--ink); animation: slam .6s .35s cubic-bezier(.2, 1.6, .4, 1) both; }
.ec-label { font-family: var(--font-sfx); font-size: 3cqw; letter-spacing: .4em; color: #fff; background: var(--ink); padding: .1em .9em .05em 1.3em; animation: itemIn .4s .55s both; }
.ec-title { font-weight: 800; font-size: 5.4cqw; color: #fff; -webkit-text-stroke: .35cqw var(--ink); paint-order: stroke fill; line-height: 1.1; animation: itemIn .45s .7s both; }
.ec-jp { font-family: var(--font-jp); font-size: 2.4cqw; color: var(--ink); background: #fff; padding: .15em .8em; border-radius: 99px; animation: itemIn .45s .85s both; }
.ec-cast { position: absolute; bottom: -18%; height: 92%; aspect-ratio: 2/3; animation: fromRight .7s .2s cubic-bezier(.2, .9, .2, 1) both; filter: drop-shadow(1cqw 0 0 rgba(0, 0, 0, .25)); }
.ec-cast svg { width: 100%; height: 100%; }
.ec-skip { position: absolute; right: 2cqw; bottom: 2cqw; color: #fff; font-weight: 800; font-size: max(11px, 1.2cqw); opacity: .8; }

.tbc { position: absolute; left: 2.5%; bottom: 33%; z-index: 21; display: flex; align-items: center; gap: 1.2cqw; animation: fromLeft .6s cubic-bezier(.2, .9, .2, 1) both; pointer-events: none; }
.tbc-box { background: var(--gold); color: var(--ink); font-family: var(--font-sfx); font-size: 3.6cqw; letter-spacing: .12em; padding: .25em .8em .15em; border: .35cqw solid var(--ink); box-shadow: .6cqw .6cqw 0 var(--ink); transform: skewX(-10deg); }
.tbc-arrow { width: 0; height: 0; border-top: 2.6cqw solid transparent; border-bottom: 2.6cqw solid transparent; border-left: 4cqw solid var(--gold); filter: drop-shadow(.5cqw .5cqw 0 var(--ink)); margin-left: -1.6cqw; }
.tbc-jp { font-family: var(--font-jp); font-size: 2.6cqw; color: #fff; -webkit-text-stroke: .3cqw var(--ink); paint-order: stroke fill; }
.stage.frozen .layer:not(.overlay) { filter: sepia(.55) saturate(.7) brightness(.85); transition: filter .5s; }
.overlay { z-index: 19; pointer-events: none; }
/* Only the eyecatch takes clicks. Flash, cut-in and "to be continued" stay click-through so they can never sit
   on top of the dialogue buttons (a leftover flash used to swallow every Back click and advance instead). */
.overlay > .eyecatch { pointer-events: auto; }

/* ---------- episode menu ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 6, 24, .7); backdrop-filter: blur(4px); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fadeIn .2s; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: #fff; color: var(--ink); border-radius: 22px; border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: 20px; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.modal h2 { margin: 0 0 12px; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.modal h2 small { font-family: var(--font-jp); color: var(--pink); font-size: 14px; font-weight: 400; }
.ep-list { display: grid; gap: 8px; }
.ep-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: #f7f5ff; border: 2px solid transparent; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.ep-row:hover:not([disabled]) { border-color: var(--violet); }
.ep-row[disabled] { opacity: .5; cursor: not-allowed; }
.ep-row .n { font-family: var(--font-sfx); font-size: 22px; width: 64px; color: var(--pink); letter-spacing: 1px; }
.ep-row .t { flex: 1; font-weight: 800; }
.ep-row .t small { display: block; font-family: var(--font-jp); font-weight: 400; color: #8a83b5; font-size: 12px; }
.ep-row .s { font-size: 12px; font-weight: 800; color: #0e9488; }
.modal .close { float: right; background: none; border: 0; cursor: pointer; color: var(--ink); font-size: 22px; }

/* ---------- final trial ---------- */
.trial { max-width: 980px; margin: 0 auto; padding: 4px 16px 32px; }
.arena { position: relative; height: clamp(200px, 30vh, 300px); border-radius: 20px; overflow: hidden; background: radial-gradient(ellipse at 70% 50%, #4b2a8a 0%, #1d1240 55%, #0e0820 100%); box-shadow: 0 0 0 3px rgba(255, 255, 255, .12); container-type: inline-size; }
.arena .speedlines { opacity: .22; }
.arena-boss { position: absolute; right: 6%; top: 50%; height: 108%; aspect-ratio: 1; transform: translateY(-46%); transition: filter .3s; }
.arena-boss svg { width: 100%; height: 100%; }
.arena-boss.hit { animation: bossHit .5s ease; }
.arena-boss.laugh { animation: bossLaugh .6s ease; }
.arena-boss.defeated { animation: bossDie 1.4s ease forwards; }
.arena-hero { position: absolute; left: 3%; bottom: -36%; height: 150%; aspect-ratio: 2/3; }
.arena-hero svg { width: 100%; height: 100%; }
.arena-vu { position: absolute; left: 29%; bottom: 7%; height: 36%; aspect-ratio: 300/290; animation: float 3s ease-in-out infinite; }
.arena-vu svg { width: 100%; height: 100%; }
.hp { position: absolute; left: 50%; transform: translateX(-50%); top: 14px; width: min(60%, 460px); z-index: 3; }
.hp-label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; font-size: 13px; margin-bottom: 4px; text-shadow: 0 2px 0 #000; }
.hp-label b { font-family: var(--font-jp); font-weight: 400; color: #ffb1c9; margin-right: 6px; }
.hp-bar { display: flex; gap: 3px; padding: 4px; background: rgba(0, 0, 0, .45); border-radius: 99px; border: 2px solid rgba(255, 255, 255, .35); }
.hp-bar i { flex: 1; height: 12px; border-radius: 99px; background: linear-gradient(180deg, #ff7aa8, #e2245f); transition: opacity .3s, transform .3s; }
.hp-bar i.gone { opacity: .12; transform: scaleY(.6); }
.hp-bar i.break { animation: pipBreak .5s ease forwards; }
.trial-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 2px 10px; flex-wrap: wrap; }
.trial-title h2 { margin: 0; font-family: var(--font-sfx); font-weight: 400; font-size: 34px; letter-spacing: 2px; }
.trial-title h2 small { font-family: var(--font-jp); font-size: 15px; color: var(--pink); margin-left: 8px; letter-spacing: 1px; }
.trial-count { font-weight: 800; color: #c9c2f0; font-size: 14px; }
.qcard { background: #fff; color: var(--ink); border-radius: 22px; border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--pink); padding: 20px 22px 22px; animation: cardIn .45s cubic-bezier(.2, 1.25, .4, 1) both; }
.qmeta { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.qtag { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--violet-soft); color: var(--violet); }
.qtag.retry { background: #fff1c2; color: #946800; }
.qprompt { font-size: clamp(17px, 2.3vw, 22px); font-weight: 800; line-height: 1.38; margin: 4px 0 16px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 13px 14px; border-radius: 16px; border: 3px solid #e6e1f7; background: #fbfaff; color: var(--ink); font: inherit; font-weight: 700; font-size: 16px; line-height: 1.38; cursor: pointer; transition: border-color .15s, transform .12s, background .15s; }
.opt:hover:not([disabled]) { border-color: var(--violet); transform: translateX(3px); background: #fff; }
.opt .k { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--ink); color: #fff; font-family: var(--font-sfx); font-size: 20px; letter-spacing: 1px; }
.opt[disabled] { cursor: default; }
.opt.picked-right { border-color: var(--green); background: #e9fbf3; }
.opt.picked-right .k { background: var(--green); }
.opt.picked-wrong { border-color: var(--red); background: #fff0f2; animation: shudder .4s linear; }
.opt.picked-wrong .k { background: var(--red); }
.opt.dim { opacity: .45; }
.feedback { margin-top: 14px; border-radius: 16px; padding: 14px 16px; display: flex; gap: 14px; align-items: flex-start; animation: itemIn .35s both; }
.feedback.good { background: #e9fbf3; border: 2px solid #9fe6c8; }
.feedback.bad { background: #fff7e0; border: 2px solid #ffd76b; }
.feedback .fb-icon { flex: none; width: 52px; height: 52px; }
.feedback .fb-icon svg { width: 100%; height: 100%; }
.feedback h4 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.feedback h4 .jp { font-family: var(--font-jp); font-weight: 400; margin-right: 8px; }
.feedback.good h4 { color: #0d8a5c; }
.feedback.bad h4 { color: #a46a00; }
.feedback p { margin: 0; line-height: 1.45; font-weight: 600; }
.feedback .ref { margin-top: 6px; font-size: 13px; color: #6b6889; font-weight: 700; }
.fb-actions { margin-top: 14px; display: flex; justify-content: flex-end; }
.slash { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.slash::before { content: ''; position: absolute; left: -10%; right: -10%; top: 50%; height: 6px; background: #fff; box-shadow: 0 0 18px #fff, 0 0 40px var(--pink); transform: rotate(-18deg) scaleX(0); animation: slash .35s ease-out forwards; }

.victory { text-align: center; padding: 20px 0; }
.victory-big { font-family: var(--font-sfx); font-size: clamp(56px, 12vw, 120px); letter-spacing: 4px; line-height: 1; color: var(--gold); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 6px 6px 0 var(--pink); animation: slam .7s cubic-bezier(.2, 1.6, .4, 1) both; }
.victory-jp { font-family: var(--font-jp); font-size: clamp(22px, 4vw, 38px); color: #fff; margin-top: 4px; animation: itemIn .5s .4s both; }
.victory p { font-size: 18px; font-weight: 700; color: #ddd7ff; animation: itemIn .5s .6s both; }

/* ---------- keyframes ---------- */
@keyframes rise { from { transform: translateY(30%); opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes float { 50% { transform: translateY(-6%); } }
@keyframes breathe { 50% { transform: scaleY(1.008) translateY(-.4%); } }
@keyframes sway { 50% { transform: rotate(1.6deg); } }
@keyframes sweat { 0% { transform: translateY(-6px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(16px); opacity: 0; } }
@keyframes vein { to { transform: scale(1.18); } }
@keyframes pulse { from { opacity: .25; } to { opacity: .8; } }
@keyframes blinkLed { 50% { opacity: .3; } }
@keyframes blob { 50% { transform: scale(1.03, .97); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes slotIn { from { opacity: 0; transform: translateX(-50%) translateY(6%); } }
@keyframes hop { 30% { transform: translateY(-4%); } 60% { transform: translateY(0); } 80% { transform: translateY(-1.5%); } }
@keyframes shudder { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-1.5%); } 40% { transform: translateX(1.5%); } 60% { transform: translateX(-1%); } 80% { transform: translateX(1%); } }
@keyframes captionIn { from { transform: translateY(-40%) rotate(-6deg); opacity: 0; } }
@keyframes cardIn { from { transform: translateX(-50%) translateY(10%) scale(.92); opacity: 0; } }
.qcard { --tx: 0; }
@keyframes itemIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tileIn { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flagIn { from { transform: translateX(-20px) rotate(-3deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes wave { 50% { transform: rotate(-12deg) skewX(-6deg); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes bubbleIn { from { transform: scale(.6) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes typingGone { to { height: 0; padding: 0; margin: 0; opacity: 0; overflow: hidden; } }
@keyframes dot { 50% { transform: translateY(-4px); opacity: .5; } }
@keyframes typeIn { from { width: 0; } to { width: 100%; } }
@keyframes caret { 50% { border-color: transparent; } }
@keyframes slam { from { transform: scale(2.4); opacity: 0; } 60% { transform: scale(.92); opacity: 1; } to { transform: scale(1); opacity: 1; } }
@keyframes flick { 0% { opacity: 1; } 33% { opacity: 0; } }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }
@keyframes shake { 0%, 100% { transform: translate(0, 0); } 15% { transform: translate(-1.2%, .6%); } 30% { transform: translate(1.2%, -.8%); } 45% { transform: translate(-.9%, .9%); } 60% { transform: translate(.8%, -.4%); } 75% { transform: translate(-.4%, .3%); } }
@keyframes auraPulse { 50% { opacity: .65; } }
@keyframes redPulse { from { opacity: .45; } to { opacity: 1; } }
@keyframes tape { to { background-position: 4.5cqw 0; } }
@keyframes sfxPop { from { transform: translate(-50%, 0) rotate(-9deg) scale(2.2); opacity: 0; } 70% { transform: translate(-50%, 0) rotate(-9deg) scale(.92); opacity: 1; } to { transform: translate(-50%, 0) rotate(-9deg) scale(1); opacity: 1; } }
@keyframes wobble { 50% { transform: translateY(-6%) rotate(2deg); } }
@keyframes twinkle { 0% { transform: scale(0) rotate(0); opacity: 0; } 40% { transform: scale(1.15) rotate(30deg); opacity: 1; } 100% { transform: scale(0) rotate(90deg); opacity: 0; } }
@keyframes glint { 0% { transform: scale(0) rotate(-30deg); opacity: 0; } 35% { transform: scale(1.2) rotate(15deg); opacity: 1; } 100% { transform: scale(0) rotate(60deg); opacity: 0; } }
@keyframes fall { from { transform: translate(0, 0) rotate(0); } to { transform: translate(var(--dx, 8cqw), 115cqh) rotate(540deg); } }
@keyframes rain { from { background-position: 0 0; } to { background-position: -1.5cqw 9cqw; } }
@keyframes cutIn { 0% { clip-path: inset(50% 0 50% 0); } 18% { clip-path: inset(0 0 0 0); } 82% { clip-path: inset(0 0 0 0); } 100% { clip-path: inset(50% 0 50% 0); } }
@keyframes fromLeft { from { transform: translateX(-100%); } }
@keyframes fromRight { from { transform: translateX(100%); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes bossHit { 0% { transform: translateY(-46%); filter: brightness(3); } 30% { transform: translateY(-46%) translateX(6%) rotate(6deg); } 60% { transform: translateY(-46%) translateX(-3%); filter: none; } 100% { transform: translateY(-46%); } }
@keyframes bossLaugh { 25%, 75% { transform: translateY(-50%) scale(1.06); } 50% { transform: translateY(-44%) scale(.98); } }
@keyframes bossDie { 0% { transform: translateY(-46%); opacity: 1; filter: brightness(2); } 30% { transform: translateY(-46%) rotate(-8deg) scale(1.05); } 100% { transform: translateY(-30%) scale(.2) rotate(30deg); opacity: 0; filter: brightness(3) blur(4px); } }
@keyframes pipBreak { 0% { transform: scale(1.3); filter: brightness(2); } 100% { opacity: .12; transform: scaleY(.6); } }
@keyframes slash { 0% { transform: rotate(-18deg) scaleX(0); opacity: 1; } 60% { transform: rotate(-18deg) scaleX(1); opacity: 1; } 100% { transform: rotate(-18deg) scaleX(1); opacity: 0; } }
@keyframes stamp { from { transform: rotate(-14deg) scale(2.2); opacity: 0; } 70% { transform: rotate(-14deg) scale(.95); opacity: .95; } to { transform: rotate(-14deg) scale(1); opacity: .88; } }

/* background animations */
.bg-svg .bg-conveyor { animation: conveyor 6s linear infinite; }
@keyframes conveyor { to { transform: translateX(-1440px); } }
.bg-svg .bg-scan { animation: scan 2.4s ease-in-out infinite; }
@keyframes scan { 50% { opacity: .45; } }
.bg-svg .bg-blink { animation: blinkLed 1s steps(2) infinite; }
.bg-svg .bg-flash-box { animation: boxFlash 2.4s steps(1) infinite; }
@keyframes boxFlash { 0% { opacity: 0; } 40% { opacity: 1; } 80% { opacity: 0; } }
.bg-svg .bg-drift { animation: drift 40s linear infinite alternate; }
@keyframes drift { to { transform: translateX(60px); } }
.bg-svg .bg-twinkle { animation: pulse 1.6s ease-in-out infinite alternate; }
.bg-svg .bg-neon { animation: neon 3s steps(1) infinite; }
@keyframes neon { 0%, 100% { opacity: 1; } 92% { opacity: .35; } 94% { opacity: 1; } 96% { opacity: .5; } }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .hud { gap: 8px; padding: 0 10px; }
  .hud-logo small { display: none; }
  .hud-logo { font-size: 20px; }
  .hbtn .lbl { display: none; }
  .hbtn { padding: 0 10px; }
  .stage-wrap { padding: 2px 6px 10px; }
}
@media (max-width: 760px) and (orientation: portrait) {
  .stage { width: 100%; aspect-ratio: auto; height: calc(100dvh - var(--chrome, 74px)); min-height: 520px; max-height: 920px; border-radius: 14px; }
  .slot { height: auto; width: min(90%, 47cqh); bottom: 22%; }
  .slot[data-pos=left], .slot[data-pos=right], .slot[data-pos=center] { left: 50%; }
  .slot[data-pos=float] { width: min(36%, 20cqh); height: auto; top: 3%; left: 80%; }
  .slot[data-pos=float].solo, .slot[data-pos=float].speaking { width: min(64%, 34cqh); height: auto; top: 7%; left: 50%; }
  .slot.call { width: min(72%, 40cqh); height: auto; aspect-ratio: 3 / 3.6; top: 7%; bottom: auto; }
  .slot.call[data-pos=right], .slot.call[data-pos=left] { left: 50%; }
  .stage.has-card .slot { opacity: 0 !important; }
  .stage.has-card .slot[data-pos=float] { opacity: 1 !important; width: min(22%, 12cqh); height: auto; left: 88%; top: auto; bottom: 25%; }
  .dialogue { min-height: 21%; font-size: clamp(15px, 4.2cqw, 18px); padding: 6cqw 4.5cqw 13cqw; }
  .nametag { font-size: 13px; }
  .card { width: 94%; top: 2%; max-height: 72%; font-size: clamp(12px, 3.5cqw, 15px); padding: 4cqw; }
  .icon-grid { grid-template-columns: repeat(4, 1fr); gap: .4em; }
  .contacts, .stakes, .card-items.cols2 { grid-template-columns: 1fr; }
  .caption { font-size: 12px; max-width: 80%; }
  .sfx { font-size: clamp(26px, 12cqw, 60px); }
  .stage.has-card .sfx { display: none; }
  .ec-num { font-size: 18cqw; } .ec-title { font-size: 8.5cqw; } .ec-jp { font-size: 4.5cqw; } .ec-label { font-size: 5cqw; }
  .eyecatch .ec-text { inset: 0; }
  .ec-cast { height: auto; width: 90%; bottom: -22%; }
  .tbc-box { font-size: 6cqw; } .tbc-jp { font-size: 5cqw; } .tbc { bottom: 30%; }
  .tap-hint { display: none; }
  .title-cast { opacity: .35; }
  .kanji-big { font-size: 17cqw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .petal, .rain, .speedlines g { display: none; }
}


/* =================== HIDDEN X additions =================== */
:root { --font-math: 'Cambria Math', 'STIX Two Math', 'Times New Roman', Georgia, serif; }
button.hud-logo { background: none; border: 0; color: #fff; cursor: pointer; padding: 0; }
.hud-progress .seg.done i { background: linear-gradient(90deg, var(--gold), #ff9a3c); }

/* math in cards and practice: variables in italic serif, like a textbook */
.card i, .math i, .model i, .g-eq i, .eqt i, .math-check i, .hint i, .feedback i { font-family: var(--font-math); font-style: italic; font-weight: 600; font-size: 1.12em; }

/* ---------- story cards: model (words → math) and math (solve) ---------- */
.model { display: grid; gap: .5em; }
.model-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(6.5em, auto); gap: .7em; align-items: center; padding: .45em .75em; border-radius: .7em; background: #f7f5ff; opacity: 0; animation: itemIn .4s forwards; animation-delay: calc(.2s + var(--i) * .35s); }
.model-row .w { font-weight: 700; line-height: 1.3; }
.model-row .arrow { color: var(--pink); font-weight: 900; }
.model-row .m { font-weight: 800; font-size: 1.12em; color: var(--violet); white-space: nowrap; text-align: right; }
.model-eq { margin-top: .8em; text-align: center; font-weight: 800; font-size: 1.5em; padding: .35em .8em; border-radius: .7em; background: var(--ink); color: #fff; opacity: 0; animation: slam .5s cubic-bezier(.2, 1.6, .4, 1) forwards; animation-delay: calc(.35s + var(--i) * .35s); }
.model-eq i { color: var(--gold); }
.math { display: grid; gap: .35em; }
.math-line { display: grid; grid-template-columns: minmax(8em, auto) 1fr; gap: 1em; align-items: baseline; padding: .3em .2em; border-bottom: 2px dashed #eee9fb; opacity: 0; animation: itemIn .4s forwards; animation-delay: calc(.2s + var(--i) * .45s); }
.math-line .eq { font-weight: 800; font-size: 1.32em; white-space: nowrap; }
.math-line .note { color: #6b6889; font-weight: 700; font-size: .92em; }
.math-line .note::before { content: '← '; color: var(--pink); }
.math-line:last-child .eq { color: var(--green); }
.math-check { margin-top: .7em; display: flex; gap: .5em; align-items: center; font-weight: 800; color: #0d8a5c; opacity: 0; animation: itemIn .4s forwards; animation-delay: calc(.35s + var(--i, 3) * .45s); }
.math-check .ico { flex: none; }

/* ---------- unit map ---------- */
.modal.map { width: min(640px, 100%); }
.map-sub { margin: -4px 0 14px; color: #6b6889; font-weight: 700; font-size: 14px; }
.map-ep { display: grid; gap: 4px; }
.ep-row.practice { margin-left: 28px; width: calc(100% - 28px); background: #fff; border: 2px dashed #e1dcf5; padding: 8px 12px; }
.ep-row.practice .n { width: 34px; color: var(--violet); font-size: 18px; display: grid; place-items: center; }
.ep-row.practice .t small { font-family: var(--font-ui); font-weight: 600; color: #7b75a0; }
.map-foot { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 2px solid #eee9fb; color: #6b6889; font-size: 13px; font-weight: 700; }
.map-foot span { flex: 1 1 220px; }
.tlink.danger:hover { background: #ffe1e6; color: #c0183a; }

/* mastery meter */
.meter { display: inline-flex; align-items: center; gap: 8px; min-width: 150px; }
.meter-bar { display: block; flex: 1; height: 10px; border-radius: 99px; background: rgba(108, 78, 242, .15); overflow: hidden; min-width: 70px; }
.meter-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), var(--violet)); transition: width .6s cubic-bezier(.2, 1.2, .4, 1); }
.meter.mastered .meter-bar i { background: linear-gradient(90deg, var(--gold), #ff9a3c); }
.meter-lbl { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: var(--violet); white-space: nowrap; }
.meter.mastered .meter-lbl { color: #b07d00; }
.meter.compact { min-width: 120px; }
.trial-skill { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 800; color: #ddd7ff; }
.trial-skill .meter { min-width: 210px; }
.trial-skill .meter-bar { background: rgba(255, 255, 255, .15); }
.trial-skill .meter-lbl { color: #fff; }

/* nickname */
.name-modal { text-align: center; }
.name-modal h2 { justify-content: center; flex-wrap: wrap; }
.name-modal p { margin: 0 0 14px; color: #6b6889; font-weight: 600; line-height: 1.45; }
.name-vu { width: 96px; height: 92px; margin: -6px auto 6px; animation: float 3s ease-in-out infinite; }
.name-vu svg { width: 100%; height: 100%; }
.name-modal input { width: 100%; font: inherit; font-size: 22px; font-weight: 800; text-align: center; padding: 12px 14px; border-radius: 14px; border: 3px solid #e1dcf5; color: var(--ink); }
.name-modal input:focus { outline: none; border-color: var(--violet); }
.name-actions { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; }

/* ---------- practice ---------- */
.pcard { box-shadow: 8px 8px 0 var(--teal); }
.practice .arena-hero { bottom: -58%; height: 160%; }
.qtag.lvl { background: #fff1c2; color: #946800; letter-spacing: .5px; }
.qtag.review { background: var(--teal-soft); color: #0e7a70; }
.qtag.twin { background: var(--pink-soft); color: #c21f5a; }
.focus-tip { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0 4px; padding: 10px 12px; border-radius: 14px; background: #fff7e0; border: 2px solid #ffd76b; font-weight: 600; line-height: 1.4; }
.focus-tip .ico { color: #b07d00; margin-top: 1px; }
.ptext { font-size: clamp(17px, 2.2vw, 21px); font-weight: 600; line-height: 1.55; margin: 8px 0 6px; }
.ptext .num { font-weight: 800; border-radius: 6px; padding: 0 2px; transition: background .3s, box-shadow .3s; }
.ptext.scanned .num { background: var(--pink-soft); box-shadow: 0 0 0 2px var(--pink); animation: scanIn .5s both; }
.ptext.scanned .num:nth-of-type(2) { animation-delay: .15s; } .ptext.scanned .num:nth-of-type(3) { animation-delay: .3s; } .ptext.scanned .num:nth-of-type(4) { animation-delay: .45s; }
@keyframes scanIn { from { box-shadow: 0 0 0 8px rgba(255, 79, 139, 0); background: #fff; } }
.pask { font-size: clamp(17px, 2.2vw, 21px); font-weight: 800; margin: 0 0 14px; color: var(--violet); }
.hints { display: grid; gap: 8px; margin-bottom: 12px; }
.hint { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 12px; background: var(--violet-soft); font-weight: 600; line-height: 1.45; animation: itemIn .35s both; }
.hint b { flex: none; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--violet); }
.answer-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ans-box { flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 0 14px; border-radius: 16px; border: 3px solid #e1dcf5; background: #fbfaff; transition: border-color .15s; }
.ans-box:focus-within { border-color: var(--violet); background: #fff; }
.ans-box .pre, .ans-box .post { font-weight: 800; color: #7b75a0; white-space: nowrap; }
.ans-box .pre.var { font-family: var(--font-math); font-style: italic; font-size: 22px; color: var(--ink); }
.ans-box input { flex: 1; min-width: 0; width: 100%; border: 0; background: none; font: inherit; font-size: 24px; font-weight: 800; padding: 10px 0; color: var(--ink); outline: none; }
.ans-box input.shake { animation: shudder .4s linear; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.fb-actions { gap: 10px; flex-wrap: wrap; }
.fb-main { flex: 1; min-width: 0; }
.feedback p + p { margin-top: 6px; }
.toast { display: flex; gap: 8px; align-items: center; margin: 0 0 8px; padding: 8px 12px; border-radius: 12px; font-weight: 800; animation: slam .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.toast.up { background: var(--violet); color: #fff; }
.toast.down { background: #fff; color: var(--ink-2); border: 2px solid #e1dcf5; }
.toast.mastered { background: var(--gold); color: var(--ink); }
.slash.crit::before { height: 10px; box-shadow: 0 0 22px #fff, 0 0 60px var(--gold); }

/* guided steps */
.guided { display: grid; gap: 14px; margin: 4px 0 6px; }
.guided .lead { margin: 0; font-weight: 700; color: #a46a00; background: #fff7e0; border-radius: 12px; padding: 10px 12px; }
.g-step { display: flex; gap: 12px; align-items: flex-start; animation: itemIn .35s both; }
.g-n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pink); color: #fff; font-family: var(--font-sfx); font-size: 20px; box-shadow: 3px 3px 0 var(--ink); }
.g-step.g2 .g-n { background: var(--teal); }
.g-body { flex: 1; min-width: 0; }
.g-body h4 { margin: 4px 0 6px; font-size: 18px; font-weight: 800; }
.g-sub { margin: 0 0 10px; color: #6b6889; font-weight: 700; }
.choices { display: grid; gap: 8px; }
.eqt { font-weight: 800; font-size: 19px; }
.g-eq { font-weight: 800; font-size: 22px; padding: 8px 14px; border-radius: 12px; background: var(--ink); color: #fff; display: inline-block; margin-bottom: 8px; }
.g-eq i { color: var(--gold); }
.g-hint { margin: 10px 0 6px; font-weight: 700; color: #a46a00; }
.g-fb:empty { display: none; }
.g-fb { margin-top: 10px; }
.tlink.reveal { justify-self: start; }
.model.inline, .math.inline { font-size: 15px; }
.model.inline .model-row, .math.inline .math-line, .solution .math-check { animation-duration: .3s; animation-delay: calc(.05s + var(--i) * .12s); }
.solution { margin-top: 10px; padding: 12px; border-radius: 14px; background: #fff; border: 2px solid #e6e1f7; display: grid; gap: 10px; }
.sol-title { display: flex; gap: 6px; align-items: center; font-weight: 800; color: var(--ink-2); font-size: 14px; }
.solution .math-check { margin-top: 0; }
.sol-toggle { margin-top: 8px; }
.sol-toggle summary { cursor: pointer; font-weight: 800; color: #0d8a5c; font-size: 14px; }

/* round over and unit clear */
.round-over p { margin: 8px 0; }
.round-meter { display: grid; justify-items: center; gap: 4px; margin: 10px auto 4px; max-width: 420px; }
.round-meter .meter { width: 100%; }
.round-meter .meter-bar { height: 14px; background: rgba(255, 255, 255, .15); }
.round-meter .meter-lbl { color: #fff; font-size: 14px; }
.round-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.unit-clear { position: relative; max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; overflow: hidden; container-type: inline-size; }
.uc-card { position: relative; z-index: 2; text-align: center; background: rgba(29, 23, 64, .94); border: 2px solid rgba(255, 255, 255, .15); border-radius: 28px; padding: 24px 20px 28px; }
.uc-vu { width: 110px; height: 106px; margin: 0 auto 4px; animation: float 3s ease-in-out infinite; }
.uc-vu svg { width: 100%; height: 100%; }
.kanji-line { font-family: var(--font-jp); font-size: clamp(30px, 6vw, 48px); color: #fff; margin-top: 6px; }
.kanji-line small { display: block; font-family: var(--font-ui); font-size: 14px; font-weight: 700; color: #c9c2f0; margin-top: 2px; }
.uc-sub { font-size: 18px; font-weight: 700; color: #ddd7ff; }
.uc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.uc-stats div { background: rgba(255, 255, 255, .08); border-radius: 16px; padding: 12px 8px; }
.uc-stats b { display: block; font-family: var(--font-sfx); font-size: 34px; letter-spacing: 1px; color: var(--gold); font-weight: 400; }
.uc-stats span { font-size: 13px; font-weight: 700; color: #c9c2f0; }
.uc-skills { display: grid; gap: 8px; text-align: left; max-width: 460px; margin: 0 auto; }
.uc-skill { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 800; }
.uc-skill .meter-bar { background: rgba(255, 255, 255, .15); }
.uc-skill .meter-lbl { color: #fff; }
.uc-petals { position: absolute; inset: 0; pointer-events: none; }

@media (max-width: 760px) {
  .practice .arena { height: 180px; }
  .practice .arena-boss { right: -6%; height: 82%; top: 58%; }
  .practice .arena-hero { left: -6%; bottom: -88%; height: 190%; }
  .practice .arena-vu { left: 36%; bottom: 8%; height: 30%; }
  .practice .hp { width: 84%; top: 8px; }
  .pcard { padding: 16px 14px 18px; }
  .ans-box input { font-size: 22px; }
  .answer-row .btn { flex: 1 1 100%; }
  .ep-row.practice { margin-left: 12px; width: calc(100% - 12px); flex-wrap: wrap; }
  .ep-row.practice .meter { width: 100%; }
  .math-line { grid-template-columns: 1fr; gap: 0; }
  .model-row { grid-template-columns: 1fr; gap: .1em; }
  .model-row .arrow { display: none; }
  .model-row .m { text-align: left; }
  .uc-stats b { font-size: 26px; }
  .trial-title h2 { font-size: 28px; }
}
