/* 図形の面積・角度クイズ固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }

/* このゲームの色。ダークでは暗い地に明るい線（base.css と同じ切り替え方） */
:root {
  --z-card: #FBFAF6; --z-ink: #1F2328; --z-sub: #5B616B; --z-dot: #C9C4B8; --z-white: #FFFFFF;
  --z-fill: #EEF3F8; --z-side: #DDE6EF; --z-top: #F4F7FA; --z-grid: #B9C6D3; --z-ghost: #8A8F98;
  --z-a: #2F5D8A; --z-b: #B4531A; --z-c: #2E7D4F; --z-q: #B23A3A;
  --z-ta: #CFE0F0; --z-tb: #F6DCC8; --z-tc: #D3EBDC;
  --z-green: #2E7D4F; --z-red: #B23A3A; --z-okbg: #E4F2E9; --z-ngbg: #F8E1E1; --z-slot: #FFF6E3; --z-hint: #B7791F;
  --z-lab: #E3ECF5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --z-card: #2B2D31; --z-ink: #ECEAE4; --z-sub: #A9ADB4; --z-dot: #5A5E66; --z-white: #1C1D20;
    --z-fill: #33404D; --z-side: #2A3541; --z-top: #3B4957; --z-grid: #56677A; --z-ghost: #9AA0A8;
    --z-a: #8DB6DE; --z-b: #E6A070; --z-c: #6CC894; --z-q: #F08A84;
    --z-ta: #2E4A66; --z-tb: #5A3A26; --z-tc: #284A36;
    --z-green: #5BBF85; --z-red: #E88580; --z-okbg: #203A2A; --z-ngbg: #43292A; --z-slot: #3A3226; --z-hint: #BD8828;
    --z-lab: #2A3642;
  }
}
:root[data-theme="dark"] {
  --z-card: #2B2D31; --z-ink: #ECEAE4; --z-sub: #A9ADB4; --z-dot: #5A5E66; --z-white: #1C1D20;
  --z-fill: #33404D; --z-side: #2A3541; --z-top: #3B4957; --z-grid: #56677A; --z-ghost: #9AA0A8;
  --z-a: #8DB6DE; --z-b: #E6A070; --z-c: #6CC894; --z-q: #F08A84;
  --z-ta: #2E4A66; --z-tb: #5A3A26; --z-tc: #284A36;
  --z-green: #5BBF85; --z-red: #E88580; --z-okbg: #203A2A; --z-ngbg: #43292A; --z-slot: #3A3226; --z-hint: #BD8828;
  --z-lab: #2A3642;
}

.board-wrap { min-height: 200px; container-type: inline-size; }

/* ---------- 問題のカード ---------- */
.card {
  background: var(--z-card); color: var(--z-ink); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px 12px; text-align: center; display: flex; flex-direction: column; align-items: center;
}
.prog { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 18px; margin-bottom: 2px; }
.prog i {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--z-dot); background: var(--z-card); font-style: normal;
  font-size: 14px; line-height: 1; font-weight: 700; color: var(--z-white); display: inline-flex; align-items: center; justify-content: center;
}
.prog i.now { border-color: var(--z-a); box-shadow: 0 0 0 2px var(--z-white), 0 0 0 4px var(--z-a); }
.prog i.ok { background: var(--z-green); border-color: var(--z-green); }
.prog i.ng { background: var(--z-red); border-color: var(--z-red); }
.prog i.ok::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--z-white); }
.prog i.ng::after { content: '×'; }

.ask { margin: 2px 0 0; font-size: 18px; font-weight: 700; color: var(--z-ink); line-height: 1.9; }
.ask .kind { display: inline-block; font-size: 14px; border-radius: 999px; padding: 0 10px; margin-right: 6px; line-height: 22px; vertical-align: 1px; color: var(--z-white); background: var(--z-a); font-weight: 700; }
.ask .kind rt { color: var(--z-white); }
.ask rt { font-size: 10px; font-weight: 400; color: var(--z-sub); }

/* ---------- 図 ---------- */
.figwrap { width: 100%; max-width: 440px; margin: 2px auto 0; }
.card.pop .figwrap { animation: pop-in .22s ease-out; }
.fig { width: 100%; height: auto; display: block; overflow: visible; }
.fig .shape { fill: var(--z-fill); stroke: var(--z-ink); stroke-width: 2; stroke-linejoin: round; }
.fig .shape.side { fill: var(--z-side); }
.fig .shape.top { fill: var(--z-top); }
.fig .shape.sq { fill: var(--z-top); }
.fig .shape.ball { fill: var(--z-top); }
.fig .shape.nofill, .fig .edge.nofill { fill: none; }
.fig .edge { stroke: var(--z-ink); stroke-width: 2; fill: none; stroke-linecap: round; }
.fig .aux { stroke: var(--z-ink); stroke-width: 1.6; stroke-dasharray: 6 4; fill: none; }
.fig .aux.a { stroke: var(--z-a); }
.fig .hidden { stroke: var(--z-ink); stroke-width: 1.4; stroke-dasharray: 4 4; fill: none; opacity: .75; }
.fig .grid { stroke: var(--z-grid); stroke-width: 1; }
.fig .tick { stroke: var(--z-ink); stroke-width: 2; }
.fig .rmark { fill: none; stroke: var(--z-ink); stroke-width: 1.4; }
.fig .pt { fill: var(--z-ink); }
.fig .arc { fill: none; stroke: var(--z-ink); stroke-width: 1.6; }
.fig .arc.q { stroke: var(--z-q); stroke-width: 2.4; }
.fig .arcw { fill: none; stroke-width: 2; stroke-dasharray: 3 4; }
.fig .arcthick { fill: none; stroke: var(--z-q); stroke-width: 5; stroke-linecap: round; }
.fig .lab { font-size: 16px; font-weight: 700; fill: var(--z-ink); font-family: var(--font); paint-order: stroke; stroke: var(--z-card); stroke-width: 4px; stroke-linejoin: round; }
.fig .lab.small { font-size: 14px; }
.fig .lab.q { fill: var(--z-q); font-size: 20px; }
.fig .lab.in { font-weight: 700; }
/* 説明の色（式と同じ）。色だけに頼らないよう、線の形も変える: a＝実線、b＝破線、c＝点線 */
.fig .hl { stroke-width: 5; stroke-linecap: round; fill: none; }
.fig .hl.a, .fig .arc.a, .fig .arcw.a { stroke: var(--z-a); }
.fig .hl.b, .fig .arc.b { stroke: var(--z-b); }
.fig .hl.c { stroke: var(--z-c); }
.fig .hl.dash { stroke-dasharray: 9 5; stroke-linecap: butt; }
.fig .hl.dot { stroke-dasharray: 2 5; }
.fig .arc.a, .fig .arc.b { stroke-width: 3; }
.fig .lab.c-a { fill: var(--z-a); }
.fig .lab.c-b { fill: var(--z-b); }
.fig .lab.c-c { fill: var(--z-c); }
.fig .tint.a, .fig .tint0 { fill: var(--z-ta); }
.fig .tint.b { fill: var(--z-tb); }
.fig .tint.c { fill: var(--z-tc); }
.fig .tint { stroke: none; }
.fig .shape.tint { stroke: var(--z-ink); stroke-width: 2; }
.fig .ghost { fill: none; stroke: var(--z-ghost); stroke-width: 1.6; stroke-dasharray: 3 4; }
.fig .ghostl { fill: none; stroke: var(--z-ghost); stroke-width: 1.6; stroke-dasharray: 3 4; }
.fig .lab.ghostt { fill: var(--z-sub); font-weight: 400; }
.figcap { margin: 0; font-size: 14px; color: var(--z-sub); line-height: 1.7; }
.figcap rt { font-size: 10px; }

/* ---------- 答えの欄 ---------- */
.answer { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 2px; flex-wrap: wrap; }
.ansbox {
  min-width: 4.2em; height: 1.5em; padding: 0 .3em; display: inline-flex; align-items: center; justify-content: flex-end; box-sizing: border-box;
  font-size: clamp(28px, 8cqw, 38px); font-weight: 700; font-variant-numeric: tabular-nums; border: 3px dashed var(--z-hint); border-radius: 6px; background: var(--z-slot); color: var(--z-ink);
}
.ansbox.on { border-style: solid; box-shadow: 0 0 0 3px var(--z-white), 0 0 0 5px var(--z-a); }
.ansbox.right { border: 3px solid var(--z-green); background: var(--z-okbg); color: var(--z-green); box-shadow: none; }
.ansbox.wrong { border: 3px solid var(--z-red); background: var(--z-ngbg); color: var(--z-red); box-shadow: none; text-decoration: line-through; text-decoration-thickness: 2px; }
.ansbox .caret { display: inline-block; width: 2px; height: .9em; background: var(--z-a); margin-left: 2px; animation: blink 1s steps(1) infinite; }
.unit { font-size: 24px; font-weight: 700; color: var(--z-ink); }
.fix { font-size: 18px; font-weight: 700; color: var(--z-ink); width: 100%; }
.fix b { color: var(--z-green); font-size: 22px; }
@keyframes blink { 50% { opacity: 0; } }

.verdict { margin: 2px 0 0; font-size: 20px; font-weight: 700; }
.verdict.ok { color: var(--z-green); }
.verdict.ng { color: var(--z-red); }
.verdict .mark { display: inline-block; width: 1.4em; height: 1.4em; line-height: 1.4em; border-radius: 50%; color: var(--z-white); margin-right: 6px; font-size: .85em; vertical-align: 1px; }
.verdict.ok .mark { background: var(--z-green); }
.verdict.ng .mark { background: var(--z-red); }
@keyframes pop-in { from { transform: scale(.96); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 100% { transform: none; } }

/* ---------- 数字のボタン ---------- */
.pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; max-width: 520px; margin: 10px auto 0; }
.key {
  appearance: none; font: inherit; font-size: 28px; font-weight: 700; min-height: 54px; padding: 0; font-variant-numeric: tabular-nums;
  border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; touch-action: manipulation;
}
.key.erase1 { font-size: 18px; color: var(--accent); }
.key.enter { grid-column: 1 / -1; font-size: 20px; background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.key rt { font-size: 10px; }
.key:active:not(:disabled) { transform: translateY(1px); }
.key:disabled { opacity: .4; cursor: not-allowed; }
.key:focus-visible, .opt:focus-visible { outline: 3px solid var(--warn); outline-offset: 2px; }

/* ---------- 4択 ---------- */
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 560px; margin: 10px auto 0; }
.opt {
  appearance: none; font: inherit; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 12px; text-align: left;
  border-radius: var(--radius); border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; touch-action: manipulation;
}
.opt .n { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.opt .t { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.opt:hover:not([aria-disabled="true"]) { border-color: var(--accent); }
.opt:active:not([aria-disabled="true"]) { transform: translateY(1px); }
.opt[aria-disabled="true"] { cursor: default; }
.opt.dim { opacity: .6; }
.opt.ng { border-color: var(--ng); color: var(--ng); }
.opt.ng .n { border-color: var(--ng); background: var(--ng); color: var(--bg); }
.opt.ng .n::before { content: '×'; }
.opt.ng .n span { display: none; }
.opt.ng.shake { animation: shake .35s ease-out; }
.opt.ok { border-color: var(--ok); background: var(--ok); color: var(--bg); }
.opt.ok .n { border-color: var(--bg); color: var(--bg); }
.opt.show { border-color: var(--ok); border-width: 3px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

.next-row { max-width: 560px; margin: 10px auto 0; }
.btn.next { width: 100%; min-height: 52px; font-size: 19px; }

/* ---------- 説明・ヒント ---------- */
.explain {
  margin: 10px auto 0; max-width: 560px; box-sizing: border-box; border-radius: var(--radius); padding: 10px 14px;
  background: var(--z-card); border: 2px solid var(--line); color: var(--z-ink); font-size: 17px; line-height: 2; text-align: left;
}
.explain p { margin: 0 0 4px; }
.explain p:last-child { margin-bottom: 0; }
.explain rt { font-size: 10px; color: var(--z-sub); }
.explain .lab { display: inline-block; font-size: 14px; font-weight: 700; border-radius: 999px; padding: 0 8px; line-height: 22px; background: var(--z-lab); color: var(--z-a); margin-right: 6px; }
.explain .lab rt { color: inherit; }
.explain .alt { font-size: 15px; color: var(--z-sub); }
.explain .note { font-size: 15px; color: var(--z-sub); }
.explain.hintbox { border: 2px dashed var(--z-hint); }
.explain .t { color: var(--z-sub); font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.explain .efig { max-width: 360px; margin: 4px auto; }
.fx { font-weight: 700; font-variant-numeric: tabular-nums; }
.fx .a { color: var(--z-a); text-decoration: underline 3px solid; text-underline-offset: 5px; }
.fx .b { color: var(--z-b); text-decoration: underline 3px dashed; text-underline-offset: 5px; }
.fx .c { color: var(--z-c); text-decoration: underline 3px dotted; text-underline-offset: 5px; }
.fx .ans { color: var(--z-green); font-size: 1.15em; }
.fx rt { text-decoration: none; }

.linkbtn { display: inline-flex; align-items: center; text-decoration: none; }
#furi-btn[aria-pressed="false"] { text-decoration: line-through; text-decoration-thickness: 2px; }
.turnbar .status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; min-width: 64px; text-align: right; margin-left: auto; }
.tag { display: inline-block; white-space: nowrap; font-size: 14px; font-weight: 700; padding: 0 8px; border-radius: 999px; border: 1.5px solid currentColor; margin-left: 6px; vertical-align: middle; color: var(--accent); }
.tag.retry { color: var(--ng); }

/* ---------- 結果 ---------- */
.result-box { position: static; margin: 0 auto; max-width: 560px; }
.result-box .big { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.result-box .weak { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin: 6px 0 10px; text-align: left; }
.result-box .weak span { border-left: 4px solid var(--ng); background: var(--surface); border-radius: 4px; padding: 4px 10px; line-height: 1.9; font-size: 15px; }
.result-box .weak rt { font-size: 10px; }
.callout { z-index: 5; top: 30%; }
.howto img.narrow { max-width: 560px; }
.units .choice span { font-size: 16px; }

@media (max-width: 420px) {
  .stage { padding: 8px; }
  .card { padding: 6px 6px 8px; }
  .ask { font-size: 16px; line-height: 1.8; }
  .key { min-height: 48px; font-size: 25px; }
  .pad { gap: 5px; margin-top: 8px; }
  .opt { min-height: 50px; padding: 4px 8px; gap: 8px; }
  .opt .t { font-size: 19px; }
  .controls .btn.icon { padding: 0 9px; }
  .explain { padding: 8px 10px; font-size: 16px; }
  .unit { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .card.pop .figwrap, .opt.ng.shake { animation: none; }
  .ansbox .caret { animation: none; }
}
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; --tb-rt: 11px; --tb-st-rt: 11px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 1; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
