/* ============================================================
   チノウ・ラボ  —  スタイル
   ============================================================ */

:root {
  --bg: #060a18;
  --bg2: #0c1433;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-2: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-2: rgba(255, 255, 255, 0.24);
  --text: #eef2ff;
  --muted: #a3aed6;
  --dim: #6c78a6;
  --cyan: #4de2ff;
  --violet: #9b7bff;
  --pink: #ff5fa2;
  --gold: #ffd166;
  --mint: #5dffb0;
  --ok: #3dffa8;
  --ng: #ff5a6e;
  --c1: #4de2ff;
  --c2: #9b7bff;
  --radius: 20px;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  --font-round: "M PLUS Rounded 1c", var(--font);
  --font-num: "Orbitron", "M PLUS Rounded 1c", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; color: inherit; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* ---------- 背景 ---------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 800px at 85% -10%, #1b1f5c 0%, transparent 60%),
    radial-gradient(900px 700px at -10% 110%, #0f3a4f 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}
#bg-nebula, #bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; display: block; }
#bg-nebula { filter: saturate(1.2) contrast(1.05); }
/* 映画のフィルムのような細かい粒子（高級感） */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

#app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; overflow-x: clip; }

.screen { display: none; }
.screen.active { display: block; animation: screenIn .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.wrap { max-width: 1120px; margin: 0 auto; padding: 20px 16px calc(40px + var(--safe-b)); }

.glass {
  background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.025));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255,255,255,.08);
}

/* ---------- ホーム ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 46px; height: 46px; flex: none; }
.brand-logo .orbit { transform-origin: 50% 50%; animation: spin 12s linear infinite; }
.brand-logo .orbit.o2 { animation-duration: 18s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-name { font-family: var(--font-round); font-weight: 800; font-size: 22px; letter-spacing: .06em; line-height: 1.1; }
.brand-name small { display: block; font-family: var(--font-num); font-size: 10px; font-weight: 600; letter-spacing: .35em; color: var(--muted); }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--stroke);
  background: var(--panel); display: grid; place-items: center; cursor: pointer;
  transition: background .2s, transform .15s;
}
.icon-btn:hover { background: var(--panel-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 22px; height: 22px; }

.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 12px; margin: 4px 0 18px; min-height: 330px; }
.hero-kicker { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-num); font-size: 10.5px; letter-spacing: .35em; color: #a9e3ff; margin-bottom: 16px; padding: 7px 14px; border-radius: 99px; border: 1px solid rgba(159, 220, 255, .28); background: rgba(80, 140, 255, .08); backdrop-filter: blur(8px); }
.hero-kicker span { width: 7px; height: 7px; border-radius: 50%; background: #5dffb0; box-shadow: 0 0 10px #5dffb0; animation: pulse 1.6s ease-in-out infinite; }
.hero h1 {
  font-family: var(--font-round); font-weight: 800; margin: 0;
  font-size: clamp(36px, 6.6vw, 68px); line-height: 1.08; letter-spacing: .01em;
  filter: drop-shadow(0 6px 30px rgba(120, 140, 255, .35));
}
.hero-visual { position: relative; height: 340px; }
.hero-crystal { position: absolute; left: -40px; top: -40px; width: calc(100% + 80px); height: calc(100% + 80px); }
.hero p { color: #c6cdf0; margin: 16px 0 0; font-size: clamp(13.5px, 2.6vw, 16.5px); max-width: 540px; line-height: 1.8; }

.profile { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; padding: 22px; margin-bottom: 34px; align-items: center; position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(92, 110, 255, .16), rgba(20, 26, 70, .55) 45%, rgba(255, 95, 162, .10)); border-color: rgba(160, 180, 255, .22); }
.profile::before { content: ""; position: absolute; width: 360px; height: 360px; left: -120px; top: -180px; border-radius: 50%; background: radial-gradient(circle, rgba(120, 140, 255, .35), transparent 65%); pointer-events: none; }
.profile::after { content: ""; position: absolute; width: 300px; height: 300px; right: -80px; bottom: -170px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 95, 162, .22), transparent 65%); pointer-events: none; }
.profile > * { position: relative; z-index: 1; }
.profile-main { display: flex; align-items: center; gap: 18px; min-width: 0; }
.lv-ring { position: relative; width: 108px; height: 108px; flex: none; }
.lv-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.lv-ring .lv-num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }
.lv-ring .lv-num b { font-family: var(--font-num); font-size: 34px; display: block; }
.lv-ring .lv-num small { font-family: var(--font-num); font-size: 10px; letter-spacing: .3em; color: var(--muted); }
.profile-info { min-width: 0; flex: 1; }
.profile-title { font-family: var(--font-round); font-weight: 800; font-size: 20px; }
.profile-sub { color: var(--muted); font-size: 13px; }
.xp-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; margin: 10px 0 6px; }
.xp-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink)); box-shadow: 0 0 12px rgba(155,123,255,.7); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.stat-row { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.stat { font-size: 12px; color: var(--muted); }
.stat b { display: block; font-family: var(--font-num); font-size: 18px; color: var(--text); }

.radar-box { display: flex; flex-direction: column; align-items: center; }
.radar-box h3 { margin: 0 0 4px; font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: .1em; }
.radar { width: 100%; max-width: 280px; height: auto; overflow: visible; }
.radar .grid-line { fill: none; stroke: rgba(255,255,255,.1); }
.radar .axis { stroke: rgba(255,255,255,.1); }
.radar .area { fill: url(#radarFill); stroke: #9fdcff; stroke-width: 2; filter: drop-shadow(0 0 8px rgba(77,226,255,.6)); transition: all 1s; }
.radar .dot { fill: #fff; }
.radar text { fill: var(--muted); font-size: 11px; font-weight: 700; font-family: var(--font); }
.radar text.val { fill: var(--text); font-family: var(--font-num); font-size: 10px; }

.section-title { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.section-title h2 { font-family: var(--font-round); font-size: 20px; margin: 0; }
.section-title span { color: var(--dim); font-family: var(--font-num); font-size: 11px; letter-spacing: .3em; }

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; perspective: 1400px; }
.game-card {
  position: relative; text-align: left; cursor: pointer; padding: 0; border: none; color: var(--text);
  border-radius: 24px; overflow: hidden; display: flex; flex-direction: column;
  background: linear-gradient(175deg, rgba(20, 26, 62, .94), rgba(8, 11, 30, .97));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 24px 50px -24px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.07);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .6s cubic-bezier(.2,.8,.2,1), box-shadow .4s;
  animation: cardIn .8s both cubic-bezier(.2,.8,.2,1);
}
.game-card.tilting { transition: transform .08s linear, box-shadow .4s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.96); } }
.game-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 3;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c1) 80%, transparent), transparent 35%, transparent 65%, color-mix(in srgb, var(--c2) 80%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: .45; transition: opacity .3s;
}
.game-card:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 34px 70px -24px color-mix(in srgb, var(--c1) 55%, rgba(0,0,0,.8)), 0 0 0 1px color-mix(in srgb, var(--c1) 40%, transparent); }
.game-card:hover::after { opacity: 1; }
.game-card:active { transform: scale(.985); }
.gc-art { position: relative; aspect-ratio: 5 / 3; overflow: hidden; background: #070b1f; }
.gc-art .key-art { width: 100%; height: 100%; display: block; transition: transform 1s cubic-bezier(.2,.8,.2,1); }
.game-card:hover .key-art { transform: scale(1.06); }
.gc-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 42%; background: linear-gradient(transparent, rgba(16, 21, 52, .96)); pointer-events: none; }
.gc-icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; position: relative; flex: none;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--c1) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.45);
}
.gc-icon svg { width: 30px; height: 30px; }
.gc-art .gc-icon { position: absolute; left: 16px; bottom: 12px; z-index: 2; width: 46px; height: 46px; border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.5), 0 0 22px color-mix(in srgb, var(--c1) 60%, transparent), inset 0 1px 0 rgba(255,255,255,.5); }
.gc-art .gc-icon svg { width: 26px; height: 26px; }
.gc-body { position: relative; padding: 12px 18px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.gc-title { font-family: var(--font-round); font-weight: 800; font-size: 19px; line-height: 1.3; position: relative; }
.gc-en { font-family: var(--font-num); font-size: 9.5px; letter-spacing: .3em; color: color-mix(in srgb, var(--c1) 70%, #fff); display: block; font-weight: 600; margin-top: 2px; }
.gc-desc { font-size: 12.8px; color: #b3bcdf; position: relative; flex: 1; line-height: 1.65; }
.gc-sheen { position: absolute; inset: 0; pointer-events: none; z-index: 4; border-radius: inherit; opacity: 0; transition: opacity .35s;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,.18), transparent 42%); mix-blend-mode: screen; }
.game-card.tilting .gc-sheen { opacity: 1; }
.gc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid var(--stroke); white-space: nowrap;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 8px var(--c1); }
.gc-best { font-family: var(--font-num); font-size: 11px; color: var(--muted); white-space: nowrap; }
.gc-best b { color: var(--text); font-size: 13px; }

.footer { margin-top: 36px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; color: var(--dim); font-size: 12px; }
.link-btn { background: none; border: 1px solid var(--stroke); border-radius: 99px; padding: 6px 14px; cursor: pointer; color: var(--muted); font-size: 12px; }
.link-btn:hover { color: var(--text); border-color: var(--stroke-2); }

/* ---------- キーアートのアニメーション ---------- */
.key-art .bob { animation: bob 4.2s ease-in-out infinite; transform-box: fill-box; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.key-art .float-slow { animation: bob 5.5s ease-in-out infinite; }
.key-art .tw { animation: twinkle 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.key-art .tw.d2 { animation-delay: -1s; } .key-art .tw.d3 { animation-delay: -1.9s; }
@keyframes twinkle { 50% { opacity: .35; transform: scale(.7); } }
.key-art .pulse-q { animation: pulseQ 2.2s ease-in-out infinite; }
@keyframes pulseQ { 50% { transform: scale(1.08); } }
.key-art .dash-flow { animation: dashFlow 2.5s linear infinite; }
@keyframes dashFlow { to { stroke-dashoffset: -36; } }
.key-art .sway { animation: sway 6s ease-in-out infinite; }
@keyframes sway { 25% { transform: rotate(1.6deg); } 75% { transform: rotate(-1.6deg); } }
.key-art .spin-slow { animation: spin 60s linear infinite; }
.key-art .beam { animation: beam 2.6s ease-in-out infinite; }
@keyframes beam { 50% { opacity: .35; } }
.key-art .petal { animation: petal 9s linear infinite; }
@keyframes petal { from { transform: translate(0, -20px); opacity: 0; } 15% { opacity: 1; } to { transform: translate(40px, 60px); opacity: 0; } }
.key-art .rocket { animation: rocket 5s ease-in-out infinite; }
@keyframes rocket { 50% { transform: translateY(-8px); } }

/* ---------- モーダル ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50; background: rgba(3, 6, 18, .6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeIn .25s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); overflow: auto;
  border-radius: 26px; background: linear-gradient(175deg, #131b42, #0a0f2c);
  border: 1px solid var(--stroke-2); box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: pop .35s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.96); } }
.modal-head { position: relative; overflow: hidden; }
.mh-art { position: relative; aspect-ratio: 2 / 1; overflow: hidden; }
.mh-art .key-art { width: 100%; height: 100%; display: block; animation: artZoom 14s ease-in-out infinite alternate; }
@keyframes artZoom { to { transform: scale(1.08); } }
.mh-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, #131b42 98%); }
.mh-text { position: relative; padding: 0 22px 12px; margin-top: -44px; }
.mh-text .gc-icon { width: 58px; height: 58px; margin-bottom: 10px; box-shadow: 0 0 0 4px #131b42, 0 10px 30px color-mix(in srgb, var(--c1) 50%, transparent), inset 0 1px 0 rgba(255,255,255,.5); }
.modal-head h2 { margin: 0; font-family: var(--font-round); font-size: 26px; line-height: 1.25; }
.modal-head h2 small { display: block; font-family: var(--font-num); font-size: 10px; letter-spacing: .35em; color: color-mix(in srgb, var(--c1) 70%, #fff); font-weight: 600; margin-top: 4px; }
.modal-head p { margin: 8px 0 0; color: #b9c2e6; font-size: 14px; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 3; background: rgba(5, 8, 24, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-body { padding: 4px 22px 22px; }
.modal-body h4 { margin: 16px 0 8px; font-size: 12px; letter-spacing: .15em; color: var(--muted); }
.howto { margin: 0; padding-left: 1.2em; color: #d6ddff; font-size: 14px; }
.howto li { margin: 3px 0; }
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.mode {
  border: 1px solid var(--stroke); background: var(--panel); border-radius: 14px; padding: 10px 12px;
  cursor: pointer; text-align: left; transition: all .2s;
}
.mode b { display: block; font-size: 14px; }
.mode small { color: var(--muted); font-size: 11px; line-height: 1.4; display: block; }
.mode.sel { border-color: var(--c1); background: color-mix(in srgb, var(--c1) 14%, transparent); box-shadow: 0 0 0 1px var(--c1), 0 0 18px color-mix(in srgb, var(--c1) 30%, transparent); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }

/* ---------- ボタン ---------- */
.btn {
  appearance: none; border: 1px solid var(--stroke-2); background: var(--panel-2); color: var(--text);
  font-weight: 700; font-size: 15px; border-radius: 16px; padding: 13px 22px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s, box-shadow .2s, background .2s, opacity .2s; min-height: 48px;
}
.btn:hover { background: rgba(255,255,255,.14); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary {
  border: none; color: #07102a;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 8px 26px color-mix(in srgb, var(--c1) 40%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { font-size: 17px; padding: 15px 30px; min-width: 160px; }
.btn.wide { width: 100%; }

/* ---------- ゲーム画面 ---------- */
.game-bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  padding: 10px 16px; background: rgba(6, 10, 24, .7);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke);
}
.gb-mid { min-width: 0; }
.gb-title { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-round); }
.gb-title small { color: var(--muted); font-weight: 700; margin-left: 6px; font-size: 12px; }
.gb-progress { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.gb-track { flex: 1; height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.gb-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--c1), var(--c2)); transition: width .5s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 10px var(--c1); }
.gb-count { font-family: var(--font-num); font-size: 11px; color: var(--muted); white-space: nowrap; }
.gb-right { display: flex; align-items: center; gap: 10px; }
.gb-score { text-align: right; line-height: 1.05; }
.gb-score small { display: block; font-family: var(--font-num); font-size: 8.5px; letter-spacing: .25em; color: var(--muted); }
.gb-score b { font-family: var(--font-num); font-size: 18px; }
.timer-ring { width: 40px; height: 40px; position: relative; visibility: hidden; }
.timer-ring.on { visibility: visible; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 4; }
.timer-ring .bg { stroke: rgba(255,255,255,.1); }
.timer-ring .fg { stroke: var(--c1); stroke-linecap: round; transition: stroke .3s; }
.timer-ring.warn .fg { stroke: var(--ng); }
.timer-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-num); font-size: 12px; font-weight: 700; }

.stage { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(40px + var(--safe-b)); }
.q-card { padding: 20px; margin-bottom: 16px; }
.q-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.q-num { font-family: var(--font-num); font-size: 11px; letter-spacing: .25em; color: var(--c1); font-weight: 700; }
.q-text { font-size: clamp(17px, 4.2vw, 22px); font-weight: 700; line-height: 1.6; margin: 0; }
.q-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.center { text-align: center; }

/* 選択肢 */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choices.one { grid-template-columns: 1fr; }
.choice {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left;
  min-height: 60px; padding: 12px 14px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--stroke); background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  font-size: 16px; font-weight: 700; line-height: 1.45;
  transition: transform .15s, border-color .2s, background .2s, box-shadow .2s, opacity .3s;
  animation: cardIn .45s both cubic-bezier(.2,.8,.2,1);
}
.choice:hover:not(:disabled) { border-color: var(--stroke-2); background: rgba(255,255,255,.1); transform: translateY(-2px); }
.choice:active:not(:disabled) { transform: scale(.98); }
.choice:disabled { cursor: default; }
.choice .key {
  flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  font-family: var(--font-num); font-size: 12px; background: rgba(255,255,255,.08); border: 1px solid var(--stroke);
}
.choice.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); box-shadow: 0 0 0 1px var(--ok), 0 0 26px color-mix(in srgb, var(--ok) 35%, transparent); }
.choice.correct .key { background: var(--ok); color: #03220f; border-color: transparent; }
.choice.wrong { border-color: var(--ng); background: color-mix(in srgb, var(--ng) 16%, transparent); animation: shake .45s; }
.choice.wrong .key { background: var(--ng); color: #2a0008; border-color: transparent; }
.choice.dim { opacity: .4; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* 解説パネル */
.explain {
  margin-top: 18px; padding: 18px 18px 16px; border-radius: 20px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  border: 1px solid var(--stroke-2); animation: explainIn .45s cubic-bezier(.2,.8,.2,1);
}
.explain::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ok); box-shadow: 0 0 16px var(--ok); }
.explain.ng::before { background: var(--ng); box-shadow: 0 0 16px var(--ng); }
@keyframes explainIn { from { opacity: 0; transform: translateY(16px); } }
.explain-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.verdict { font-family: var(--font-round); font-weight: 800; font-size: 20px; color: var(--ok); }
.explain.ng .verdict { color: var(--ng); }
.explain-answer { font-size: 14px; color: var(--muted); }
.explain-answer b { color: var(--text); font-size: 16px; }
.explain-body { font-size: 14.5px; color: #dbe2ff; line-height: 1.75; }
.explain-body .lead { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .15em; color: var(--c1); margin-right: 6px; }
.explain .btn { margin-top: 14px; }

/* 正解/不正解エフェクト */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; display: grid; place-items: center; }
.fx-mark { width: min(38vw, 200px); height: min(38vw, 200px); animation: fxMark .75s cubic-bezier(.2,.8,.2,1) forwards; }
.fx-mark circle, .fx-mark path { fill: none; stroke-width: 10; stroke-linecap: round; }
@keyframes fxMark { 0% { opacity: 0; transform: scale(.5); } 25% { opacity: .95; transform: scale(1.05); } 70% { opacity: .8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.15); } }
.fx-flash { position: fixed; inset: 0; pointer-events: none; z-index: 39; animation: fxFlash .6s ease-out forwards; }
@keyframes fxFlash { from { opacity: .5; } to { opacity: 0; } }
.fx-pts {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, 0); z-index: 41; pointer-events: none; text-align: center;
  font-family: var(--font-num); font-weight: 900; font-size: 30px; color: #fff; text-shadow: 0 0 20px var(--c1), 0 0 4px #000;
  animation: fxPts 1.1s cubic-bezier(.2,.8,.2,1) forwards; white-space: nowrap;
}
.fx-pts small { display: block; font-size: 14px; letter-spacing: .2em; color: var(--gold); text-shadow: 0 0 14px var(--gold); }
@keyframes fxPts { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.8); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 70% { opacity: 1; transform: translate(-50%, -30px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%) translateY(30px);
  background: rgba(20, 28, 64, .95); border: 1px solid var(--stroke-2); padding: 10px 18px; border-radius: 99px;
  font-size: 14px; z-index: 60; opacity: 0; transition: all .3s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* テンキー */
.answer-box {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 72px; margin: 0 auto 14px; max-width: 360px; padding: 8px 18px; border-radius: 18px;
  border: 1px solid var(--stroke-2); background: rgba(0, 0, 0, .25);
  font-family: var(--font-num); font-size: 34px; font-weight: 700; letter-spacing: .06em;
  box-shadow: inset 0 0 30px rgba(0,0,0,.3);
}
.answer-box .ph { color: var(--dim); font-size: 16px; font-family: var(--font); letter-spacing: 0; font-weight: 700; }
.answer-box .caret { width: 3px; height: 34px; background: var(--c1); animation: blink 1s steps(1) infinite; box-shadow: 0 0 10px var(--c1); }
@keyframes blink { 50% { opacity: 0; } }
.answer-box.ok { border-color: var(--ok); color: var(--ok); }
.answer-box.ng { border-color: var(--ng); color: var(--ng); animation: shake .45s; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 360px; margin: 0 auto; }
.keypad button {
  height: 58px; border-radius: 16px; border: 1px solid var(--stroke); cursor: pointer;
  background: linear-gradient(160deg, rgba(255,255,255,.1), rgba(255,255,255,.03));
  font-family: var(--font-num); font-size: 22px; font-weight: 700; transition: transform .1s, background .15s;
  touch-action: manipulation;
}
.keypad button:active { transform: scale(.93); background: rgba(255,255,255,.18); }
.keypad button.fn { font-family: var(--font); font-size: 16px; color: var(--muted); }
.keypad button.go { grid-column: 1 / -1; border: none; color: #07102a; font-family: var(--font); font-size: 17px; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 8px 24px color-mix(in srgb, var(--c1) 35%, transparent); }
.keypad button:disabled { opacity: .4; }

/* ---------- 結果画面 ---------- */
.result { max-width: 640px; margin: 0 auto; padding: 28px 16px calc(40px + var(--safe-b)); }
.result-card { padding: 0 22px 26px; text-align: center; position: relative; overflow: hidden; background: linear-gradient(180deg, rgb(17, 23, 56) 30%, rgba(10, 14, 40, .96)); border-color: rgba(255,255,255,.1); }
.result-card::before { content: ""; position: absolute; inset: -40% -20% auto; height: 300px; background: radial-gradient(circle, color-mix(in srgb, var(--c1) 50%, transparent), transparent 65%); opacity: .5; pointer-events: none; }
.result-card > * { position: relative; }
.result-art { margin: 0 -22px; aspect-ratio: 5 / 2; overflow: hidden; }
.result-art .key-art { width: 100%; height: 100%; display: block; animation: artZoom 14s ease-in-out infinite alternate; }
.result-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(17, 23, 56, .98)); }
.result-game { margin-top: -30px; }
.result-game { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-family: var(--font-round); }
.result-game .gc-icon { width: 40px; height: 40px; border-radius: 12px; }
.result-game .gc-icon svg { width: 24px; height: 24px; }
.stars { display: flex; justify-content: center; gap: 10px; margin: 20px 0 6px; }
.stars svg { width: 56px; height: 56px; opacity: .18; transform: scale(.6); transition: all .5s cubic-bezier(.2,.9,.3,1.5); }
.stars svg.on { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 14px rgba(255, 209, 102, .8)); }
.stars svg:nth-child(2) { width: 70px; height: 70px; margin-top: -10px; }
.result-rank { font-family: var(--font-round); font-weight: 800; font-size: 20px; margin: 4px 0; }
.result-score { font-family: var(--font-num); font-size: clamp(44px, 12vw, 64px); font-weight: 900; line-height: 1.1; margin: 6px 0; text-shadow: 0 0 30px color-mix(in srgb, var(--c1) 70%, transparent); }
.result-score small { display: block; font-size: 11px; letter-spacing: .4em; color: var(--muted); font-weight: 600; text-shadow: none; }
.badge-new { display: inline-block; font-family: var(--font-num); font-size: 12px; font-weight: 900; letter-spacing: .2em; color: #2a1800; background: linear-gradient(90deg, #ffd166, #ff9e57); padding: 4px 12px; border-radius: 99px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.07); box-shadow: 0 0 24px rgba(255,209,102,.6); } }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 6px; }
.result-grid div { background: rgba(255,255,255,.05); border: 1px solid var(--stroke); border-radius: 14px; padding: 10px 6px; }
.result-grid small { display: block; font-size: 11px; color: var(--muted); }
.result-grid b { font-family: var(--font-num); font-size: 18px; }
.levelup { margin-top: 14px; padding: 12px; border-radius: 14px; background: linear-gradient(90deg, rgba(155,123,255,.25), rgba(77,226,255,.2)); border: 1px solid rgba(155,123,255,.5); font-weight: 800; }
.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.review { margin-top: 20px; padding: 20px; text-align: left; }
.review h3 { margin: 0 0 4px; font-family: var(--font-round); font-size: 18px; }
.review > p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.review-item { padding: 12px 0; border-top: 1px solid var(--stroke); }
.review-item .rq { font-weight: 700; font-size: 14.5px; }
.review-item .ra { font-size: 13.5px; margin-top: 4px; }
.review-item .ra b { color: var(--ok); }
.review-item .ra s { color: var(--ng); text-decoration-thickness: 1px; }
.review-item .re { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.65; }
.review-item svg { vertical-align: middle; }

.confetti { position: fixed; top: -20px; width: 10px; height: 14px; z-index: 45; pointer-events: none; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

/* ============================================================
   各ゲーム
   ============================================================ */

/* --- 図形マトリクス --- */
.mx-wrap { display: grid; grid-template-columns: 1fr; gap: 18px; justify-items: center; }
.mx-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px;
  width: min(100%, 360px); border-radius: 22px;
}
.mx-cell {
  aspect-ratio: 1; border-radius: 14px; background: rgba(0, 0, 0, .22); border: 1px solid rgba(255,255,255,.07);
  display: grid; place-items: center; overflow: hidden; animation: cellIn .5s both cubic-bezier(.2,.8,.2,1);
}
@keyframes cellIn { from { opacity: 0; transform: scale(.7); } }
.mx-cell svg { width: 92%; height: 92%; filter: drop-shadow(0 0 5px rgba(255,255,255,.18)); }
.mx-cell.q { border: 2px dashed var(--c1); background: color-mix(in srgb, var(--c1) 8%, transparent); font-family: var(--font-num); font-size: 34px; font-weight: 900; color: var(--c1); animation: qPulse 1.8s ease-in-out infinite; }
@keyframes qPulse { 50% { box-shadow: 0 0 24px color-mix(in srgb, var(--c1) 50%, transparent); } }
.mx-cell.q.filled { border-style: solid; animation: none; }
.mx-cell.q.filled.ok { border-color: var(--ok); box-shadow: 0 0 24px color-mix(in srgb, var(--ok) 45%, transparent); }
.mx-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(100%, 420px); }
.mx-opt { aspect-ratio: 1; padding: 6px; border-radius: 16px; cursor: pointer; border: 1px solid var(--stroke); background: linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02)); display: grid; place-items: center; position: relative; transition: transform .15s, border-color .2s; animation: cardIn .45s both; }
.mx-opt:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--stroke-2); }
.mx-opt svg { width: 88%; height: 88%; }
.mx-opt .key { position: absolute; top: 6px; left: 8px; font-family: var(--font-num); font-size: 10px; color: var(--muted); }
.mx-opt.correct { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok), 0 0 22px color-mix(in srgb, var(--ok) 40%, transparent); }
.mx-opt.wrong { border-color: var(--ng); box-shadow: 0 0 0 1px var(--ng); animation: shake .45s; }
.mx-opt.dim { opacity: .35; }
.rule-list { margin: 6px 0 0; padding-left: 1.2em; }
.rule-list li { margin: 2px 0; }

/* --- 数列 --- */
.seq-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 4px; margin: 10px 0 6px; }
.seq-item { display: flex; align-items: center; gap: 4px; }
.orb {
  --s: clamp(50px, 13vw, 76px);
  width: var(--s); height: var(--s); border-radius: 50%; display: grid; place-items: center; flex: none;
  font-family: var(--font-num); font-weight: 700; font-size: clamp(14px, 3.8vw, 22px);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.28), rgba(255,255,255,.04) 60%), color-mix(in srgb, var(--c1) 20%, #0b1230);
  border: 1px solid color-mix(in srgb, var(--c1) 60%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--c1) 30%, transparent), inset 0 0 12px rgba(255,255,255,.08);
  animation: orbIn .55s both cubic-bezier(.2,.9,.3,1.3);
}
@keyframes orbIn { from { opacity: 0; transform: scale(.3) translateY(10px); } }
.orb.q { border: 2px dashed var(--c2); color: var(--c2); background: color-mix(in srgb, var(--c2) 12%, #0b1230); animation: orbIn .55s both, qPulse 1.8s 0.6s ease-in-out infinite; font-size: clamp(20px, 5vw, 28px); }
.orb.q.ok { border-style: solid; border-color: var(--ok); color: var(--ok); }
.orb.q.ng { border-style: solid; border-color: var(--ng); color: var(--text); }
.seq-dot { width: 10px; height: 2px; background: linear-gradient(90deg, transparent, var(--stroke-2), transparent); }
.seq-ops { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 12px 0 2px; }
.seq-ops span { font-family: var(--font-num); font-size: 13px; padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--c1) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c1) 40%, transparent); animation: cardIn .4s both; }

/* --- 天秤 --- */
.bal-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.scale { position: relative; padding: 18px 8px 4px; border-radius: 20px; background: radial-gradient(120% 90% at 50% 100%, rgba(255, 196, 77, .10), transparent 60%), linear-gradient(170deg, rgba(255,255,255,.06), rgba(0,0,0,.22)); border: 1px solid rgba(255, 220, 150, .12); box-shadow: inset 0 1px 0 rgba(255,255,255,.07); animation: cardIn .5s both; }
.scale-tag { position: absolute; top: 10px; left: 14px; font-family: var(--font-num); font-size: 10px; color: #e9d6ac; letter-spacing: .25em; opacity: .8; }
.scale.question { border-color: color-mix(in srgb, var(--c1) 60%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--c1) 35%, transparent), 0 0 30px color-mix(in srgb, var(--c1) 18%, transparent), inset 0 1px 0 rgba(255,255,255,.08); }
.scale-svg { width: 100%; height: auto; display: block; overflow: visible; }
.scale-svg .beam-swing { transform-origin: 150px 30px; animation: wobble 1.8s cubic-bezier(.3,.7,.3,1) both; }
@keyframes wobble { 0% { transform: rotate(-8deg); } 30% { transform: rotate(5deg); } 55% { transform: rotate(-2.5deg); } 75% { transform: rotate(1deg); } 100% { transform: rotate(0); } }
.scale-svg .drop { animation: dropIn .5s both cubic-bezier(.3,1.4,.5,1); }
@keyframes dropIn { from { opacity: 0; transform: translateY(-14px); } }
.scale-svg .drop { transform-box: fill-box; }
.bal-q { margin: 16px 0 12px; text-align: center; font-weight: 700; font-size: 17px; }
.bal-q svg { width: 28px; height: 28px; vertical-align: -7px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.glyph { width: 20px; height: 20px; vertical-align: -4px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.choices.nums { grid-template-columns: repeat(4, 1fr); }
.choices.nums .choice { justify-content: center; font-family: var(--font-num); font-size: 22px; }

/* --- フラッシュ暗算 --- */
.flash-stage { height: min(52vw, 260px); display: grid; place-items: center; border-radius: 24px; margin-bottom: 16px; position: relative; overflow: hidden; }
.flash-num { font-family: var(--font-num); font-weight: 900; font-size: clamp(72px, 24vw, 150px); line-height: 1; text-shadow: 0 0 40px var(--c1), 0 0 90px color-mix(in srgb, var(--c2) 60%, transparent); }
.flash-num.minus { color: #ff8fb0; text-shadow: 0 0 40px var(--ng); }
.flash-num.pop { animation: flashPop .25s cubic-bezier(.2,.9,.3,1.4); }
@keyframes flashPop { from { transform: scale(.6); opacity: 0; } }
.flash-msg { font-family: var(--font-round); font-weight: 800; font-size: clamp(22px, 6vw, 34px); color: var(--muted); }
.flash-info { position: absolute; left: 14px; top: 10px; font-family: var(--font-num); font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.flash-eq { font-family: var(--font-num); font-size: 17px; word-break: break-word; }

/* --- メモリーグリッド --- */
.mem-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.mem-msg { font-family: var(--font-round); font-weight: 800; font-size: 18px; }
.lives { display: flex; gap: 4px; }
.lives svg { width: 22px; height: 22px; }
.lives svg.lost { opacity: .2; filter: grayscale(1); }
.mem-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 8px; width: min(100%, 440px); margin: 0 auto; padding: 12px; border-radius: 24px; }
.mem-cell {
  aspect-ratio: 1; border-radius: 14px; cursor: pointer; border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05); transition: background .2s, box-shadow .2s, transform .12s; position: relative;
  font-family: var(--font-num); font-weight: 900; font-size: 20px; display: grid; place-items: center; color: #07102a;
}
.mem-cell:active { transform: scale(.94); }
.mem-cell.lit { background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: 0 0 26px color-mix(in srgb, var(--c1) 70%, transparent); transform: scale(1.04); }
.mem-cell.hit { background: color-mix(in srgb, var(--ok) 70%, #0b1230); box-shadow: 0 0 20px color-mix(in srgb, var(--ok) 55%, transparent); }
.mem-cell.miss { background: var(--ng); box-shadow: 0 0 20px var(--ng); animation: shake .4s; }
.mem-cell.reveal { box-shadow: inset 0 0 0 3px var(--c1); }
.mem-grid.lock .mem-cell { cursor: default; }

/* --- タイムライン --- */
.tl-rail { position: relative; padding-left: 30px; display: grid; gap: 10px; margin-bottom: 18px; }
.tl-rail::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: linear-gradient(var(--c1), var(--c2)); box-shadow: 0 0 12px var(--c1); }
.tl-rail-end { position: relative; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .1em; }
.tl-slot { position: relative; min-height: 58px; border-radius: 16px; border: 1.5px dashed rgba(255,255,255,.18); display: flex; align-items: center; padding: 0 14px; color: var(--dim); font-size: 13px; }
.tl-slot::before { content: attr(data-n); position: absolute; left: -30px; top: 50%; width: 25px; height: 25px; margin-top: -12.5px; border-radius: 50%; background: #0b1230; border: 2px solid var(--c1); display: grid; place-items: center; font-family: var(--font-num); font-size: 11px; color: var(--text); font-weight: 700; }
.tl-slot.filled { border: none; padding: 0; }
.tl-pool { display: grid; gap: 10px; }
.tl-card {
  width: 100%; text-align: left; cursor: pointer; padding: 12px 14px; border-radius: 16px; min-height: 58px;
  border: 1px solid var(--stroke); background: linear-gradient(160deg, rgba(255,255,255,.1), rgba(255,255,255,.03));
  font-size: 15px; font-weight: 700; line-height: 1.45; display: flex; align-items: center; gap: 10px;
  animation: cardIn .4s both; transition: border-color .2s, background .2s;
}
.tl-card:hover:not(:disabled) { border-color: var(--stroke-2); }
.tl-card .yr { margin-left: auto; font-family: var(--font-num); font-size: 13px; white-space: nowrap; padding: 2px 10px; border-radius: 99px; background: rgba(255,255,255,.1); }
.tl-card.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.tl-card.ng { border-color: var(--ng); background: color-mix(in srgb, var(--ng) 12%, transparent); }
.tl-hint { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.tl-actions { display: flex; gap: 10px; margin-top: 16px; }
.tl-actions .btn { flex: 1; }
.tl-answer { list-style: none; margin: 8px 0 0; padding: 0; }
.tl-answer li { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--stroke); }
.tl-answer li b { font-family: var(--font-num); font-size: 13px; color: var(--c1); }
.tl-answer li small { display: block; color: var(--muted); font-size: 12.5px; }

/* --- ことばの結晶 --- */
.tiles { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.tile {
  width: clamp(54px, 15vw, 78px); height: clamp(54px, 15vw, 78px); border-radius: 16px; display: grid; place-items: center;
  font-size: clamp(28px, 8vw, 42px); font-weight: 900; font-family: "Zen Kaku Gothic New", "Hiragino Mincho ProN", serif;
  background: linear-gradient(150deg, rgba(255,255,255,.2), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.25); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 20px rgba(0,0,0,.25);
  animation: tileIn .6s both cubic-bezier(.2,.9,.3,1.3); position: relative;
}
.tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); background-size: 250% 100%; animation: glint 4s ease-in-out infinite; pointer-events: none; }
@keyframes glint { 0%, 60% { background-position: 150% 0; } 100% { background-position: -100% 0; } }
@keyframes tileIn { from { opacity: 0; transform: rotateX(80deg) translateY(-20px); } }
.tile.blank { border: 2px dashed var(--c1); color: var(--c1); background: color-mix(in srgb, var(--c1) 12%, transparent); animation: tileIn .6s both, qPulse 1.8s .6s ease-in-out infinite; font-family: var(--font-num); }
.tile.blank.ok { border-style: solid; border-color: var(--ok); color: var(--ok); animation: none; box-shadow: 0 0 26px color-mix(in srgb, var(--ok) 45%, transparent); font-family: inherit; }
.tile.blank.ng { border-style: solid; border-color: var(--ng); color: var(--text); animation: none; font-family: inherit; }
.tile.small { width: auto; min-width: 44px; height: 54px; padding: 0 12px; font-size: 22px; }
.choices.kanji .choice { justify-content: center; font-size: 26px; min-height: 70px; font-family: "Zen Kaku Gothic New", serif; }
.type-chip { background: color-mix(in srgb, var(--c1) 20%, transparent); border-color: color-mix(in srgb, var(--c1) 50%, transparent); }

/* --- プラネタリウム --- */
body.pl-lock { overflow: hidden; }
.pl-wrap { position: fixed; left: 0; right: 0; bottom: 0; top: 60px; z-index: 5; overflow: hidden; background: #02040c; }
.pl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
.pl-canvas:active { cursor: grabbing; }
.pl-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.pl-top > * { pointer-events: auto; }
.pl-scene { font-family: var(--font-round); font-weight: 800; font-size: clamp(18px, 4.6vw, 26px); text-shadow: 0 0 18px rgba(126, 240, 255, .7), 0 2px 6px #000; }
.pl-scene.in { animation: plTitle .8s cubic-bezier(.2,.8,.2,1); }
@keyframes plTitle { from { opacity: 0; transform: translateY(-8px); letter-spacing: .3em; } }
.pl-when { font-size: 12px; color: var(--muted); background: rgba(5, 10, 30, .6); border: 1px solid var(--stroke); padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.pl-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 12px calc(12px + var(--safe-b)); display: grid; gap: 10px; justify-items: center; pointer-events: none;
  background: linear-gradient(transparent, rgba(2, 4, 12, .75) 40%); }
.pl-bottom > * { pointer-events: auto; }
.pl-sub { max-width: 720px; width: 100%; font-size: clamp(14px, 3.7vw, 17px); line-height: 1.8; padding: 12px 16px; border-radius: 16px;
  background: rgba(6, 12, 34, .72); border: 1px solid rgba(143, 184, 255, .25); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  max-height: 34vh; overflow: auto; }
.pl-sub span { color: rgba(220, 230, 255, .55); transition: color .4s; }
.pl-sub span.now { color: #fff; text-shadow: 0 0 12px rgba(143, 184, 255, .6); }
.pl-sub span.done { color: rgba(220, 230, 255, .8); }
.pl-ctrl { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pl-transport { display: flex; align-items: center; gap: 8px; }
.pl-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--stroke-2); background: rgba(10, 18, 48, .75); display: grid; place-items: center; cursor: pointer; }
.pl-btn svg { width: 18px; height: 18px; }
.pl-btn.big { width: 54px; height: 54px; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #07102a; border: none; box-shadow: 0 0 22px color-mix(in srgb, var(--c1) 50%, transparent); }
.pl-btn.big svg { width: 22px; height: 22px; }
.pl-btn:disabled { opacity: .35; cursor: default; }
.pl-chip { border: 1px solid var(--stroke-2); background: rgba(10, 18, 48, .75); border-radius: 99px; padding: 8px 14px; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted); min-height: 38px; }
.pl-chip.on { color: #fff; border-color: var(--c1); background: color-mix(in srgb, var(--c1) 22%, rgba(10, 18, 48, .8)); }
.pl-seasons { display: flex; gap: 6px; flex-wrap: wrap; }
.pl-hint { font-size: 12px; color: var(--muted); text-align: center; text-shadow: 0 1px 4px #000; }
.pl-info { position: absolute; top: 56px; right: 12px; width: min(300px, calc(100% - 24px)); padding: 14px 16px; border-radius: 16px;
  background: rgba(8, 14, 40, .88); border: 1px solid rgba(143, 184, 255, .35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(-8px); pointer-events: none; transition: all .3s; }
.pl-info.show { opacity: 1; transform: none; pointer-events: auto; }
.pl-info b { font-family: var(--font-round); font-size: 18px; margin-right: 8px; }
.pl-info .chip { margin: 2px 4px 2px 0; }
.pl-info p { margin: 8px 0 0; font-size: 13.5px; line-height: 1.7; color: #dbe2ff; }
.pl-wrap.quiz-mode .pl-canvas { filter: brightness(.55); pointer-events: none; }
.pl-quiz { position: absolute; inset: 56px 0 0 0; overflow: auto; padding: 8px 16px calc(30px + var(--safe-b)); }
.pl-quiz > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.pl-quiz .q-card { background: rgba(8, 14, 40, .8); }

/* ============================================================
   質感の強化（光・ガラス・立体感）
   ============================================================ */
.game-bar { background: linear-gradient(180deg, rgba(8, 12, 34, .88), rgba(8, 12, 34, .62)); box-shadow: 0 12px 30px -14px rgba(0,0,0,.7); border-bottom-color: rgba(255,255,255,.07); }
.game-bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--c1), var(--c2), transparent); opacity: .7; }
.gb-track { background: rgba(255,255,255,.07); box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }

.q-card { position: relative; overflow: hidden; background: linear-gradient(160deg, rgba(34, 42, 100, .72), rgba(10, 14, 42, .78)); border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 24px 50px -24px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.1); }
.q-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--c1), var(--c2), transparent); }
.q-card::after { content: ""; position: absolute; width: 280px; height: 280px; right: -110px; top: -150px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c1) 30%, transparent), transparent 65%); pointer-events: none; }
.q-card > * { position: relative; z-index: 1; }
.q-text { text-shadow: 0 2px 12px rgba(0,0,0,.35); }

.choice { background: linear-gradient(180deg, rgba(44, 54, 118, .6), rgba(14, 18, 50, .82)); border: 1px solid rgba(255,255,255,.12); overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 10px 22px -12px rgba(0,0,0,.8); }
.choice::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 50%; background: linear-gradient(180deg, rgba(255,255,255,.08), transparent); pointer-events: none; }
.choice:hover:not(:disabled) { border-color: color-mix(in srgb, var(--c1) 65%, transparent); background: linear-gradient(180deg, rgba(54, 66, 138, .7), rgba(18, 22, 60, .85));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c1) 35%, transparent), 0 14px 30px -12px color-mix(in srgb, var(--c1) 55%, transparent), inset 0 1px 0 rgba(255,255,255,.18); }
.choice .key { background: linear-gradient(135deg, color-mix(in srgb, var(--c1) 50%, transparent), color-mix(in srgb, var(--c2) 40%, transparent)); border-color: rgba(255,255,255,.25); box-shadow: inset 0 1px 0 rgba(255,255,255,.3); }
.choice.correct { background: linear-gradient(180deg, color-mix(in srgb, var(--ok) 30%, rgba(14,40,40,.9)), rgba(8, 30, 28, .9)); }
.choice.wrong { background: linear-gradient(180deg, color-mix(in srgb, var(--ng) 30%, rgba(40,14,24,.9)), rgba(30, 8, 16, .9)); }

.answer-box { background: linear-gradient(180deg, rgba(2, 4, 16, .78), rgba(12, 16, 40, .72)); border-color: color-mix(in srgb, var(--c1) 35%, transparent);
  box-shadow: inset 0 3px 14px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.04), 0 0 30px -10px color-mix(in srgb, var(--c1) 40%, transparent); }
.keypad button { background: linear-gradient(180deg, rgba(66, 78, 150, .6), rgba(18, 22, 58, .9)); border: 1px solid rgba(255,255,255,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 -3px 0 rgba(0,0,0,.35), 0 8px 16px -8px rgba(0,0,0,.8); }
.keypad button:active { transform: translateY(2px) scale(.97); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -1px 0 rgba(0,0,0,.35); }

.explain { background: linear-gradient(160deg, rgba(36, 44, 100, .8), rgba(12, 16, 46, .9)); box-shadow: 0 24px 50px -24px rgba(0,0,0,.85), inset 0 1px 0 rgba(255,255,255,.1); }

/* 図形マトリクス */
.mx-grid { background: linear-gradient(160deg, rgba(44, 66, 140, .38), rgba(6, 10, 32, .7)); border: 1px solid color-mix(in srgb, var(--c1) 30%, transparent);
  box-shadow: 0 30px 60px -25px rgba(0,0,0,.85), 0 0 50px -12px color-mix(in srgb, var(--c1) 40%, transparent), inset 0 1px 0 rgba(255,255,255,.12); }
.mx-cell { background: radial-gradient(120% 90% at 30% 0%, rgba(255,255,255,.09), transparent 55%), linear-gradient(160deg, #121c4a, #060a22); border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), inset 0 -10px 18px rgba(0,0,0,.4); }
.mx-cell svg { filter: none; }
.mx-opt { background: radial-gradient(120% 90% at 30% 0%, rgba(255,255,255,.1), transparent 55%), linear-gradient(170deg, rgba(40, 52, 120, .55), rgba(10, 14, 40, .85));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 12px 24px -14px rgba(0,0,0,.9); }
.mx-opt:hover:not(:disabled) { box-shadow: 0 0 0 1px color-mix(in srgb, var(--c1) 50%, transparent), 0 16px 30px -12px color-mix(in srgb, var(--c1) 50%, transparent), inset 0 1px 0 rgba(255,255,255,.16); }

/* 数列：ガラス玉 */
.orb {
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.95) 0 5%, rgba(255,255,255,.35) 11%, transparent 28%),
    radial-gradient(circle at 50% 118%, color-mix(in srgb, var(--c2) 75%, transparent), transparent 58%),
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--c1) 60%, #1a0d3a), #10072a 78%);
  border: 1px solid color-mix(in srgb, var(--c1) 70%, #ffffff);
  box-shadow: 0 12px 26px -8px color-mix(in srgb, var(--c1) 60%, transparent), 0 0 24px -6px color-mix(in srgb, var(--c2) 60%, transparent), inset 0 -6px 12px rgba(0,0,0,.35), inset 0 2px 6px rgba(255,255,255,.25);
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
}
.seq-dot { height: 3px; border-radius: 2px; background: linear-gradient(90deg, color-mix(in srgb, var(--c1) 70%, transparent), color-mix(in srgb, var(--c2) 70%, transparent)); box-shadow: 0 0 6px var(--c1); }

/* メモリー：ガラスのタイル */
.mem-grid { background: linear-gradient(160deg, rgba(20, 70, 80, .35), rgba(4, 12, 26, .7)); border: 1px solid color-mix(in srgb, var(--c1) 25%, transparent);
  box-shadow: 0 30px 60px -25px rgba(0,0,0,.85), 0 0 50px -14px color-mix(in srgb, var(--c1) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.1); }
.mem-cell { background: radial-gradient(120% 90% at 30% 0%, rgba(255,255,255,.1), transparent 55%), linear-gradient(160deg, rgba(40, 110, 120, .35), rgba(6, 22, 34, .8));
  border: 1px solid rgba(160, 255, 230, .14); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -8px 14px rgba(0,0,0,.4), 0 8px 14px -10px rgba(0,0,0,.9); }
.mem-cell.lit { background: radial-gradient(circle at 34% 28%, #fff 0 7%, rgba(255,255,255,.3) 16%, transparent 38%), linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 0 0 2px rgba(255,255,255,.55), 0 0 26px var(--c1), 0 0 60px color-mix(in srgb, var(--c1) 55%, transparent); }
.mem-cell.hit { background: radial-gradient(circle at 34% 28%, rgba(255,255,255,.7) 0 6%, transparent 32%), linear-gradient(135deg, color-mix(in srgb, var(--ok) 85%, #fff), color-mix(in srgb, var(--ok) 55%, #06302a));
  box-shadow: 0 0 22px color-mix(in srgb, var(--ok) 60%, transparent), inset 0 -6px 12px rgba(0,0,0,.25); }
.mem-cell.miss { background: linear-gradient(135deg, #ff8a9a, #c01d3d); }

/* フラッシュ暗算 */
.flash-stage { background: radial-gradient(circle at 50% 50%, transparent 0 min(21vw, 84px), color-mix(in srgb, var(--c1) 55%, transparent) calc(min(21vw, 84px) + 1px), transparent calc(min(21vw, 84px) + 3px)), radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c1) 26%, transparent), transparent 60%), linear-gradient(160deg, rgba(50, 20, 90, .6), rgba(8, 6, 26, .88)); }
.flash-stage::before { content: ""; position: absolute; width: 160%; aspect-ratio: 1; left: -30%; top: 50%; margin-top: -80%;
  background: conic-gradient(from 0deg, transparent, color-mix(in srgb, var(--c1) 35%, transparent), transparent 25%, color-mix(in srgb, var(--c2) 35%, transparent), transparent 55%, color-mix(in srgb, var(--c1) 25%, transparent), transparent 80%);
  animation: spin 14s linear infinite; opacity: .8; pointer-events: none;
  -webkit-mask: radial-gradient(circle, transparent 18%, #000 42%); mask: radial-gradient(circle, transparent 18%, #000 42%); }
.flash-stage::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px); pointer-events: none; }
.flash-num, .flash-msg { position: relative; z-index: 1; }
.flash-stage .flash-info { z-index: 1; }
.flash-burst { position: absolute; left: 50%; top: 50%; width: min(46vw, 180px); aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  border: 2px solid color-mix(in srgb, var(--c1) 80%, #fff); box-shadow: 0 0 30px var(--c1), inset 0 0 30px color-mix(in srgb, var(--c1) 60%, transparent);
  animation: burst .75s cubic-bezier(.2,.8,.2,1) forwards; }
.flash-burst.minus { border-color: #ff8fa6; box-shadow: 0 0 30px #ff4d6d, inset 0 0 30px rgba(255,77,109,.5); }
@keyframes burst { from { transform: translate(-50%, -50%) scale(.35); opacity: 1; } to { transform: translate(-50%, -50%) scale(1.35); opacity: 0; } }
.flash-num { background: linear-gradient(180deg, #ffffff 25%, color-mix(in srgb, var(--c1) 45%, #fff) 62%, var(--c1)); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 0 16px var(--c1)) drop-shadow(0 0 40px color-mix(in srgb, var(--c2) 70%, transparent)); }
.flash-num.minus { background: linear-gradient(180deg, #ffffff 25%, #ffb3c4 62%, #ff4d6d); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 16px #ff4d6d); }

/* ことばの結晶：多面カットの水晶 */
.tile { background: linear-gradient(145deg, rgba(255,255,255,.38), rgba(255,255,255,.07) 46%, rgba(255,255,255,.16) 54%, rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -5px 12px rgba(0,0,0,.25), 0 14px 26px -10px rgba(0,0,0,.7), 0 0 26px -6px color-mix(in srgb, var(--c1) 55%, transparent);
  text-shadow: 0 2px 10px color-mix(in srgb, var(--c2) 70%, transparent); }

/* タイムライン */
.tl-card { background: linear-gradient(180deg, rgba(70, 44, 96, .55), rgba(22, 12, 38, .85)); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 10px 22px -14px rgba(0,0,0,.9); border-left: 3px solid var(--c1); }
.tl-slot { background: rgba(255,255,255,.02); }

/* ---------- レスポンシブ ---------- */
@media (min-width: 820px) {
  .mx-wrap { grid-template-columns: 1fr 1fr; align-items: center; }
  .mx-opts { width: 100%; max-width: 360px; }
}
@media (max-width: 760px) {
  .profile { grid-template-columns: 1fr; }
  .radar { max-width: 260px; }
}
@media (max-width: 560px) {
  .wrap { padding-top: 14px; }
  .games { grid-template-columns: 1fr 1fr; gap: 12px; }
  .games .game-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .games .game-card:last-child:nth-child(odd) .gc-art { aspect-ratio: 2 / 1; }
  .game-card { border-radius: 18px; }
  .gc-art .gc-icon { width: 36px; height: 36px; border-radius: 11px; left: 10px; bottom: 8px; }
  .gc-art .gc-icon svg { width: 21px; height: 21px; }
  .gc-body { padding: 8px 12px 12px; gap: 6px; }
  .gc-title { font-size: 15px; }
  .gc-en { font-size: 8px; letter-spacing: .2em; }
  .gc-desc { font-size: 11.3px; line-height: 1.55; }
  .gc-foot { flex-direction: column; align-items: flex-start; gap: 4px; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 6px; }
  .hero-visual { position: absolute; right: -96px; top: -70px; width: 250px; height: 250px; opacity: .5; z-index: -1; }
  .lv-ring { width: 88px; height: 88px; }
  .lv-ring .lv-num b { font-size: 28px; }
  .profile { padding: 16px; }
  .choices { grid-template-columns: 1fr; gap: 10px; }
  .choices.nums { grid-template-columns: repeat(2, 1fr); }
  .choices.kanji { grid-template-columns: 1fr 1fr; }
  .choice { min-height: 54px; font-size: 15px; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .q-card { padding: 16px; }
  .stage { padding-top: 14px; }
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 26px 26px 0 0; max-height: 92dvh; padding-bottom: var(--safe-b); }
  .keypad button { height: 54px; }
  .game-bar { padding: 8px 12px; gap: 10px; }
  .seq-row { gap: 8px 2px; }
  .seq-dot { width: 4px; }
  .seq-item { gap: 2px; }
  .orb { --s: min(76px, calc((100vw - 124px) / 6)); font-size: clamp(13px, 3.8vw, 20px); }
}
@media (max-width: 360px) {
  .games { grid-template-columns: 1fr; }
}
@media (hover: none) {
  .game-card:hover, .choice:hover:not(:disabled), .mx-opt:hover:not(:disabled) { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
