/* まなびドリル — 落ち着いた色・大きな押しやすいボタン・スマホ優先 */
:root {
	--bg: #f4f7fb;
	--card: #ffffff;
	--ink: #1f2a44;
	--muted: #5f6b82;
	--line: #dfe5ef;
	--accent: #3b7ddd;
	--accent-ink: #ffffff;
	--ok: #2f9e6b;
	--ok-bg: #e5f6ee;
	--ng: #d0564f;
	--ng-bg: #fdecea;
	--warn: #a86a00;
	--sky: #e3efff;
	--peach: #ffeee3;
	--mint: #e2f6ee;
	--lav: #eeeafd;
	--gold: #f2b84b;
	--shadow: 0 2px 0 rgba(31, 42, 68, 0.06), 0 6px 18px rgba(31, 42, 68, 0.06);
	--r: 16px;
	--font: 'BIZ UDPGothic', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
	--round: 'M PLUS Rounded 1c', 'BIZ UDPGothic', 'Hiragino Maru Gothic ProN', Meiryo, sans-serif;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #141a26;
		--card: #1d2535;
		--ink: #e8edf6;
		--muted: #a3aec3;
		--line: #2f3a50;
		--accent: #6ea4ff;
		--accent-ink: #0d1422;
		--ok: #4cc28c;
		--ok-bg: #173327;
		--ng: #ff7d75;
		--ng-bg: #3a1f1f;
		--warn: #f0b44c;
		--sky: #1f2d47;
		--peach: #3a2a22;
		--mint: #1b3329;
		--lav: #2a2742;
		--shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
	}
}
* { box-sizing: border-box; }
html, body.stb { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body.stb { font-family: var(--font); line-height: 1.6; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
.st { max-width: 600px; margin: 0 auto; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); min-height: 100vh; min-height: 100dvh; }
.st button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.st button:focus-visible, .st a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.st button[disabled] { opacity: 0.45; cursor: default; }
.st-boot { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 70vh; gap: 12px; text-align: center; }
.st-boot h1 { font-family: var(--round); margin: 0; font-size: 28px; }
.st-boot i { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: st-spin 0.9s linear infinite; }
@keyframes st-spin { to { transform: rotate(360deg); } }

/* 上の帯 */
.st-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; min-height: 52px; }
.st-top > :first-child { justify-self: start; }
.st-top > :last-child { justify-self: end; }
.st-logo { margin: 0; font-family: var(--round); font-weight: 800; font-size: 20px; letter-spacing: 0.02em; white-space: nowrap; }
.st-ptitle { font-family: var(--round); font-weight: 700; font-size: 15px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
.st-back { background: none; border: 0; padding: 10px 4px; color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.st-snd { background: var(--card); border: 1px solid var(--line); border-radius: 999px; width: 40px; height: 40px; font-size: 18px; line-height: 1; }

/* ホーム */
.st-stat { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; margin: 4px 0 12px; }
.st-stat > * { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; min-height: 76px; }
.st-goal div { display: flex; flex-direction: column; line-height: 1.1; }
.st-goal b { font-size: 24px; font-family: var(--round); }
.st-goal small { color: var(--muted); font-size: 12px; }
.st-goal span, .st-streak span, .st-band span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.st-streak, .st-band { flex-direction: column; gap: 2px !important; }
.st-streak b, .st-band b { font-family: var(--round); font-size: 18px; }
.st-ring { width: 52px; height: 52px; flex: none; }
.st-ring__bg { fill: none; stroke: var(--line); stroke-width: 7; }
.st-ring__fg { fill: none; stroke: var(--ok); stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray 0.6s ease; }
.st-daily { display: grid; width: 100%; text-align: left; gap: 2px; padding: 14px 16px; border-radius: var(--r); border: 2px solid var(--accent); background: var(--card); box-shadow: var(--shadow); margin-bottom: 14px; }
.st-daily__t { font-family: var(--round); font-weight: 800; font-size: 18px; }
.st-daily__s { color: var(--muted); font-size: 13px; }
.st-chip { justify-self: start; margin-top: 6px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--sky); }
.st-chip.is-stamp { background: #fff3d6; color: #7a5200; }
.st-chip.is-done { background: var(--ok-bg); color: var(--ok); }
.st-h { font-family: var(--round); font-size: 15px; margin: 6px 2px 8px; color: var(--muted); }
.st-subjs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-subj { display: grid; justify-items: start; gap: 0; padding: 14px; min-height: 112px; border-radius: var(--r); border: 0; box-shadow: var(--shadow); text-align: left; transition: transform 0.12s ease; }
.st-subj:active { transform: scale(0.97); }
.st-subj__ico { font-size: 26px; line-height: 1.2; }
.st-subj__name { font-family: var(--round); font-weight: 800; font-size: 17px; }
.st-subj__lv { font-size: 12px; color: var(--muted); }
.st-subj__best { font-size: 12px; margin-top: 2px; }
.tone-sky.st-subj { background: var(--sky); }
.tone-peach.st-subj { background: var(--peach); }
.tone-mint.st-subj { background: var(--mint); }
.tone-lav.st-subj { background: var(--lav); }
.st-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.st-tile { position: relative; display: grid; gap: 2px; padding: 12px 10px; background: var(--card); border: 0; border-radius: var(--r); box-shadow: var(--shadow); text-align: left; font-size: 13px; }
.st-tile span { white-space: nowrap; font-weight: 700; }
.st-tile b { font-size: 12px; color: var(--muted); font-weight: 400; }
.st-dot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--ng); }
.st-foot { font-size: 12px; color: var(--muted); text-align: center; margin: 16px 4px 0; }
.st-foot a { color: var(--accent); }

.st-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin: 10px 0; }
.st-center { text-align: center; }
.st-left { text-align: left; }
.st-h2 { font-family: var(--round); font-size: 16px; margin: 0 0 10px; }
.st-muted { color: var(--muted); font-size: 13px; }
.st-sub { color: var(--muted); font-size: 14px; margin: 6px 0; }
.st-bands { display: grid; gap: 10px; margin-top: 12px; }
.st-bandbtn { padding: 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-family: var(--round); font-weight: 700; font-size: 18px; }
.st-bandbtn.is-on { border-color: var(--accent); background: var(--sky); }
.st-lvs { display: flex; flex-wrap: wrap; gap: 8px; }
.st-lvbtn { display: inline-flex; flex-direction: column; align-items: center; min-width: 76px; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); font-weight: 700; line-height: 1.2; }
.st-lvbtn small { font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }
.st-lvbtn.is-on { border-color: var(--accent); background: var(--sky); }
.st-modes { display: grid; gap: 10px; margin-top: 4px; }
.st-mode { display: grid; gap: 4px; text-align: left; padding: 18px 16px; border-radius: var(--r); border: 0; background: var(--card); box-shadow: var(--shadow); }
.st-mode b { font-family: var(--round); font-size: 18px; }
.st-mode span { font-size: 13px; color: var(--muted); }
.st-mode.is-ta { background: var(--accent); color: var(--accent-ink); }
.st-mode.is-ta span { color: inherit; opacity: 0.85; }

/* 遊ぶ画面 */
.st.is-play { display: flex; flex-direction: column; }
.st-hud { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 4px 12px; align-items: center; margin: 2px 0 8px; }
.st-timer, .st-prog { position: relative; height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; }
.st-timer i, .st-prog i { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--accent); border-radius: 999px; transition: width 0.25s linear; }
.st-timer i { transition: none; }
.st-timer.is-low i { background: var(--ng); }
.st-timer b, .st-prog b { position: absolute; right: 8px; top: -1px; font-size: 11px; line-height: 16px; color: var(--ink); mix-blend-mode: normal; }
.st-score { display: flex; align-items: baseline; gap: 2px; font-family: var(--round); }
.st-score b { font-size: 26px; min-width: 2ch; text-align: right; }
.st-score span { font-size: 12px; color: var(--muted); }
.st-combo { grid-column: 1 / -1; height: 20px; font-family: var(--round); font-weight: 800; font-size: 14px; color: var(--warn); text-align: center; }
.st-combo.is-pop { animation: st-pop 0.35s ease; }
.st-q { position: relative; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 18px 16px 22px; text-align: center; min-height: 148px; display: flex; flex-direction: column; justify-content: center; border: 3px solid transparent; transition: border-color 0.15s ease, background-color 0.15s ease; }
.st-q.is-in { animation: st-in 0.22s ease; }
.st-q.is-ok { border-color: var(--ok); background: var(--ok-bg); }
.st-q.is-ng { border-color: var(--ng); animation: st-shake 0.32s ease; }
.st-qh { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.st-qp { font-size: 30px; font-weight: 700; line-height: 1.35; word-break: keep-all; overflow-wrap: anywhere; }
.st-qp.is-big { font-size: 40px; letter-spacing: 0.04em; }
.st-qp.is-latin { font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, var(--font); letter-spacing: 0.01em; }
.st-qp sup { font-size: 0.55em; vertical-align: 0.9em; line-height: 0; }
.st-qp sub, .st-cb sub { font-size: 0.55em; vertical-align: -0.25em; line-height: 0; }
.st-fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: 0.82em; line-height: 1.1; margin: 0 0.12em; }
.st-fr > span:first-child { border-bottom: 2px solid currentColor; padding: 0 0.2em 0.04em; }
.st-fr > span:last-child { padding-top: 0.04em; }
.st-ans { margin-top: 12px; }
.st-ch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-cb { position: relative; min-height: 64px; padding: 10px 10px 10px 30px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); box-shadow: var(--shadow); font-size: 18px; font-weight: 700; line-height: 1.3; transition: transform 0.08s ease, border-color 0.12s ease, background-color 0.12s ease; }
.st-ch.is-big .st-cb { font-size: 24px; }
.st-ch.is-latin .st-cb { font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, var(--font); }
.st-cb:active { transform: scale(0.97); }
.st-cb__n { position: absolute; left: 9px; top: 7px; font-size: 11px; color: var(--muted); font-weight: 400; }
.st-cb.is-ok, .st-cb.is-right { border-color: var(--ok); background: var(--ok-bg); }
.st-cb.is-ok { animation: st-pop 0.3s ease; }
.st-cb.is-ng { border-color: var(--ng); background: var(--ng-bg); }
.st-cb.is-pick, .st-in.is-pick { border-color: var(--accent); background: var(--sky); }
.st-in { display: flex; align-items: center; justify-content: center; height: 64px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); font-size: 32px; font-weight: 700; font-family: var(--round); }
.st-in.is-ok { border-color: var(--ok); background: var(--ok-bg); }
.st-in.is-ng { border-color: var(--ng); background: var(--ng-bg); }
.st-caret { width: 2px; height: 32px; background: var(--accent); margin-left: 3px; animation: st-blink 1s steps(2) infinite; }
.st-kp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.st-k { min-height: 54px; border-radius: 12px; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 24px; font-weight: 700; font-family: var(--round); }
.st-k:active { transform: scale(0.96); background: var(--sky); }
.st-k.is-del { background: var(--line); }
.st-k.is-ok { grid-column: span 2; background: var(--accent); color: var(--accent-ink); }
.st-fb { margin-top: 12px; padding: 12px 14px; border-radius: 14px; display: grid; gap: 4px; font-size: 15px; }
.st-fb.is-ok { background: var(--ok-bg); color: var(--ok); }
.st-fb.is-ng { background: var(--ng-bg); color: var(--ink); }
.st-fb.is-ng b { color: var(--ng); font-size: 18px; }
.st-fb span { color: var(--muted); font-size: 14px; }
.st-float { position: absolute; right: 14px; top: 8px; font-family: var(--round); font-weight: 800; font-size: 20px; color: var(--ok); pointer-events: none; animation: st-float 0.85s ease forwards; }
.st-cb .st-float { right: 8px; top: -6px; }

/* 結果 */
.st-big { font-family: var(--round); font-weight: 800; font-size: 60px; line-height: 1.1; }
.st-big small { font-size: 22px; color: var(--muted); margin-left: 4px; }
.st-rec { font-family: var(--round); font-weight: 800; color: var(--warn); margin: 8px 0; animation: st-pop 0.5s ease; }
.st-warn { color: var(--warn); font-size: 14px; }
.st-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.st-btn { min-height: 48px; padding: 10px 18px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-weight: 700; }
.st-btn.is-main { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.st-btn.is-next { justify-self: end; margin-top: 4px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.st-btn.is-danger { border-color: var(--ng); color: var(--ng); margin-top: 8px; }
.st-newb { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.st-newb__i { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: #fff3d6; color: #7a5200; font-size: 13px; font-weight: 700; animation: st-pop 0.5s ease; }
.st-miss, .st-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.st-miss li, .st-check li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.st-miss__q { font-size: 17px; font-weight: 700; }
.st-miss__q small, .st-check small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.st-miss__a { font-size: 14px; color: var(--ok); }
.st-miss__a span { color: var(--muted); margin-left: 6px; }
.st-miss__x { font-size: 13px; color: var(--muted); }
.st-check li { display: grid; grid-template-columns: 28px 1fr; gap: 6px; align-items: start; font-size: 16px; }
.st-check li.is-ok .st-mark { color: var(--ok); }
.st-check li.is-ng .st-mark { color: var(--ng); }
.st-mark { font-size: 20px; font-weight: 800; }
.st-note__m { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 4px; align-items: center; }
.st-due { color: var(--ng); }
.st-dots { display: inline-flex; gap: 3px; }
.st-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.st-dots i.is-on { background: var(--ok); }

/* バッジ・記録 */
.st-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 6px; }
.st-badge { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 14px 10px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); opacity: 0.6; }
.st-badge.is-got { opacity: 1; }
.st-badge i { font-style: normal; font-size: 30px; }
.st-badge b { font-family: var(--round); font-size: 14px; }
.st-badge span { font-size: 12px; color: var(--muted); }
.st-badge small { font-size: 11px; color: var(--ok); }
.st-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 120px; }
.st-bar7 { display: grid; grid-template-rows: 1fr auto auto; height: 100%; text-align: center; font-size: 11px; color: var(--muted); }
.st-bar7 i { align-self: end; display: block; background: var(--ok); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.st-bar7 b { color: var(--ink); font-size: 12px; }
.st-rect { width: 100%; border-collapse: collapse; font-size: 13px; }
.st-rect th { text-align: left; white-space: nowrap; padding: 8px 8px 8px 0; vertical-align: top; }
.st-rect td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.st-recl { display: inline-block; margin: 2px 10px 2px 0; color: var(--muted); }
.st-recl b { color: var(--ink); }
.st-toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 10; transition: opacity 0.4s ease; font-family: var(--font); }
.st-toast.is-out { opacity: 0; }

@keyframes st-pop { 0% { transform: scale(0.92); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes st-in { from { opacity: 0.2; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes st-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes st-float { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-26px); } }
@keyframes st-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
	.st *, .st-toast { animation: none !important; transition: none !important; }
}
@media (min-width: 900px) {
	.st { padding-top: 20px; }
	.st-qp { font-size: 34px; }
	.st-qp.is-big { font-size: 46px; }
	.st-subj { min-height: 124px; }
}
@media (max-width: 360px) {
	.st-qp.is-big { font-size: 32px; }
	.st-ch.is-big .st-cb { font-size: 20px; }
	.st-stat { grid-template-columns: 1fr 1fr; }
	.st-band { grid-column: span 2; }
}
