/* Aqua Loop — a hand-crafted water-sort garden */
:root {
  --bg-deep: #041b20;
  --bg-mid: #082f34;
  --ink: #effcf7;
  --ink-soft: rgba(229, 250, 244, 0.72);
  --ink-faint: rgba(213, 242, 235, 0.46);
  --line: rgba(203, 255, 244, 0.14);
  --line-soft: rgba(203, 255, 244, 0.075);
  --glass: rgba(6, 30, 34, 0.48);
  --glass-deep: rgba(3, 20, 23, 0.68);
  --mint: #7bf0cf;
  --mint-bright: #b4ffe7;
  --gold: #ffd79c;
  --gold-deep: #e4a85e;
  --coral: #ff8f9b;
  --chapter-accent: #7bf0cf;
  --chapter-soft: rgba(123, 240, 207, .24);
  --chapter-glow: rgba(123, 240, 207, .12);
  --chapter-glow-strong: rgba(123, 240, 207, .22);
  --chapter-deep: #1d7868;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "STZhongsong", "Noto Serif CJK SC", "Yu Mincho", "Hiragino Mincho ProN", "SimSun", serif;
  --sans: "Noto Sans SC", "Avenir Next", "Segoe UI", "PingFang SC", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Malgun Gothic", "Apple SD Gothic Neo", "Microsoft YaHei", sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --shadow-deep: 0 32px 100px rgba(0, 6, 8, 0.52);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
::selection { background: rgba(123, 240, 207, .24); color: #fff; }
.svg-sprite { position: fixed; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.ico use[href="#i-star"], .ico use[href="#i-drop"] { fill: currentColor; }
kbd {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  border: 1px solid rgba(218, 255, 246, .16);
  border-radius: 5px;
  background: rgba(255, 255, 255, .045);
  color: var(--ink-faint);
  font-family: var(--sans); font-size: 9px; line-height: 1;
}

/* ————— World ————— */
.world { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #031b20; }
.world::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 18, 22, .05) 0%, rgba(2, 16, 20, 0) 46%, rgba(2, 14, 17, .22) 100%),
    radial-gradient(120% 78% at 50% 110%, #2a8579 0%, #115056 28%, #082e36 55%, #041b21 77%, #021216 100%);
}
.sky-glow {
  position: absolute; left: 50%; top: 44%; width: min(1300px, 120vw); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(93, 217, 185, .26) 0%, rgba(46, 158, 148, .16) 25%, rgba(27, 89, 91, .06) 52%, transparent 70%);
  filter: blur(24px);
}
.sun {
  position: absolute; right: 4vw; top: -18vw; width: min(58vw, 800px); aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 177, .48) 0%, rgba(255, 183, 123, .20) 32%, rgba(255, 153, 100, .055) 56%, transparent 70%);
  filter: blur(38px);
  animation: sun-breathe 12s var(--ease-soft) infinite alternate;
}
@keyframes sun-breathe { from { transform: scale(.95); opacity: .8; } to { transform: scale(1.05); opacity: 1; } }
.aurora {
  position: absolute; border-radius: 50%; filter: blur(80px); mix-blend-mode: screen; opacity: .38;
  animation: aurora-drift 26s var(--ease-soft) infinite alternate;
}
.aurora-a { width: 48vw; height: 38vw; left: -12vw; top: 8vh; background: radial-gradient(circle, rgba(22, 130, 122, .8), rgba(14, 82, 93, .25) 55%, transparent 72%); }
.aurora-b { width: 44vw; height: 40vw; right: -10vw; bottom: -8vh; background: radial-gradient(circle, rgba(173, 107, 85, .34), rgba(88, 63, 78, .16) 50%, transparent 72%); animation-delay: -9s; }
@keyframes aurora-drift { from { transform: translate3d(-2%, -2%, 0) scale(.95); } to { transform: translate3d(3%, 4%, 0) scale(1.08); } }

.halo { position: absolute; left: 50%; top: 53%; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; }
.halo-a {
  width: min(84vw, 1120px); aspect-ratio: 1;
  border: 1px solid rgba(186, 255, 240, .075);
  box-shadow: 0 0 0 1px rgba(186, 255, 240, .018) inset, 0 0 90px rgba(100, 224, 192, .035);
}
.halo-a::before, .halo-a::after {
  content: ""; position: absolute; border-radius: 50%;
  border: 1px dashed rgba(192, 255, 243, .06);
}
.halo-a::before { inset: 8.2%; animation: spin 130s linear infinite; }
.halo-a::after { inset: 22%; border-style: solid; border-color: rgba(192, 255, 243, .045); }
.halo-b { width: min(66vw, 860px); aspect-ratio: 1; border: 1px solid rgba(255, 214, 166, .045); animation: spin 95s linear infinite reverse; }
.halo-b::before {
  content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%;
  left: 11%; top: 17%; background: var(--gold);
  box-shadow: 0 0 18px 4px rgba(255, 205, 140, .35);
}
@keyframes spin { to { transform: rotate(360deg); } }
.botanical { position: absolute; bottom: -2vh; width: min(28vw, 390px); opacity: .8; pointer-events: none; }
.botanical svg { display: block; width: 100%; height: auto; }
.botanical-left { left: -5vw; }
.botanical-right { right: -5vw; opacity: .65; }
.world-grain {
  position: absolute; inset: 0; opacity: .075; mix-blend-mode: soft-light; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 44%, rgba(0, 10, 12, .42) 100%); pointer-events: none; }
.dust { position: absolute; inset: 0; pointer-events: none; }
.dust span {
  position: absolute; width: var(--s, 3px); height: var(--s, 3px); border-radius: 50%;
  left: var(--x); top: var(--y); opacity: 0; background: rgba(213, 255, 240, .75);
  box-shadow: 0 0 8px 1px rgba(160, 255, 230, .28);
  animation: dust-rise var(--dur, 18s) linear var(--delay, 0s) infinite;
}
@keyframes dust-rise {
  0% { opacity: 0; transform: translate3d(0, 18px, 0) scale(.7); }
  18% { opacity: var(--op, .4); }
  80% { opacity: var(--op, .4); }
  100% { opacity: 0; transform: translate3d(var(--dx, 12px), -38vh, 0) scale(1); }
}

/* ————— App frame ————— */
.app {
  position: relative; z-index: 2;
  width: min(1280px, 100%); height: 100dvh;
  margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) clamp(14px, 3vw, 42px) max(12px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 15px);
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 54px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.brand-mark {
  position: relative; width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid rgba(188, 255, 241, .22); border-radius: 50%;
  color: var(--mint-bright);
  background: radial-gradient(circle at 34% 26%, rgba(164, 255, 231, .18), rgba(12, 70, 67, .16) 55%, rgba(4, 24, 27, .45));
  box-shadow: inset 0 0 18px rgba(106, 255, 217, .09), 0 8px 28px rgba(0, 0, 0, .25);
}
.brand-mark .ico { width: 21px; height: 21px; filter: drop-shadow(0 0 8px rgba(120, 255, 220, .5)); }
.brand-orbit { position: absolute; inset: -4px; border-radius: 50%; border: 1px dashed rgba(187, 255, 239, .14); animation: spin 32s linear infinite; }
.brand-orbit::before { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; left: 2px; top: 8px; background: var(--gold); box-shadow: 0 0 9px 2px rgba(255, 200, 127, .4); }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: .18em; text-shadow: 0 2px 28px rgba(137, 255, 222, .18); white-space: nowrap; }
.brand-copy small { margin-top: 7px; font-size: 8px; font-weight: 600; letter-spacing: .38em; color: rgba(208, 241, 233, .52); }

.chapter-pill {
  position: relative;
  height: 52px; min-width: 218px;
  display: grid; grid-template-columns: auto 1px 1fr; align-items: center; gap: 13px;
  padding: 7px 17px 10px; border: 1px solid var(--line); border-radius: 17px;
  background: linear-gradient(145deg, rgba(17, 61, 62, .46), rgba(3, 22, 25, .38));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 10px 30px rgba(0, 0, 0, .14);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: border-color .3s, background .3s, transform .3s var(--ease-out);
}
.chapter-pill:hover { border-color: var(--chapter-soft); background: linear-gradient(145deg, rgba(22, 75, 74, .55), rgba(4, 28, 31, .44)); transform: translateY(-1px); }
.chapter-index { font-family: var(--serif); font-size: 25px; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.chapter-divider { width: 1px; height: 26px; background: linear-gradient(transparent, rgba(209, 255, 245, .2), transparent); }
.chapter-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.1; }
.chapter-copy small { font-size: 9px; letter-spacing: .2em; color: var(--ink-faint); }
.chapter-copy strong { font-size: 11px; font-weight: 500; letter-spacing: .06em; color: var(--ink-soft); }
.chapter-progress { position: absolute; left: 17px; right: 17px; bottom: 6px; height: 2px; border-radius: 4px; background: rgba(204, 255, 244, .08); overflow: hidden; }
.chapter-progress i { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--chapter-accent), var(--gold)); box-shadow: 0 0 12px var(--chapter-soft); transition: width .6s var(--ease-out); }
.lang-suggest {
  display: none; align-items: center; gap: 7px; max-width: min(280px, 100%);
  padding: 7px 10px; border: 1px solid rgba(255, 216, 155, .2); border-radius: 12px;
  color: rgba(231, 249, 243, .68); background: rgba(255, 216, 155, .045);
  font-size: 9px; letter-spacing: .04em; white-space: nowrap; overflow: hidden;
  transition: color .2s, border-color .2s, background .2s;
}
.lang-suggest .ico { width: 13px; height: 13px; flex: none; opacity: .72; }
.lang-suggest-arrow { width: 11px !important; margin-left: 1px; }
.lang-suggest #langSuggestText { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lang-suggest:hover { color: var(--ink); border-color: rgba(255, 216, 155, .38); background: rgba(255, 216, 155, .08); }
.lang-suggest[hidden] { display: none; }
@media (min-width: 721px) {
  .topbar { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; column-gap: 18px; justify-content: initial; }
  .brand, .chapter-pill { justify-self: start; }
  .top-actions { justify-self: end; }
}
@media (min-width: 901px) {
  .lang-suggest:not([hidden]) { display: inline-flex; justify-self: center; }
}
@media (max-width: 900px) {
  body.has-lang-suggest .topbar { position: relative; padding-bottom: 34px; }
  .lang-suggest:not([hidden]) {
    display: inline-flex; position: absolute; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: none; justify-content: center;
    padding: 6px 9px; font-size: 9px;
    color: rgba(244, 255, 251, .82); border-color: rgba(255, 216, 155, .32);
    background: rgba(255, 216, 155, .09);
  }
}
.top-actions { display: flex; align-items: center; gap: 7px; min-width: 190px; justify-content: flex-end; }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%;
  color: rgba(223, 250, 242, .62); border: 1px solid transparent; text-decoration: none;
  transition: color .25s, background .25s, border-color .25s, transform .25s var(--ease-out);
}
.icon-btn:hover { color: var(--ink); background: rgba(175, 255, 233, .075); border-color: var(--line-soft); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.icon-btn:active { transform: translateY(0) scale(.96); }
.icon-btn .ico { width: 19px; height: 19px; }
.ico-sound-off { display: none; }
body.is-muted .ico-sound-on { display: none; }
body.is-muted .ico-sound-off { display: block; }

/* ————— Card ————— */
.play-card {
  position: relative; flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  border-radius: 32px; border: 1px solid rgba(198, 255, 244, .18);
  background:
    radial-gradient(85% 95% at 15% 2%, rgba(255, 195, 132, .075), transparent 42%),
    radial-gradient(80% 100% at 86% 0%, rgba(118, 229, 207, .105), transparent 46%),
    radial-gradient(100% 120% at 50% 105%, rgba(61, 171, 155, .10), transparent 54%),
    linear-gradient(150deg, rgba(12, 48, 50, .55), rgba(4, 30, 34, .64) 58%, rgba(3, 22, 26, .72));
  box-shadow: var(--shadow-deep), 0 0 80px rgba(75, 200, 173, .035), inset 0 1px 0 rgba(255, 255, 255, .13), inset 0 -1px 0 rgba(0, 0, 0, .2);
  backdrop-filter: blur(26px) saturate(1.22); -webkit-backdrop-filter: blur(26px) saturate(1.22);
  overflow: hidden;
  isolation: isolate;
}
.play-card::before {
  content: ""; position: absolute; z-index: 3; left: 10%; right: 10%; top: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(216, 255, 247, .48), transparent);
  opacity: .65; pointer-events: none;
}
.play-card::after {
  content: ""; position: absolute; z-index: 0; width: 720px; height: 720px; left: 50%; top: 54%; transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--chapter-glow), rgba(54, 189, 164, .035) 45%, transparent 68%);
  pointer-events: none;
}

.play-head { position: relative; z-index: 4; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 20px 30px 0; }
.level-heading { min-width: 0; }
.eyebrow {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  color: rgba(203, 238, 230, .42); font-size: 9px; font-weight: 600; letter-spacing: .27em;
}
.eyebrow-line { display: inline-block; width: 25px; height: 1px; background: linear-gradient(90deg, var(--chapter-accent), transparent); }
.level-heading h1 { margin: 0; display: flex; align-items: baseline; gap: 14px; font-family: var(--serif); font-weight: 600; font-size: clamp(30px, 3.4vw, 38px); letter-spacing: .16em; line-height: 1.12; color: #f6fffc; text-shadow: 0 4px 34px rgba(111, 255, 219, .12); }
.level-number { color: rgba(200, 237, 229, .46); font-family: var(--sans); font-size: 9px; font-weight: 600; letter-spacing: .24em; transform: translateY(-2px); }
.metrics { display: flex; align-items: center; gap: clamp(18px, 3vw, 36px); padding-bottom: 2px; }
.metric { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.metric span { font-size: 9px; letter-spacing: .19em; color: rgba(206, 240, 232, .42); }
.metric strong { font-family: var(--serif); font-size: 28px; line-height: 1; font-weight: 600; color: rgba(242, 255, 251, .94); font-variant-numeric: tabular-nums; }
.best-metric strong { color: var(--gold); }
.best-metric strong.is-empty { color: rgba(255, 215, 156, .35); }

/* ————— Scene ————— */
.scene { position: relative; z-index: 2; flex: 1; min-height: 0; margin: 0 15px; }
.scene::before {
  content: ""; position: absolute; z-index: 0; left: 50%; top: -5%; width: 74%; height: 58%; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 223, 178, .10), rgba(255, 199, 145, .028) 42%, transparent 70%);
  filter: blur(6px); pointer-events: none;
}
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.scene-halo {
  position: absolute; left: 50%; top: 52%; width: min(780px, 82%); height: 64%; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, var(--chapter-glow-strong), var(--chapter-glow) 42%, transparent 68%);
  filter: blur(14px); pointer-events: none;
}
.scene-ring {
  position: absolute; left: 50%; top: 51%; width: min(670px, 62vw); aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 1px solid rgba(189, 255, 237, .12); border-radius: 50%; pointer-events: none; opacity: .95;
  box-shadow: inset 0 0 60px rgba(138, 255, 227, .025), 0 0 40px rgba(138, 255, 227, .02);
  animation: spin 120s linear infinite;
}
.scene-ring::before, .scene-ring::after { content: ""; position: absolute; border-radius: 50%; border: 1px dashed rgba(189, 255, 237, .085); }
.scene-ring::before { inset: 4%; }
.scene-ring::after { inset: 12%; border-style: solid; border-color: rgba(255, 214, 164, .07); }
.scene-ring span { width: 6px; height: 6px; left: 12%; top: 19%; background: var(--chapter-accent); box-shadow: 0 0 16px 4px var(--chapter-soft); }
.scene-ring i { width: 4px; height: 4px; right: 4%; top: 49%; background: rgba(168, 255, 234, .9); box-shadow: 0 0 14px 3px rgba(118, 255, 218, .4); }
.scene-ring b { width: 2px; height: 2px; left: 36%; bottom: 6%; background: rgba(255, 195, 177, .9); }
.scene-vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 62%, rgba(1, 13, 15, .18) 100%); }
.scene-toast {
  position: absolute; z-index: 8; left: 50%; top: 15px; transform: translate(-50%, -8px);
  max-width: calc(100% - 40px); padding: 9px 16px; border-radius: 100px;
  border: 1px solid rgba(199, 255, 242, .16); background: rgba(4, 28, 31, .82);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22); backdrop-filter: blur(14px);
  color: rgba(228, 253, 246, .86); font-size: 11px; letter-spacing: .04em; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-soft), transform .3s var(--ease-out);
}
.scene-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.coach {
  position: absolute; z-index: 9; left: 50%; bottom: 15px; transform: translateX(-50%);
  width: min(470px, calc(100% - 30px)); display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 14px; border-radius: 17px;
  border: 1px solid rgba(197, 255, 242, .16); background: rgba(4, 28, 31, .78);
  backdrop-filter: blur(18px); box-shadow: 0 18px 48px rgba(0, 0, 0, .3);
  animation: coach-in .7s var(--ease-out) both;
}
@keyframes coach-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.coach-icon { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--mint); background: rgba(111, 255, 219, .08); border: 1px solid rgba(132, 255, 225, .14); }
.coach-icon .ico { width: 16px; height: 16px; }
.coach strong { display: block; margin-top: 1px; color: rgba(238, 255, 250, .9); font-size: 11px; font-weight: 500; letter-spacing: .04em; }
.coach p { margin: 2px 0 0; color: rgba(206, 239, 232, .55); font-size: 10px; line-height: 1.55; }
.coach-close { flex: none; width: 26px; height: 26px; display: grid; place-items: center; color: rgba(218, 249, 241, .4); border-radius: 50%; }
.coach-close:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.coach-close .ico { width: 13px; height: 13px; }
.scene-map-btn {
  position: absolute; z-index: 6; right: 10px; bottom: 10px; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line-soft); color: rgba(220, 251, 244, .45);
  background: rgba(2, 24, 27, .28); backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(4px); transition: all .3s var(--ease-soft);
}
.scene:hover .scene-map-btn, .scene-map-btn:focus-visible { opacity: 1; transform: none; }
.scene-map-btn:hover { color: var(--ink); border-color: var(--line); }
.scene-map-btn .ico { width: 16px; height: 16px; }

/* ————— Foot ————— */
.play-foot { position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 9px 30px 19px; }
.foot-meta { display: flex; align-items: center; gap: clamp(14px, 3vw, 30px); min-width: 0; }
.tip { display: flex; align-items: center; gap: 9px; margin: 0; min-width: 0; color: rgba(215, 246, 238, .62); font-size: 11.5px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip-orb { flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px 2px rgba(123, 240, 207, .38); animation: orb-pulse 3.4s ease-in-out infinite; }
@keyframes orb-pulse { 0%, 100% { opacity: .55; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }
.par-chip { display: flex; align-items: center; gap: 5px; flex: none; color: rgba(227, 247, 241, .55); font-size: 10px; letter-spacing: .06em; }
.par-chip .ico { width: 14px; height: 14px; color: var(--gold); filter: drop-shadow(0 0 6px rgba(255, 208, 145, .32)); }
.par-chip b { margin-left: 3px; color: var(--gold); font-family: var(--serif); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.par-chip em { font-style: normal; color: rgba(255, 220, 169, .5); }
.dock { display: flex; align-items: center; gap: 8px; flex: none; }
.action {
  height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 15px;
  border: 1px solid rgba(203, 255, 244, .105); border-radius: 13px;
  color: rgba(228, 251, 245, .68); background: rgba(255, 255, 255, .035);
  font-size: 11.5px; letter-spacing: .07em;
  transition: color .22s, background .22s, border-color .22s, transform .22s var(--ease-out), box-shadow .22s;
}
.action .ico { width: 16px; height: 16px; opacity: .9; }
.action:hover:not(:disabled) { color: var(--ink); background: rgba(163, 255, 230, .075); border-color: rgba(192, 255, 242, .2); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, .14); }
.action:active:not(:disabled) { transform: translateY(0) scale(.975); }
.action:disabled { opacity: .28; }
.action.is-pulsing {
  color: var(--gold);
  border-color: rgba(255, 211, 151, .55);
  background: rgba(255, 205, 137, .09);
  animation: undo-pulse 1.25s var(--ease-soft) infinite;
}
@keyframes undo-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 205, 137, 0); }
  45% { box-shadow: 0 0 0 6px rgba(255, 205, 137, .08), 0 0 22px rgba(255, 205, 137, .16); }
}
.action-primary { color: #06251f; background: linear-gradient(135deg, #a2f8df, #6bd9bd); border-color: transparent; box-shadow: 0 8px 24px rgba(84, 220, 184, .2); font-weight: 600; }
.action-primary:hover:not(:disabled) { color: #031d18; background: linear-gradient(135deg, #c1ffeb, #7be8ca); box-shadow: 0 10px 30px rgba(84, 220, 184, .32); }
.action-primary .ico { stroke-width: 1.9; }
.action-undo { position: relative; }
.undo-count {
  position: absolute; top: -6px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center; border-radius: 10px;
  color: #fff; background: #ff6b7a; border: 2px solid #062527;
  font-size: 9px; font-weight: 700; line-height: 1; letter-spacing: .02em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .32);
}
.undo-count.is-ad { min-width: 19px; background: var(--gold); color: #3a2408; font-size: 7px; letter-spacing: 0; }
.page-foot { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; color: rgba(199, 235, 226, .25); font-size: 9px; letter-spacing: .16em; }

/* ————— Ad slots ————— */
.ad-rail { flex: none; display: flex; justify-content: center; width: 100%; }
.ad-unit {
  position: relative; width: 100%; height: 90px; overflow: hidden;
  display: grid; place-items: center;
  border: 1px dashed rgba(190, 255, 241, .13); border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .018), rgba(255, 255, 255, .006));
}
.ad-unit--main { max-width: 970px; }
.ad-unit--map { max-width: 728px; height: 90px; margin: 0 auto 15px; }
.ad-unit--win { max-width: 320px; height: 50px; margin: 14px auto 0; border-radius: 9px; }
.ad-unit.is-live { border-style: solid; border-color: rgba(190, 255, 241, .08); }
.ad-unit ins { display: block; width: 100%; }
.ad-placeholder { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; height: 100%; color: rgba(200, 239, 231, .22); }
.ad-art { display: none; width: 100%; height: 100%; margin: 0; overflow: hidden; }
.ad-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
html[lang="zh-CN"] .ad-art, html[lang="zh-Hant"] .ad-art { display: block; }
html[lang="zh-CN"] .ad-text, html[lang="zh-Hant"] .ad-text { display: none; }
.ad-tag { padding: 3px 6px; border: 1px solid rgba(190, 255, 241, .12); border-radius: 4px; font-size: 7px; font-weight: 600; letter-spacing: .2em; }
.ad-note { font-size: 8px; letter-spacing: .12em; color: rgba(200, 239, 231, .28); }
body.ads-declined .ad-rail,
body.ads-declined .ad-unit,
body.auto-ads .ad-rail,
body.auto-ads .ad-unit { display: none; }
body.google-cmp [data-open-consent] { display: none; }

/* ————— Legal links / consent ————— */
.page-foot-legal { display: flex; align-items: center; gap: 10px; font-size: 8px; letter-spacing: .08em; }
.page-foot-legal a, .page-foot-legal button { color: rgba(199, 235, 226, .32); transition: color .2s; }
.page-foot-legal a:hover, .page-foot-legal button:hover { color: rgba(213, 255, 244, .72); }
.help-legal { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 15px; color: rgba(200, 239, 231, .28); font-size: 8.5px; letter-spacing: .08em; }
.help-legal a, .help-legal button { color: rgba(200, 239, 231, .45); transition: color .2s; }
.help-legal a:hover, .help-legal button:hover { color: rgba(235, 255, 249, .85); }

.consent-banner {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 300;
  width: min(760px, calc(100vw - 28px)); transform: translateX(-50%);
  animation: consent-in .45s var(--ease-out) both;
}
@keyframes consent-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.consent-card {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px 16px; border: 1px solid rgba(188, 255, 240, .18); border-radius: 16px;
  background: linear-gradient(145deg, rgba(10, 45, 47, .98), rgba(3, 23, 27, .99));
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.consent-copy { min-width: 0; }
.consent-copy strong { display: block; color: rgba(242, 255, 251, .9); font-size: 11px; font-weight: 500; letter-spacing: .08em; }
.consent-copy p { margin: 4px 0 0; color: rgba(202, 240, 231, .5); font-size: 9.5px; line-height: 1.55; }
.consent-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.consent-btn { height: 31px; padding: 0 11px; border-radius: 8px; font-size: 9px; font-weight: 500; letter-spacing: .05em; white-space: nowrap; }
.consent-btn--ghost { color: rgba(220, 251, 242, .62); border: 1px solid rgba(192, 255, 241, .16); }
.consent-btn--ghost:hover { color: var(--ink); border-color: rgba(192, 255, 241, .3); }
.consent-btn--primary { color: #05241e; background: linear-gradient(135deg, #a9fbe2, #6cdabe); box-shadow: 0 6px 20px rgba(78, 219, 179, .16); }
.consent-btn--primary:hover { background: linear-gradient(135deg, #c4ffeb, #7fe8cc); }
.consent-more { color: rgba(201, 239, 230, .42); font-size: 8px; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.consent-more:hover { color: rgba(235, 255, 249, .8); }

/* ————— Overlays ————— */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.overlay-scrim { position: absolute; inset: 0; background: rgba(1, 12, 15, .7); backdrop-filter: blur(16px) saturate(.8); -webkit-backdrop-filter: blur(16px) saturate(.8); animation: scrim-in .4s ease both; }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; z-index: 1; width: min(880px, 94vw); max-height: 90dvh; overflow: auto; overscroll-behavior: contain;
  padding: 27px 28px 24px; border: 1px solid rgba(198, 255, 244, .16); border-radius: 29px;
  background:
    radial-gradient(100% 90% at 50% -10%, rgba(98, 222, 191, .12), transparent 50%),
    linear-gradient(155deg, rgba(11, 44, 47, .97), rgba(3, 22, 26, .98) 62%, rgba(3, 18, 22, .99));
  box-shadow: 0 40px 120px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 255, 255, .11);
  animation: modal-in .55s var(--ease-out) both;
  scrollbar-width: thin; scrollbar-color: rgba(179, 255, 234, .18) transparent;
}
.modal::-webkit-scrollbar { width: 5px; }
.modal::-webkit-scrollbar-thumb { background: rgba(179, 255, 234, .16); border-radius: 8px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.975); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.modal-kicker { display: block; margin-bottom: 5px; color: rgba(207, 242, 234, .38); font-size: 8px; font-weight: 600; letter-spacing: .32em; }
.modal h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 28px; letter-spacing: .12em; line-height: 1.2; }
.modal-close { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-soft); color: rgba(222, 250, 242, .5); background: rgba(255, 255, 255, .025); transition: all .25s; }
.modal-close:hover { color: var(--ink); border-color: var(--line); background: rgba(255, 255, 255, .055); transform: rotate(4deg); }
.modal-close .ico { width: 16px; height: 16px; }
.modal-note { margin: 17px 0 0; color: rgba(201, 235, 227, .3); font-size: 9px; letter-spacing: .08em; text-align: center; }

.level-summary { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 17px; padding: 11px 15px; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(255, 255, 255, .022); }
.level-modal { width: min(920px, 94vw); }
.summary-stars { display: flex; align-items: baseline; gap: 4px; color: var(--gold); }
.summary-stars .ico { width: 14px; height: 14px; align-self: center; filter: drop-shadow(0 0 5px rgba(255, 209, 148, .35)); }
.summary-stars strong { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.summary-stars span { color: rgba(255, 225, 181, .4); font-size: 9px; letter-spacing: .04em; }
.summary-stars span b { color: rgba(255, 225, 181, .58); font-weight: 500; }
.summary-progress { height: 3px; border-radius: 5px; background: rgba(213, 255, 245, .08); overflow: hidden; }
.summary-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--chapter-accent), var(--gold)); transition: width .5s var(--ease-out); }
.summary-label { color: rgba(201, 239, 230, .42); font-size: 9px; letter-spacing: .06em; }

/* Chapter rail */
.chapter-tabs {
  display: flex; gap: 6px; margin: 0 0 15px; padding: 3px 2px 6px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
}
.chapter-tabs::-webkit-scrollbar { display: none; }
.chapter-tab {
  --tab-accent: var(--chapter-accent);
  --tab-soft: var(--chapter-soft);
  position: relative; flex: 1 0 68px; min-width: 68px; height: 43px;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center;
  column-gap: 7px; padding: 6px 9px; text-align: left;
  border: 1px solid rgba(196, 248, 236, .08); border-radius: 11px;
  background: rgba(255, 255, 255, .018);
  transition: border-color .25s, background .25s, transform .25s var(--ease-out), box-shadow .25s;
}
.chapter-tab:hover { transform: translateY(-1px); border-color: rgba(196, 255, 242, .18); background: rgba(255, 255, 255, .035); }
.chapter-tab .ct-roman { grid-row: span 2; font-family: var(--serif); font-size: 14px; line-height: 1; color: var(--tab-accent); opacity: .72; }
.chapter-tab .ct-name { align-self: end; color: rgba(226, 251, 244, .58); font-size: 9px; letter-spacing: .09em; white-space: nowrap; }
.chapter-tab .ct-stars { align-self: start; color: rgba(213, 247, 238, .28); font-size: 8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chapter-tab .ct-stars i { color: var(--gold); font-style: normal; font-size: 7px; opacity: .7; }
.chapter-tab.active {
  border-color: var(--tab-soft);
  background: linear-gradient(145deg, var(--tab-soft), rgba(255, 255, 255, .02));
  box-shadow: 0 0 20px var(--tab-soft), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.chapter-tab.active .ct-name { color: rgba(247, 255, 252, .92); }
.chapter-tab.active .ct-stars { color: rgba(255, 229, 186, .7); }
.chapter-tab.active::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: -6px; height: 2px; border-radius: 4px; background: var(--tab-accent); box-shadow: 0 0 10px var(--tab-soft); }
.level-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.level-card {
  position: relative; min-height: 102px; padding: 12px 12px 10px; text-align: left; overflow: hidden;
  border: 1px solid rgba(196, 248, 236, .115); border-radius: 15px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .052), rgba(255, 255, 255, .018));
  transition: transform .3s var(--ease-out), border-color .3s, background .3s, box-shadow .3s;
}
.level-card::after { content: ""; position: absolute; width: 62px; height: 62px; right: -19px; bottom: -23px; border-radius: 50%; background: radial-gradient(circle, rgba(118, 255, 221, .11), transparent 65%); opacity: 0; transition: opacity .3s; }
.level-card:hover:not(.locked) { transform: translateY(-3px); border-color: rgba(167, 255, 233, .26); background: linear-gradient(145deg, rgba(139, 255, 225, .09), rgba(255, 255, 255, .015)); box-shadow: 0 14px 30px rgba(0, 0, 0, .22); }
.level-card:hover:not(.locked)::after { opacity: 1; }
.level-card.current { border-color: var(--chapter-soft); box-shadow: 0 0 0 1px var(--chapter-glow) inset, 0 0 30px var(--chapter-glow); }
.level-card.locked { opacity: .44; filter: saturate(.55); }
.level-card.locked:hover { transform: none; }
.level-card .lc-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.lc-num { font-family: var(--serif); font-size: 20px; line-height: 1; font-weight: 500; color: rgba(242, 255, 251, .9); font-variant-numeric: tabular-nums; }
.level-card.current .lc-num { color: var(--chapter-accent); }
.lc-lock { width: 12px; height: 12px; color: rgba(222, 250, 243, .45); }
.lc-name { display: block; margin-top: 5px; color: rgba(218, 248, 241, .64); font-size: 9.5px; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-stars { display: flex; gap: 2px; margin-top: 13px; height: 11px; }
.lc-stars .ico { width: 10px; height: 10px; color: rgba(215, 247, 239, .17); }
.lc-stars .ico.on { color: var(--gold); filter: drop-shadow(0 0 4px rgba(255, 205, 137, .28)); }
.lc-vial { position: absolute; right: 11px; bottom: 11px; width: 12px; height: 29px; border: 1px solid rgba(228, 255, 249, .25); border-radius: 3px 3px 6px 6px; background: rgba(255, 255, 255, .03); display: flex; flex-direction: column-reverse; padding: 2px; gap: 1px; opacity: .8; }
.lc-vial i { display: block; height: 4px; border-radius: 1px; opacity: .9; }
.level-card.current .lc-vial { border-color: rgba(255, 220, 166, .48); }
.lc-badge { position: absolute; left: 11px; bottom: 10px; font-size: 7px; letter-spacing: .13em; color: rgba(255, 217, 161, .6); }

/* Help */
.help-modal { width: min(640px, 94vw); }
.help-hero { display: flex; align-items: center; gap: 22px; padding: 14px 17px; margin-bottom: 19px; border: 1px solid var(--line-soft); border-radius: 17px; background: rgba(255, 255, 255, .022); }
.help-hero p { margin: 0; max-width: 300px; color: rgba(212, 245, 237, .54); font-family: var(--serif); font-size: 13px; line-height: 1.75; letter-spacing: .04em; }
.help-vials { flex: none; display: flex; align-items: center; gap: 7px; }
.hv { width: 22px; height: 53px; display: flex; flex-direction: column-reverse; gap: 1px; padding: 3px; border: 1px solid rgba(224, 255, 248, .22); border-radius: 4px 4px 9px 9px; background: rgba(255, 255, 255, .035); box-shadow: inset 0 0 8px rgba(174, 255, 238, .06); }
.hv i { display: block; height: 10px; border-radius: 1.5px; }
.hv-a i:nth-child(1) { background: #ffb347; } .hv-a i:nth-child(2) { background: #36cfe0; } .hv-a i:nth-child(3) { background: #b9e04b; }
.hv-b i:nth-child(1) { background: #ff6b7a; } .hv-b i:nth-child(2) { background: #b06cff; }
.hv-c i:nth-child(1) { background: #b06cff; } .hv-c i:nth-child(2) { background: #b06cff; } .hv-c i:nth-child(3) { background: #b06cff; } .hv-c i:nth-child(4) { background: #b06cff; }
.help-arrow { color: rgba(185, 255, 236, .42); margin: 0 2px; }
.help-arrow .ico { width: 17px; height: 17px; }
.help-steps { display: flex; flex-direction: column; gap: 2px; margin: 0 0 17px; padding: 0; list-style: none; }
.help-steps li { display: flex; gap: 13px; padding: 11px 5px; border-bottom: 1px solid rgba(205, 255, 244, .055); }
.help-steps li:last-child { border-bottom: 0; }
.help-steps li > span { flex: none; width: 24px; padding-top: 1px; color: rgba(255, 212, 151, .58); font-family: var(--serif); font-size: 12px; letter-spacing: .04em; }
.help-steps strong { display: block; color: rgba(240, 255, 250, .86); font-size: 12px; font-weight: 500; letter-spacing: .06em; }
.help-steps p { margin: 3px 0 0; color: rgba(205, 239, 231, .43); font-size: 10.5px; line-height: 1.6; }
.help-tips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.help-tips > div { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(255, 255, 255, .02); color: rgba(203, 240, 231, .43); font-size: 9.5px; line-height: 1.5; }
.help-tips .ico { flex: none; width: 15px; height: 15px; color: var(--mint); }
.help-tips b { color: rgba(233, 255, 249, .72); font-weight: 500; }
.wide-btn {
  width: 100%; height: 50px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 14px; color: #05241e; background: linear-gradient(135deg, #a9fbe2, #6cdabe);
  box-shadow: 0 12px 34px rgba(78, 219, 179, .17), inset 0 1px 0 rgba(255, 255, 255, .35);
  font-weight: 600; font-size: 12px; letter-spacing: .14em;
  transition: transform .25s var(--ease-out), box-shadow .25s, background .25s;
}
.wide-btn:hover { transform: translateY(-1px); background: linear-gradient(135deg, #c4ffeb, #7fe8cc); box-shadow: 0 16px 40px rgba(78, 219, 179, .25), inset 0 1px 0 rgba(255, 255, 255, .4); }
.wide-btn:active { transform: translateY(0) scale(.99); }
.wide-btn .ico { width: 15px; height: 15px; }

/* Win */
.confetti-canvas { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.win-overlay .overlay-scrim { background: rgba(1, 12, 15, .68); backdrop-filter: blur(12px) saturate(.9); }
.win-modal {
  width: min(490px, 92vw); padding: 33px 34px 20px; text-align: center; overflow: hidden;
  z-index: 3;
  background:
    radial-gradient(120% 85% at 50% -10%, rgba(137, 255, 220, .16), transparent 52%),
    linear-gradient(155deg, rgba(12, 50, 48, .98), rgba(3, 24, 27, .99) 65%);
  border-color: rgba(195, 255, 238, .2);
}
.win-rings { position: absolute; inset: -45% -38% auto; height: 115%; pointer-events: none; opacity: .55; }
.win-rings i, .win-rings span, .win-rings b { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); border-radius: 50%; border: 1px solid rgba(159, 255, 230, .1); }
.win-rings i { width: 340px; height: 340px; animation: spin 70s linear infinite; border-style: dashed; }
.win-rings span { width: 250px; height: 250px; border-color: rgba(255, 213, 157, .1); }
.win-rings b { width: 430px; height: 430px; border-color: rgba(159, 255, 230, .05); }
.win-kicker { position: relative; display: block; margin-bottom: 6px; color: rgba(173, 238, 221, .45); font-size: 8px; font-weight: 600; letter-spacing: .38em; }
.win-modal h2 { position: relative; margin: 0; font-family: var(--serif); font-size: 38px; font-weight: 500; letter-spacing: .16em; line-height: 1.2; color: #f7fffc; text-shadow: 0 4px 34px rgba(123, 255, 219, .14); }
.win-sub { position: relative; margin: 7px 0 0; color: rgba(207, 242, 233, .42); font-size: 10px; letter-spacing: .15em; }
.win-stars { position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; margin: 17px 0 11px; }
.win-star { width: 50px; height: 50px; display: grid; place-items: center; color: rgba(214, 249, 240, .1); transform: scale(.8); transition: color .4s, filter .4s, transform .5s var(--ease-out); }
.win-star .ico { width: 34px; height: 34px; }
.win-star.is-earned { color: var(--gold); filter: drop-shadow(0 0 14px rgba(255, 202, 131, .35)); transform: scale(1); }
.win-star.is-earned:nth-child(1) { animation: star-pop .6s .18s var(--ease-out) both; }
.win-star.is-earned:nth-child(2) { animation: star-pop .6s .34s var(--ease-out) both; }
.win-star.is-earned:nth-child(3) { animation: star-pop .6s .5s var(--ease-out) both; }
@keyframes star-pop { 0% { transform: scale(.3) rotate(-12deg); opacity: .3; } 65% { transform: scale(1.14) rotate(2deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
.win-stats { position: relative; display: flex; align-items: center; justify-content: center; gap: 22px; padding: 13px 0 3px; }
.win-stats > div { display: flex; flex-direction: column; gap: 3px; }
.win-stats span { color: rgba(204, 240, 232, .36); font-size: 8px; letter-spacing: .12em; }
.win-stats strong { color: rgba(240, 255, 250, .9); font-family: var(--serif); font-size: 23px; font-weight: 500; font-variant-numeric: tabular-nums; }
.win-stats i { width: 1px; height: 24px; background: rgba(211, 255, 246, .09); }
.win-note { position: relative; min-height: 18px; margin: 14px 0 20px; color: rgba(205, 240, 231, .46); font-family: var(--serif); font-size: 11px; letter-spacing: .05em; }
.win-actions { position: relative; display: flex; gap: 8px; }
.ghost-btn { flex: 0 0 38%; height: 50px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-soft); border-radius: 14px; color: rgba(220, 249, 242, .6); background: rgba(255, 255, 255, .025); font-size: 10.5px; letter-spacing: .06em; transition: all .25s; }
.ghost-btn:hover { color: var(--ink); border-color: var(--line); background: rgba(255, 255, 255, .055); }
.ghost-btn .ico { width: 15px; height: 15px; }
.win-next { flex: 1; }

/* Rewarded undo placeholder */
.reward-modal {
  width: min(480px, 92vw); padding: 27px 28px 23px; overflow: hidden;
  text-align: center;
  background:
    radial-gradient(100% 80% at 50% -10%, rgba(255, 207, 139, .1), transparent 52%),
    linear-gradient(155deg, rgba(12, 48, 46, .99), rgba(3, 22, 26, .99));
}
.reward-kicker { display: block; color: var(--gold); font-size: 8px; font-weight: 600; letter-spacing: .26em; }
.reward-modal h2 { margin: 7px 0 8px; font-family: var(--serif); font-size: 28px; font-weight: 500; letter-spacing: .08em; }
.reward-body { margin: 0 auto; max-width: 380px; color: rgba(205, 240, 231, .5); font-size: 10.5px; line-height: 1.65; }
.reward-stage {
  position: relative; aspect-ratio: 16 / 9; margin: 17px 0 18px;
  display: grid; place-items: center; overflow: hidden;
  border: 1px solid rgba(190, 255, 241, .16); border-radius: 15px;
  background:
    radial-gradient(55% 100% at 18% 40%, rgba(115, 255, 215, .18), transparent 65%),
    radial-gradient(55% 100% at 82% 55%, rgba(255, 202, 125, .11), transparent 65%),
    linear-gradient(145deg, #0a3a39, #051e23);
}
.reward-stage::after {
  content: ""; position: absolute; inset: -40%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, .08) 50%, transparent 58%);
  animation: reward-sweep 3.6s linear infinite;
}
@keyframes reward-sweep { from { transform: translateX(-38%); } to { transform: translateX(38%); } }
.reward-ad-tag { position: absolute; top: 10px; left: 11px; z-index: 2; padding: 3px 6px; border-radius: 4px; background: rgba(255, 216, 155, .9); color: #35230d; font-size: 7px; font-weight: 700; letter-spacing: .16em; }
.reward-ring { position: absolute; width: 145px; height: 145px; border: 1px solid rgba(163, 255, 232, .18); border-radius: 50%; box-shadow: 0 0 45px rgba(105, 255, 218, .12); animation: reward-ring 2.4s ease-in-out infinite; }
@keyframes reward-ring { 0%,100% { transform: scale(.9); opacity: .55; } 50% { transform: scale(1.08); opacity: 1; } }
.reward-count { position: relative; z-index: 2; color: #f4fffb; font-family: var(--serif); font-size: 54px; font-weight: 500; line-height: 1; text-shadow: 0 0 28px rgba(123, 255, 219, .25); }
.reward-stage-label { position: absolute; bottom: 11px; z-index: 2; color: rgba(204, 243, 233, .45); font-size: 7px; letter-spacing: .2em; }
.reward-stage.is-ready { border-color: rgba(168, 255, 232, .38); }
.reward-stage.is-ready .reward-count { color: var(--mint); }
.reward-actions { display: flex; gap: 8px; }
.reward-actions .ghost-btn { flex: 0 0 34%; height: 45px; }
.reward-claim { flex: 1; height: 45px; font-size: 9.5px; line-height: 1.25; white-space: normal; padding: 0 10px; }
.reward-claim:disabled { opacity: .34; filter: saturate(.45); box-shadow: none; cursor: default; }

.noscript { position: fixed; inset: auto 20px 20px; z-index: 200; padding: 14px; text-align: center; background: #082f34; border-radius: 12px; }

/* ————— Responsive ————— */
@media (max-width: 900px) {
  .app { padding-left: 16px; padding-right: 16px; }
  .brand { min-width: 150px; }
  .top-actions { min-width: 150px; }
  .chapter-pill { min-width: 190px; }
  .level-grid { gap: 7px; }
  .level-card { min-height: 94px; padding: 10px; }
  .lc-vial { right: 8px; bottom: 9px; }
}
@media (max-width: 720px) {
  .app { padding: 9px 9px 7px; gap: 7px; }
  .topbar { min-height: 44px; gap: 8px; }
  .brand { min-width: 0; gap: 8px; }
  .brand-mark { width: 37px; height: 37px; }
  .brand-mark .ico { width: 18px; height: 18px; }
  .brand-copy strong { font-size: 15px; letter-spacing: .12em; }
  .brand-copy small { font-size: 6px; letter-spacing: .28em; margin-top: 5px; }
  .chapter-pill { min-width: 0; width: 150px; height: 44px; padding: 5px 11px 8px; gap: 8px; border-radius: 13px; }
  .chapter-index { font-size: 20px; }
  .chapter-divider { height: 21px; }
  .chapter-copy small { font-size: 7.5px; letter-spacing: .12em; }
  .chapter-copy strong { font-size: 9px; }
  .chapter-progress { left: 11px; right: 11px; bottom: 4px; }
  .top-actions { min-width: 0; gap: 2px; }
  .icon-btn { width: 36px; height: 36px; }
  .icon-btn .ico { width: 17px; height: 17px; }
  .play-card { border-radius: 23px; }
  .play-head { padding: 13px 16px 0; gap: 10px; }
  .eyebrow { font-size: 7.5px; letter-spacing: .19em; margin-bottom: 3px; }
  .eyebrow-line { width: 16px; }
  .level-heading h1 { font-size: 23px; letter-spacing: .08em; gap: 8px; }
  .level-number { font-size: 7.5px; letter-spacing: .13em; }
  .metrics { gap: 14px; }
  .metric span { font-size: 7.5px; letter-spacing: .13em; }
  .metric strong { font-size: 21px; }
  .scene { margin: 0 2px; }
  .scene-ring { width: min(440px, 86vw); }
  .scene-map-btn { display: none; }
  .play-foot { padding: 6px 14px 11px; flex-direction: column; gap: 7px; align-items: stretch; }
  .foot-meta { justify-content: space-between; gap: 10px; }
  .tip { font-size: 9px; white-space: normal; line-height: 1.3; max-width: 62%; min-height: 5.3em; align-items: center; }
  .par-chip { font-size: 8.5px; }
  .par-chip b { font-size: 14px; }
  .dock { width: 100%; gap: 6px; }
  .action { flex: 1; height: 39px; justify-content: center; padding: 0 5px; gap: 5px; font-size: 9.5px; letter-spacing: .04em; }

  .action .ico { width: 15px; height: 15px; }
  .action-primary { flex: 1.4; }
  .page-foot { display: none; }
  .coach { bottom: 4px; padding: 10px 11px; gap: 9px; }
  .coach p { font-size: 9.5px; }
  .overlay { padding: 10px; }
  .modal { width: 100%; max-height: 92dvh; padding: 20px 15px 18px; border-radius: 22px; }
  .modal h2 { font-size: 23px; }
  .level-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .chapter-tabs { gap: 5px; margin-bottom: 12px; }
  .chapter-tab { flex: 0 0 64px; min-width: 64px; height: 39px; padding: 4px 7px; column-gap: 5px; }
  .chapter-tab .ct-roman { font-size: 12px; }
  .chapter-tab .ct-name { font-size: 8px; }
  .chapter-tab .ct-stars { font-size: 7px; }
  .chapter-tab.active::after { bottom: -5px; left: 7px; right: 7px; }
  .level-card { min-height: 85px; padding: 9px; border-radius: 12px; }
  .lc-num { font-size: 18px; }
  .lc-name { font-size: 8px; margin-top: 4px; }
  .lc-stars { margin-top: 10px; }
  .lc-vial { width: 10px; height: 25px; right: 8px; bottom: 8px; }
  .lc-badge { display: none; }
  .level-summary { grid-template-columns: auto 1fr; gap: 10px; padding: 9px 11px; }
  .summary-label { display: none; }
  .summary-progress { grid-column: 1 / -1; }
  .help-hero { gap: 12px; padding: 11px; }
  .help-hero p { font-size: 11px; }
  .help-vials { gap: 4px; }
  .hv { width: 18px; height: 44px; }
  .hv i { height: 8px; }
  .help-tips { grid-template-columns: 1fr; }
  .help-steps li { padding: 9px 3px; gap: 9px; }
  .win-modal { padding: 26px 20px 17px; }
  .win-modal h2 { font-size: 32px; }
  .reward-modal { padding: 22px 17px 17px; }
  .reward-modal h2 { font-size: 24px; }
  .reward-body { font-size: 9.5px; }
  .reward-stage { margin: 13px 0 14px; }
  .win-stars { margin: 12px 0 7px; }
  .win-star { width: 42px; height: 42px; }
  .win-star .ico { width: 28px; height: 28px; }
  .win-actions { flex-direction: column; }
  .ghost-btn { flex: none; height: 45px; }
  .win-next { height: 48px; }
  .win-stats { gap: 17px; }
  .win-stats strong { font-size: 20px; }
}
@media (max-width: 430px) {
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 14px; }
  .chapter-pill { width: 118px; }
  .chapter-copy small { display: none; }
  .chapter-copy strong { font-size: 8.5px; }
  .chapter-index { font-size: 18px; }
  .chapter-divider { height: 18px; }
  .metrics .best-metric { display: none; }
  .level-heading h1 { font-size: 21px; }
  .tip { max-width: 56%; }
  .overlay { padding: 7px; }
  .level-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-height: 690px) {
  .app { padding-top: 9px; padding-bottom: 7px; gap: 7px; }
  .topbar { min-height: 44px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: 16px; }
  .chapter-pill { height: 44px; }
  .play-head { padding-top: 11px; }
  .level-heading h1 { font-size: 24px; }
  .eyebrow { margin-bottom: 3px; }
  .metric strong { font-size: 21px; }
  .play-foot { padding-top: 5px; padding-bottom: 10px; }
  .action { height: 38px; }
  .page-foot { display: none; }
}
@media (max-width: 920px) and (max-height: 560px) and (orientation: landscape) {
  .app { padding: 5px 12px 5px; gap: 5px; }
  .topbar { min-height: 36px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy small { display: none; }
  .chapter-pill { height: 36px; width: 140px; padding: 3px 10px 6px; }
  .chapter-index { font-size: 17px; }
  .top-actions .icon-btn { width: 32px; height: 32px; }
  .play-head { padding: 7px 18px 0; }
  .eyebrow { display: none; }
  .level-heading h1 { font-size: 21px; }
  .metric strong { font-size: 19px; }
  .play-foot { padding: 3px 18px 7px; }
  .action { height: 34px; font-size: 10px; }
  .tip { font-size: 9.5px; }
  .page-foot { display: none; }
  .scene-map-btn { display: none; }
}
html[lang="ja"] { --sans: "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans SC", "Segoe UI", sans-serif; --serif: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", "Noto Serif SC", "SimSun", serif; }
html[lang="ko"] { --sans: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans SC", "Segoe UI", sans-serif; --serif: "Noto Serif KR", "Batang", "Noto Serif SC", "SimSun", serif; }
html[lang="ru"] { --sans: "Segoe UI", "Noto Sans SC", "Arial", sans-serif; }

/* Language chooser */
.language-modal { width: min(570px, 94vw); }
.language-hint { margin: -4px 0 16px; color: rgba(208, 241, 233, .47); font-size: 10.5px; line-height: 1.6; }
.language-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.language-option {
  position: relative; min-height: 64px; padding: 11px 13px; text-align: left;
  border: 1px solid var(--line-soft); border-radius: 13px;
  background: rgba(255, 255, 255, .022);
  transition: border-color .25s, background .25s, transform .25s var(--ease-out);
}
.language-option:hover { transform: translateY(-1px); border-color: var(--chapter-soft); background: rgba(255, 255, 255, .045); }
.language-option.active { border-color: var(--chapter-soft); background: linear-gradient(145deg, var(--chapter-glow), rgba(255, 255, 255, .025)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }
.language-option .lang-native { display: block; color: rgba(241, 255, 251, .9); font-family: var(--sans); font-size: 14px; letter-spacing: .02em; }
.language-option .lang-code { display: block; margin-top: 4px; color: rgba(205, 239, 231, .34); font-size: 8px; letter-spacing: .14em; text-transform: uppercase; }
.language-option.active .lang-code { color: var(--chapter-accent); }
.language-option .lang-check { position: absolute; right: 10px; top: 10px; width: 13px; height: 13px; color: var(--chapter-accent); opacity: 0; }
.language-option.active .lang-check { opacity: 1; }
.language-legal { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line-soft); color: rgba(200, 239, 231, .26); font-size: 8px; letter-spacing: .05em; }
.language-legal a, .language-legal button { color: rgba(200, 239, 231, .42); transition: color .2s; }
.language-legal a:hover, .language-legal button:hover { color: rgba(235, 255, 249, .82); }

.chapter-copy { min-width: 0; overflow: hidden; }
.chapter-copy small, .chapter-copy strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 720px) {
  #levelsBtn { display: none; }
  .language-modal { width: 100%; }
  .language-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .language-option { min-height: 57px; padding: 9px 11px; }
  .language-option .lang-native { font-size: 13px; }
  .language-option .lang-code { font-size: 7px; }
  .ad-unit--main { max-width: 320px; height: 100px; }
  .ad-unit--map { max-width: 320px; height: 100px; margin-bottom: 12px; }
  .ad-unit--win { max-width: 320px; height: 50px; margin-top: 11px; }
  .ad-note { display: none; }
  .ad-tag { font-size: 6.5px; }
  html[lang="ru"] .brand-copy strong { font-size: 12px; letter-spacing: .03em; white-space: nowrap; }
  html[lang="ru"] .brand-copy small { letter-spacing: .18em; }
  .consent-banner { bottom: max(10px, env(safe-area-inset-bottom)); width: calc(100vw - 20px); }
  .consent-card { flex-direction: column; align-items: stretch; gap: 10px; padding: 13px 14px; }
  .consent-actions { justify-content: flex-end; flex-wrap: wrap; }
  .consent-copy p { font-size: 9px; }
}

@media (max-width: 720px) and (max-height: 700px) {
  .ad-rail { display: none; }
}

@media (max-width: 360px), (max-width: 430px) and (max-height: 690px) {
  .topbar { gap: 5px 6px; }
  .brand { gap: 6px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-copy strong { font-size: 13px; letter-spacing: .02em; white-space: nowrap; }
  .chapter-pill { width: 112px; padding: 4px 8px 7px; gap: 6px; }
  .chapter-index { font-size: 16px; }
  .chapter-divider { height: 16px; }
  .chapter-copy strong { font-size: 7.5px; letter-spacing: 0; }
}

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