/* ほけつドリル スタイル（Chromebook 1366×768 を基準に） */
:root {
  --bg: #fdf8ef;
  --ink: #2b2b2b;
  --muted: #6b6b6b;
  --card: #ffffff;
  --line: #e6dccb;
  --kid: #ff8a3d;
  --teacher: #3b7dd8;
  --ok: #18a058;
  --ng: #e0533b;
  --secret: #7b4fd6;
  --kokugo: #e2557a;
  --sansu: #2f7fe0;
  --rika: #1e9e6a;
  --shakai: #e08a12;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "BIZ UDPGothic", "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 18px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
rt { font-size: 0.5em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }

/* ---------- 共通ヘッダー ---------- */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: #fff; border-bottom: 2px solid var(--line);
}
.back {
  padding: 8px 14px; border-radius: 10px; background: #f2ece1; font-weight: 700; white-space: nowrap;
}
.back:hover { background: #e9e0cf; }
.bar-title { font-size: 22px; font-weight: 700; }
.bar-extra { margin-left: auto; }
.page { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; }
.lead { font-size: 24px; font-weight: 700; text-align: center; margin: 8px 0 20px; }

/* ---------- トップ ---------- */
.top { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.logo { font-size: 56px; margin: 0; letter-spacing: 0.05em; }
.logo-mark { margin-right: 10px; }
.top-sub { font-size: 22px; color: var(--muted); margin: 4px 0 36px; }
.top-catch { list-style: none; margin: 6px auto 22px; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.top-catch li { display: inline-block; padding: 8px 18px; border-radius: 999px; background: #fff; border: 2px solid #f6c76b;
  color: #6b4a12; font-size: 19px; font-weight: 700; line-height: 1.9; box-shadow: 0 2px 0 #f0d9a8; }
.top-catch li::before { content: '✔ '; color: #e8902a; }
.top-buttons { display: flex; gap: 32px; flex-wrap: wrap; justify-content: center; }
.big-btn {
  width: 300px; height: 260px; border-radius: 28px; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.15); transition: transform .08s;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(0,0,0,0.15); }
.big-btn.kid { background: var(--kid); }
.big-btn.teacher { background: var(--teacher); }
.big-icon { font-size: 72px; line-height: 1.1; }
.big-label { font-size: 40px; font-weight: 700; }
.big-label rt { font-size: 16px; }
.big-desc { font-size: 18px; opacity: .95; }

/* ---------- 学年 ---------- */
.grade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.grade-btn {
  height: 150px; border-radius: 24px; background: #fff; border: 4px solid var(--line);
  display: flex; align-items: baseline; justify-content: center; gap: 4px; padding-top: 28px;
  box-shadow: 0 6px 0 var(--line);
}
.grade-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--line); }
.grade-num { font-size: 72px; font-weight: 700; line-height: 1; }
.grade-unit { font-size: 24px; font-weight: 700; }
.g1 .grade-num { color: #e2557a; } .g2 .grade-num { color: #ff8a3d; } .g3 .grade-num { color: #d9a400; }
.g4 .grade-num { color: #1e9e6a; } .g5 .grade-num { color: #2f7fe0; } .g6 .grade-num { color: #7b4fd6; }

/* ---------- 教科 ---------- */
.subj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.subj-card {
  border-radius: 24px; color: #fff; padding: 22px 12px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
}
.subj-card:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,0.15); }
.s-kokugo { background: var(--kokugo); } .s-sansu { background: var(--sansu); }
.s-rika { background: var(--rika); } .s-shakai { background: var(--shakai); }
.subj-icon { font-size: 52px; line-height: 1.2; }
.subj-name { font-size: 34px; font-weight: 700; }
.subj-name rt { font-size: 14px; }
.badge { background: rgba(255,255,255,0.9); color: var(--ink); border-radius: 999px; padding: 2px 14px; font-size: 16px; font-weight: 700; }
.badge.new { color: #c0392b; }
.badge.secret { color: var(--secret); }
.badge.done { color: #b07800; }
.badge.miss { color: #b04a00; font-size: 14px; }
.reset-area { text-align: center; margin-top: 48px; }

/* ---------- タブ・コレクション ---------- */
.tabs { display: flex; gap: 8px; border-bottom: 3px solid var(--line); margin-bottom: 20px; }
.tab {
  padding: 10px 22px; border-radius: 14px 14px 0 0; background: #f2ece1; color: var(--muted);
  font-size: 20px; font-weight: 700; margin-bottom: -3px; border: 3px solid transparent;
}
.tab.active { background: var(--bg); color: var(--ink); border-color: var(--line); border-bottom-color: var(--bg); }
.tab-count { display: inline-block; background: #7b4fd6; color: #fff; border-radius: 999px; font-size: 14px; padding: 0 8px; margin-left: 4px; vertical-align: middle; }
.collect-help { text-align: center; color: var(--muted); font-size: 16px; margin-top: -10px; }
.coll-grade { font-size: 20px; margin: 26px 0 10px; padding-left: 10px; border-left: 6px solid var(--kid); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; justify-items: center; }
.slot { background: none; border: none; padding: 0; font-family: inherit; color: inherit; }
button.slot { cursor: pointer; transition: transform .1s; }
button.slot:hover { transform: translateY(-3px) rotate(-1deg); }
.save-note { margin-top: 28px; text-align: center; font-size: 14px; color: var(--muted); }
.warn { background: #fff4e5; border: 2px solid #f0b46a; border-radius: 10px; padding: 8px 12px; font-size: 15px; }

/* ===== しょくぎょうカード ===== */
.tcard {
  --w: 180px;
  position: relative; width: var(--w); aspect-ratio: 5 / 7; font-size: calc(var(--w) * 0.075);
  border-radius: calc(var(--w) * 0.07); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 6px 14px rgba(0,0,0,.22); text-align: center; line-height: 1.35; isolation: isolate;
  border: calc(var(--w) * 0.03) solid #fff;
}
.tcard-art { position: relative; flex: none; height: 62%; overflow: hidden; }
.tcard-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tcard-emoji {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: calc(var(--w) * 0.36); line-height: 1; filter: drop-shadow(0 3px 2px rgba(0,0,0,.35));
}
.tcard-rar { position: absolute; top: 4%; left: 5%; font-size: .85em; letter-spacing: .05em; color: #ffd84a; text-shadow: 0 0 2px #000, 0 1px 0 #000; }
.tcard-type { position: absolute; top: 4%; right: 5%; font-size: .5em; font-weight: 700; letter-spacing: .12em; padding: .1em .5em; border-radius: 1em; background: rgba(0,0,0,.45); color: #fff; }
.tcard-plate { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 3% 6% 5%; gap: 2%; }
.tcard-name { font-size: 1.15em; font-weight: 700; line-height: 1.4; }
.tcard-name rt { font-size: .5em; font-weight: 700; text-shadow: none; font-family: "BIZ UDPGothic", sans-serif; letter-spacing: 0; }
.st-battle .tcard-name rt { color: #ffcf6b; }
.st-hero .tcard-name rt { color: #1d1d1d; }
.st-cyber .tcard-name rt { color: #bdfcff; }
.st-fantasy .tcard-name rt { color: #ffe08a; }
.tcard-catch { font-size: .62em; line-height: 1.45; opacity: .92; }
.tcard-catch rt { font-size: .55em; }

/* バトル：赤×黒、太い文字に ふちどり */
.st-battle { background: linear-gradient(180deg, #2b0000, #000); border-color: #c8102e; color: #fff; }
.st-battle .tcard-name { font-family: "Dela Gothic One", sans-serif; font-weight: 400; transform: skewX(-8deg); color: #fff;
  text-shadow: 0.08em 0.08em 0 #c8102e, 0 0 0.3em rgba(255,80,0,.9); letter-spacing: .03em; }
.st-battle .tcard-catch { color: #ffcf6b; font-weight: 700; }
.st-battle .tcard-emoji { filter: drop-shadow(0 0 6px #ffcc00) drop-shadow(0 0 14px #ff4500); }
/* きらきら（少女まんが風）：パステル、まるい文字 */
.st-shoujo { background: linear-gradient(180deg, #fff0f7, #ffe1f0); border-color: #ffb3d6; color: #b2306b; }
.st-shoujo .tcard-name { font-family: "Zen Maru Gothic", sans-serif; color: #e0458a; text-shadow: 0 0 3px #fff, 0 0 6px #fff; }
.st-shoujo .tcard-catch { font-family: "Zen Maru Gothic", sans-serif; color: #b25a8d; }
.st-shoujo .tcard-emoji { filter: drop-shadow(0 0 8px #fff) drop-shadow(0 0 14px #ff9ccf); }
.st-shoujo .tcard-rar { color: #ff7ab8; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.st-shoujo .tcard-type { background: rgba(255,111,174,.85); }
/* コミック（アメコミ風）：黄色×黒わく */
.st-hero { background: #fff; border-color: #1d1d1d; color: #1d1d1d; }
.st-hero .tcard-art { border-bottom: calc(var(--w) * 0.02) solid #1d1d1d; }
.st-hero .tcard-name { font-family: "Dela Gothic One", sans-serif; font-weight: 400; color: #ff3b30; transform: rotate(-2deg);
  text-shadow: 0.07em 0.07em 0 #1d1d1d; }
.st-hero .tcard-catch { font-weight: 700; }
.st-hero .tcard-emoji { filter: drop-shadow(3px 3px 0 #1d1d1d); }
/* サイバー：ネオン */
.st-cyber { background: linear-gradient(180deg, #0b0f2e, #050716); border-color: #00e5ff; color: #bdfcff; box-shadow: 0 0 10px rgba(0,229,255,.6), 0 6px 14px rgba(0,0,0,.3); }
.st-cyber .tcard-name { color: #e8feff; text-shadow: 0 0 4px #00e5ff, 0 0 10px #00e5ff; letter-spacing: .04em; }
.st-cyber .tcard-catch { color: #ff7ce6; }
.st-cyber .tcard-emoji { filter: drop-shadow(0 0 6px #00e5ff) drop-shadow(0 0 12px #ff2bd6); }
/* 和風：わし（和紙）と ふで文字 */
.st-wa { background: #f4e8cf; border-color: #7a1f1f; color: #2b1d0e; }
.st-wa .tcard-name { font-family: "Yuji Syuku", serif; font-weight: 400; font-size: 1.25em; color: #2b1d0e; }
.st-wa .tcard-catch { font-family: "Yuji Syuku", serif; color: #7a1f1f; }
.st-wa .tcard-type { background: #7a1f1f; }
/* ファンタジー：むらさき×きん */
.st-fantasy { background: linear-gradient(180deg, #2b1260, #12062b); border-color: #e5b84c; color: #f8e7b0; }
.st-fantasy .tcard-name { color: #ffe08a; text-shadow: 0 0 6px rgba(245,201,91,.8), 0 2px 0 #4a2a00; letter-spacing: .04em; }
.st-fantasy .tcard-catch { color: #e6d6ff; }
.st-fantasy .tcard-emoji { filter: drop-shadow(0 0 8px #ffe08a) drop-shadow(0 0 16px #b48cff); }
/* ポップ */
.st-pop { background: #fff; border-color: #4ecdc4; color: #2b2d42; }
.st-pop .tcard-name { font-family: "Zen Maru Gothic", sans-serif; color: #fff; background: #ff6b6b; border-radius: 1em; padding: .1em .5em; display: inline-block; margin: 0 auto; }
.st-pop .tcard-catch { font-family: "Zen Maru Gothic", sans-serif; font-weight: 700; color: #3a7d77; }
.st-pop .tcard-type { background: #ff6b6b; }
/* ネイチャー */
.st-nature { background: linear-gradient(180deg, #f3fbe9, #dff2cf); border-color: #5aa64f; color: #24481f; }
.st-nature .tcard-name { font-family: "Zen Maru Gothic", sans-serif; color: #2f6b29; }
.st-nature .tcard-catch { font-family: "Zen Maru Gothic", sans-serif; color: #4b7a3f; }
.st-nature .tcard-type { background: #3d8b3a; }

/* レア度 ★★ … きんの わく、★★★ … ホロ（にじいろに ひかる） */
.tcard.r2 { outline: calc(var(--w) * 0.015) solid #e5b84c; outline-offset: calc(var(--w) * -0.045); }
.tcard.r3 { outline: calc(var(--w) * 0.018) solid #ffd84a; outline-offset: calc(var(--w) * -0.05); }
.tcard-holo {
  position: absolute; inset: 0; pointer-events: none; z-index: 2; mix-blend-mode: color-dodge; opacity: .55;
  background: linear-gradient(115deg, transparent 20%, rgba(255,0,150,.5) 32%, rgba(255,240,0,.5) 40%, rgba(0,255,200,.5) 48%, rgba(80,120,255,.5) 56%, transparent 68%);
  background-size: 250% 250%; animation: holo 3.5s linear infinite;
}
@keyframes holo { 0% { background-position: 100% 100%; } 100% { background-position: 0% 0%; } }

/* まだ もって いない カード：シルエット */
.tcard.locked { filter: grayscale(1); opacity: .8; }
.tcard.locked .tcard-svg { opacity: .35; }
.tcard.locked .tcard-emoji { filter: brightness(0); opacity: .55; }
.tcard.locked .tcard-name { font-family: inherit; transform: none; text-shadow: none; color: #777; background: none; }
.tcard.locked .tcard-catch { color: #444; font-family: inherit; font-weight: 700; }
.tcard.locked .tcard-plate { background: #eeeeee; }

/* くわしく 見る */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(20, 15, 5, 0.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 26px; padding: 22px; max-width: 760px; width: 100%; max-height: 94vh; overflow: auto; display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.detail-top { flex: none; animation: pop .45s ease-out; }
.detail-body { flex: 1; min-width: 260px; text-align: left; }
.detail-sub { font-weight: 700; color: #b07800; margin: 4px 0 6px; font-size: 18px; }
.detail-points { font-size: 18px; line-height: 2; margin: 0; padding-left: 1.2em; }
.detail-points li { margin-bottom: 4px; }
.detail-points rt, .detail-mame rt { font-size: 0.5em; }
.detail-mame { background: #eef6ff; border-left: 6px solid #4d96ff; border-radius: 10px; padding: 8px 12px; margin-top: 12px; font-size: 17px; line-height: 2; }
.detail-mame p { margin: 4px 0; }
.detail-mame-title { font-weight: 700; color: #2a5ea8; }
.detail-from { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.modal-box > .primary-btn { flex-basis: 100%; max-width: 240px; }

.card-get { margin: 16px auto 4px; padding: 16px; border-radius: 20px; background: #fff8e1; border: 3px solid #e2b100; max-width: 420px; }
.card-get-title { font-size: 22px; font-weight: 700; margin: 0 0 10px; }
.card-get .tcard { margin: 0 auto; animation: pop .55s ease-out; }
.card-btn { display: block; width: fit-content; margin: 14px auto 0; }
.group-card-get { font-size: 13px; color: #b07800; font-weight: 700; }
.group-card-get.todo { color: #9a8a6e; font-weight: 400; }
@keyframes pop { 0% { transform: scale(.5) rotate(-10deg); } 70% { transform: scale(1.08) rotate(3deg); } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .tcard-holo, .detail-top, .card-get .tcard { animation: none; } }

/* 絵文字の地図など */
.emoji-row { display: inline-block; font-size: 1.6em; line-height: 1.25; letter-spacing: .12em; }
.sheet .emoji-row { font-size: 1.5em; }

/* ---------- 超難問 ---------- */
.hard-tag { display: inline-block; background: linear-gradient(90deg, #ff3d00, #c2185b); color: #fff; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 0 10px 1px; vertical-align: middle; line-height: 1.9; }
.hard-tag rt { font-size: 9px; color: #fff; }
.group-card .hard-tag { position: absolute; top: -12px; left: 8px; }
.group-card.hard { border-color: #ff7a45; background: linear-gradient(180deg, #fff1ea, #fff); box-shadow: 0 5px 0 #ff7a45; }
.hard-note { background: #fff1ea; border: 2px solid #ff7a45; border-radius: 12px; padding: 8px 14px; text-align: center; font-size: 17px; }
.p-hard { border: 1.5px solid #000; padding: 0 6px; font-size: .8em; }

/* ---------- グループ ---------- */
.continue-btn {
  display: block; text-align: center; background: var(--kid); color: #fff; font-size: 28px; font-weight: 700;
  border-radius: 20px; padding: 18px; box-shadow: 0 6px 0 #d26a25; margin-bottom: 14px;
}
.continue-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #d26a25; }
.legend { text-align: center; color: var(--muted); font-size: 15px; margin: 6px 0 16px; }
.group-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.group-card {
  position: relative; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 5px 0 var(--line); min-height: 112px;
}
.group-card:active:not(.locked) { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.group-name { font-size: 22px; font-weight: 700; }
.group-range { font-size: 14px; color: var(--muted); }
.group-state { font-size: 16px; font-weight: 700; margin-top: 4px; }
.group-card.locked { background: #f3efe8; color: #b5ab9b; box-shadow: none; border-style: dashed; }
.group-card.locked .group-range, .group-card.locked .group-state { color: #b5ab9b; }
.group-card.clear { border-color: #f08aa8; background: #fff5f8; box-shadow: 0 5px 0 #f08aa8; }
.group-card.perfect { border-color: #e2b100; background: linear-gradient(180deg, #fff7d1, #fff); box-shadow: 0 5px 0 #e2b100; }
.group-mark { position: absolute; top: -14px; right: -8px; font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.group-card.review { grid-column: span 2; border-color: #8fb3ef; background: #f2f7ff; box-shadow: 0 5px 0 #8fb3ef; }
.group-card.review .group-name { color: #2a5ea8; }

.drill-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.drill-tile {
  position: relative; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; box-shadow: 0 5px 0 var(--line); min-height: 128px;
}
.drill-tile:active:not(.locked) { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.drill-label { font-size: 13px; color: var(--muted); }
.drill-no { font-size: 38px; font-weight: 700; line-height: 1.2; }
.drill-state { font-size: 15px; font-weight: 700; color: var(--muted); }
.drill-state.new { color: #c0392b; }
.drill-mark { font-size: 34px; line-height: 1.1; }
.drill-tile.locked { background: #f3efe8; color: #b5ab9b; box-shadow: none; border-style: dashed; }
.drill-tile.clear { border-color: #f08aa8; background: #fff5f8; box-shadow: 0 5px 0 #f08aa8; }
.drill-tile.perfect { border-color: #e2b100; background: linear-gradient(180deg, #fff7d1, #fff); box-shadow: 0 5px 0 #e2b100; }

.cele-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.sub-btn.big { font-size: 20px; padding: 12px 24px; display: inline-block; }
.group-done { font-size: 22px; font-weight: 700; color: #b07800; }
.ok-note { font-size: 18px; margin: -6px 0 12px; color: #2a5ea8; font-weight: 700; }
.first-note { margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; background: #eef4ff; color: #3a5a8c;
  font-size: 15px; line-height: 1.8; }
/* 問題番号（まちがい報告用）：問題カードの右下に小さく */
.pid { margin: 10px -6px -8px 0; text-align: right; font-size: 11px; line-height: 1.2; color: #8a8a8a;
  letter-spacing: .02em; user-select: all; }
.tip-box { position: relative; margin: 4px 0 16px; padding: 22px 16px 12px; border: 2px dashed #f2b23a; border-radius: 14px;
  background: #fff8e6; font-size: 18px; line-height: 1.9; text-align: left; animation: tip-in .35s ease-out; }
.tip-tag { position: absolute; top: -13px; left: 12px; padding: 2px 10px; border-radius: 999px; background: #f2b23a;
  color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .05em; }
@keyframes tip-in { from { transform: translateY(6px); } to { transform: none; } }
@media print { .tip-box { display: none; } }
.dot.again { background: #f2c200; }
.qnum .from { font-weight: 400; font-size: 14px; margin-left: 6px; }
.review .qnum { background: #3b7dd8; }
.link-btn { background: none; border: none; color: var(--muted); text-decoration: underline; font-size: 15px; }

/* ---------- ドリル ---------- */
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dot { width: 16px; height: 16px; border-radius: 50%; background: #e8e1d3; }
.dot.ok { background: var(--ok); }
.dot.now { background: #fff; border: 3px solid var(--kid); }
.secret .dot.now, .bar .dot.now { }
.qcard {
  background: var(--card); border-radius: 24px; padding: 28px 32px 24px;
  border: 3px solid var(--line); box-shadow: 0 6px 0 var(--line);
}
.qnum { display: inline-block; background: var(--kid); color: #fff; font-weight: 700; border-radius: 999px; padding: 2px 16px; font-size: 18px; }
.qtext { font-size: 26px; font-weight: 700; margin: 16px 0 22px; line-height: 1.8; }
.gr1 .qtext, .gr2 .qtext { font-size: 30px; letter-spacing: 0.03em; }
.qtext rt { font-size: 13px; font-weight: 400; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.choices.many { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  min-height: 72px; padding: 12px 16px; border-radius: 16px;
  border: 3px solid #d7cbb6; background: #fffdf8; font-size: 22px; color: var(--ink);
  box-shadow: 0 4px 0 #d7cbb6;
}
.gr1 .choice, .gr2 .choice { font-size: 26px; }
.choice:hover:not(:disabled) { border-color: var(--kid); }
.choice:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #d7cbb6; }
.choice-label { flex: none; width: 36px; height: 36px; border-radius: 50%; background: #f2ece1; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; }
.choice-text rt { font-size: 12px; }
.choice.wrong { border-color: #ccc; background: #f1f1f1; color: #aaa; box-shadow: none; text-decoration: line-through; }
.choice.wrong .choice-label::before { content: "✕"; color: var(--ng); }
.choice.wrong .choice-label { font-size: 0; }
.choice.wrong .choice-label::before { font-size: 20px; }
.choice.right { border-color: var(--ok); background: #e6f7ed; box-shadow: 0 4px 0 var(--ok); color: var(--ink); }
.choice:disabled { cursor: default; }

.input-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ans-input {
  font-family: inherit; font-size: 30px; font-weight: 700; width: 260px; padding: 10px 16px;
  border: 3px solid #d7cbb6; border-radius: 14px; background: #fffdf8; color: var(--ink);
}
.ans-input:focus { outline: none; border-color: var(--kid); box-shadow: 0 0 0 4px rgba(255,138,61,0.2); }
.ans-input.right { border-color: var(--ok); background: #e6f7ed; }
.unit { font-size: 26px; font-weight: 700; }

.primary-btn {
  display: inline-block; border: none; border-radius: 14px; background: var(--kid); color: #fff;
  font-size: 22px; font-weight: 700; padding: 12px 28px; box-shadow: 0 4px 0 #d26a25;
}
.primary-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #d26a25; }
.primary-btn:disabled { opacity: .5; }
.sub-btn {
  border: 2px solid #d7cbb6; background: #fff; border-radius: 12px; font-size: 16px; padding: 8px 16px; color: var(--muted);
}
.drill-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

.feedback { margin-top: 18px; }
.feedback:empty { margin: 0; }
.ok { font-size: 34px; font-weight: 700; color: var(--ok); margin-bottom: 14px; }
.ok-mark { font-size: 40px; }
.next-btn { font-size: 26px; padding: 14px 40px; }
.ng { font-size: 22px; font-weight: 700; color: var(--ng); margin-bottom: 10px; }
.hint { background: #fff7d6; border-left: 6px solid #f2c200; border-radius: 10px; padding: 10px 14px; margin-top: 8px; font-size: 20px; }
.hint rt { font-size: 11px; }
.hint-tag { font-weight: 700; margin-right: 8px; color: #8a6d00; }
.hint.soft { background: #eef4ff; border-left-color: #8fb3ef; font-size: 17px; }
.shake { animation: shake .35s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* メモ */
.drill-page { padding-bottom: 16px; }
.memo { margin-top: 18px; }
.memo-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.memo-title { font-weight: 700; color: var(--muted); margin-right: 4px; }
.memo-btn {
  border: 3px solid #d7cbb6; background: #fff; border-radius: 12px; font-size: 18px; font-weight: 700;
  padding: 6px 14px; color: var(--ink); min-height: 48px;
}
.memo-btn.pen.active { border-color: #e02020; background: #ffecec; color: #c01818; }
.memo-btn.eraser.active { border-color: #3b7dd8; background: #eef4ff; color: #2a5ea8; }
.memo-btn.clear { margin-left: auto; }
.memo-canvas {
  display: block; width: 100%; height: 260px; background: #fff; border: 3px dashed #d7cbb6; border-radius: 18px;
  touch-action: none; cursor: crosshair;
}
.memo-canvas.tool-eraser { cursor: cell; }

/* ひみつの問題 */
.secret .qcard { border-color: #cdb8f5; box-shadow: 0 6px 0 #cdb8f5; background: linear-gradient(180deg, #faf7ff, #fff); }
.secret .qnum { background: var(--secret); }
.secret .choice:hover:not(:disabled), .secret .ans-input:focus { border-color: var(--secret); }

/* お祝い画面 */
.celebrate { background: #fff; border-radius: 28px; border: 3px solid var(--line); text-align: center; padding: 40px 24px; }
.celebrate h2 { font-size: 32px; margin: 8px 0; }
.celebrate p { font-size: 20px; }
.cele-icon { font-size: 80px; }
.secret-card { border-color: #cdb8f5; background: linear-gradient(180deg, #f5efff, #fff); }
.secret-btn { background: var(--secret); box-shadow: 0 4px 0 #5a35a8; font-size: 26px; padding: 14px 40px; }
.stamp {
  display: inline-block; border: 5px double #d33; color: #d33; border-radius: 50%;
  padding: 26px 22px; font-weight: 700; transform: rotate(-8deg); margin: 16px 0;
}

/* ---------- 先生用 ---------- */
.teacher-page { font-size: 17px; }
.info-box { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 16px 24px; margin-bottom: 24px; }
.info-box h2 { margin: 0 0 6px; font-size: 20px; }
.info-box ul { margin: 6px 0; padding-left: 1.2em; }
.grid-table { width: 100%; border-collapse: separate; border-spacing: 8px; }
.grid-table th { font-size: 18px; }
.grid-table td { text-align: center; }
.grid-table td.na { color: #bbb; }
.print-link {
  display: block; background: #fff; border: 2px solid var(--teacher); color: var(--teacher); border-radius: 12px;
  padding: 10px 6px; font-weight: 700;
}
.print-link:hover { background: #eef4ff; }
.print-link small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.print-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.print-tools .primary-btn { background: var(--teacher); box-shadow: 0 4px 0 #2a5ea8; }
.plan-box { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 18px; }
.plan-box summary { font-weight: 700; cursor: pointer; }
.plan-box textarea { width: 100%; font-family: inherit; font-size: 15px; margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.preview-label { margin: 24px 0 0; font-weight: 700; color: var(--muted); }
.print-tools .sub-btn { color: var(--ink); }
.list-title { font-size: 20px; margin: 24px 0 2px; }
.print-group { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.print-group-name { width: 6em; font-weight: 700; }
.print-nos { display: flex; gap: 6px; flex-wrap: wrap; }
.print-no { width: 46px; height: 40px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--teacher); color: var(--teacher); border-radius: 10px; font-weight: 700; background: #fff; }
.print-no:hover { background: #eef4ff; }
.print-no.na { border-color: #ddd; color: #ccc; background: #f6f6f6; }

/* ---------- 印刷プリント ---------- */
.sheets { padding: 0 16px 60px; }
.sheet {
  background: #fff; width: 210mm; min-height: 297mm; margin: 16px auto; padding: 14mm 14mm;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12); font-size: 11.5pt; line-height: 1.7; color: #000;
}
.sheet rt { font-size: 0.5em; }
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; gap: 12px; }
.sheet-head h1 { font-size: 17pt; margin: 0; }
.name-line { font-size: 11pt; white-space: nowrap; }
.name-box { display: inline-block; width: 50mm; border-bottom: 1px solid #000; margin-left: 4px; height: 1.2em; }
.plist { list-style: none; margin: 0; padding: 0; }
.pitem { display: flex; gap: 8px; padding: 6px 0 8px; border-bottom: 1px dashed #bbb; break-inside: avoid; }
.pnum { flex: none; min-width: 2.2em; height: 2.2em; border: 1.5px solid #000; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9em; }
.pbody { flex: 1; }
.pq { font-weight: 700; }
.pchoices { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 3px 0 0 4px; }
.pans { flex: none; width: 44mm; display: flex; align-items: center; justify-content: flex-end; gap: 4px; align-self: center; }
.box { display: inline-block; width: 30mm; height: 10mm; border: 1.5px solid #000; border-radius: 2mm; }
.box.small { width: 14mm; }
.punit { font-weight: 700; }
.pchoices.circle { gap: 4px 36px; }
.pchoices.circle .pchoice { padding: 0 6px; }
.circle-note { font-size: 0.75em; color: #444; }
.sheet.split .challenge { break-before: page; }
.challenge { margin-top: 12px; border: 2px solid #000; border-radius: 4mm; padding: 4mm 5mm; break-inside: avoid; }
.challenge h2 { margin: 0; font-size: 13pt; }
.challenge > p { margin: 0 0 4px; font-size: 10pt; }
.challenge .pitem:last-child { border-bottom: none; }
.pg1, .pg2 { font-size: 13.5pt; line-height: 1.7; }
.pg1 .pitem, .pg2 .pitem { padding: 5px 0 6px; }
.answer-sheet h1 { font-size: 16pt; margin: 0 0 4px; border-bottom: 2px solid #000; }
.scope { font-size: 10pt; margin: 4px 0 10px; }
.ans-table { border-collapse: collapse; width: 100%; }
.ans-table th, .ans-table td { border: 1px solid #555; padding: 4px 10px; text-align: left; }
.ans-table th { width: 3.5em; text-align: center; background: #f3f3f3; }
.ans-table tr.ch th { background: #e9e3f7; }

@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .sheets { padding: 0; }
  .sheet { margin: 0; box-shadow: none; width: 210mm; min-height: auto; }
  .answer-sheet { break-before: page; }
  .sheet { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 小さい画面 */
@media (max-width: 720px) {
  .grade-grid { grid-template-columns: repeat(2, 1fr); }
  .group-grid { grid-template-columns: repeat(2, 1fr); }
  .drill-grid { grid-template-columns: repeat(3, 1fr); }
  .big-btn { width: 100%; max-width: 320px; height: 200px; }
  .qcard { padding: 20px 16px; }
  .qtext { font-size: 22px; }
  .sheet { width: 100%; min-height: 0; padding: 16px; }
  .bar-extra .dots { display: none; }
}
