/* ===================== 基本 ===================== */
:root {
  /* イングリッシュモンスターと同じ質感：うすい青むらさきの背景・白いカード・インディゴのグラデーション */
  --bg: #f4f6fb;
  --paper: #ffffff;
  --ink: #1f2937;
  --muted: #556070;
  --line: #e3e7f1;
  --accent: #4f46e5;
  --accent2: #3730a3;
  --accent-grad: linear-gradient(135deg, #7c74f0 0%, #4f46e5 50%, #7c3aed 100%);
  --pink-grad: linear-gradient(135deg, #f472b6 0%, #a855f7 55%, #6366f1 100%);
  --warn: #f97316;
  --ok: #16a34a;
  --ng: #dc2626;
  --radius: 20px;
  --shadow: 0 1px 2px rgb(15 23 42 / .05), 0 6px 18px -6px rgb(30 41 99 / .18);
  --shadow-lg: 0 2px 4px rgb(15 23 42 / .05), 0 18px 40px -12px rgb(49 46 129 / .28);
  --font: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'BIZ UDPGothic', 'Yu Gothic UI', Meiryo, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --accent-text: #4338ca;
  --on-accent: #ffffff;
  --warn2: #c2410c;
  --track: #e8ebf4;
  --soft: #eef2fb;
  --ok-bg: #e7f8ee;
  --ok-line: #b7e4c7;
  --ng-bg: #fdecec;
  --ng-line: #f5b5b5;
  --tint1: rgb(165 180 252 / .22);
  --tint2: rgb(249 168 212 / .16);
  --toast: rgba(31, 41, 55, .92);
  --adv: #c0531f;
  --nuki: #0f766e;
  --sel: #fde68a;
  --sel-ink: #1f2937;
  --coin: #b45309;
  --coin-bg: #fef3c7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --paper: #151b2e; --ink: #f3f4f6; --muted: #9ca3af; --line: #252d47;
    --accent: #818cf8; --accent2: #4f46e5; --accent-text: #a5b4fc; --track: #232b45; --soft: #1c2440;
    --ok-bg: #12301f; --ok-line: #23593a; --ng-bg: #3a1b1b; --ng-line: #6b2a2a; --ok: #4ade80; --ng: #f87171;
    --tint1: rgb(129 140 248 / .12); --tint2: rgb(244 114 182 / .08); --nuki: #5eead4; --adv: #fb923c; --toast: rgba(243, 244, 246, .94);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 22px -8px rgb(0 0 0 / .6); --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 18px 40px -12px rgb(0 0 0 / .7);
    --coin: #fcd34d; --coin-bg: #3b2f12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --paper: #151b2e; --ink: #f3f4f6; --muted: #9ca3af; --line: #252d47;
  --accent: #818cf8; --accent2: #4f46e5; --accent-text: #a5b4fc; --track: #232b45; --soft: #1c2440;
  --ok-bg: #12301f; --ok-line: #23593a; --ng-bg: #3a1b1b; --ng-line: #6b2a2a; --ok: #4ade80; --ng: #f87171;
  --tint1: rgb(129 140 248 / .12); --tint2: rgb(244 114 182 / .08); --nuki: #5eead4; --adv: #fb923c; --toast: rgba(243, 244, 246, .94);
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 22px -8px rgb(0 0 0 / .6); --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 18px 40px -12px rgb(0 0 0 / .7);
  --coin: #fcd34d; --coin-bg: #3b2f12;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(120% 60% at 0% 0%, var(--tint1), transparent 60%),
    radial-gradient(90% 50% at 100% 10%, var(--tint2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.6;
  overflow-x: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; font-weight: 700; }
button:disabled { cursor: default; opacity: .45; }
.hidden { display: none !important; }
kbd { font-family: inherit; font-size: .7em; padding: 0 .4em; border: 1px solid currentColor; border-radius: 4px; opacity: .55; margin-left: .3em; }
@media (hover: none) { kbd { display: none; } }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 10px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
}
.brand {
  margin: 0; font-size: clamp(20px, 6vw, 24px); font-weight: 900; letter-spacing: .02em; white-space: nowrap;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.top-pills { display: flex; gap: 6px; }
.pill { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.coin { background: var(--coin-bg); color: var(--coin); }
body.in-quiz .topbar, body.in-quiz .tabbar { display: none; }
body::before { content: ''; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 11; background: var(--bg); }

#view { flex: 1; padding-block: 16px calc(96px + var(--safe-b)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); min-width: 0; }
body.in-quiz #view { padding-bottom: 32px; }

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px -12px rgb(30 41 99 / .25); padding-bottom: var(--safe-b); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.tabbar button { border: 0; background: none; margin: 6px 3px 8px; padding: 5px 0 6px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; color: var(--muted); }
.tabbar .tab-ico { font-size: 21px; filter: grayscale(1); opacity: .7; }
.tabbar button.active { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tabbar button.active .tab-ico { filter: none; opacity: 1; }

/* ===================== 共通パーツ ===================== */
.btn {
  border: 2px solid var(--line); background: var(--paper); border-radius: 16px;
  padding: 12px 16px; font-size: 16px; box-shadow: 0 3px 0 var(--line);
  transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: var(--on-accent); box-shadow: inset 0 1px 0 rgb(255 255 255 / .28), 0 3px 0 var(--accent2), 0 8px 16px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.warn { background: var(--warn2); border-color: #9a3412; color: #fff; box-shadow: 0 3px 0 #9a3412; }
.btn.ok { background: var(--ok); border-color: var(--accent-text); color: var(--on-accent); box-shadow: 0 3px 0 var(--accent2); }
.btn.ng { background: var(--on-accent); border-color: var(--ng); color: var(--ng); box-shadow: 0 3px 0 var(--ng-line); }
.btn.danger { color: var(--ng); border-color: var(--ng-line); box-shadow: none; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { display: block; width: 100%; margin-top: 12px; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0; }
.bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 99px; transition: width .4s; }
.back { border: 0; background: none; color: var(--muted); font-size: 15px; padding: 4px 0; }
.page-h { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.page-h h2 { margin: 0; font-size: 20px; font-weight: 900; }
.page-h small { font-size: 14px; color: var(--muted); }
.sec-h { font-size: 16px; font-weight: 900; margin: 24px 0 8px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .big { font-size: 56px; }

/* ===================== ホーム ===================== */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--paper); border-radius: var(--radius); padding: 12px 8px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; font-weight: 900; line-height: 1.2; color: var(--accent-text); }
.stat b i { font-style: normal; font-size: 13px; color: var(--muted); margin-left: 1px; }
.stat small { font-size: 11px; color: var(--muted); }
.overall { display: flex; align-items: center; gap: 10px; margin: 12px 2px 0; font-size: 12px; color: var(--muted); }
.overall .bar { flex: 1; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 4px; }
.quick .btn { display: flex; flex-direction: column; align-items: center; padding: 14px 8px; font-size: 15px; }
.quick .btn .ico { font-size: 26px; line-height: 1.2; }
.quick .btn small { font-weight: 500; font-size: 12px; opacity: .85; }
.field-h { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 900; margin: 22px 0 8px; color: var(--fc); }
.field-h::before { content: ''; width: 6px; height: 18px; border-radius: 3px; background: var(--fc); }
.units { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.unit {
  display: flex; align-items: flex-start; gap: 8px; text-align: left;
  border: 0; border-top: 4px solid var(--fc); background: var(--paper); border-radius: 14px;
  padding: 12px 10px; box-shadow: var(--shadow); min-width: 0;
}
.unit:active { transform: scale(.98); }
.u-ico { font-size: 26px; line-height: 1; }
.u-ico.big { font-size: 44px; }
.u-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.u-name { font-size: 14px; line-height: 1.35; }
.u-meta { font-size: 11px; color: var(--muted); font-weight: 500; display: flex; gap: 6px; flex-wrap: wrap; }
.u-meta em { font-style: normal; color: var(--warn); font-weight: 700; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; }

/* ===================== シート（単元メニュー） ===================== */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(20, 30, 25, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding-block: 22px calc(20px + var(--safe-b)); padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  animation: up .2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.close { position: absolute; top: 10px; right: 12px; border: 0; background: var(--track); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; line-height: 1; color: var(--muted); }
.sheet-head { display: flex; gap: 12px; align-items: center; padding-right: 36px; }
.sheet-head small { color: color-mix(in srgb, var(--fc) 70%, var(--ink)); font-weight: 700; font-size: 13px; }
.sheet-head h3 { margin: 0; font-size: 20px; font-weight: 900; line-height: 1.3; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--track); border-radius: 12px; padding: 4px; margin: 16px 0 12px; }
.seg button { border: 0; background: none; padding: 8px; border-radius: 9px; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left;
  background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 3px 0 var(--line);
}
.mode .ico { grid-row: span 2; font-size: 24px; }
.mode b { font-size: 15px; }
.mode small { font-size: 11px; color: var(--muted); font-weight: 500; line-height: 1.4; }
.mode:last-child { grid-column: span 2; }

/* ===================== 問題一覧 ===================== */
.hide-toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); margin: 4px 0 12px; }
.qlist { list-style: none; padding: 0; margin: 0; counter-reset: q; display: flex; flex-direction: column; gap: 8px; }
.qlist li { counter-increment: q; background: var(--paper); border-radius: 12px; padding: 12px 14px 12px 44px; position: relative; box-shadow: var(--shadow); border-left: 4px solid transparent; }
.qlist li::before { content: counter(q); position: absolute; left: 12px; top: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--track); font-size: 12px; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.qlist li.mastered { border-left-color: var(--accent); }
.qlist li.weak { border-left-color: var(--warn); }
.qlist p { margin: 0; }
.lq { font-size: 15px; }
.la { margin-top: 6px !important; }
.la span { font-weight: 900; color: var(--accent-text); background: linear-gradient(transparent 60%, var(--ok-bg) 60%); }
.le { font-size: 13px; color: var(--muted); margin-top: 4px !important; }
.hide-ans .qlist li:not(.peek) .la span { color: transparent; background: var(--track); border-radius: 4px; }
.hide-ans .qlist li:not(.peek) .le { display: none; }
.hide-ans .qlist li { cursor: pointer; }

/* ===================== 4択テスト ===================== */
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qt-title { font-size: 13px; color: var(--muted); font-weight: 700; flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt-count { font-weight: 900; font-size: 15px; }
.progress { height: 6px; background: var(--track); border-radius: 99px; margin: 8px 0 16px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.qcard { background: var(--paper); border-radius: var(--radius); padding: 18px 18px 22px; box-shadow: var(--shadow); border-top: 5px solid var(--fc); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; color: color-mix(in srgb, var(--fc) 62%, var(--ink)); background: color-mix(in srgb, var(--fc) 12%, var(--paper)); padding: 2px 10px; border-radius: 99px; }
.qtext { font-size: 19px; font-weight: 700; margin: 12px 0 0; line-height: 1.6; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 16px;
  box-shadow: 0 3px 0 var(--line); transition: transform .06s;
}
.choice:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.choice:disabled { opacity: 1; }
.choice .num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--soft); font-size: 14px; color: var(--muted); }
.choice.correct { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 3px 0 var(--ok-line); }
.choice.correct .num { background: var(--ok); color: var(--on-accent); }
.choice.wrong { border-color: var(--ng); background: var(--ng-bg); box-shadow: 0 3px 0 var(--ng-line); animation: shake .3s; }
.choice.wrong .num { background: var(--ng); color: var(--on-accent); }
.choice:disabled:not(.correct):not(.wrong) { opacity: .5; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.fb { margin-top: 16px; border-radius: var(--radius); padding: 14px 16px; background: var(--paper); border: 2px solid; animation: up .2s; }
.fb.ok { border-color: var(--ok); }
.fb.ng { border-color: var(--ng); }
.fb-h { font-size: 18px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.fb.ok .fb-h { color: color-mix(in srgb, var(--ok) 70%, var(--ink)); }
.fb.ng .fb-h { color: var(--ng); }
.badge { font-size: 12px; background: var(--accent); color: var(--on-accent); padding: 2px 10px; border-radius: 99px; }
.fb-a { margin: 6px 0 0; }
.fb-a b { color: var(--accent-text); font-size: 17px; }
.fb-e { font-size: 14px; color: var(--muted); margin: 6px 0 0; }

/* ===================== 一問一答カード ===================== */
.flash { perspective: 1200px; cursor: pointer; outline: none; }
.flash-inner { position: relative; min-height: 300px; transition: transform .45s; transform-style: preserve-3d; display: grid; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--paper); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); border-top: 5px solid var(--fc);
  display: flex; flex-direction: column;
}
.face.back { transform: rotateY(180deg); border-top-color: var(--accent); --fc: var(--accent); }
.face .tag { align-self: flex-start; }
.face .bq { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.face .hint { margin-top: auto; text-align: center; color: var(--muted); font-size: 13px; }
.atext { font-size: 24px; font-weight: 900; color: var(--accent-text); margin: 16px 0 4px; }
.judge { text-align: center; margin-top: 16px; }
.judge p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.judge-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===================== 結果 ===================== */
.result { text-align: center; padding: 16px 0 4px; }
.r-title { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.score {
  --p: 0; width: 160px; height: 160px; margin: 0 auto; border-radius: 50%;
  display: flex; align-items: baseline; justify-content: center; padding-top: 52px;
  background: radial-gradient(closest-side, var(--paper) 78%, transparent 79% 100%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--track) 0);
}
.score b { font-size: 46px; font-weight: 900; line-height: 1; color: var(--accent-text); }
.score span { font-size: 18px; color: var(--muted); margin-left: 4px; }
.r-msg { font-size: 18px; font-weight: 900; margin: 14px 0 0; }
.r-btns { margin-top: 20px; }

/* ===================== 記録 ===================== */
.chart { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 140px; background: var(--paper); border-radius: var(--radius); padding: 12px 10px 8px; box-shadow: var(--shadow); }
.chart .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.chart .b { width: 100%; max-width: 18px; background: color-mix(in srgb, var(--accent) 35%, var(--paper)); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .today .b { background: var(--accent); }
.chart .v { font-size: 10px; color: var(--muted); }
.chart .l { font-size: 10px; color: var(--muted); margin-top: 4px; }
.chart .today .l { color: var(--accent-text); font-weight: 900; }
.tbl { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 14px; }
.tbl th { background: var(--soft); font-size: 12px; color: var(--muted); padding: 8px; text-align: left; }
.tbl td { padding: 10px 8px; border-top: 1px solid var(--line); }
.tbl td:not(:first-child), .tbl th:not(:first-child) { text-align: right; white-space: nowrap; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--soft); }
.tbl .low { color: var(--ng); font-weight: 700; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.settings { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; font-size: 14px; }
.settings label { display: flex; align-items: center; gap: 6px; }

/* ===================== トースト ===================== */
.toast { pointer-events: none; position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); z-index: 40; background: var(--toast); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; white-space: nowrap; }

@media (max-width: 360px) {
  .units, .modes { grid-template-columns: 1fr; }
  .mode:last-child { grid-column: auto; }
}

/* ===================== レベル ===================== */
.new-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 99px; font-size: 10px; font-weight: 900; line-height: 1.7; vertical-align: 2px; color: #fff; background: #be123c; letter-spacing: .03em; }
.lv-badge { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 99px; font-size: 10px; font-weight: 900; line-height: 1.7; vertical-align: 2px; color: #fff; background: #c2410c; white-space: nowrap; }
.lv-seg { margin: 18px 0 0; }
.lv-jump { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 12px 0 0; }
.lv-jump a { text-align: center; padding: 8px; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; }
.lv-jump a:hover { background: var(--paper); }
.p-sec { display: flex; flex-direction: column; gap: 2px; scroll-margin-top: calc(64px + env(safe-area-inset-top, 0px)); }
.prints li.lv-adv .p-no { background: #c2410c; }
.p-sec small { font-size: 12px; font-weight: 500; color: var(--muted); }

/* ===================== プリント ===================== */
.dl-all {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 12px; padding: 14px 16px;
  background: var(--paper); border: 2px solid var(--fc); border-radius: var(--radius); box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
}
.dl-all .ico { font-size: 28px; }
.dl-all > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-all b { font-size: 16px; }
.dl-all small { color: var(--muted); font-size: 12px; }
.dl-label { flex: none; background: color-mix(in srgb, var(--fc) 78%, #000); color: var(--on-accent); font-weight: 700; padding: 6px 12px; border-radius: 99px; font-size: 13px; }
.prints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.prints li { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 10px; background: var(--paper); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.p-no { flex: none; background: color-mix(in srgb, var(--fc) 78%, #000); color: var(--on-accent); font-weight: 900; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.p-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-body b { font-size: 14px; line-height: 1.35; }
.p-body small { color: var(--muted); font-size: 11px; }
.p-btns { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
@media (min-width: 480px) {
  .prints li { grid-template-columns: auto 1fr auto; }
  .p-btns { grid-column: auto; display: flex; }
}
.p-btns .btn { text-align: center; }
.p-btns a.btn { text-decoration: none; color: inherit; }

/* ===================== 抜き出し演習 ===================== */
.nuki-entry {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 10px; padding: 12px 14px; text-align: left;
  background: var(--paper); border: 2px solid var(--nuki); border-radius: 14px; box-shadow: 0 3px 0 var(--line);
}
.nuki-entry .ico { font-size: 26px; }
.nuki-entry > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nuki-entry b { font-size: 15px; }
.nuki-entry small { font-size: 12px; color: var(--muted); font-weight: 500; }
.nuki-prog { flex: none; font-size: 13px; color: var(--nuki); font-variant-numeric: tabular-nums; }
.prints li.lv-nuki .p-no, a.dl-all[href*="nuki"] .dl-label { background: #0f766e; }
.rules-card { background: var(--paper); border: 1.5px solid var(--nuki); border-radius: 12px; padding: 10px 14px; margin: 4px 0 14px; font-size: 13px; }
.rules-card b { color: var(--nuki); }
.rules-card ul { margin: 4px 0 0; padding-left: 1.2em; }
.rules-card em { font-style: normal; font-weight: 900; }
.passage-box {
  background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 12px 10px 4px;
  max-height: 46vh; overflow: auto; overscroll-behavior: contain; position: relative;
}
.passage-box .pl { display: flex; font-size: 14px; line-height: 2; white-space: nowrap; }
.passage-box .ln { flex: none; width: 26px; padding-right: 6px; text-align: right; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.passage-box .pt { flex: 1; min-width: 0; }
/* せまい画面：段落で流し、5行ごとの行番号を文中に小さく出す */
.passage-box.flow { padding-left: 12px; }
.passage-box.flow .para { font-size: 15px; line-height: 2.1; }
.passage-box.flow .pl, .passage-box.flow .pt { display: inline; white-space: normal; }
.passage-box.flow .pt { word-break: break-all; }
.passage-box.flow .ln { display: none; }
.passage-box.flow .ln:not(:empty) { display: inline-block; width: auto; padding: 0 3px; margin: 0 2px; line-height: 1.4; border-radius: 4px; background: var(--soft); vertical-align: 2px; }
.passage-box .c { cursor: pointer; border-radius: 2px; }
.passage-box .c.u { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 5px; }
.passage-box .c.u.cur { text-decoration-color: var(--nuki); text-decoration-thickness: 3px; }
.passage-box .mk { font-size: 11px; color: var(--nuki); margin-right: 1px; }
.passage-box .c.sel { background: var(--sel); color: var(--sel-ink); }
.passage-box .c.anchor { outline: 2px solid var(--nuki); }
.passage-box .c.ans { background: var(--ok-bg); box-shadow: inset 0 -3px 0 var(--ok); }
.nk-card { background: var(--paper); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-top: 12px; }
.nk-qt { margin: 0; font-size: 15px; font-weight: 700; }
.nk-qt b { color: var(--nuki); margin-right: 6px; }
.nk-how { margin: 8px 0; font-size: 12px; color: var(--muted); }
.nk-sel { min-height: 44px; border: 2px dashed var(--line); border-radius: 10px; padding: 8px 10px; font-size: 15px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; }
.nk-sel .pick { font-weight: 700; background: var(--sel); color: var(--sel-ink); border-radius: 3px; padding: 0 2px; }
.nk-sel .tail { font-weight: 700; color: var(--muted); }
.nk-sel .cnt { margin-left: auto; font-size: 12px; color: var(--nuki); font-weight: 700; white-space: nowrap; }
.nk-sel .cnt.off { color: var(--ng); }
.nk-sel .se { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.nk-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.nk-btns:empty { display: none; }
.nk-key { margin-top: 12px; border-radius: 12px; background: var(--soft); padding: 10px 12px; font-size: 13px; }
.nk-key p { margin: 4px 0; }
.nk-key .k { font-size: 16px; font-weight: 900; color: var(--accent-text); }
.nk-key .k .t { color: var(--muted); }
.nk-key .where { font-size: 12px; font-weight: 700; color: var(--nuki); }
.nk-key b { display: inline-block; font-size: 11px; background: var(--paper); border-radius: 4px; padding: 0 6px; margin-right: 6px; }

/* ===================== 確認ダイアログ ===================== */
.ask p { font-size: 16px; margin: 4px 36px 16px 0; }
.ask-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.danger-fill { background: var(--ng); border-color: var(--ng); color: var(--on-accent); box-shadow: none; }
button:focus-visible, .flash:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* =====================================================================
 * 理科モンスター：相棒モンスター（イングリッシュモンスターのデザインにそろえる）
 * ===================================================================== */
.xpbar { height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; }
.xpbar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #a78bfa, #6366f1); transition: width .5s; }
.coin-pill { display: inline-flex; align-items: center; gap: 2px; font-weight: 900; font-size: 13px; color: var(--coin); background: var(--coin-bg); border: 1.5px solid color-mix(in srgb, var(--coin) 45%, transparent); border-radius: 99px; padding: 1px 9px; font-variant-numeric: tabular-nums; }
.icon-btn { border: 0; background: var(--soft); border-radius: 10px; width: 32px; height: 32px; font-size: 15px; }

/* ホームの相棒カード */
.partner { display: flex; gap: 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.pt-box { position: relative; isolation: isolate; overflow: hidden; flex: none; width: 112px; height: 112px; border: 0; border-radius: 18px; padding: 0; background: linear-gradient(160deg, var(--soft), color-mix(in srgb, var(--accent) 10%, var(--paper))); box-shadow: inset 0 1px 0 rgb(255 255 255 / .6), 0 4px 12px -6px rgb(30 41 99 / .35); }
.pt-fig { display: block; width: 100%; height: 100%; }
.pt-fig .monster-svg { width: 100%; height: 100%; overflow: visible; }
.pt-fig.bounce { animation: bounce .6s; }
@keyframes bounce { 30% { transform: translateY(-10px); } 60% { transform: translateY(0); } 80% { transform: translateY(-4px); } }
.pt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pt-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.pt-name b { font-size: 17px; font-weight: 900; }
.pt-name.big b { font-size: 21px; }
.pt-name .icon-btn { margin-left: auto; align-self: center; }
.pt-lv { font-weight: 900; color: var(--accent-text); }
.pt-stars { color: #f59e0b; font-size: 12px; letter-spacing: -1px; }
.pt-line { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.pt-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hearts { font-size: 11px; letter-spacing: -1px; }
.room-space, .room-observatory { background: linear-gradient(160deg, #312e81, #1e1b4b) !important; }
.room-space .pt-line, .room-observatory .pt-line { color: #e0e7ff; }
.room-scene { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
.poke-hearts { position: absolute; inset: 0; pointer-events: none; }
.poke-hearts i { position: absolute; top: 24%; font-style: normal; color: #f472b6; font-size: 15px; opacity: 0; animation: heart-up 1.1s ease-out forwards; }
.poke-hearts i:nth-child(1) { left: 14%; } .poke-hearts i:nth-child(2) { left: 46%; animation-delay: .12s; font-size: 19px; } .poke-hearts i:nth-child(3) { left: 76%; animation-delay: .24s; }
@keyframes heart-up { 0% { transform: translateY(10px) scale(.5); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-30px) scale(1.1); opacity: 0; } }

.goal { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 12px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.goal > span:first-child { white-space: nowrap; }
.goal b { color: var(--ink); font-variant-numeric: tabular-nums; }
.goal .bar { flex: 1; }
.goal .bar span { background: linear-gradient(90deg, #34d399, #10b981); }
.goal.done { border-color: color-mix(in srgb, #10b981 50%, transparent); background: color-mix(in srgb, #10b981 8%, var(--paper)); }
.goal-gift { font-size: 18px; }
.gacha-banner {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; width: 100%; margin-top: 10px; padding: 12px 16px; text-align: left;
  border: 0; border-radius: var(--radius); color: #fff; background: var(--pink-grad);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 4px 0 #6d28d9, 0 12px 24px -12px #a855f7;
}
.gacha-banner:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 2px 0 #6d28d9; }
.gb-main { font-size: 18px; font-weight: 900; }
.gb-tag { grid-row: span 2; font-size: 12px; font-weight: 900; background: rgb(255 255 255 / .22); border-radius: 99px; padding: 4px 10px; white-space: nowrap; }
.gacha-banner small { font-size: 12px; opacity: .9; font-weight: 500; }

/* 学習中のごほうび */
.lv-banner { position: fixed; z-index: 55; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 8px; border-radius: 99px; color: #fff; background: linear-gradient(135deg, #f59e0b, #f97316); box-shadow: 0 10px 24px -10px #f97316; font-size: 13px; white-space: nowrap; animation: banner 2.6s ease-out forwards; pointer-events: none; }
.lv-banner b { display: block; font-size: 15px; font-weight: 900; }
.lb-fig { width: 44px; height: 44px; background: rgb(255 255 255 / .35); border-radius: 50%; }
.lb-fig .monster-svg { width: 100%; height: 100%; }
@keyframes banner { 0% { transform: translate(-50%, -30px); opacity: 0; } 12%, 85% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, -20px); opacity: 0; } }
.gain-float { position: fixed; z-index: 50; top: calc(70px + env(safe-area-inset-top, 0px)); right: 18px; padding: 4px 12px; border-radius: 99px; font-weight: 900; font-size: 15px; color: #fff; background: linear-gradient(135deg, #8b5cf6, #6366f1); box-shadow: 0 6px 16px -6px #6366f1; animation: xp-float 1.5s ease-out forwards; pointer-events: none; }
@keyframes xp-float { 0% { transform: translateY(8px); opacity: 0; } 15% { opacity: 1; transform: translateY(0); } 75% { opacity: 1; } 100% { transform: translateY(-24px); opacity: 0; } }
.fb-gain { margin: 8px 0 0; font-weight: 900; color: var(--accent-text); font-size: 14px; }
.fb-gain span { margin-left: 8px; font-size: 12px; color: #fff; background: linear-gradient(135deg, #f59e0b, #f97316); padding: 1px 8px; border-radius: 99px; }
.cheer { display: flex; align-items: center; gap: 10px; margin-top: 12px; animation: up .25s ease-out; }
.cheer-fig { flex: none; width: 58px; height: 58px; }
.cheer-fig .monster-svg { width: 100%; height: 100%; }
.cheer-txt { position: relative; flex: 1; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 9px 12px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.cheer-txt::before { content: ''; position: absolute; left: -7px; top: 50%; width: 12px; height: 12px; background: var(--paper); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: translateY(-50%) rotate(45deg); }
.cheer.streak .cheer-txt { color: var(--accent-text); }

/* お祝い・ガチャの結果・はじめての説明 */
.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgb(15 23 42 / .55); backdrop-filter: blur(4px); animation: fade .2s; }
.celebrate, .onboard { position: relative; overflow: hidden; width: min(100%, 360px); text-align: center; background: var(--paper); border-radius: 28px; padding: 22px 20px 20px; box-shadow: var(--shadow-lg); animation: pop-in .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop-in { from { transform: scale(.7); opacity: 0; } }
.celebrate h2, .onboard h2 { margin: 6px 0 4px; font-size: 24px; font-weight: 900; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cel-fig, .ob-fig { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.cel-fig .monster-svg, .ob-fig .monster-svg { width: 100%; height: 100%; overflow: visible; }
.celebrate.evolve .cel-fig { animation: reveal 1.4s ease-out; }
@keyframes reveal { 0%, 45% { filter: brightness(0) invert(1) drop-shadow(0 0 30px #fff); } 100% { filter: drop-shadow(0 0 18px #fde047); } }
.cel-burst { position: absolute; left: 50%; top: 100px; width: 420px; height: 420px; margin: -210px 0 0 -210px; z-index: -1; opacity: .32;
  background: repeating-conic-gradient(from 0deg, #fde68a 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: spin 14s linear infinite; mask: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 65%); }
@keyframes spin { to { transform: rotate(360deg); } }
.lvup-ring { position: absolute; inset: 10px; border-radius: 50%; border: 4px solid #fbbf24; pointer-events: none; animation: lvup-ring 1s ease-out forwards; }
@keyframes lvup-ring { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.cel-sub { margin: 0; font-weight: 700; }
.cel-desc { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.cel-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 14px; }
.rarity { margin: 0; display: inline-block; font-size: 12px; font-weight: 900; padding: 2px 12px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.r-R .rarity { background: #e0f2fe; color: #0369a1; }
.r-SR .rarity { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #78350f; }
.r-UR .rarity { background: linear-gradient(135deg, #f9a8d4, #a5b4fc, #86efac); color: #4c1d95; }
.gacha-reveal.r-SR .cel-burst { background: repeating-conic-gradient(from 0deg, #f59e0b 0 10deg, transparent 10deg 20deg); opacity: .45; }
.gacha-reveal.r-UR .cel-burst { background: repeating-conic-gradient(from 0deg, #f472b6 0 8deg, #60a5fa 8deg 16deg, #34d399 16deg 24deg, transparent 24deg 32deg); opacity: .45; }
.gacha-reveal .cel-fig { animation: gacha-egg .7s ease-out; }
@keyframes gacha-egg { 0% { transform: scale(0); } 80% { transform: scale(1.15); } 100% { transform: scale(1); } }
.onboard p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.ob-dots { display: flex; justify-content: center; gap: 6px; margin: 14px 0 4px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--track); transition: width .2s; }
.ob-dots i.on { width: 24px; background: var(--accent); }
.ob-skip { margin-top: 8px; border: 0; background: none; color: var(--muted); font-weight: 500; font-size: 14px; }

/* 結果画面のごほうび */
.r-reward { display: grid; grid-template-columns: 76px 1fr; gap: 4px 12px; align-items: center; margin-top: 14px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.rr-fig { width: 76px; height: 76px; }
.rr-fig .monster-svg { width: 100%; height: 100%; }
.rr-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rr-name { margin: 0; font-weight: 700; }
.rr-name b { color: var(--accent-text); }
.rr-gain { margin: 0; display: flex; gap: 8px; align-items: center; font-weight: 900; color: var(--accent-text); }
.rr-extra { grid-column: 1 / -1; margin: 6px 0 0; padding: 8px 0 0 1.2em; border-top: 1px dashed var(--line); font-size: 13px; }

/* あいぼうタブ */
.mon-seg { grid-template-columns: repeat(5, 1fr); margin-top: 0; }
.mon-seg button { padding: 8px 2px; font-size: 13px; }
.mon-stage { position: relative; isolation: isolate; overflow: hidden; text-align: center; padding: 10px 0 12px; border-radius: var(--radius); background: linear-gradient(160deg, var(--soft), color-mix(in srgb, var(--accent) 10%, var(--paper))); box-shadow: var(--shadow); }
.mon-big { position: relative; display: block; width: 190px; height: 190px; margin: 0 auto; border: 0; background: none; padding: 0; }
.mon-stage .pt-line { margin-top: 2px; }
.mon-card { margin-top: 12px; padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.mon-card .muted { margin: 0; font-size: 12px; }
.mon-desc { margin: 0; font-size: 14px; line-height: 1.7; }
.mini-h { margin: 18px 0 8px; font-size: 15px; font-weight: 900; }
.mon-card .mini-h { margin: 0; }
.evo-next { flex-direction: row; align-items: center; }
.evo-fig { flex: none; width: 64px; height: 64px; }
.evo-fig .monster-svg { width: 100%; height: 100%; }
.src-row { display: grid; grid-template-columns: 64px 1fr 48px; align-items: center; gap: 8px; font-size: 13px; }
.src-row .bar span { background: var(--accent-grad); }
.src-row b { text-align: right; font-variant-numeric: tabular-nums; }
.prof { width: 100%; border-collapse: collapse; font-size: 14px; }
.prof th { text-align: left; width: 6.5em; color: var(--muted); font-weight: 500; vertical-align: top; padding: 6px 0; }
.prof td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.prof tr:last-child td { border-bottom: 0; }
.prof small { display: block; color: var(--muted); font-size: 12px; }
.party { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.pm { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: var(--paper); border: 2px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; }
.pm.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--paper)); }
.pm.r-SR { border-color: #f59e0b; } .pm.r-UR { border-color: #c084fc; }
.pm-fig { width: 72px; height: 72px; }
.pm-fig .monster-svg { width: 100%; height: 100%; }
.pm b { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm small { font-size: 11px; color: var(--muted); }
.pm-tag { position: absolute; top: 4px; left: 4px; font-size: 10px; font-weight: 900; color: #fff; background: var(--accent-grad); border-radius: 99px; padding: 0 7px; }
.ask .nm-input { width: 100%; font: inherit; font-size: 18px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); margin-bottom: 14px; }

.shop-stage { position: relative; isolation: isolate; overflow: hidden; height: 150px; border-radius: var(--radius); background: linear-gradient(160deg, var(--soft), color-mix(in srgb, var(--accent) 10%, var(--paper))); box-shadow: var(--shadow); }
.shop-fig { position: absolute; left: 50%; bottom: 4px; width: 132px; height: 132px; transform: translateX(-50%); }
.shop-fig .monster-svg { width: 100%; height: 100%; }
.shop-wallet { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.coupon { font-size: 12px; font-weight: 900; color: #be185d; background: #fce7f3; border-radius: 99px; padding: 1px 9px; }
.shop-seg { grid-template-columns: repeat(3, 1fr); }
.shop { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; padding: 12px 8px 10px; background: var(--paper); border: 2px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; }
.shop-item.on { border-color: var(--accent); }
.si-ico { font-size: 30px; line-height: 1.2; }
.shop-item b { font-size: 13px; }
.shop-item small { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.shop-item .btn { width: 100%; }
.shop-item .buy { background: var(--coin-bg); color: var(--coin); border-color: color-mix(in srgb, var(--coin) 35%, transparent); box-shadow: 0 3px 0 color-mix(in srgb, var(--coin) 35%, transparent); }
.shop-item .buy s { font-size: 11px; opacity: .6; margin-left: 4px; }

.gacha { text-align: center; padding: 18px 16px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.gacha h2 { margin: 4px 0; font-size: 22px; font-weight: 900; }
.capsule { width: 150px; height: 150px; margin: 0 auto; }
.capsule .monster-svg { width: 100%; height: 100%; }
.capsule.shake { animation: capsule 1.2s ease-in-out; }
@keyframes capsule { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-14deg); } 30% { transform: rotate(14deg); } 45% { transform: rotate(-10deg); } 60% { transform: rotate(10deg); } 80% { transform: scale(1.25); filter: brightness(1.6); } }
.gacha-btn { font-size: 18px; padding: 14px; color: #fff; border: 0; background: var(--pink-grad); box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 4px 0 #6d28d9; }
.gacha-note { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.rates { text-align: left; font-size: 12px; color: var(--muted); margin-top: 10px; }
.rates summary { cursor: pointer; font-weight: 700; }
.zukan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.zk { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 4px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.zk.no { background: var(--soft); }
.zk-fig { width: 64px; height: 64px; }
.zk-fig .monster-svg { width: 100%; height: 100%; }
.zk b { font-size: 11px; line-height: 1.3; }
.zk small { font-size: 10px; color: var(--muted); }
.zukan.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.zukan.four .zk-fig { width: 56px; height: 56px; }
.zk-branch { margin: 12px 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.souv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sv { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 2px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.sv span { font-size: 24px; }
.sv small { font-size: 10px; line-height: 1.3; }
.sv.no { opacity: .55; }

/* 相棒の動き：呼吸・まばたき・タマゴのゆれ（イングリッシュモンスターと同じ） */
.monster-breathe { transform-origin: 50px 90px; animation: breathe 3.2s ease-in-out infinite, hop 13s ease-in-out infinite 4s; }
@keyframes breathe { 50% { transform: scale(1.03, .97); } }
@keyframes hop { 0%, 92%, 100% { translate: 0 0; } 95% { translate: 0 -6px; } 97% { translate: 0 0; } 98.5% { translate: 0 -2px; } }
.monster-eyes { transform-origin: 50px 57px; animation: blink 4.5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.egg-wobble { transform-origin: 50px 92px; animation: wobble 2.8s ease-in-out infinite; }
@keyframes wobble { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-6deg); } 86% { transform: rotate(5deg); } 93% { transform: rotate(-2deg); } }
.wings { transform-origin: 50px 62px; animation: flap 1.6s ease-in-out infinite; }
@keyframes flap { 50% { transform: scaleX(1.06); } }
.halo { animation: halo 2.4s ease-in-out infinite; }
@keyframes halo { 50% { transform: translateY(-2px); opacity: .7; } }
.sparks { animation: sparks .9s steps(2) infinite; }
@keyframes sparks { 50% { opacity: .2; } }
.particles > g > * { animation: drift 3s ease-in-out infinite; animation-delay: inherit; }
@keyframes drift { 50% { transform: translateY(-5px) rotate(12deg); opacity: .6; } }
.monster-face.glance { animation: glance 9s ease-in-out infinite; }
@keyframes glance { 0%, 60%, 100% { transform: translateX(0); } 64%, 70% { transform: translateX(-3px); } 74%, 80% { transform: translateX(3px); } }
.snot { transform-origin: 57px 70px; animation: snot 2.4s ease-in-out infinite; }
@keyframes snot { 50% { transform: scale(1.6); } }
.myth-glitter, .scene-twinkle { animation: twinkle 1.8s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .2; } }
.scene-bubble { animation: rise 4s linear infinite; }
@keyframes rise { to { transform: translateY(-30px); opacity: 0; } }
.scene-snow { animation: snow 4s linear infinite; }
@keyframes snow { to { transform: translate(-8px, 40px); opacity: 0; } }
.rare-rays { transform-origin: 50px 58px; animation: spin 18s linear infinite; }
.rare-glint { animation: twinkle 1.4s ease-in-out infinite; }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .monster-breathe, .monster-eyes, .egg-wobble, .wings, .halo, .sparks, .particles > g > *, .monster-face.glance, .snot,
  .myth-glitter, .scene-twinkle, .scene-bubble, .scene-snow, .rare-rays, .rare-glint, .cel-burst, .gain-float, .lv-banner { animation: none !important; }
  .poke-hearts, .lvup-ring { display: none; }
}

/* 今日のミッション */
.missions { margin-top: 12px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.missions .mini-h { margin: 0 0 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.missions .mini-h small { font-size: 11px; font-weight: 500; color: var(--muted); }
.missions ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.missions li { display: grid; grid-template-columns: 1fr auto 88px; align-items: center; gap: 8px; font-size: 13px; min-height: 30px; }
.missions li .bar { height: 7px; }
.missions li .bar span { background: var(--accent-grad); }
.ms-prog { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ms-ok { text-align: center; font-weight: 900; color: var(--ok); }
.missions li.claimed .ms-text { color: var(--muted); text-decoration: line-through; }
.missions li.done .ms-text { font-weight: 700; }
.missions .btn.small { padding: 4px 6px; font-size: 12px; }

/* 今日のボス（ホームの入口） */
.boss-banner {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 8px 14px 8px 8px; text-align: left; border: 0; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 55%, #ea580c 100%); box-shadow: inset 0 1px 0 rgb(255 255 255 / .2), 0 4px 0 #450a0a, 0 12px 22px -12px #dc2626;
}
.boss-banner:active { transform: translateY(2px); box-shadow: 0 2px 0 #450a0a; }
.boss-banner.won { background: linear-gradient(135deg, #334155, #475569); box-shadow: 0 4px 0 #1e293b; }
.bb-fig { width: 56px; height: 56px; }
.bb-fig .boss-svg, .br-fig .boss-svg, .boss-fig .boss-svg { width: 100%; height: 100%; overflow: visible; }
.bb-body { display: flex; flex-direction: column; min-width: 0; }
.bb-body b { font-size: 16px; font-weight: 900; letter-spacing: .02em; }
.bb-body small { font-size: 12px; opacity: .9; }
.bb-coin { font-size: 12px; font-weight: 900; background: rgb(255 255 255 / .18); border-radius: 99px; padding: 4px 10px; white-space: nowrap; }

/* ボス戦 */
.boss-arena { position: relative; padding: 10px 12px 12px; margin-bottom: 12px; border-radius: var(--radius); color: #fff; background: radial-gradient(120% 90% at 50% 0%, #4c1d95, #1e1b4b 70%); box-shadow: var(--shadow-lg); }
.boss-arena.ouch { animation: ouch .4s; }
@keyframes ouch { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.boss-hp { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 13px; }
.boss-hp small { font-variant-numeric: tabular-nums; opacity: .9; }
.hpbar { height: 12px; border-radius: 99px; background: rgb(255 255 255 / .18); overflow: hidden; }
.hpbar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #f87171, #ef4444, #dc2626); transition: width .4s; }
.boss-fig { position: relative; width: 130px; height: 130px; margin: 6px auto 0; }
.boss-fig.hit { animation: boss-hit .45s; }
@keyframes boss-hit { 0% { filter: brightness(2.2); transform: translateX(0); } 30% { transform: translateX(8px) rotate(4deg); } 60% { transform: translateX(-6px) rotate(-3deg); } 100% { filter: none; transform: none; } }
.dmg { position: absolute; left: 50%; top: 20%; font-weight: 900; font-size: 22px; color: #fde047; text-shadow: 0 2px 0 #7c2d12, 0 0 10px #f97316; opacity: 0; pointer-events: none; white-space: nowrap; }
.dmg.show { animation: dmg-pop 1s ease-out forwards; }
.dmg.crit { color: #fff; font-size: 24px; }
@keyframes dmg-pop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 30% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -30px) scale(1); } }
.arena-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.ally { width: 48px; height: 48px; }
.ally .monster-svg { width: 100%; height: 100%; }
.lives { font-size: 16px; letter-spacing: 1px; }
.gauge { display: flex; gap: 3px; margin-left: auto; }
.gauge i { width: 14px; height: 14px; border-radius: 4px; background: rgb(255 255 255 / .18); transform: skewX(-12deg); }
.gauge i.on { background: linear-gradient(135deg, #fde047, #f97316); box-shadow: 0 0 8px #f97316; }
.btn.special { margin-top: 10px; color: #7c2d12; border: 0; background: linear-gradient(135deg, #fde047, #fb923c); box-shadow: 0 3px 0 #9a3412, 0 0 18px rgb(249 115 22 / .6); animation: pop 1s ease-in-out infinite; }
@keyframes pop { 50% { transform: scale(1.03); } }
.crit-hint { margin: 6px 2px 0; font-size: 12px; color: var(--muted); }
.boss-result { position: relative; overflow: hidden; isolation: isolate; text-align: center; padding: 18px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.boss-result h2 { margin: 6px 0 4px; font-size: 20px; font-weight: 900; }
.boss-result .rr-extra { text-align: left; border-top: 1px dashed var(--line); }
.br-fig { width: 120px; height: 120px; margin: 4px auto 0; }
.br-fig.defeated { opacity: .55; filter: grayscale(.6); transform: rotate(-8deg); }
.rank { display: inline-block; margin: 0; font-weight: 900; font-size: 15px; padding: 2px 14px; border-radius: 99px; color: #fff; background: #64748b; }
.rank-S { background: linear-gradient(135deg, #f59e0b, #ef4444); } .rank-A { background: var(--accent-grad); }
.zzz { position: absolute; right: 10px; top: 6px; font-size: 18px; animation: zzz 2s ease-in-out infinite; pointer-events: none; }
@keyframes zzz { 50% { transform: translateY(-4px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .boss-fig.hit, .boss-arena.ouch, .btn.special, .zzz, .dmg.show { animation: none !important; } .dmg.show { opacity: 1; } }

.zk-fig .boss-svg { width: 100%; height: 100%; }
.boss-hidden { filter: brightness(0) opacity(.25); }

/* 学習カレンダー・分野ごとの正答率 */
.cal, .frates { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.cal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-h b { font-size: 16px; }
.cal-h .icon-btn:disabled { opacity: .3; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cw { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 2px; }
.cd { position: relative; min-width: 0; aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; font-size: 12px; font-variant-numeric: tabular-nums; background: var(--soft); color: var(--muted); }
.cd.blank { background: none; }
.cd.l1 { background: color-mix(in srgb, var(--accent) 22%, var(--paper)); color: var(--ink); }
.cd.l2 { background: color-mix(in srgb, var(--accent) 45%, var(--paper)); color: var(--ink); }
.cd.l3 { background: color-mix(in srgb, var(--accent) 70%, var(--paper)); color: #fff; }
.cd.l4 { background: var(--accent); color: #fff; }
.cd.today { outline: 2px solid var(--warn); outline-offset: -2px; font-weight: 900; }
.cd i { position: absolute; top: -2px; right: 1px; font-style: normal; font-size: 9px; color: #f59e0b; }
.cal .muted { margin-top: 8px; font-size: 12px; }
.cal-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; font-size: 10px; color: var(--muted); }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; }
.cal-legend i.l1 { background: color-mix(in srgb, var(--accent) 22%, var(--paper)); } .cal-legend i.l2 { background: color-mix(in srgb, var(--accent) 45%, var(--paper)); }
.cal-legend i.l3 { background: color-mix(in srgb, var(--accent) 70%, var(--paper)); } .cal-legend i.l4 { background: var(--accent); }
.frates { display: flex; flex-direction: column; gap: 8px; }
.fr-row { display: grid; grid-template-columns: 5.5em 1fr 3em 3.5em; align-items: center; gap: 8px; font-size: 13px; }
.fr-name { font-weight: 700; color: color-mix(in srgb, var(--fc) 70%, var(--ink)); }
.fr-row b { text-align: right; font-variant-numeric: tabular-nums; }
.fr-row small { color: var(--muted); font-size: 11px; text-align: right; }

/* 実績バッジ */
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bdg { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px; padding: 10px 4px 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.bdg span { font-size: 26px; line-height: 1.2; }
.bdg b { font-size: 11px; }
.bdg small { font-size: 10px; color: var(--muted); line-height: 1.3; }
.bdg.no { background: var(--soft); }
.bdg.no span { filter: grayscale(1); opacity: .5; }
.bdg:not(.no) { border-color: color-mix(in srgb, #f59e0b 50%, transparent); background: linear-gradient(160deg, color-mix(in srgb, #fde68a 30%, var(--paper)), var(--paper)); }
.badge-banner { background: linear-gradient(135deg, #8b5cf6, #ec4899); box-shadow: 0 10px 24px -10px #ec4899; }
.bdg-ico { width: 40px; height: 40px; display: grid; place-items: center; font-size: 24px; background: rgb(255 255 255 / .3); border-radius: 50%; }

/* タイムアタック */
.ta-entry { border-color: #f59e0b; }
.ta-entry .nuki-prog { color: #b45309; }
.ta-time { position: relative; height: 26px; border-radius: 99px; background: var(--track); overflow: hidden; margin: 6px 0 14px; }
.ta-time span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #f97316, #f59e0b); border-radius: 99px; transition: width .2s linear; }
.ta-time b { position: relative; display: block; text-align: center; line-height: 26px; font-size: 15px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.qt-count b { color: var(--accent-text); font-size: 18px; }

/* プリントタブの目次（分野ごと） */
nav.lv-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
nav.lv-jump a { flex: 1 1 auto; text-align: center; padding: 6px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; text-decoration: none; color: color-mix(in srgb, var(--fc) 62%, var(--ink)); background: color-mix(in srgb, var(--fc) 12%, var(--paper)); border: 1px solid color-mix(in srgb, var(--fc) 35%, transparent); }

/* 練習モードのタイル（ホーム） */
.modes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.mode-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 10px 12px; text-align: left; background: var(--paper); border: 2px solid color-mix(in srgb, var(--mc) 45%, transparent); border-radius: 16px; box-shadow: 0 3px 0 color-mix(in srgb, var(--mc) 30%, transparent); }
.mode-tile:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--mc) 30%, transparent); }
.mt-ico { font-size: 28px; line-height: 1; grid-row: span 2; }
.mode-tile b { font-size: 14px; line-height: 1.3; align-self: end; }
.mode-tile small { font-size: 11px; color: color-mix(in srgb, var(--mc) 55%, var(--ink)); font-weight: 700; align-self: start; }
/* まちがえやすいペア */
.pair-card .qtext { font-size: 18px; }
.pair-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.pair-btn { justify-content: center; text-align: center; font-size: 18px; font-weight: 900; padding: 18px 8px; }
.pair-tbl { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.pair-tbl th { white-space: nowrap; text-align: left; vertical-align: top; padding: 6px 10px 6px 0; color: var(--accent-text); }
.pair-tbl td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pair-tbl tr:last-child td { border-bottom: 0; }
.pair-review { margin-top: 10px; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 14px; box-shadow: var(--shadow); }
.pair-review.ok { border-left-color: var(--ok); }
.pair-review .fb-e { margin-top: 6px; }

/* 単元ステージの星 */
.stars { display: inline-flex; gap: 1px; color: color-mix(in srgb, var(--muted) 35%, transparent); font-style: normal; line-height: 1; }
.stars i { font-style: normal; font-size: 18px; }
.stars i.on { color: #f59e0b; text-shadow: 0 1px 0 rgba(180, 83, 9, .35); }
.stars.sm i { font-size: 12px; }
.stars.lg i { font-size: 40px; }
.stars.lg i.on { animation: star-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.stars.lg i:nth-child(2) { animation-delay: .15s; }
.stars.lg i:nth-child(3) { animation-delay: .3s; }
@keyframes star-pop { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
.stage-btn { display: flex; align-items: center; gap: 10px; width: 100%; margin: 4px 0 12px; padding: 12px 14px; text-align: left; background: color-mix(in srgb, var(--fc) 10%, var(--paper)); border: 2px solid color-mix(in srgb, var(--fc) 50%, transparent); border-radius: 16px; box-shadow: 0 3px 0 color-mix(in srgb, var(--fc) 30%, transparent); }
.stage-btn .ico { font-size: 26px; }
.stage-btn .sb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stage-btn small { color: var(--muted); font-size: 11px; }
.stage-result { margin-top: 8px; }
.stage-result p { margin: 4px 0 0; font-weight: 700; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .stars.lg i.on { animation: none; } }

/* おやつ */
.snack-card .mini-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.snack-card .mini-h small { font-size: 12px; margin: 0; }
.snack-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
.snack-btn { display: flex; flex-direction: column; align-items: center; min-width: 56px; padding: 6px 8px 4px; background: var(--soft); border: 2px solid var(--line); border-radius: 14px; }
.snack-btn span { font-size: 28px; line-height: 1.1; }
.snack-btn small { font-size: 11px; font-weight: 700; color: var(--muted); }
.snack-btn:disabled { opacity: .45; }
.snack-btn:not(:disabled):active { transform: scale(.94); }
.si-btns { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pt-fig, .shop-fig { position: relative; }
.snack-pop { position: absolute; left: 50%; top: 52%; font-size: 30px; transform: translate(-50%, 0); animation: snack-eat 1.1s ease-in forwards; pointer-events: none; }
@keyframes snack-eat { 0% { transform: translate(-50%, -60px) scale(1); opacity: 1; } 60% { transform: translate(-50%, 0) scale(.8); opacity: 1; } 100% { transform: translate(-50%, 4px) scale(0); opacity: 0; } }
.munch { animation: munch .25s ease-in-out infinite alternate; transform-origin: 50px 72px; transform-box: view-box; }
@keyframes munch { from { transform: scaleY(1); } to { transform: scaleY(.45); } }
@media (prefers-reduced-motion: reduce) { .snack-pop, .munch { animation: none; } .snack-pop { display: none; } }

/* 設定 */
.top-pills { align-items: center; }
.top-gear { width: 30px; height: 30px; font-size: 15px; }
.set-card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-top: 12px; }
.set-card .btn + .btn { margin-top: 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; font-weight: 700; padding: 4px 0; }
.set-item { margin-top: 14px; font-weight: 700; }
.set-item .seg { margin: 8px 0 4px; }
.set-seg[data-set="goal"] { grid-template-columns: repeat(4, 1fr); }
.switch { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--track); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.bk-text { width: 100%; font: 12px/1.4 ui-monospace, monospace; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: var(--ink); word-break: break-all; resize: vertical; }
/* 文字の大きさ（画面全体を拡大） */
:root[data-fs="l"] #view { zoom: 1.1; }
:root[data-fs="xl"] #view { zoom: 1.22; }

/* 読み上げボタン */
.qcard { position: relative; }
.tts-btn { position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--soft); font-size: 16px; line-height: 1; box-shadow: 0 2px 0 var(--line); }
.tts-btn:active { transform: translateY(1px); box-shadow: none; }
.qcard:has(.tts-btn) .qtext { padding-right: 36px; }
.set-row .set-sub { display: block; font-weight: 400; font-size: 12px; margin: 2px 0 0; }
.set-row + .set-row { margin-top: 10px; }

/* 今日の復習 */
.review-banner { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 12px 16px; text-align: left; color: #fff; border: 0; border-radius: var(--radius); background: linear-gradient(135deg, #0ea5e9, #6366f1); box-shadow: 0 4px 0 #4338ca, var(--shadow); }
.review-banner:active { transform: translateY(2px); box-shadow: 0 2px 0 #4338ca; }
.rv-ico { font-size: 30px; }
.rv-body { flex: 1; display: flex; flex-direction: column; }
.rv-body b { font-size: 17px; font-weight: 900; }
.rv-body small { opacity: .9; font-size: 12px; }
.rv-n { background: rgba(255, 255, 255, .22); padding: 4px 12px; border-radius: 99px; font-weight: 900; }

/* 学習レポート */
.report { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.report h3 { font-size: 15px; font-weight: 900; margin: 18px 0 6px; padding-left: 8px; border-left: 4px solid var(--accent); }
.rp-head h2 { margin: 0; font-size: 18px; }
.rp-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.rp-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.rp-sum div { background: var(--soft); border-radius: 12px; padding: 8px 4px; text-align: center; display: flex; flex-direction: column; }
.rp-sum b { font-size: 20px; font-weight: 900; }
.rp-sum b i { font-size: 11px; font-style: normal; color: var(--muted); }
.rp-sum small { font-size: 10px; color: var(--muted); line-height: 1.3; }
.rp-advice { background: color-mix(in srgb, var(--accent) 8%, var(--paper)); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 12px 0 0; }
.rp-week th, .rp-week td { padding: 3px 8px; font-size: 12px; text-align: left; }
.rp-week th { white-space: nowrap; font-weight: 400; width: 1%; }
.rp-bar { display: inline-block; height: 10px; border-radius: 99px; background: var(--accent); margin-right: 6px; vertical-align: middle; max-width: 70%; }
.rp-untouched, .rp-foot { font-size: 13px; }
.rp-foot { color: var(--muted); margin-top: 16px; }
@media print {
  .topbar, .tabbar, .no-print, #toast, .lv-banner, .gain-float { display: none !important; }
  body { background: #fff !important; }
  #view { padding: 0 !important; zoom: 1 !important; }
  .report { box-shadow: none; padding: 0; }
  .report, .report * { color: #111 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 図で答える問題 */
.zu-fig { display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin: 10px 0 4px; overflow: hidden; }
.zu-fig svg { display: block; width: 100%; height: auto; }
.zu-fig.sm { margin: 0 0 6px; }
.zu-note { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.zm circle { fill: #fff; stroke: #334155; stroke-width: 1.5; }
.zm text { font: 900 11px var(--font); fill: #0f172a; }
.zm.hi circle { fill: #f59e0b; stroke: #b45309; stroke-width: 2; animation: zm-pulse 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.zm.hi text { fill: #fff; }
.zl { stroke: #64748b; stroke-width: 1.2; }
@keyframes zm-pulse { 50% { transform: scale(1.18); } }
.zu-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.zu-card { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 8px 10px; background: var(--paper); border: 0; border-top: 4px solid var(--fc); border-radius: 16px; box-shadow: var(--shadow); text-align: left; }
.zu-card b { font-size: 14px; }
.zu-card small { color: var(--muted); font-size: 11px; }
.qlist .zu-fig.sm { max-width: 240px; }
@media (prefers-reduced-motion: reduce) { .zm.hi circle { animation: none; } }

/* ホームの整理 */
.modes-grid .mode-tile:last-child:nth-child(odd) { grid-column: span 2; }
.missions summary { cursor: pointer; list-style: none; }
.missions summary::-webkit-details-marker { display: none; }
.missions summary::after { content: '▾'; margin-left: auto; color: var(--muted); transition: transform .2s; }
.missions:not([open]) summary::after { transform: rotate(-90deg); }
.missions:not([open]) .mini-h { margin: 0; }
.ms-count { font-size: 12px; color: var(--accent-text); background: var(--soft); padding: 1px 8px; border-radius: 99px; }

/* 単元メニュー：関係する練習 */
.rel-h { margin: 14px 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.rel { display: flex; flex-wrap: wrap; gap: 6px; }
.rel-btn { border: 1px solid var(--line); background: var(--soft); color: var(--ink); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.rel-btn:active { transform: scale(.97); }

/* 記述問題 */
.kj-label { display: block; margin: 14px 2px 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.kj-text { width: 100%; font: 16px/1.6 var(--font); padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); resize: vertical; margin-bottom: 12px; }
.kj-text:focus { outline: none; border-color: var(--accent); }
.kj-fb { border-color: #7c3aed; }
.kj-model { font-size: 16px; font-weight: 700; margin: 4px 0 8px; padding: 8px 12px; background: color-mix(in srgb, #7c3aed 10%, var(--paper)); border-radius: 10px; }
.kj-sub { font-size: 12px; color: var(--muted); margin: 6px 0 4px; }
.kj-sub.center { text-align: center; margin-top: 12px; }
.kj-keys { display: flex; flex-wrap: wrap; gap: 6px; }
.kj-key { border: 2px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 700; }
.kj-key.on { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.kj-warn { color: var(--warn); font-size: 13px; font-weight: 700; margin: 8px 0 0; }

/* 今日のおすすめ単元 */
.reco { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 10px; padding: 10px 14px; text-align: left; background: var(--paper); border: 0; border-left: 5px solid var(--fc); border-radius: 16px; box-shadow: var(--shadow); color: var(--ink); }
.reco-ico { font-size: 30px; }
.reco-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.reco-body b { font-size: 15px; }
.reco-body small { font-size: 11px; color: var(--muted); }
.reco-body small:first-child { color: color-mix(in srgb, var(--fc) 62%, var(--ink)); font-weight: 700; }
.reco-go { font-size: 26px; color: var(--muted); }

/* 用語さがし */
.search-in { width: 100%; font: 16px var(--font); padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); margin: 6px 0 10px; }
.search-in:focus { outline: none; border-color: var(--accent); }
.s-unit { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.qlist mark { background: #fde68a; color: #1f2937; border-radius: 3px; padding: 0 1px; }
.top-pills .icon-btn + .icon-btn { margin-left: -2px; }
/* せまい画面（360px など）では上のバーを小さく */
@media (max-width: 400px) {
  .brand { font-size: 18px !important; letter-spacing: 0; }
  .top-pills { gap: 4px; }
  .top-pills .pill { padding: 3px 7px; font-size: 12px; }
  .top-gear { width: 28px; height: 28px; font-size: 14px; }
}

/* 苦手タブ */
.w-seg { grid-template-columns: 1fr 1fr; }
.w-unit-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.w-unit-h .sec-h { margin-bottom: 8px; }
.w-unit-h .btn.small { flex: none; margin-top: 16px; }
.w-count { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--ng); background: var(--ng-bg); border-radius: 99px; padding: 1px 8px; }

/* 要点まとめ */
.points { background: color-mix(in srgb, #f59e0b 9%, var(--paper)); border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent); border-radius: var(--radius); padding: 12px 14px 10px; margin: 8px 0 12px; }
.points h3 { margin: 0 0 6px; font-size: 15px; }
.points ul { margin: 0; padding-left: 1.2em; }
.points li { font-size: 14px; line-height: 1.6; margin-bottom: 4px; }

/* ステージマップ */
.sm-link { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 16px; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; font-weight: 700; color: var(--ink); box-shadow: var(--shadow); }
.sm-link b { margin-left: auto; color: color-mix(in srgb, #f59e0b 50%, var(--ink)); }
.sm-link span { color: var(--muted); font-size: 20px; }
.sm-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.sm-total b { font-size: 30px; font-weight: 900; color: color-mix(in srgb, #f59e0b 50%, var(--ink)); }
.sm-total .bar { flex-basis: 100%; }
.sm-total .bar span { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.sm-f { margin-left: auto; font-size: 12px; color: var(--muted); }
.sm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sm-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; color: var(--ink); min-width: 0; }
.sm-cell.full { border-color: #f59e0b; background: color-mix(in srgb, #fbbf24 12%, var(--paper)); }
.sm-ico { font-size: 22px; }
.sm-name { font-size: 11px; font-weight: 700; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.sm-name i { display: block; font-style: normal; font-size: 9px; color: color-mix(in srgb, #ea580c 60%, var(--ink)); }

/* 使い方ガイド */
.guide { display: flex; flex-direction: column; gap: 8px; }
.g-item { display: flex; gap: 12px; align-items: flex-start; background: var(--paper); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; }
.g-ico { font-size: 26px; line-height: 1; width: 34px; flex: none; text-align: center; }
.g-item b { font-size: 15px; }
.g-item p { margin: 4px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }

/* バックアップのお知らせ */
.bk-notice { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 10px 12px; background: var(--paper); border: 1px dashed var(--accent); border-radius: 14px; font-size: 13px; font-weight: 700; }
.bk-notice span { flex: 1; display: flex; flex-direction: column; }
.bk-notice small { font-weight: 400; color: var(--muted); font-size: 11px; }

/* 季節のイベント */
.event { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 10px 14px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, #f97316 14%, var(--paper)), color-mix(in srgb, #a855f7 12%, var(--paper))); border: 1px solid color-mix(in srgb, #f97316 30%, transparent); }
.ev-ico { font-size: 30px; line-height: 1.1; }
.ev-body { flex: 1; min-width: 0; }
.ev-body b { font-size: 14px; }
.ev-body p { margin: 2px 0 6px; font-size: 13px; line-height: 1.55; }
.ev-body small { font-size: 11px; color: var(--muted); font-weight: 700; }

/* 実力テスト */
.exam-res { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; margin-top: 12px; }
.exam-res h3 { font-size: 15px; margin: 4px 0 8px; }
.th-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 16px; }
.th-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.th-b { width: 70%; background: var(--accent-grad); border-radius: 6px 6px 0 0; min-height: 2px; }
.th-v { font-size: 11px; font-weight: 700; }
.th-l { font-size: 10px; color: var(--muted); margin-top: 2px; }

.center-t { text-align: center; }
.rp-time { font-size: 13px; margin: 8px 0 0; }
.btn.warn small { opacity: 1; color: #fff; }

/* 問題を知らせる印 */
.flag-btn { display: block; margin: 8px 0 0 auto; border: 0; background: none; color: var(--muted); font-size: 12px; padding: 4px 0; }
.flag-btn.on { color: var(--ng); font-weight: 700; }

/* 今週のチャレンジ */
.weekly { display: grid; grid-template-columns: 1fr auto 88px; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.weekly .bar { height: 7px; }
.weekly .bar span { background: linear-gradient(90deg, #f59e0b, #f97316); }
.weekly .btn.small { padding: 4px 6px; font-size: 12px; }

/* 分野のしぼりこみ */
.f-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 4px; }
.f-chips button { border: 1px solid color-mix(in srgb, var(--fc) 40%, transparent); background: var(--paper); color: color-mix(in srgb, var(--fc) 62%, var(--ink)); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 700; }
.f-chips button small { margin-left: 4px; font-size: 10px; }
.f-chips button.on { background: color-mix(in srgb, var(--fc) 65%, #000); border-color: transparent; color: #fff; }
.g-chips { margin-top: 2px; }
.g-chips button { padding: 4px 10px; font-size: 12px; }

/* 授業用プリントのメニュー */
.pc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.pc-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 12px; text-align: left; background: var(--paper); border: 0; border-top: 5px solid var(--fc); border-radius: 16px; box-shadow: var(--shadow); color: var(--ink); min-width: 0; }
.pc-card:active { transform: translateY(1px); }
.pc-ico { font-size: 28px; line-height: 1.2; }
.pc-card b { font-size: 14px; line-height: 1.35; }
.pc-card small { font-size: 11px; color: var(--muted); }

/* ホームの区切り（アプリで練習・あそぶ・単元） */
.home-sec { display: flex; align-items: center; gap: 8px; margin: 26px 0 4px; font-size: 17px; font-weight: 900; color: var(--ink); }
.home-sec span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--soft); font-size: 18px; }
.home-sec::after { content: ''; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.home-sec + .review-banner, .home-sec + .quick, .home-sec + .boss-banner, .home-sec + .summary { margin-top: 10px; }

.pc-grid .pc-card:last-child:nth-child(odd) { grid-column: span 2; }
.prints.pdf-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.prints.pdf-list .p-btns { grid-column: auto; display: flex; margin: 0; }
.prints.pdf-list .p-btns a.btn.primary { color: #fff; }
.prints.pdf-list .p-btns .btn { white-space: nowrap; padding: 6px 12px; }

/* ===================== Android アプリ版（js/ads.js） ===================== */
/* アプリ版には PDF を入れないので「授業プリント」タブを出さない */
.native-app .tabbar { grid-template-columns: repeat(4, 1fr); }
.native-app .tabbar button[data-tab="print"] { display: none; }
/* ホームの下にバナー広告が出ている間は、タブと画面をその高さだけ上げる */
body.has-ad .tabbar { bottom: var(--ad-h, 0px); padding-bottom: 0; }
body.has-ad #view { padding-bottom: calc(96px + var(--ad-h, 0px)); }
