/* ============================================================
   授業ライブ — デザイン「Astra 教室版」
   数学ラボ3の Astra Academy（星空・方眼・ガラス・金の細線・明朝見出し）を教室向けに調整。
   ・背景と枠は暗く光らせ、問題・振り返り・結果など「読む部分」は白い紙面（.paper）にする
   ・夜（既定）／昼（data-theme="day"）の2つ
   ============================================================ */

/* ---------- トークン（夜） ---------- */
:root {
  --ink0: #05091d;
  --night: #0a1231;
  --gold: #ffd77a;
  --gold-2: #e39a35;
  --cyan: #78e7ff;
  --violet: #b19cff;
  --mint: #72e5b2;
  --rose: #ff8fa8;
  --amber: #ffc56b;

  --bg: var(--ink0);
  --surface: rgba(18, 32, 88, .66);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .12);
  --ink: #f3f6ff;
  --ink-2: #c7d3f2;
  --ink-3: #93a3cc;
  --line: rgba(171, 220, 255, .26);
  --line-strong: rgba(171, 220, 255, .5);
  --line-gold: rgba(255, 220, 132, .55);
  --primary: #7fd0ff;
  --primary-2: #a9e1ff;
  --primary-ink: #061130;
  --primary-soft: rgba(127, 208, 255, .15);
  --good: #72e5b2;
  --good-soft: rgba(114, 229, 178, .15);
  --bad: #ff8fa8;
  --bad-soft: rgba(255, 143, 168, .16);
  --warn: #ffc56b;
  --warn-soft: rgba(255, 197, 107, .16);
  --violet-soft: rgba(177, 156, 255, .17);
  --grid: rgba(171, 220, 255, .16);

  --card-bg: linear-gradient(145deg, rgba(22, 40, 106, .74), rgba(28, 20, 86, .64));
  --card-border: rgba(171, 220, 255, .28);
  --card-shadow: 0 16px 40px rgba(1, 5, 26, .38), inset 0 1px rgba(255, 255, 255, .12);
  --bar-bg: linear-gradient(180deg, rgba(5, 8, 33, .93), rgba(8, 14, 48, .74));
  --field-bg: rgba(4, 9, 34, .55);
  --tile-base: #1f3587;
  --tile-end: rgba(17, 22, 72, .92);
  --paper-shadow: 0 14px 34px rgba(1, 5, 26, .45);

  --radius: 18px;
  --radius-s: 12px;
  --shadow: var(--card-shadow);
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "BIZ UDPGothic", "Yu Gothic UI", Meiryo, sans-serif;
  --font-round: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  --font-mincho: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --font-latin: "Cinzel", "Copperplate", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* ---------- 昼（明るい表示） ---------- */
:root[data-theme="day"] {
  --bg: #eef3ff;
  --surface: rgba(255, 255, 255, .86);
  --surface-2: rgba(40, 70, 160, .06);
  --surface-3: rgba(40, 70, 160, .11);
  --ink: #17204a;
  --ink-2: #435079;
  --ink-3: #75819f;
  --line: rgba(40, 70, 160, .18);
  --line-strong: rgba(40, 70, 160, .38);
  --line-gold: rgba(196, 136, 42, .55);
  --primary: #3552d6;
  --primary-2: #2a44b8;
  --primary-ink: #ffffff;
  --primary-soft: #e6ebff;
  --good: #13875b;
  --good-soft: #dcf4e9;
  --bad: #cf3b55;
  --bad-soft: #fde4e9;
  --warn: #b36800;
  --warn-soft: #fff0d4;
  --violet: #6b49cf;
  --violet-soft: #eee8ff;
  --gold: #b97b1c;
  --cyan: #0b87b3;
  --mint: #13875b;
  --rose: #cf3b55;
  --amber: #b36800;
  --grid: #dfe6f3;
  --card-bg: linear-gradient(145deg, rgba(255, 255, 255, .94), rgba(245, 248, 255, .88));
  --card-border: rgba(40, 70, 160, .14);
  --card-shadow: 0 10px 28px rgba(40, 60, 130, .12), inset 0 1px rgba(255, 255, 255, .9);
  --bar-bg: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(245, 248, 255, .86));
  --field-bg: #ffffff;
  --tile-base: #e9eeff;
  --tile-end: rgba(255, 255, 255, .96);
  --paper-shadow: 0 10px 26px rgba(40, 60, 130, .14);
  color-scheme: light;
}

/* ---------- 紙面（問題・振り返り・結果・一覧など、読む部分） ---------- */
.paper {
  --surface: #ffffff;
  --surface-2: #eef2fc;
  --surface-3: #e0e7f7;
  --ink: #18214a;
  --ink-2: #465179;
  --ink-3: #7b86a4;
  --line: #d9e0f1;
  --line-strong: #b8c4e4;
  --primary: #3a57d8;
  --primary-2: #2c45bd;
  --primary-ink: #ffffff;
  --primary-soft: #e7ecff;
  --good: #13875b;
  --good-soft: #ddf5ea;
  --bad: #cf3b55;
  --bad-soft: #fde5ea;
  --warn: #b36800;
  --warn-soft: #fff1d8;
  --violet: #6b49cf;
  --violet-soft: #efe9ff;
  --gold: #b97b1c;
  --cyan: #0b87b3;
  --grid: #e2e8f4;
  --field-bg: #ffffff;
  color: var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; background: var(--bg);
}
/* 夜空：放射グラデ＋藍＋38pxの数学方眼＋星 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 55% at 50% -12%, rgba(92, 120, 255, .34), transparent 62%),
    radial-gradient(ellipse 55% 45% at 105% 100%, rgba(160, 95, 255, .20), transparent 62%),
    radial-gradient(ellipse 45% 40% at -5% 70%, rgba(60, 200, 255, .10), transparent 60%),
    linear-gradient(155deg, #0c1744 0%, #070d2b 55%, #05091d 100%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='23' cy='41' r='1.1' opacity='.8'/%3E%3Ccircle cx='121' cy='18' r='.8' opacity='.6'/%3E%3Ccircle cx='199' cy='97' r='1.3' opacity='.9'/%3E%3Ccircle cx='301' cy='44' r='.9' opacity='.5'/%3E%3Ccircle cx='377' cy='131' r='1.1' opacity='.7'/%3E%3Ccircle cx='63' cy='171' r='.8' opacity='.5'/%3E%3Ccircle cx='151' cy='233' r='1' opacity='.7'/%3E%3Ccircle cx='261' cy='201' r='.7' opacity='.5'/%3E%3Ccircle cx='349' cy='267' r='1.2' opacity='.8'/%3E%3Ccircle cx='31' cy='309' r='1' opacity='.6'/%3E%3Ccircle cx='113' cy='371' r='.8' opacity='.6'/%3E%3Ccircle cx='219' cy='339' r='1.2' opacity='.8'/%3E%3Ccircle cx='309' cy='389' r='.8' opacity='.5'/%3E%3Ccircle cx='401' cy='359' r='.9' opacity='.6'/%3E%3C/g%3E%3Cg fill='%23ffe6a8'%3E%3Ccircle cx='247' cy='139' r='1.4' opacity='.9'/%3E%3Ccircle cx='81' cy='261' r='1.2' opacity='.8'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(rgba(150, 200, 255, .085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 200, 255, .085) 1px, transparent 1px);
  background-size: 420px 420px, 38px 38px, 38px 38px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .7) 50%, rgba(0, 0, 0, .25) 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .7) 50%, rgba(0, 0, 0, .25) 100%);
}
:root[data-theme="day"] body::before {
  background:
    radial-gradient(ellipse 80% 55% at 50% -12%, rgba(120, 160, 255, .30), transparent 62%),
    radial-gradient(ellipse 55% 45% at 105% 100%, rgba(255, 200, 120, .22), transparent 62%),
    linear-gradient(160deg, #e7eeff 0%, #f5f8ff 55%, #fdf8ee 100%);
}
:root[data-theme="day"] body::after {
  background-image: linear-gradient(rgba(40, 70, 160, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(40, 70, 160, .07) 1px, transparent 1px);
  background-size: 38px 38px, 38px 38px;
}
/* 右上の軌道リング（飾り） */
.sky-deco { position: fixed; right: -140px; top: -140px; width: 460px; height: 460px; pointer-events: none; z-index: -1; opacity: .5; }
.sky-deco::before, .sky-deco::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(155, 237, 255, .22); }
.sky-deco::after { inset: 70px; border-color: rgba(255, 220, 132, .22); box-shadow: 0 0 60px rgba(120, 200, 255, .12) inset; }
:root[data-theme="day"] .sky-deco { opacity: .7; }
:root[data-theme="day"] .sky-deco::before { border-color: rgba(60, 100, 200, .16); }
:root[data-theme="day"] .sky-deco::after { border-color: rgba(200, 140, 40, .2); }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
::selection { background: rgba(120, 231, 255, .35); }
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.22em; }

/* ---------- 文字 ---------- */
.eyebrow { font: 700 11px/1.4 var(--font-latin); letter-spacing: .2em; text-transform: uppercase; color: var(--cyan); }
.eyebrow.gold { color: var(--gold); }
.mincho { font-family: var(--font-mincho); }
.round { font-family: var(--font-round); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 8px; }
h1 { font-size: 22px; font-family: var(--font-mincho); font-weight: 700; letter-spacing: .02em; }
h2 { font-size: 18px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 800; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }

/* ---------- レイアウト ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 18px 16px 150px; }
.wrap.wide { max-width: 1360px; padding-bottom: 40px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > section:empty, .stack > div:empty { display: none; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- ヘッダー ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--bar-bg);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .18);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--line-gold), transparent); }
.topbar .in { max-width: 1360px; margin: 0 auto; padding: 9px 16px; display: flex; align-items: center; gap: 12px; }
.topbar.narrow .in { max-width: 760px; }
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand .emblem { width: 34px; height: 34px; filter: drop-shadow(0 0 8px rgba(255, 210, 110, .45)); }
.brand .wm { display: flex; flex-direction: column; line-height: 1.05; }
.brand .wm b {
  font: 700 19px var(--font-mincho); letter-spacing: .08em;
  background: linear-gradient(90deg, #fff, #bdf3ff 55%, #dcc8ff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="day"] .brand .wm b { background: linear-gradient(90deg, #1b2a6b, #3552d6 60%, #7b4fd0); -webkit-background-clip: text; background-clip: text; }
.brand .wm small { font: 700 8.5px var(--font-latin); letter-spacing: .26em; color: var(--gold); margin-top: 3px; }
.who { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.who .badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 700;
}
.who .num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 800 13px var(--font-round);
  background: radial-gradient(circle at 35% 30%, #fff5cf, #ffd36e 50%, #c9781f); color: #4a2a06; box-shadow: 0 0 10px rgba(255, 210, 110, .45);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); display: inline-block; flex: none; }
.dot.on { background: var(--mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 25%, transparent), 0 0 10px var(--mint); }
.dot.off { background: var(--rose); box-shadow: 0 0 8px var(--rose); }

/* ---------- カード（ガラス）・紙面・タイル ---------- */
.card {
  position: relative; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--card-shadow); padding: 16px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.card::before {
  content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--line-gold), transparent);
}
.card.flat { box-shadow: none; background: var(--surface-2); backdrop-filter: none; }
.card.flat::before { display: none; }
.card.tint { background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 20%, transparent), color-mix(in srgb, var(--violet) 12%, transparent)), var(--card-bg); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.card.good { background: linear-gradient(145deg, color-mix(in srgb, var(--good) 22%, transparent), transparent), var(--card-bg); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.card.warn { background: linear-gradient(145deg, color-mix(in srgb, var(--warn) 22%, transparent), transparent), var(--card-bg); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.card.bad { background: linear-gradient(145deg, color-mix(in srgb, var(--bad) 22%, transparent), transparent), var(--card-bg); border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.card.paper {
  background: linear-gradient(180deg, #ffffff, #f4f7ff); border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: var(--paper-shadow); backdrop-filter: none; -webkit-backdrop-filter: none;
}
.card.paper::before { background: linear-gradient(90deg, transparent, rgba(196, 136, 42, .5), transparent); }
.card.paper.flat { background: #f3f6fd; border-color: #e1e7f5; box-shadow: none; }
.card h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card.center h2 { justify-content: center; }
.card-k { font: 700 11px/1.4 var(--font-latin); letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); margin-bottom: 4px; }
.paper .card-k { color: var(--primary); }
.lesson-no {
  font: 800 13px var(--font-round); padding: 2px 9px; border-radius: 8px; letter-spacing: .02em;
  background: linear-gradient(135deg, rgba(120, 231, 255, .2), rgba(169, 149, 255, .2)); color: var(--ink);
  border: 1px solid var(--line); vertical-align: 2px;
}
.paper .lesson-no, :root[data-theme="day"] .lesson-no { background: linear-gradient(135deg, #e7ecff, #efe7ff); color: #2b3a8f; border-color: #cfd8f4; }
.meate { font: 700 19px/1.5 var(--font-mincho); }
.meate::before {
  content: "めあて"; display: inline-block; font: 800 12px var(--font-round); color: #4a2a06; background: linear-gradient(180deg, #ffe39a, #e8a743);
  border-radius: 6px; padding: 1px 8px; margin-right: 8px; vertical-align: 3px;
}

/* 今日の授業（ヒーロー） */
.hero {
  --uc: #6f96ff; position: relative; overflow: hidden; padding: 20px 20px 18px; border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--uc) 55%, rgba(255, 255, 255, .45));
  background:
    radial-gradient(circle at 88% 22%, color-mix(in srgb, var(--uc) 34%, transparent), transparent 46%),
    linear-gradient(118deg, rgba(11, 26, 75, .92), rgba(34, 23, 92, .72));
  box-shadow: 0 18px 45px rgba(0, 2, 28, .42), inset 0 1px rgba(255, 255, 255, .26);
}
:root[data-theme="day"] .hero {
  background: radial-gradient(circle at 88% 22%, color-mix(in srgb, var(--uc) 22%, transparent), transparent 46%), linear-gradient(118deg, #ffffff, #eef2ff);
  box-shadow: 0 14px 30px rgba(40, 60, 130, .14);
}
.hero .eyebrow { color: color-mix(in srgb, var(--uc) 45%, #bff4ff); padding-right: 110px; }
:root[data-theme="day"] .hero .eyebrow { color: color-mix(in srgb, var(--uc) 80%, #1b2a6b); }
.hero-title { position: relative; margin: 8px 0 4px; padding-right: 110px; font: 700 clamp(24px, 5.2vw, 34px)/1.25 var(--font-mincho); text-shadow: 0 0 24px rgba(126, 229, 255, .3); }
:root[data-theme="day"] .hero-title { text-shadow: none; }
.hero-title .lesson-no { font-size: 15px; margin-right: 8px; vertical-align: 5px; }
.hero-crest {
  position: absolute; right: 20px; top: 20px; width: 88px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--uc) 70%, white); color: color-mix(in srgb, var(--uc) 55%, white);
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--uc) 32%, transparent), rgba(5, 10, 40, .4) 70%);
  box-shadow: 0 0 0 9px color-mix(in srgb, var(--uc) 11%, transparent), 0 0 0 22px color-mix(in srgb, var(--uc) 6%, transparent), 0 0 30px color-mix(in srgb, var(--uc) 40%, transparent);
  animation: orbitBreathe 4.8s ease-in-out infinite;
}
:root[data-theme="day"] .hero-crest { background: radial-gradient(circle at 40% 35%, #fff, color-mix(in srgb, var(--uc) 16%, white)); color: color-mix(in srgb, var(--uc) 85%, #10204a); }
.hero-crest .ic { width: 44px; height: 44px; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--uc) 60%, transparent)); }
.objective {
  position: relative; margin-top: 14px; padding: 12px 14px 12px 46px; border: 1px solid var(--line-gold); border-radius: 14px;
  background: linear-gradient(115deg, rgba(120, 76, 14, .32), rgba(20, 22, 70, .25));
}
:root[data-theme="day"] .objective { background: linear-gradient(115deg, #fff7e3, #ffffff); }
.objective .ic { position: absolute; left: 14px; top: 14px; width: 22px; height: 22px; color: var(--gold); filter: drop-shadow(0 0 6px rgba(255, 210, 110, .6)); }
.objective .k { display: block; font: 700 10.5px var(--font-latin); letter-spacing: .2em; color: var(--gold); }
.objective p { margin: 2px 0 0; font: 700 clamp(17px, 3.6vw, 20px)/1.5 var(--font-mincho); }
.hero-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 480px) {
  .hero .eyebrow, .hero-title { padding-right: 76px; }
  .hero-crest { width: 64px; right: 14px; top: 16px; }
  .hero-crest .ic { width: 32px; height: 32px; }
}

/* ミッションのタイル（小テスト・振り返り・課題・投票など） */
.tile {
  --tile: #7fc4ff; position: relative; overflow: hidden; padding: 16px 18px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--tile) 58%, rgba(255, 255, 255, .45));
  background: linear-gradient(145deg, color-mix(in srgb, var(--tile) 25%, var(--tile-base)), var(--tile-end));
  box-shadow: 0 6px 0 rgba(3, 8, 34, .55), 0 13px 24px rgba(0, 3, 25, .28), inset 0 1px rgba(255, 255, 255, .2);
}
:root[data-theme="day"] .tile { box-shadow: 0 5px 0 color-mix(in srgb, var(--tile) 22%, #c9d3ee), 0 10px 22px rgba(40, 60, 130, .12); }
.tile.violet { --tile: #c28bff; } .tile.mint { --tile: #69e8bf; } .tile.gold { --tile: #ffd26e; } .tile.rose { --tile: #ff8fb0; } .tile.cyan { --tile: #78e7ff; }
:root[data-theme="day"] .tile { --tile: #2f6fd6; }
:root[data-theme="day"] .tile.violet { --tile: #7b4fd0; } :root[data-theme="day"] .tile.mint { --tile: #129a6c; } :root[data-theme="day"] .tile.gold { --tile: #c5821f; } :root[data-theme="day"] .tile.rose { --tile: #d2476a; } :root[data-theme="day"] .tile.cyan { --tile: #0b87b3; }
.tile .ribbon { display: flex; align-items: center; gap: 8px; color: var(--tile); font: 700 10.5px var(--font-latin); letter-spacing: .2em; text-transform: uppercase; }
.tile .big-ic { position: absolute; right: 16px; top: 14px; width: 50px; height: 50px; color: var(--tile); opacity: .9; filter: drop-shadow(0 0 10px var(--tile)); }
:root[data-theme="day"] .tile .big-ic { filter: none; opacity: .75; }
.tile h2 { margin: 6px 64px 4px 0; font: 700 20px/1.35 var(--font-mincho); display: block; }
.tile .meta { color: var(--ink-2); font-size: 13px; margin: 0 64px 10px 0; }
.tile .state { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--good); }
.tile .state .ic { width: 20px; height: 20px; }

/* 待機画面（授業前） */
.await { text-align: center; padding: 26px 16px 22px; overflow: hidden; }
.orb {
  position: relative; width: 132px; aspect-ratio: 1; margin: 18px auto 30px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #e8fbff, #84ccff 30%, #4a4fd0 64%, #171b5c 100%);
  box-shadow: 0 0 46px rgba(120, 200, 255, .55), inset -12px -16px 30px rgba(12, 10, 60, .65);
  animation: orbFloat 5.5s ease-in-out infinite;
}
.orb::before, .orb::after { content: ""; position: absolute; border-radius: 50%; left: 50%; top: 50%; pointer-events: none; }
.orb::before { width: 214px; height: 66px; margin: -33px 0 0 -107px; border: 1.5px solid rgba(255, 220, 132, .7); transform: rotate(-16deg); box-shadow: 0 0 12px rgba(255, 210, 110, .35); }
.orb::after { width: 250px; height: 250px; margin: -125px 0 0 -125px; border: 1px dashed rgba(155, 237, 255, .3); animation: spin 60s linear infinite; }
:root[data-theme="day"] .orb::after { border-color: rgba(60, 100, 200, .25); }
.await h2 { justify-content: center; font: 700 22px var(--font-mincho); }
.twinkle { display: inline-flex; gap: 6px; margin-left: 4px; vertical-align: middle; }
.twinkle i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); display: inline-block; animation: twinkle 1.4s infinite; }
.twinkle i:nth-child(2) { animation-delay: .2s; } .twinkle i:nth-child(3) { animation-delay: .4s; }

/* ---------- ボタン ---------- */
.btn {
  position: relative; appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 12px; padding: 10px 16px; min-height: 44px; font-family: var(--font-round); font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; letter-spacing: .02em;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; overflow: hidden;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn:active { transform: translateY(2px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: grayscale(.4); }
#screenBtn { white-space: nowrap; flex: none; }
.bonus-star { color: #c9851a; font-size: .95em; }
.btn .ic { width: 18px; height: 18px; }
/* 金（いちばん大事な操作） */
.btn.primary {
  color: #3a1f02; border: 1px solid #ffeab0;
  background: linear-gradient(180deg, #ffd479 0%, #f0a23c 55%, #d87b1c 100%);
  box-shadow: 0 4px 0 #8a4b10, 0 10px 22px rgba(255, 170, 60, .28), inset 0 1px rgba(255, 255, 255, .6);
  text-shadow: 0 1px rgba(255, 255, 255, .35);
}
.btn.primary:hover { filter: brightness(1.08) saturate(1.05); background: linear-gradient(180deg, #ffdd8e 0%, #f3aa47 55%, #de8424 100%); }
.btn.primary:active { box-shadow: 0 1px 0 #8a4b10, inset 0 2px 6px rgba(0, 0, 0, .25); transform: translateY(3px); }
.btn.blue { color: #fff; border-color: #bcecff; background: linear-gradient(180deg, #4f9bff, #4a47c9); box-shadow: 0 4px 0 #242a7a, 0 10px 20px rgba(80, 140, 255, .25), inset 0 1px rgba(255, 255, 255, .45); }
.btn.violet { color: #fff; border-color: #ead6ff; background: linear-gradient(180deg, #b77bff, #6a3cc4); box-shadow: 0 4px 0 #3c1f7a, 0 10px 20px rgba(160, 110, 255, .25), inset 0 1px rgba(255, 255, 255, .45); }
.btn.good { color: #fff; border-color: #c7ffef; background: linear-gradient(180deg, #3fd4b0, #14897f); box-shadow: 0 4px 0 #0b4f4a, 0 10px 20px rgba(60, 210, 170, .22), inset 0 1px rgba(255, 255, 255, .45); }
.btn.bad { color: #fff; border-color: #ffd0ce; background: linear-gradient(180deg, #ff7a8b, #bb2f55); box-shadow: 0 4px 0 #6b1430, 0 10px 20px rgba(255, 100, 130, .22), inset 0 1px rgba(255, 255, 255, .4); }
.btn.blue:hover, .btn.violet:hover, .btn.good:hover, .btn.bad:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.soft { background: var(--surface-2); border-color: var(--line); }
.btn.small { min-height: 34px; padding: 5px 12px; border-radius: 9px; font-size: 13.5px; }
.btn.small.primary, .btn.small.good, .btn.small.bad, .btn.small.blue, .btn.small.violet { box-shadow: 0 3px 0 rgba(0, 0, 0, .35), inset 0 1px rgba(255, 255, 255, .45); }
.btn.big { min-height: 58px; font-size: 19px; padding: 12px 26px; border-radius: 14px; letter-spacing: .06em; }
/* 斜めカット＋内側の線（Astra の GameButton 風） */
.btn.slant { border-radius: 0; clip-path: polygon(3.5% 0, 100% 0, 96.5% 100%, 0 100%); padding-left: 34px; padding-right: 34px; }
.btn.slant::after { content: ""; position: absolute; inset: 4px 8px; clip-path: polygon(3% 0, 100% 0, 97% 100%, 0 100%); border: 1px solid rgba(255, 255, 255, .42); pointer-events: none; }
.btn.slant::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent); transform: skewX(-18deg);
}
.btn.slant:hover::before { animation: shine .8s ease; }
.btn.block { width: 100%; }
.btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.iconbtn { min-width: 44px; padding: 8px; }
.paper .btn:not(.primary):not(.good):not(.bad):not(.blue):not(.violet) { background: #ffffff; border-color: #cfd8ee; color: #22306a; box-shadow: 0 2px 0 #dfe5f4; }
.paper .btn:not(.primary):not(.good):not(.bad):not(.blue):not(.violet):hover { background: #f1f4fe; border-color: #aebce4; }
.paper .btn.ghost { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
.paper .btn.on { background: var(--primary-soft) !important; border-color: var(--primary) !important; color: var(--primary) !important; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; cursor: pointer; font: 800 14px var(--font-round); color: var(--ink-2); min-height: 36px; }
.seg button.on { background: linear-gradient(180deg, rgba(120, 231, 255, .3), rgba(120, 160, 255, .18)); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(120, 231, 255, .55), 0 0 12px rgba(120, 231, 255, .2); }
:root[data-theme="day"] .seg button.on, .paper .seg button.on { background: #ffffff; color: var(--primary); box-shadow: 0 1px 3px rgba(30, 50, 120, .18), inset 0 0 0 1px #c6d1f2; }

/* ---------- 入力 ---------- */
label.f { display: block; font-size: 13px; font-weight: 800; color: var(--ink-2); margin: 12px 0 5px; }
input.in, select.in, textarea.in {
  width: 100%; border: 1.5px solid var(--line); background: var(--field-bg); border-radius: 12px; color: var(--ink);
  padding: 10px 12px; min-height: 46px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input.in::placeholder, textarea.in::placeholder { color: var(--ink-3); opacity: .9; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 22%, transparent); }
.paper input.in:focus, .paper select.in:focus, .paper textarea.in:focus { border-color: #5b73e6; box-shadow: 0 0 0 3px rgba(91, 115, 230, .18); }
textarea.in { min-height: 86px; resize: vertical; line-height: 1.65; }
select.in option { background: #0d1538; color: #f3f6ff; }
.paper select.in option, :root[data-theme="day"] select.in option { background: #fff; color: #18214a; }
.in.bad { border-color: var(--bad); }
.field-hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.msg { border-radius: 12px; padding: 9px 12px; font-size: 14px; margin-top: 10px; border: 1px solid transparent; }
.msg.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.msg.good { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.msg.info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.msg.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.row > input.in, .row > select.in { width: auto; flex: 1 1 80px; min-width: 0; }
.row > input.in[style*="width"], .row > select.in[style*="width"] { flex: 0 0 auto; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: #e8a743; }

/* ---------- チップ ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; border: 1px solid var(--line); font-family: var(--font-round);
}
.chip.p { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 38%, transparent); }
.chip.g { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 38%, transparent); }
.chip.b { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.chip.w { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.chip.v { background: var(--violet-soft); color: var(--violet); border-color: color-mix(in srgb, var(--violet) 40%, transparent); }
.chip.lv2 { box-shadow: 0 0 0 1px currentColor inset, 0 0 10px color-mix(in srgb, currentColor 30%, transparent); }
button.chip { cursor: pointer; }

/* ---------- 数式 ---------- */
.math { font-family: "Times New Roman", "Hiragino Mincho ProN", serif; font-size: 1.1em; white-space: nowrap; display: inline-flex; align-items: center; flex-wrap: wrap; vertical-align: middle; }
.math i.mv { font-style: italic; padding: 0 1px; }
.math .mn { font-family: var(--font); font-feature-settings: "tnum"; }
.math .mo { font-family: var(--font); }
.math .mo.b { padding: 0 .28em; }
.math sup { font-size: .72em; margin-left: 1px; position: relative; top: -.1em; }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 2px; line-height: 1.12; font-size: .92em; }
.frac .fn { padding: 0 3px 1px; }
.frac .fd { padding: 1px 3px 0; border-top: 1.5px solid currentColor; }
.unit { margin-left: 4px; color: var(--ink-2); font-size: .92em; }

/* ---------- 図 ---------- */
svg.fig { display: block; max-width: 100%; height: auto; margin: 10px auto; color: var(--ink); }
svg.fig.sq { max-width: 360px; }
svg.fig.wide { max-width: 560px; }
svg.fig.small { max-width: 180px; }
.fg-grid { stroke: var(--grid); stroke-width: 1; }
.fg-ink { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.fg-inkfill { fill: var(--ink); }
.fg-hid { stroke: var(--ink-3); stroke-width: 1.3; stroke-dasharray: 5 4; }
.fg-sub { stroke: var(--ink-3); stroke-width: 1.2; }
.fg-acc { stroke: var(--primary); stroke-width: 2.4; fill: none; }
.fg-acc2 { stroke: var(--violet); stroke-width: 2; stroke-dasharray: 7 5; }
.fg-dot { fill: var(--ink); }
.fg-txt { fill: var(--ink-2); font-size: 13px; font-family: var(--font); }
.fg-txt.it, .fg-lab.it { font-style: italic; font-family: "Times New Roman", serif; }
.fg-num { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.fg-lab { fill: var(--ink); font-size: 15px; font-weight: 800; font-family: var(--font); }
.fg-stick { stroke: #e09a2e; stroke-width: 5; stroke-linecap: round; }
.fg-stone { fill: var(--ink-2); stroke: var(--surface); stroke-width: 2; }
.fg-tri0 { fill: color-mix(in srgb, var(--primary) 35%, transparent); stroke: var(--primary); stroke-width: 1.6; }
.fg-tri { fill: color-mix(in srgb, var(--ink-3) 18%, transparent); stroke: var(--ink-2); stroke-width: 1.4; }
.fg-sector { fill: color-mix(in srgb, var(--primary) 18%, transparent); stroke: var(--primary); stroke-width: 1.8; }
.fg-shape { fill: color-mix(in srgb, var(--primary) 10%, transparent); stroke: var(--ink); stroke-width: 1.6; }
.fg-bar { fill: color-mix(in srgb, var(--primary) 30%, transparent); stroke: var(--primary); stroke-width: 1.2; }
.fg-good { fill: var(--good); }
.fg-bad { fill: none; stroke: var(--bad); stroke-width: 2; }
.fg-pick { fill: var(--primary); }
.fg-ghost { fill: color-mix(in srgb, var(--primary) 25%, transparent); }

/* ---------- 表 ---------- */
table.t { border-collapse: collapse; width: 100%; font-size: 14px; }
table.t th, table.t td { border: 1px solid var(--line); padding: 6px 9px; text-align: center; }
table.t th { background: var(--surface-2); font-weight: 800; }
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- 反応ボタン（下のドック） ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(10, 18, 60, .86), rgba(5, 9, 30, .96)); border-top: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 -10px 30px rgba(0, 0, 0, .3);
}
:root[data-theme="day"] .dock { background: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(244, 247, 255, .97)); box-shadow: 0 -8px 24px rgba(40, 60, 130, .12); }
.dock::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--line-gold), transparent); }
.dock .in { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.rx {
  --rc: #7fd0ff; position: relative; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border-radius: 16px; padding: 7px 2px 5px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 64px;
  font: 800 11px var(--font-round); color: var(--ink-2); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .2s;
}
:root[data-theme="day"] .rx { background: #fff; }
.rx[data-rx="like"] { --rc: #ffd26e; } .rx[data-rx="aha"] { --rc: #78e7ff; } .rx[data-rx="lost"] { --rc: #ff8fa8; } .rx[data-rx="slow"] { --rc: #ffc56b; }
.rx[data-rx="hand"] { --rc: #b19cff; } .rx[data-rx="help"] { --rc: #ff6f86; } .rx[data-rx="q"] { --rc: #8fd0ff; } .rx[data-rx="c"] { --rc: #72e5b2; }
.rx .e {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; line-height: 1;
  background: radial-gradient(circle at 38% 30%, color-mix(in srgb, var(--rc) 55%, transparent), color-mix(in srgb, var(--rc) 12%, transparent) 72%);
  box-shadow: 0 0 12px color-mix(in srgb, var(--rc) 35%, transparent), inset 0 1px rgba(255, 255, 255, .35);
}
.rx:hover { border-color: color-mix(in srgb, var(--rc) 60%, transparent); }
.rx:active { transform: scale(.92); }
.rx.on { border-color: var(--rc); color: var(--ink); background: color-mix(in srgb, var(--rc) 20%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--rc) 45%, transparent), inset 0 0 0 1px var(--rc); }
.rx.on .e { animation: ringPulse 1.8s ease-out infinite; }
.rx:disabled { opacity: .4; }
@media (max-width: 560px) {
  .dock .in { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .rx { min-height: 58px; }
  .rx .e { width: 32px; height: 32px; font-size: 18px; }
  .wrap { padding-bottom: 200px; }
}
.floaty { position: fixed; pointer-events: none; font-size: 32px; z-index: 90; animation: floaty 1.1s ease-out forwards; filter: drop-shadow(0 0 10px rgba(255, 255, 255, .6)); }
body.padopen .dock { display: none; }
body.padopen .wrap { padding-bottom: 60vh; }

/* ---------- タイマー ---------- */
.timerbar { position: sticky; top: 64px; z-index: 25; margin: 0 0 14px; }
.timerbar .card { padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.timerbar .card > .ic { width: 26px; height: 26px; color: var(--gold); filter: drop-shadow(0 0 6px rgba(255, 210, 110, .55)); }
.timerbar .t { font: 800 28px var(--font-round); font-variant-numeric: tabular-nums; letter-spacing: .03em; text-shadow: 0 0 16px rgba(120, 231, 255, .45); }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; flex: 1; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #78e7ff, #9d8cff); border-radius: 99px; transition: width .5s linear; box-shadow: 0 0 10px rgba(120, 231, 255, .5); }
.paper .bar > i, :root[data-theme="day"] .bar > i { background: linear-gradient(90deg, #4b8cf0, #7b5fe0); box-shadow: none; }
.bar.warn > i { background: linear-gradient(90deg, #ffd479, #f08a3c) !important; }
.bar.bad > i { background: linear-gradient(90deg, #ff9bb2, #e0405e) !important; }
.bar.good > i { background: linear-gradient(90deg, #72e5b2, #2cc0a0) !important; }

/* ---------- 小テスト ---------- */
.qhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qhead b { font: 700 17px var(--font-mincho); }
.qprog { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 12px 0 2px; }
.qprog > i { display: block; height: 100%; background: linear-gradient(90deg, #78e7ff, #b19cff); box-shadow: 0 0 10px rgba(120, 231, 255, .5); transition: width .3s; }
.qnav { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 14px; }
.qnav button {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  font: 800 14px var(--font-round); color: var(--ink-2); transition: .15s;
}
.qnav button.done { background: linear-gradient(180deg, rgba(120, 231, 255, .32), rgba(120, 160, 255, .14)); border-color: rgba(120, 231, 255, .65); color: var(--ink); box-shadow: 0 0 12px rgba(120, 231, 255, .28); }
:root[data-theme="day"] .qnav button.done { background: #e6ecff; border-color: #9fb2ef; color: #2b3a8f; box-shadow: none; }
.qnav button.cur { border: 2px solid var(--gold); box-shadow: 0 0 14px rgba(255, 215, 122, .45); color: var(--ink); }
.qnav button.star { color: var(--gold); }
.qnav .rv { width: auto; padding: 0 14px; }
.q-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; margin-bottom: 8px;
  font: 800 12px var(--font-round); color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed); box-shadow: 0 2px 8px rgba(79, 70, 229, .35);
}
.q-pill.star { background: linear-gradient(135deg, #f0a23c, #c9651c); }
.lead { font-size: 17.5px; line-height: 1.8; font-weight: 700; }
.paper .lead { color: #1e2553; }
.sub { border-top: 1px dashed var(--line); padding: 14px 0 4px; }
.sub:first-of-type { border-top: 0; }
.sub .p { margin-bottom: 8px; }
.sub .lb { font: 800 15px var(--font-round); color: var(--primary); margin-right: 6px; }
.choices { display: grid; gap: 9px; }
.choices.cols2 { grid-template-columns: 1fr 1fr; }
.choice {
  display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); background: var(--surface-2); border-radius: 14px;
  padding: 11px 13px; min-height: 50px; cursor: pointer; text-align: left; width: 100%; font-weight: 700; color: var(--ink); transition: .12s;
}
.choice:hover { border-color: var(--line-strong); }
.choice .mk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink-3); flex: none; display: grid; place-items: center; font-size: 13px; }
.choice.multi .mk { border-radius: 6px; }
.choice.on { border-color: var(--cyan); background: color-mix(in srgb, var(--cyan) 16%, transparent); box-shadow: 0 0 14px color-mix(in srgb, var(--cyan) 25%, transparent); }
.choice.on .mk { border-color: var(--cyan); background: var(--cyan); color: #06112e; }
.choice.on .mk::after { content: "✓"; font-weight: 900; }
/* 紙面の上の選択肢（数学ラボ3の選択肢と同じ手ざわり） */
.paper .choice { border: 2.5px solid #aab6f2; background: linear-gradient(135deg, #f4f6ff, #e6ebff); box-shadow: 0 3px 0 #cdd5fa; color: #1e1b4b; }
.paper .choice:hover { border-color: #6f7ff0; transform: translateY(-1px); }
.paper .choice .mk { border-color: #8a96cf; background: #fff; }
.paper .choice.on { border-color: #4f46e5; background: linear-gradient(135deg, #e0e7ff, #c9d3ff); box-shadow: 0 3px 0 #a5b4fc, 0 0 0 3px rgba(79, 70, 229, .14); }
.paper .choice.on .mk { border-color: #4f46e5; background: #4f46e5; color: #fff; }
.choice.right { border-color: var(--good); background: var(--good-soft); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }

/* 数式入力 */
.mf { display: flex; flex-direction: column; gap: 6px; }
.mf .box { display: flex; align-items: center; gap: 8px; }
.mf .box input.in { flex: 1 1 auto; font: 800 20px var(--font-round); letter-spacing: .03em; min-height: 52px; }
.paper .mf .box input.in { border: 2.5px solid #d7def2; color: #1e1b4b; }
.paper .mf .box input.in:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129, 140, 248, .2); }
.mf .u { color: var(--ink-2); white-space: nowrap; font-weight: 700; }
.mf .pv { min-height: 30px; font-size: 19px; padding: 2px 4px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.mf .pv .lbl { font: 800 11px var(--font-round); color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.mf .pv.err { color: var(--bad); font-size: 13px; font-weight: 700; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; }
.keys button {
  min-width: 44px; height: 42px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer;
  font: 800 18px var(--font-round); padding: 0 10px; touch-action: manipulation; color: var(--ink);
}
.paper .keys button { background: linear-gradient(180deg, #ffffff, #eef1fd); border-color: #cdd5f0; color: #26307a; box-shadow: 0 2px 0 #d7ddf2; }
.keys button:active { transform: translateY(2px); }
.pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 6px; padding: 9px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; }
.paper .pad { background: #eef2fc; border-color: #dbe2f4; }
.pad button { height: 48px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font: 800 20px var(--font-round); cursor: pointer; touch-action: manipulation; color: var(--ink); }
.paper .pad button { background: #fff; border-color: #cdd5f0; box-shadow: 0 2px 0 #d7ddf2; color: #1e1b4b; }
.pad button.fn { font-size: 13px; background: var(--surface-3); }
.paper .pad button.fn { background: #e3e8f8; }
.pad button.ok { background: linear-gradient(180deg, #ffd479, #e08a2a); color: #3a1f02; border-color: #ffe3a0; font-size: 15px; }
.pad button:active { transform: translateY(2px); }

/* 方眼入力 */
.gridin { max-width: 400px; margin: 8px auto; touch-action: manipulation; }
.gridin svg { cursor: crosshair; }
.plotlabels { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 6px 0; }
.plotlabels button { min-width: 50px; }

/* 結果 */
.rbanner {
  position: relative; overflow: hidden; text-align: center; padding: 26px 16px 22px; border-radius: 22px; border: 1px solid var(--line-gold);
  background: radial-gradient(circle at 50% -10%, rgba(255, 210, 110, .32), transparent 60%), linear-gradient(160deg, rgba(38, 28, 96, .94), rgba(9, 16, 52, .96));
  box-shadow: 0 18px 44px rgba(0, 2, 28, .45), inset 0 1px rgba(255, 255, 255, .25);
}
:root[data-theme="day"] .rbanner { background: radial-gradient(circle at 50% -10%, rgba(255, 210, 110, .35), transparent 60%), linear-gradient(160deg, #ffffff, #f1f4ff); box-shadow: 0 12px 30px rgba(40, 60, 130, .15); }
.rbanner .eyebrow { font-size: 14px; letter-spacing: .34em; color: var(--gold); }
.rbanner .sub-t { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.rbanner .head { font: 700 20px var(--font-mincho); margin: 6px 0 10px; }
.score-big {
  font: 900 68px/1 var(--font-round); margin: 10px 0 4px;
  background: linear-gradient(180deg, #fff8dc, #ffd479 50%, #e38a2a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 rgba(90, 40, 0, .55));
}
:root[data-theme="day"] .score-big { background: linear-gradient(180deg, #f3b54a, #c9651c); -webkit-background-clip: text; background-clip: text; filter: none; }
.score-big small { font-size: 26px; }
.stars3 { display: flex; justify-content: center; gap: 8px; margin: 6px 0 8px; }
.stars3 .ic { width: 38px; height: 38px; color: rgba(255, 255, 255, .22); fill: rgba(255, 255, 255, .08); }
:root[data-theme="day"] .stars3 .ic { color: #cfd6ea; fill: #eef1f9; }
.stars3 .ic.lit { color: #fff0b0; fill: #ffcf5c; filter: drop-shadow(0 0 10px rgba(255, 200, 80, .8)); animation: starPop .5s cubic-bezier(.2, 1.5, .4, 1) both; }
.stars3 .ic.lit:nth-child(2) { animation-delay: .15s; } .stars3 .ic.lit:nth-child(3) { animation-delay: .3s; }
.res-item { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.res-item:first-child { border-top: 0; }
.mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 900 15px var(--font-round); }
.mark.o { background: var(--good-soft); color: var(--good); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--good) 45%, transparent); }
.mark.x { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bad) 45%, transparent); }
.why { font-size: 13px; color: var(--warn); margin-top: 3px; font-weight: 700; }
.sol { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border-radius: 12px; padding: 9px 12px; margin-top: 8px; border-left: 3px solid var(--primary); }

/* ---------- 振り返り ---------- */
.faces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.face {
  border: 2px solid #d9e0f1; border-radius: 16px; background: linear-gradient(180deg, #ffffff, #f2f5fd); padding: 10px 4px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; font: 800 12px var(--font-round); color: #465179; min-height: 84px; box-shadow: 0 3px 0 #e1e6f4; transition: .12s;
}
.face .e { font-size: 32px; line-height: 1.1; }
.face:hover { transform: translateY(-2px); }
.face.on { border-color: #4f46e5; background: linear-gradient(180deg, #eef1ff, #dfe6ff); color: #2e2a8a; box-shadow: 0 3px 0 #a5b4fc, 0 0 0 3px rgba(79, 70, 229, .14); }
.face.on .e { animation: starPop .45s cubic-bezier(.2, 1.5, .4, 1); }
.stems { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.stems button { border: 1.5px dashed #b3bee0; background: #f7f9ff; border-radius: 999px; padding: 4px 12px; font: 700 13px var(--font-round); cursor: pointer; color: #3d4a80; }
.stems button:hover { border-style: solid; color: #3a57d8; border-color: #3a57d8; background: #eef2ff; }
.prevbox { border: 1px solid color-mix(in srgb, var(--violet) 45%, transparent); border-left: 4px solid var(--violet); background: var(--violet-soft); border-radius: 12px; padding: 10px 13px; }
.medals { display: flex; flex-wrap: wrap; gap: 14px 10px; justify-content: center; }
.medal { width: 96px; text-align: center; }
.medal .m {
  width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; color: #5a3208;
  background: radial-gradient(circle at 34% 28%, #fff7d4, #ffd36e 45%, #c9781f 88%); border: 2px solid #fff0b0;
  box-shadow: 0 0 0 4px rgba(255, 210, 110, .18), 0 0 18px rgba(255, 200, 90, .45), 0 6px 12px rgba(0, 0, 0, .3);
  animation: starPop .55s cubic-bezier(.2, 1.5, .4, 1) both;
}
.medal.lv1 .m { color: #22346a; background: radial-gradient(circle at 34% 28%, #ffffff, #d6e6ff 45%, #8098d0 88%); border-color: #eef4ff; box-shadow: 0 0 0 4px rgba(170, 200, 255, .16), 0 0 14px rgba(150, 190, 255, .35), 0 6px 12px rgba(0, 0, 0, .28); }
.medal .m .ic { width: 30px; height: 30px; }
.medal small { display: block; font: 800 11.5px/1.35 var(--font-round); color: var(--ink); }
.medal .cnt { display: inline-block; margin-top: 2px; font: 800 11px var(--font-round); color: var(--gold); }
.medal.off .m { filter: grayscale(1) brightness(.7); opacity: .3; box-shadow: none; animation: none; }
.medal.off small { color: var(--ink-3); }
.bubble { position: relative; background: linear-gradient(180deg, #ffffff, #f4f7ff); color: #1e2553; border-radius: 18px; padding: 13px 16px; box-shadow: var(--paper-shadow); font-weight: 700; }
.bubble.dark { background: var(--surface-2); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.celebrate { position: relative; overflow: hidden; }
.burst { position: absolute; inset: 0; pointer-events: none; }
.burst span { position: absolute; bottom: -20px; font-size: 22px; animation: rise 2.6s ease-out forwards; opacity: 0; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; opacity: 0; animation: fall 2.8s ease-in forwards; }

/* ---------- 質問ボード ---------- */
.post { display: flex; gap: 10px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.post:first-child { border-top: 0; }
.post .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.plus { display: inline-flex; align-items: center; gap: 4px; }
.plus.on { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 12px color-mix(in srgb, var(--primary) 30%, transparent); }

/* ---------- ダイアログ・通知 ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 22, .62); backdrop-filter: blur(3px); animation: fadeIn .15s ease; }
.modal {
  position: relative; color: var(--ink); border-radius: 20px; padding: 20px; width: min(540px, 100%); max-height: 90vh; overflow: auto;
  background: linear-gradient(160deg, #15205a, #0a1033); border: 1px solid var(--line-gold);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 1px rgba(255, 255, 255, .15); animation: popIn .22s cubic-bezier(.2, 1.3, .4, 1);
}
:root[data-theme="day"] .modal { background: linear-gradient(160deg, #ffffff, #f3f6ff); box-shadow: 0 24px 60px rgba(30, 50, 120, .25); }
.modal h2 { font: 700 20px var(--font-mincho); }
.toasts { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: linear-gradient(160deg, rgba(20, 32, 90, .96), rgba(10, 16, 50, .96)); color: #f3f6ff; padding: 10px 18px; border-radius: 14px;
  font: 700 14px var(--font-round); border: 1px solid var(--line-gold); box-shadow: 0 10px 30px rgba(0, 0, 0, .4), 0 0 18px rgba(255, 210, 110, .15);
  animation: tin .22s ease-out; max-width: 90vw;
}
.toast.bad { background: linear-gradient(160deg, #b8324f, #7e1c3a); border-color: #ffc3cf; }
.toast.good { background: linear-gradient(160deg, #13977a, #0b5c55); border-color: #b6ffe6; }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 110; background: linear-gradient(90deg, #b8324f, #7e1c3a); color: #fff; text-align: center; font: 700 13px var(--font-round); padding: 5px; }

/* ---------- 先生 ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; background: transparent; padding: 7px 12px; border-radius: 11px;
  font: 800 13.5px var(--font-round); color: var(--ink-2); cursor: pointer; white-space: nowrap; min-height: 38px;
}
.tabs button .ic { width: 17px; height: 17px; }
@media (max-width: 1080px) { .tabs button:not(.on) .lb { display: none; } .tabs button { padding: 7px 10px; } }
.tabs button:hover { background: var(--surface-2); color: var(--ink); }
.tabs button.on { color: var(--ink); background: linear-gradient(180deg, rgba(120, 231, 255, .24), rgba(120, 160, 255, .12)); border-color: rgba(120, 231, 255, .5); box-shadow: 0 0 14px rgba(120, 231, 255, .18); }
:root[data-theme="day"] .tabs button.on { background: #fff; color: var(--primary); border-color: #c6d1f2; box-shadow: 0 1px 4px rgba(30, 50, 120, .14); }
.cockpit { display: grid; grid-template-columns: 350px minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
@media (max-width: 1200px) { .cockpit { grid-template-columns: 330px minmax(0, 1fr); } .cockpit .col3 { grid-column: 1 / -1; } }
@media (max-width: 780px) { .cockpit { grid-template-columns: 1fr; } }
.sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sec-head > .ic { width: 24px; height: 24px; color: var(--gold); filter: drop-shadow(0 0 6px rgba(255, 210, 110, .45)); }
.paper .sec-head > .ic { filter: none; }
.sec-head h2 { margin: 0; font: 700 18px var(--font-mincho); }
.sec-head .eyebrow { display: block; font-size: 9.5px; }
.ctl { border-top: 1px solid var(--line); padding: 13px 0; }
.ctl:first-child { border-top: 0; padding-top: 0; }
.ctl h3 { font-size: 14px; display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.ctl h3 .t { display: inline-flex; align-items: center; gap: 7px; }
.ctl h3 .t .ic { width: 18px; height: 18px; color: var(--cyan); }
.big-n { font: 900 40px/1 var(--font-round); font-feature-settings: "tnum"; }
.big-n small { font-size: 16px; color: var(--ink-3); font-weight: 700; }
.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .meters { grid-template-columns: repeat(2, 1fr); } }
.meter {
  --mc: #7fd0ff; position: relative; overflow: hidden; background: linear-gradient(160deg, color-mix(in srgb, var(--mc) 16%, transparent), transparent 70%), var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--mc) 32%, transparent); border-radius: 14px; padding: 10px 12px;
}
.meter.m-online { --mc: #72e5b2; } .meter.m-lost { --mc: #ff8fa8; } .meter.m-hand { --mc: #b19cff; } .meter.m-help { --mc: #ffc56b; }
.meter .k { font: 800 12px var(--font-round); color: var(--ink-2); display: flex; align-items: center; gap: 5px; }
.meter .k .ic { width: 16px; height: 16px; color: var(--mc); }
.meter .n { font: 900 32px/1.1 var(--font-round); font-feature-settings: "tnum"; }
.meter.hot { border-color: var(--mc); box-shadow: 0 0 18px color-mix(in srgb, var(--mc) 35%, transparent); animation: hotPulse 2s ease-in-out infinite; }
.meter.hot .n { color: var(--mc); }
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 7px; }
.seat {
  position: relative; min-height: 48px; border-radius: 12px; padding: 5px 2px; text-align: center; cursor: pointer;
  font: 900 15px var(--font-round); background: var(--surface-2); color: var(--ink-3); border: 1.5px solid transparent; transition: .15s;
}
.seat.on { background: linear-gradient(180deg, rgba(120, 200, 255, .2), rgba(120, 200, 255, .07)); color: var(--ink); border-color: rgba(120, 200, 255, .38); }
:root[data-theme="day"] .seat.on { background: #fff; border-color: #c6d1f2; }
.seat.lost { background: color-mix(in srgb, #ff8fa8 22%, transparent); border-color: #ff8fa8; color: #ffd4de; box-shadow: 0 0 14px rgba(255, 143, 168, .35); }
:root[data-theme="day"] .seat.lost { color: #b3243f; }
.seat.hand { border-color: #b19cff; box-shadow: 0 0 14px rgba(177, 156, 255, .45); }
.seat.help { --mc: #ffc56b; background: color-mix(in srgb, #ffc56b 24%, transparent); border-color: #ffc56b; color: #ffe8bf; animation: hotPulse 1.6s ease-in-out infinite; }
:root[data-theme="day"] .seat.help { color: #8a5200; }
.seat.done::after {
  content: "✓"; position: absolute; top: -7px; right: -5px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; color: #05321f; background: linear-gradient(180deg, #9ff3cf, #3fc893); box-shadow: 0 0 8px rgba(114, 229, 178, .7);
}
.seat .st { display: block; font-size: 13px; line-height: 1; }
.queue { list-style: none; padding: 0; margin: 0; }
.queue li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.spark { width: 100%; height: 60px; display: block; }
.timeline .tl-base { stroke: var(--line-strong); stroke-width: 1; }
.timeline .tl-tick { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.hbar { display: grid; grid-template-columns: 70px 1fr 48px; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }
.hbar .bar { height: 12px; }
.matrix td.s { font-weight: 800; font-feature-settings: "tnum"; }
.matrix td.hi { background: var(--good-soft); color: var(--good); }
.matrix td.mid { background: var(--warn-soft); color: var(--warn); }
.matrix td.lo { background: var(--bad-soft); color: var(--bad); }
.matrix td.none { color: var(--ink-3); }
.matrix td.clickable { cursor: pointer; }
.matrix td.clickable:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.matrix th.sticky, .matrix td.sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.heat td.l0 { background: transparent; color: var(--ink-3); }
.heat td.l1 { background: color-mix(in srgb, var(--primary) 14%, transparent); }
.heat td.l2 { background: color-mix(in srgb, var(--primary) 34%, transparent); font-weight: 800; }
.rcard { border: 1px solid var(--line); border-radius: 14px; padding: 13px; background: var(--surface); }
.rcard.flag { border-color: var(--bad); box-shadow: inset 4px 0 0 var(--bad); }
.rcard .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.rcard mark { background: #fff0b8; color: inherit; border-radius: 3px; padding: 0 2px; box-shadow: 0 1px 0 #f0d77a; }
.ev { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.ev .chip { cursor: pointer; }
.ev .chip.l0 { opacity: .5; }
.ev .chip.edited { outline: 2px dashed var(--violet); outline-offset: 1px; }
.qr { background: #fff; padding: 10px; border-radius: 14px; display: inline-block; box-shadow: 0 0 0 1px var(--line-gold), 0 0 24px rgba(255, 210, 110, .2); }
.qr svg { display: block; width: 100%; height: auto; }
.kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 13px; }
.code-big { font: 800 34px var(--mono); letter-spacing: .18em; text-shadow: 0 0 18px rgba(255, 210, 110, .45); color: var(--gold); }
.paper .code-big, :root[data-theme="day"] .code-big { text-shadow: none; }
.empty { color: var(--ink-3); text-align: center; padding: 18px 8px; font-size: 14px; }
details.more > summary { cursor: pointer; font-weight: 800; color: var(--ink-2); padding: 4px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--ink-3); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- 投影 ---------- */
body.screen { overflow: hidden; }
.scr { height: 100vh; display: grid; grid-template-rows: auto 1fr; gap: 18px; padding: 22px 30px; }
.scr .top { display: flex; align-items: center; gap: 26px; }
.scr .meate { font-size: clamp(20px, min(2.8vw, 5.4vh), 42px); text-shadow: 0 0 26px rgba(126, 229, 255, .3); }
.scr .tm { font: 900 clamp(46px, 7.5vw, 120px)/1 var(--font-round); font-variant-numeric: tabular-nums; text-shadow: 0 0 34px rgba(120, 231, 255, .55); }
.scr .panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; min-height: 0; }
.scr .panel {
  position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 0; padding: 20px 24px; border-radius: 22px;
  background: var(--card-bg); border: 1px solid var(--card-border); box-shadow: var(--card-shadow);
}
.scr .panel::before { content: ""; position: absolute; left: 22px; right: 22px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--line-gold), transparent); }
.scr .panel h2 { font: 700 clamp(17px, 1.7vw, 26px) var(--font-mincho); color: var(--ink); display: flex; align-items: center; gap: 10px; }
.scr .panel h2 .ic { color: var(--gold); width: 1.1em; height: 1.1em; }
.scr .q { font-size: clamp(18px, 1.8vw, 28px); padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.scr .q .pl { font: 900 1em var(--font-round); color: var(--gold); min-width: 64px; }
.scr .huge { font: 900 clamp(56px, min(9vw, 15vh), 150px)/1 var(--font-round); font-feature-settings: "tnum"; }
.scr .pbar { display: grid; grid-template-columns: auto minmax(40px, 1fr) auto; gap: 12px; align-items: center; font: 800 clamp(14px, 1.5vw, 24px) var(--font-round); margin: 9px 0; }
.scr .pbar > span:first-child { min-width: 6.2em; }
.scr .pbar > span:last-child { min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; }
.scr .pbar .bar { height: 26px; }
.scr .joinqr { width: min(22vh, 230px); }
.scr .join { padding: 12px 14px 10px; border-radius: 20px; background: var(--card-bg); border: 1px solid var(--line-gold); box-shadow: var(--card-shadow); }
.scr .join .joinqr { margin: 0 auto; }
.scr-title { position: relative; padding: 16px 22px 16px 24px; border-radius: 22px; background: var(--card-bg); border: 1px solid var(--card-border); box-shadow: var(--card-shadow); overflow: hidden; }
.scr-title::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: linear-gradient(180deg, var(--uc, var(--gold)), color-mix(in srgb, var(--uc, var(--gold)) 30%, transparent)); }
.scr-title::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--uc, var(--cyan)) 35%, transparent), transparent 70%); pointer-events: none; }
.scr-crest { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); width: clamp(70px, 8vw, 120px); color: color-mix(in srgb, var(--uc, var(--gold)) 55%, #fff); opacity: .35; }
.scr-crest .ic { width: 100%; height: auto; }
.scr-sub { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font: 700 clamp(14px, 1.4vw, 20px) var(--font); color: var(--ink-2); position: relative; z-index: 1; }
.scr-sub .emblem { width: 34px; height: 34px; }
.scr .meate { position: relative; z-index: 1; }
.scr-notice { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 6px 16px; border-radius: 999px; font: 800 clamp(18px, 2vw, 28px) var(--font-round); color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.scr-notice .ic { width: 1em; height: 1em; }
.scr #tmr .eyebrow { display: inline-flex; align-items: center; gap: 6px; }
.scr #tmr .eyebrow .ic { width: 16px; height: 16px; }
.p-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.p-head > .ic { width: clamp(30px, 2.6vw, 42px); height: clamp(30px, 2.6vw, 42px); padding: 7px; border-radius: 12px; color: var(--gold); background: rgba(255, 215, 122, .1); border: 1px solid var(--line-gold); flex: none; }
.p-head h2 { margin: 2px 0 0; font: 700 clamp(18px, 1.8vw, 28px)/1.35 var(--font-mincho); color: var(--ink); }
.p-head .eyebrow { font-size: clamp(10px, .9vw, 13px); }
.scr .panel.poll { border: 1px solid color-mix(in srgb, var(--cyan) 70%, transparent); box-shadow: var(--card-shadow), 0 0 0 1px color-mix(in srgb, var(--cyan) 25%, transparent), 0 0 42px color-mix(in srgb, var(--cyan) 22%, transparent); }
.scr .panel.poll .p-head > .ic { color: var(--cyan); background: color-mix(in srgb, var(--cyan) 12%, transparent); border-color: color-mix(in srgb, var(--cyan) 50%, transparent); }
.stat-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: clamp(8px, 1.4vw, 26px); align-items: end; }
.scr .panels.split { grid-template-columns: minmax(0, 1fr) repeat(var(--m), minmax(0, 1.35fr)); }
.scr .side { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.scr .side .panel.room { flex: 1 1 auto; }
.scr .panel.room .bars { margin-top: auto; padding-top: 14px; }
.scr .panel.room { container-type: inline-size; }
@container (max-width: 560px) {
  .scr .room .stat-row { grid-template-columns: 1fr; gap: 0; }
  .scr .room .stat { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 2px; border-bottom: 1px solid var(--line); }
  .scr .room .stat .lb { order: -1; margin: 0; flex-wrap: nowrap; white-space: nowrap; font-size: clamp(14px, 1.45vw, 24px); }
  .scr .room .stat .huge { font-size: clamp(38px, min(4.5vw, 7.5vh), 96px); }
  .scr .room .stat .huge.mid { font-size: clamp(26px, min(3vw, 5vh), 64px); }
  .scr .room .pbar { margin: 6px 0; }
}
.p-head .conn { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font: 800 clamp(12px, 1.1vw, 17px) var(--font-round); color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.p-head .conn .ic { width: 1em; height: 1em; }
@media (max-width: 900px) { body.screen { overflow: auto; } .scr { height: auto; min-height: 100vh; } .scr .top { flex-wrap: wrap; } .scr .panels.split { grid-template-columns: 1fr; } }
.stat { position: relative; padding: 4px 4px 0; }
.stat .huge { color: var(--sc, var(--ink)); text-shadow: 0 0 30px color-mix(in srgb, var(--sc, var(--cyan)) 45%, transparent); }
.stat .huge { font-size: clamp(48px, min(7.5vw, 13vh), 140px); }
.stat .huge.mid { font-size: clamp(34px, min(4.6vw, 9vh), 84px); }
.stat:not(.hot):first-child .huge { color: var(--ink-3); text-shadow: none; }
.stat.hot .huge { animation: hotPulseText 1.6s ease-in-out infinite; }
.stat .lb { font: 800 clamp(12px, 1.25vw, 22px) var(--font-round); color: var(--ink-2); display: flex; align-items: baseline; gap: 4px 6px; flex-wrap: wrap; margin-top: 4px; }
.stat .lb small { font: 700 .7em var(--font); color: var(--ink-3); }
.slow-note { font: 800 clamp(17px, 1.8vw, 24px) var(--font-round); color: var(--warn); margin: 12px 0 0; }
.scr .pbar > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.scr .pbar .ic { width: 1em; height: 1em; color: var(--ink-3); }
.scr .panel > .small .ic { width: 14px; height: 14px; vertical-align: -2px; }
.scr .q .pl { display: inline-flex; align-items: center; gap: 4px; }
.scr .q .pl .ic { width: .9em; height: .9em; }
.scr .q.pinned { background: var(--violet-soft); border-radius: 14px; padding: 10px 12px; border-top-color: transparent; }
.scr .q.done { opacity: .5; }
.scr .q .ok .ic { width: .9em; height: .9em; color: var(--good); vertical-align: -2px; }
@keyframes hotPulseText { 0%, 100% { text-shadow: 0 0 18px color-mix(in srgb, var(--rose) 35%, transparent); } 50% { text-shadow: 0 0 44px color-mix(in srgb, var(--rose) 75%, transparent); } }
:root[data-theme="day"] .stat .huge, :root[data-theme="day"] .scr .meate, :root[data-theme="day"] .scr .tm { text-shadow: none; }
:root[data-theme="day"] .stat { --sc: var(--ink); }
:root[data-theme="day"] .stat.hot { --sc: var(--bad); }
.print-only { display: none; }

/* ---------- 動き ---------- */
@keyframes orbitBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes orbFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes shine { from { left: -60%; } to { left: 130%; } }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rc) 60%, transparent), inset 0 1px rgba(255, 255, 255, .35); } 100% { box-shadow: 0 0 0 12px transparent, inset 0 1px rgba(255, 255, 255, .35); } }
@keyframes hotPulse { 0%, 100% { box-shadow: 0 0 10px color-mix(in srgb, var(--mc, #ffc56b) 25%, transparent); } 50% { box-shadow: 0 0 22px color-mix(in srgb, var(--mc, #ffc56b) 55%, transparent); } }
@keyframes floaty { from { opacity: 1; transform: translate(-50%, 0) scale(.8); } to { opacity: 0; transform: translate(-50%, -120px) scale(1.5); } }
@keyframes rise { 0% { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-280px) scale(1.2) rotate(20deg); } }
@keyframes fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(420px) rotate(540deg); } }
@keyframes starPop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.enter { animation: screenIn .3s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 印刷（問題用紙・解答） ---------- */
@media print {
  .topbar, .dock, .no-print, .tabs, .sky-deco { display: none !important; }
  :root, :root[data-theme="day"] { --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --ink: #000; --ink-2: #222; --ink-3: #555; --line: #bbb; --grid: #ddd; --card-bg: #fff; --card-shadow: none; }
  body { background: #fff; color: #000; }
  body::before, body::after { display: none; }
  .card, .card.paper { box-shadow: none; border: 0; padding: 6px 0; background: #fff; }
  .card::before { display: none; }
  .card.flat, .card.paper.flat { border-bottom: 1px solid #ccc; border-radius: 0; background: #fff; }
  .print-only { display: inline; }
  .wrap { padding: 0; }
}

/* 問題文の中の式は少し大きく */
.sub .p { font-size: 17px; font-weight: 700; }
.sub .p .math, .lead .math { font-size: 1.22em; }
.mf .pv:empty { display: none; }
