:root {
  --ink: #f4eefe;
  --muted: #b3a6d6;
  --panel: rgba(27, 18, 64, 0.84);
  --edge: rgba(200, 170, 255, 0.24);
  --amber: #ffc65c;
  --mint: #4fe0c8;
  --rose: #ff5f7e;
  --gem: #ffe45c;
  --deep: #a99bff;
  --rare: #5ad8ff;
  --school: #7be38b;
  --clever: #ff8f6b;
  --plankton: #b9b0c9;
  --none: #ff5f7e;
  --round: "Trebuchet MS", ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  --num: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #120b2c; }
body { margin: 0; color: var(--ink); font: 16px/1.6 var(--round); background: #120b2c; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--amber); }

* { scrollbar-width: thin; scrollbar-color: rgba(255, 198, 92, 0.45) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 198, 92, 0.35); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- stage and sky ---------- */
.stage { position: relative; height: 100svh; min-height: 560px; overflow: hidden; overflow: clip; background: #2c1d68; }
body.playing { overflow: hidden; }
body.playing .stage { position: fixed; inset: 0; height: auto; min-height: 0; z-index: 5; }
body.playing .content, body.playing .foot { display: none; }

.scene { position: absolute; left: 0; right: 0; top: 0; height: 5600px; will-change: transform; transition: transform 1.7s cubic-bezier(0.5, 0, 0.15, 1); overflow: hidden; }
.scene .sky { position: absolute; inset: 0;
  background: linear-gradient(180deg, #04020c 0, #08061a 360px, #0f0b2c 1500px, #191248 2600px, #22175a 2970px, #2e1d6c 3440px, #46288a 3800px, #7a3a98 4120px, #c2588f 4380px, #ff8e6e 4510px, #ffc26b 4560px, #ffc26b 100%); }
.scene .stars { position: absolute; left: 0; right: 0; top: 0; pointer-events: none;
  background-image: radial-gradient(1.6px 1.6px at 12% 18%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 33% 62%, #fff 50%, transparent 52%), radial-gradient(1.2px 1.2px at 58% 34%, #fff 50%, transparent 52%), radial-gradient(1px 1px at 81% 76%, #fff 50%, transparent 52%), radial-gradient(1.8px 1.8px at 92% 12%, #ffe9b8 50%, transparent 52%), radial-gradient(1px 1px at 47% 88%, #d9d0ff 50%, transparent 52%);
  background-size: 230px 210px, 170px 190px, 310px 260px, 140px 150px, 420px 380px, 260px 240px;
  mask-image: linear-gradient(180deg, #000 70%, transparent); -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
  animation: twinkle 7s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: 0.65; } to { opacity: 1; } }
.scene .aurora { position: absolute; left: -10%; right: -10%; pointer-events: none; opacity: 0.5; filter: blur(18px);
  background: linear-gradient(100deg, transparent 8%, rgba(79, 224, 200, 0.55) 22%, transparent 34%, rgba(169, 155, 255, 0.5) 52%, transparent 63%, rgba(79, 224, 200, 0.45) 78%, transparent 90%);
  mask-image: linear-gradient(180deg, transparent, #000 35%, #000 65%, transparent); -webkit-mask-image: linear-gradient(180deg, transparent, #000 35%, #000 65%, transparent);
  animation: aurora 14s ease-in-out infinite alternate; }
@keyframes aurora { from { transform: translateX(-4%) skewX(-6deg); } to { transform: translateX(4%) skewX(6deg); } }
.scene .orbit { position: absolute; left: 0; right: 0; border-top: 2px dashed rgba(255, 198, 92, 0.45); }
.scene .moon { position: absolute; right: 18%; width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fffaf0, #e9dfc9 60%, #c9bda6); box-shadow: 0 0 40px rgba(255, 244, 214, 0.35); }
.scene .moon::after { content: ""; position: absolute; left: 40px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: rgba(160, 145, 120, 0.4); box-shadow: -22px 20px 0 -2px rgba(160, 145, 120, 0.35); }
.scene .sun { position: absolute; left: 62%; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, #fff3b0 0, #ffcf6b 45%, rgba(255, 150, 90, 0) 70%); }
.scene .meteor { position: absolute; width: 90px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff); transform: rotate(-24deg); opacity: 0; animation: meteor 6s ease-in infinite; }
@keyframes meteor { 0%, 80% { opacity: 0; translate: 0 0; } 84% { opacity: 1; } 100% { opacity: 0; translate: 160px 70px; } }
.scene .cloud { position: absolute; color: rgba(255, 214, 230, 0.82); transform: scale(var(--s, 1)); animation: drift 90s ease-in-out infinite alternate; }
.scene .cloud svg { display: block; filter: drop-shadow(0 6px 0 rgba(140, 60, 120, 0.25)); }
@keyframes drift { from { translate: -9vw 0; } to { translate: 9vw 0; } }
.scene .flock { position: absolute; left: 0; color: #3a2050; animation: fly 30s linear infinite; }
.scene .plane { position: absolute; left: 0; animation: fly 46s linear infinite; }
.scene .probe { position: absolute; left: 72%; animation: float 7s ease-in-out infinite; }
.scene .sat { position: absolute; left: 0; animation: fly 60s linear infinite reverse; }
.scene .sat.slow { animation-duration: 95s; }
.scene .sat.fast { animation-duration: 34s; }
@keyframes fly { from { transform: translateX(-120px); } to { transform: translateX(calc(100vw + 120px)); } }
@keyframes float { 0%, 100% { translate: 0 -6px; } 50% { translate: 0 6px; } }
.scene .mark { position: absolute; font: 600 11px/1.3 var(--round); letter-spacing: 0.06em; color: rgba(236, 226, 255, 0.6); white-space: nowrap; transition: opacity 0.6s; }
.scene .mark.l { left: 14px; }
.scene .mark.r { right: 64px; text-align: right; }
.scene .mark.zone { color: #fff3d6; font-weight: 800; letter-spacing: 0.12em; }
body:not(.playing) .scene .mark { opacity: 0; }
.scene .land { position: absolute; left: 0; right: 0; height: 1100px; background: #22122f; }
.scene .land svg { display: block; }

.ruler { position: absolute; top: 0; bottom: 0; right: 0; width: 60px; pointer-events: none; }
.ruler-track { position: absolute; right: 8px; top: 0; height: 5600px; width: 52px; border-right: 2px solid rgba(236, 226, 255, 0.3); transition: transform 1.7s cubic-bezier(0.5, 0, 0.15, 1); will-change: transform; }
.ruler-track i { position: absolute; right: 0; width: 6px; border-top: 1px solid rgba(236, 226, 255, 0.4); }
.ruler-track i.big { width: 12px; border-color: rgba(255, 198, 92, 0.7); }
.ruler-track span { position: absolute; right: 16px; font: 10px var(--num); color: rgba(236, 226, 255, 0.65); transform: translateY(-50%); white-space: nowrap; }
.you { position: absolute; right: 8px; top: 42%; font: 800 10px var(--round); letter-spacing: 0.1em; color: var(--amber); transform: translateY(-50%); }
.you::after { content: ""; display: inline-block; width: 20px; height: 2px; border-radius: 2px; background: var(--amber); vertical-align: middle; margin-left: 4px; }

.craft { position: absolute; left: 14%; top: 42%; width: 48px; height: 64px; transform: translateY(-50%); transform-origin: 50% 20%; animation: sway 4s ease-in-out infinite; filter: drop-shadow(0 0 12px var(--glow, rgba(255, 120, 90, 0.5))); }
.craft svg { display: block; }
@keyframes sway { 0%, 100% { rotate: -3deg; translate: 0 -3px; } 50% { rotate: 3deg; translate: 0 3px; } }
.craft.rising { animation: lift 0.5s ease-in-out infinite; }
@keyframes lift { 0%, 100% { translate: 0 2px; } 50% { translate: 0 -2px; } }
.craft .flame { transform-origin: 50% 0; animation: flame 0.18s steps(2) infinite; }
.craft:not(.rising) .flame { opacity: 0.35; }
@keyframes flame { 50% { transform: scaleY(0.75); } }

/* ---------- hud ---------- */
.hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; z-index: 3; pointer-events: none; }
.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; padding: 6px 14px; min-width: 100px; }
.panel small, .dots-wrap small { display: block; font: 700 9px var(--round); letter-spacing: 0.22em; color: var(--muted); }
.panel b { font: 800 20px var(--num); color: var(--amber); }
.panel b.hot { color: var(--mint); }
.panel.right { text-align: right; }
.dots-wrap { text-align: center; padding-top: 6px; }
.dots { display: flex; gap: 5px; justify-content: center; }
.dots i { width: 15px; height: 15px; border-radius: 50%; background: rgba(27, 18, 64, 0.85); border: 1px solid var(--edge); }
.dots i.now { background: transparent; border: 2px solid var(--amber); box-shadow: 0 0 8px rgba(255, 198, 92, 0.7); }
.dots i.t-gem { background: var(--gem); } .dots i.t-deep { background: var(--deep); } .dots i.t-rare { background: var(--rare); }
.dots i.t-school { background: var(--school); } .dots i.t-clever { background: var(--clever); } .dots i.t-plankton { background: var(--plankton); } .dots i.t-none { background: var(--none); }
.dots-wrap small { margin-top: 4px; }

.menu-btn { position: absolute; top: 72px; left: 10px; z-index: 6; width: 42px; height: 38px; border-radius: 12px; background: var(--panel); border: 1px solid var(--edge); display: grid; place-content: center; gap: 4px; }
.menu-btn span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); }
.menu { position: absolute; top: 116px; left: 10px; z-index: 6; display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--edge); border-radius: 16px; padding: 6px; min-width: 190px; backdrop-filter: blur(8px); }
.menu[hidden] { display: none; }
.menu button, .menu a { text-align: left; background: none; border: 0; padding: 10px 14px; border-radius: 10px; color: var(--ink); text-decoration: none; font: 700 15px var(--round); }
.menu button:hover, .menu a:hover { background: rgba(255, 198, 92, 0.12); }

/* ---------- screens ---------- */
.app { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; pointer-events: none; }
.app > * { pointer-events: auto; }

.home { margin: auto; text-align: center; padding: 120px 20px 40px; max-width: 560px; }
.badge { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin: 0 0 14px; padding: 5px 14px; border-radius: 999px; background: rgba(27, 18, 64, 0.7); border: 1px solid var(--edge); font: 600 13px var(--round); color: var(--muted); }
.badge b { color: var(--amber); }
.badge .reset { font-family: var(--num); font-size: 12px; }
.title { margin: 0; font: 900 clamp(40px, 12vw, 68px)/1 var(--round); letter-spacing: 0.08em; color: #fff7e6; text-shadow: 0 4px 0 #7a3a98, 0 0 34px rgba(255, 198, 92, 0.45); }
.title span { display: block; font-size: 0.58em; letter-spacing: 0.2em; margin-top: 6px; color: var(--amber); }
.sub { margin: 12px 0 0; font: 800 14px var(--round); letter-spacing: 0.38em; color: #ffe0b8; }
.tag { margin: 12px 0 26px; font: 15px var(--round); color: #eadfff; }
.go { display: inline-block; font: 900 18px var(--round); letter-spacing: 0.08em; padding: 15px 32px; border-radius: 999px; border: 0; color: #2a1600; background: linear-gradient(180deg, #ffd98a, #ffb84d); box-shadow: 0 0 26px rgba(255, 184, 77, 0.45), 0 5px 0 #b3661a; }
.go:active { transform: translateY(3px); box-shadow: 0 0 26px rgba(255, 184, 77, 0.45), 0 2px 0 #b3661a; }
.go.ghosty { background: var(--panel); color: var(--ink); border: 1px solid var(--edge); box-shadow: none; font-size: 14px; font-weight: 700; padding: 11px 18px; }
.go.ghosty:hover { border-color: var(--amber); }
a.go { text-decoration: none; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.small { font: 600 12px var(--round); color: #eadfff; letter-spacing: 0.08em; margin-top: 16px; }
.stats { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.stats div { background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; padding: 6px 14px; min-width: 76px; }
.stats b { display: block; font: 800 18px var(--num); color: var(--mint); }
.stats span { font: 700 9px var(--round); letter-spacing: 0.18em; color: var(--muted); }
button.stats { background: none; border: 0; padding: 0; margin-left: auto; margin-right: auto; color: inherit; }
button.stats:hover div { border-color: var(--mint); }

.prompt-card { margin: 128px 66px 0 12px; background: var(--panel); border: 1px solid var(--edge); border-left: 4px solid var(--amber); border-radius: 16px; padding: 16px 18px; backdrop-filter: blur(4px); max-width: 640px; }
.prompt-card small { font: 800 11px var(--round); letter-spacing: 0.26em; color: var(--amber); }
.prompt-card h2 { margin: 8px 0; font: 800 clamp(22px, 5.4vw, 31px)/1.25 var(--round); }
.prompt-card p { margin: 0; font: 600 12px var(--round); letter-spacing: 0.1em; color: var(--muted); }

.bar { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgba(18, 11, 44, 0.92) 40%); }
.clock { position: relative; width: 58px; height: 58px; flex: none; }
.clock svg { width: 58px; height: 58px; transform: rotate(-90deg); }
.clock circle { fill: rgba(27, 18, 64, 0.92); stroke: rgba(200, 170, 255, 0.2); stroke-width: 4; }
.clock circle.left { fill: none; stroke: var(--mint); stroke-linecap: round; transition: stroke-dashoffset 0.1s linear; }
.clock b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 18px var(--num); color: var(--mint); }
.clock.hurry circle.left, .clock.hurry b { stroke: var(--rose); color: var(--rose); }
.clock.paused b { color: var(--muted); }
.clock.paused circle.left { stroke: var(--muted); }
.bar form { flex: 1; display: flex; gap: 8px; min-width: 0; }
.bar input { flex: 1; min-width: 0; font: 700 18px var(--round); padding: 14px 18px; border-radius: 999px; background: rgba(27, 18, 64, 0.94); color: var(--ink); border: 2px solid var(--edge); outline: none; }
.bar input:focus { border-color: var(--mint); }
.bar input.miss { border-color: var(--none); animation: miss 0.32s ease-in-out; }
@keyframes miss { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.bar .send { font: 900 16px var(--round); letter-spacing: 0.14em; padding: 0 22px; border-radius: 999px; border: 0; background: var(--mint); color: #0b2b26; box-shadow: 0 4px 0 #1f8f7d; }
.bar .send:disabled { opacity: 0.6; }
.err { position: absolute; bottom: 86px; left: 0; right: 0; text-align: center; font: 600 13px var(--round); color: var(--none); }
.err:not(:empty) { left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); margin: 0; padding: 7px 14px; border-radius: 999px; background: rgba(27, 18, 64, 0.94); border: 1px solid rgba(255, 95, 126, 0.5); color: #ff9db0; }

.verdict { margin: auto auto 28px; text-align: center; padding: 24px 24px 28px; max-width: 560px; width: calc(100% - 92px); background: rgba(27, 18, 64, 0.66); border: 1px solid var(--edge); border-radius: 22px; backdrop-filter: blur(5px); }
.verdict .label { font: 900 clamp(32px, 9vw, 52px)/1.05 var(--round); letter-spacing: 0.03em; text-shadow: 0 0 22px currentColor; }
.verdict .said { font: 700 19px var(--round); margin-top: 12px; }
.verdict .pts { font: 800 18px var(--round); margin-top: 10px; }
.verdict .pts em { font-style: normal; color: var(--amber); }
.verdict .note { font: 14px var(--round); color: var(--muted); margin-top: 8px; }
.verdict .fact { margin: 14px auto 0; max-width: 460px; background: var(--panel); border: 1px solid rgba(255, 228, 92, 0.5); border-radius: 14px; padding: 10px 14px; font-size: 14px; color: #fff3c4; }
.verdict .go { margin-top: 24px; }

.c-gem { color: var(--gem); } .c-deep { color: var(--deep); } .c-rare { color: var(--rare); } .c-school { color: var(--school); }
.c-clever { color: var(--clever); } .c-plankton { color: var(--plankton); } .c-none { color: var(--none); }

.sheet { position: absolute; inset: 0; overflow-y: auto; z-index: 4; padding: 76px 12px 40px; background: linear-gradient(180deg, rgba(18, 11, 44, 0.2), rgba(18, 11, 44, 0.9) 30%); }
.sheet .inner { max-width: 640px; margin: 0 auto; }
.summary { text-align: center; padding: 30px 0 10px; }
.summary small { font: 800 11px var(--round); letter-spacing: 0.3em; color: var(--muted); }
.summary .alt { font: 900 clamp(48px, 15vw, 80px)/1 var(--num); color: #fff7e6; text-shadow: 0 0 30px rgba(255, 198, 92, 0.55); margin: 10px 0 4px; }
.summary .zone { font: 900 15px var(--round); letter-spacing: 0.22em; color: var(--amber); text-transform: uppercase; }
.summary .score { font: 700 16px var(--round); margin-top: 8px; }
.summary .squares { font-size: 24px; letter-spacing: 3px; margin: 12px 0 0; }
.summary .beat { font: 14px var(--round); color: var(--muted); margin-top: 6px; }
.box { background: var(--panel); border: 1px solid var(--edge); border-radius: 16px; margin-top: 10px; }
.box > button { width: 100%; text-align: left; background: none; border: 0; padding: 12px 16px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.box .q { font-size: 13px; color: var(--muted); }
.box .a { font: 800 16px var(--round); overflow-wrap: anywhere; }
.box .chip { flex: none; }
.box .more { padding: 0 16px 14px; font-size: 14px; }
.box .more h4 { margin: 12px 0 4px; font: 800 12px var(--round); letter-spacing: 0.12em; }
.box .more p { margin: 0; color: #e2d8f7; }
.box .gemfact { color: #fff3c4; }
.check { display: flex; gap: 6px; margin-top: 12px; }
.check input { flex: 1; min-width: 0; font: 15px var(--round); padding: 9px 14px; border-radius: 999px; background: rgba(18, 11, 44, 0.9); color: var(--ink); border: 1px solid var(--edge); }
.check button { border: 0; border-radius: 999px; padding: 0 16px; background: var(--mint); color: #0b2b26; font: 800 13px var(--round); }
.check-out { font: 13px var(--round); margin-top: 6px; min-height: 1.2em; }

.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font: 800 12px var(--round); color: #1b1240; white-space: nowrap; }
.t-gem { background: var(--gem); } .t-deep { background: var(--deep); } .t-rare { background: var(--rare); } .t-school { background: var(--school); }
.t-clever { background: var(--clever); } .t-plankton { background: var(--plankton); } .t-none { background: var(--none); color: #fff; }

.list { display: grid; gap: 6px; margin-top: 12px; }
.list button { display: flex; justify-content: space-between; background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; padding: 12px 16px; font: 700 15px var(--round); }
.list button:hover { border-color: var(--amber); }
.list .date { color: var(--muted); font-weight: 400; }
.modal-text { max-width: 560px; margin: 0 auto; font-size: 15px; }
.modal-text h2 { font: 900 22px var(--round); letter-spacing: 0.06em; text-align: center; }
.modal-text li { margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: #fff7e6; color: #2a1600; padding: 10px 20px; border-radius: 999px; font: 800 14px var(--round); z-index: 40; max-width: calc(100vw - 24px); text-align: center; }

/* ---------- modal: tutorial, settings, stats ---------- */
.modal-back { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 12px; background: rgba(18, 11, 44, 0.62); backdrop-filter: blur(3px); overflow-y: auto; }
.modal-back.in-flight { bottom: 88px; align-items: start; }
.modal { position: relative; width: min(480px, 100%); max-height: calc(100svh - 24px); overflow-y: auto; background: #1b1240; border: 1px solid rgba(200, 170, 255, 0.35); border-radius: 22px; padding: 16px 18px 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 0 50px rgba(255, 198, 92, 0.05); outline: none; }
.modal-back.in-flight .modal { max-height: calc(100svh - 112px); }
.modal h2 { margin: 6px 0 8px; font: 900 20px/1.25 var(--round); letter-spacing: 0.04em; text-align: center; color: #fff7e6; }
.modal h3 { margin: 18px 0 8px; font: 800 11px var(--round); letter-spacing: 0.26em; color: var(--muted); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head small { font: 800 11px var(--round); letter-spacing: 0.26em; color: var(--amber); }
.modal .x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.05); font: 700 20px/1 var(--round); color: var(--ink); }
.modal .x:hover { border-color: var(--amber); }
.modal :focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.modal .fine { font: 12px/1.5 var(--round); color: var(--muted); margin: 14px 0 0; text-align: center; }

.tut-art { margin: 12px 0 4px; border-radius: 16px; padding: 14px; background: linear-gradient(180deg, #2e1d6c, #7a3a98 75%, #c2588f); border: 1px solid rgba(255, 210, 230, 0.3); position: relative; overflow: hidden; }
.tut-art.mock small { font: 800 10px var(--round); letter-spacing: 0.26em; color: var(--amber); }
.tut-art.mock > b { display: block; margin: 4px 0 12px; font: 800 19px/1.25 var(--round); }
.mock-bar { display: flex; gap: 8px; align-items: center; }
.mock-clock { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 3px solid var(--mint); font: 800 14px var(--num); color: var(--mint); background: rgba(27, 18, 64, 0.92); }
.mock-input { flex: 1; min-width: 0; padding: 9px 14px; border-radius: 999px; background: rgba(27, 18, 64, 0.94); border: 2px solid var(--mint); font: 700 15px var(--round); white-space: nowrap; overflow: hidden; }
.mock-input i { display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--amber); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.mock-go { flex: none; padding: 9px 14px; border-radius: 999px; background: var(--mint); color: #0b2b26; font: 900 12px var(--round); letter-spacing: 0.12em; }
.ladder { display: grid; gap: 8px; }
.rung { display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(40px, 1fr) 34px; gap: 8px; align-items: center; font: 700 14px var(--round); }
.rung .said { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rung b { text-align: right; font-family: var(--num); color: var(--amber); }
.meter { display: block; height: 8px; border-radius: 4px; background: rgba(18, 11, 44, 0.6); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair .card { background: rgba(27, 18, 64, 0.85); border: 1px solid var(--edge); border-radius: 14px; padding: 10px; display: grid; gap: 6px; align-content: start; }
.pair .card.gem { border-color: rgba(255, 228, 92, 0.6); }
.pair .card.clever { border-color: rgba(255, 143, 107, 0.6); }
.pair .card .chip { justify-self: start; white-space: normal; border-radius: 10px; }
.pair .card b { font: 800 16px var(--round); }
.pair .card small { font-size: 12.5px; line-height: 1.45; color: #e2d8f7; }
.tut-text { margin: 0; font-size: 15px; line-height: 1.55; color: #eadfff; text-align: center; }
.tut-dots { display: flex; justify-content: center; gap: 6px; margin: 14px 0 12px; }
.tut-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(200, 170, 255, 0.28); }
.tut-dots i.on { background: var(--amber); box-shadow: 0 0 8px rgba(255, 198, 92, 0.7); }
.tut-nav { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; }
.tut-nav .go { width: 100%; padding: 13px 10px; font-size: 15px; }
.tut-nav .go.ghosty { font-size: 13px; }

.opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(200, 170, 255, 0.14); cursor: pointer; }
.opt b { display: block; font: 800 15px var(--round); }
.opt small { display: block; font-size: 13px; line-height: 1.4; color: var(--muted); margin-top: 2px; }
.opt input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 26px; border-radius: 13px; background: rgba(200, 170, 255, 0.2); border: 1px solid var(--edge); position: relative; cursor: pointer; margin: 0; transition: background 0.2s; }
.opt input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #e2d8f7; transition: transform 0.2s; }
.opt input:checked { background: var(--mint); border-color: var(--mint); }
.opt input:checked::after { transform: translateX(20px); background: #0b2b26; }
.chips-preview { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0 4px; }
.skins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.skin { display: grid; justify-items: center; gap: 4px; padding: 10px 6px; border-radius: 16px; background: rgba(27, 18, 64, 0.85); border: 1px solid var(--edge); text-align: center; }
.skin .skin-art { display: grid; place-items: center; height: 68px; }
.skin b { font: 800 13px var(--round); }
.skin small { font: 11px/1.35 var(--round); color: var(--muted); }
.skin.on { border-color: var(--amber); box-shadow: 0 0 14px rgba(255, 198, 92, 0.35); }
.skin.on small { color: var(--amber); }
.skin.locked .skin-art { filter: grayscale(1) brightness(1.5) opacity(0.4); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(18, 11, 44, 0.8); border: 1px solid var(--edge); }
.tabs button { border: 0; border-radius: 999px; padding: 9px 6px; background: none; font: 800 13px var(--round); letter-spacing: 0.08em; color: var(--muted); }
.tabs button.on { background: var(--amber); color: #2a1600; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.tiles div { background: rgba(27, 18, 64, 0.85); border: 1px solid var(--edge); border-radius: 14px; padding: 8px 6px; text-align: center; }
.tiles b { display: block; font: 800 17px var(--num); color: var(--mint); }
.tiles span { font: 700 9px var(--round); letter-spacing: 0.16em; color: var(--muted); }
.dist { display: grid; gap: 6px; }
.dist-row { display: grid; grid-template-columns: 136px minmax(30px, 1fr) 30px 36px; gap: 8px; align-items: center; font: 13px var(--round); }
.dist-row .chip { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.dist-row b { text-align: right; font-family: var(--num); }
.dist-row small { color: var(--muted); text-align: right; }
.history ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.history li { display: grid; grid-template-columns: minmax(0, 1fr) auto 72px; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(27, 18, 64, 0.75); font: 13px var(--round); }
.history .h-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e2d8f7; }
.history .h-sq { font-size: 12px; letter-spacing: 1px; }
.history b { text-align: right; font-family: var(--num); color: var(--mint); }
.empty { margin: 16px 0 4px; padding: 16px; border-radius: 14px; border: 1px dashed var(--edge); font-size: 14px; color: #e2d8f7; text-align: center; }
.row.export { margin-top: 16px; }

/* ---------- colour-blind friendly tiers (Okabe–Ito) ---------- */
.cb { --gem: #f0e442; --deep: #cc79a7; --rare: #56b4e9; --school: #009e73; --clever: #e69f00; --plankton: #bbbbbb; --none: #d55e00; }
.cb .dots i { display: grid; place-items: center; font: 800 9px/1 var(--round); color: #1b1240; }
.cb .dots i.t-gem::after { content: "★"; } .cb .dots i.t-deep::after { content: "T"; } .cb .dots i.t-rare::after { content: "H"; }
.cb .dots i.t-school::after { content: "F"; } .cb .dots i.t-clever::after { content: "O"; } .cb .dots i.t-plankton::after { content: "P"; } .cb .dots i.t-none::after { content: "×"; color: #fff; }

/* ---------- reduced motion (setting or device) ---------- */
.reduce-motion .scene, .reduce-motion .ruler-track, .reduce-motion .opt input, .reduce-motion .opt input::after { transition: none; }
.reduce-motion .craft, .reduce-motion .craft .flame, .reduce-motion .scene *, .reduce-motion .mock-input i, .reduce-motion .bar input.miss { animation: none; }
@media (prefers-reduced-motion: reduce) {
  html:not(.full-motion) .scene, html:not(.full-motion) .ruler-track { transition: none; }
  html:not(.full-motion) .craft, html:not(.full-motion) .craft .flame, html:not(.full-motion) .scene * { animation: none; }
}

/* ---------- page content ---------- */
.content { max-width: 760px; margin: 0 auto; padding: 34px 18px 10px; color: #e2d8f7; }
.content h1 { color: #fff7e6; font-size: 31px; line-height: 1.2; margin: 6px 0 12px; }
.content h2 { color: #fff7e6; font-size: 25px; margin: 38px 0 10px; }
.content h2::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%; background: var(--amber); vertical-align: 0.15em; }
.steps { padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.steps li { counter-increment: step; position: relative; padding: 12px 16px 12px 56px; border-radius: 16px; background: rgba(27, 18, 64, 0.7); border: 1px solid var(--edge); }
.steps li::before { content: counter(step); position: absolute; left: 14px; top: 12px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--amber); color: #2a1600; font: 900 14px/1 var(--round); }
.tiers { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tiers th, .tiers td { text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(200, 170, 255, 0.16); vertical-align: top; }
.tiers th { color: var(--muted); font-weight: 700; }
.tiers td:nth-child(2), .tiers.ex td:nth-child(3) { font-family: var(--num); white-space: nowrap; }
details { background: rgba(27, 18, 64, 0.7); border: 1px solid var(--edge); border-radius: 16px; padding: 12px 18px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 800; color: #fff7e6; }
details p { margin: 10px 0 0; }
.foot { max-width: 760px; margin: 0 auto; padding: 26px 18px 50px; color: var(--muted); font-size: 13px; text-align: center; }
.foot a { color: var(--muted); }
.legal { max-width: 760px; margin: 0 auto; padding: 30px 18px; }
.page-top { max-width: 760px; margin: 0 auto; padding: 18px 18px 0; }
.page-top a { font: 900 20px var(--round); letter-spacing: 0.08em; color: #fff7e6; text-decoration: none; }
[data-feedback-form] { margin: 22px 0; }
[data-feedback-form] .fb-row { display: flex; gap: 14px; flex-wrap: wrap; }
[data-feedback-form] .fb-row > div { flex: 1 1 220px; }
[data-feedback-form] .fb-field { margin-bottom: 16px; }
[data-feedback-form] label { display: block; margin: 0 0 6px; font-weight: 700; font-size: 14px; }
[data-feedback-form] .fb-hint { font-weight: 400; color: var(--muted); }
[data-feedback-form] input, [data-feedback-form] textarea { width: 100%; padding: 11px 14px; font: inherit; font-size: 14px; color: var(--ink); background: rgba(27, 18, 64, 0.85); border: 1px solid var(--edge); border-radius: 12px; outline: 0; }
[data-feedback-form] input:focus, [data-feedback-form] textarea:focus { border-color: var(--amber); }
[data-feedback-form] textarea { min-height: 150px; resize: vertical; }
[data-feedback-form] button[type="submit"] { width: 100%; padding: 12px 18px; font: 900 15px var(--round); letter-spacing: 0.06em; color: #2a1600; background: linear-gradient(180deg, #ffd98a, #ffb84d); border: 0; border-radius: 999px; cursor: pointer; }
[data-feedback-form] button:disabled { opacity: 0.6; cursor: default; }
[data-feedback-form] [data-feedback-captcha] { margin: 4px 0 16px; }
[data-feedback-form] altcha-widget { --altcha-max-width: 100%; }
[data-feedback-form][data-state="error"] [data-feedback-status] { color: var(--none); }
[data-feedback-form][data-state="sent"] [data-feedback-status] { color: var(--school); }

@media (max-width: 520px) {
  .panel { min-width: 76px; padding: 5px 10px; }
  .panel b { font-size: 16px; }
  .dots i { width: 12px; height: 12px; }
  .prompt-card { margin: 120px 60px 0 10px; }
  .verdict { width: calc(100% - 72px); margin: auto auto 18px 10px; padding: 18px 14px 20px; }
  .content h1 { font-size: 26px; }
  .tiers.ex td:last-child, .tiers.ex th:last-child { display: none; }
}
@media (max-width: 400px) {
  .modal { padding: 12px 12px 14px; }
  .tut-art { padding: 11px; }
  .pair .card { padding: 8px; }
  .tut-text { font-size: 14px; }
  .skins { grid-template-columns: repeat(2, 1fr); }
  .dist-row { grid-template-columns: 128px minmax(20px, 1fr) 26px 32px; gap: 6px; }
  .dist-row .chip { font-size: 11px; padding: 2px 7px; }
  .sub.tight { letter-spacing: 0.2em; }
  .rung { grid-template-columns: minmax(0, 1fr) auto 34px; }
  .rung .meter { display: none; }
}
