/* 単位よみ早押し — トップページ（styles.css）と同じトンマナ: 紙色の背景・白い角丸カード・黄色アクセント・Noto Sans JP */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;800;900&display=swap');

:root {
  --paper:#f6f4ef; --white:#fdfcf9; --ink:#252625; --muted:#626560; --yellow:#ffe58d; --mint:#c9e7d8; --blue:#c2e3f4; --pink:#f6c6cb; --line:#e4e3dc; --soft:#eeeae1;
  /* 位の色（千=橙 / 百万=緑 / 十億=青 / 兆=赤）。白地で 4.5:1 以上 */
  --sen:#b9530f; --man:#2f7a4f; --oku:#2c5fa8; --cho:#c22f3f; --yen:#626560;
}
* { box-sizing:border-box; }
html { scroll-behavior:smooth; }
body { margin:0; color:var(--ink); background:var(--paper); font-family:'Noto Sans JP',sans-serif; font-size:1rem; line-height:1.8; -webkit-font-smoothing:antialiased; }
a { color:inherit; text-decoration:none; }
:focus-visible { outline:4px solid #000; outline-offset:2px; border-radius:4px; box-shadow:0 0 0 2px #ffd43d; }
::selection { background:var(--yellow); color:var(--ink); }
.skip-link { position:fixed; top:12px; left:12px; padding:12px 20px; background:var(--yellow); z-index:10; transform:translateY(-180%); }
.skip-link:focus { transform:translateY(0); }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.page-shell { width:min(920px,calc(100% - 64px)); margin:auto; }

/* ヘッダー・フッター（トップと同じ部品） */
.site-header { min-height:110px; display:flex; align-items:center; justify-content:space-between; gap:24px; }
.brand { display:flex; align-items:center; gap:14px; }
.brand-symbol { display:grid; place-items:center; width:54px; height:48px; background:var(--ink); color:var(--white); border-radius:18px; font:900 21px/1 monospace; letter-spacing:-3px; padding-right:3px; transform:rotate(-7deg); }
.brand strong { font-size:1.1875rem; letter-spacing:.04em; font-weight:900; display:block; line-height:1.3; }
.brand small { display:block; margin-top:4px; font-size:.875rem; letter-spacing:.14em; font-weight:700; color:var(--muted); }
.back-home { font-size:.875rem; font-weight:700; letter-spacing:.04em; padding:12px 0; }
.site-footer { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:48px 8px 28px; font-size:.875rem; font-weight:700; letter-spacing:.06em; color:var(--muted); }
@media (hover:hover) { .back-home:hover, .site-footer a:hover { text-decoration:underline; text-underline-offset:5px; } }

/* 見出し・テキスト */
.eyebrow { font-size:.875rem; letter-spacing:.13em; font-weight:800; margin:0 0 12px; color:var(--muted); }
h1 { margin:0 0 20px; font-size:clamp(1.9rem,4.4vw,2.9rem); font-weight:900; line-height:1.5; letter-spacing:.01em; }
.headline-mark { position:relative; z-index:0; white-space:nowrap; }
.headline-mark::after { content:''; position:absolute; bottom:6px; height:14px; background:var(--yellow); left:0; right:0; border-radius:10px; z-index:-1; transform:rotate(-1.5deg); }
h2 { font-size:1.375rem; font-weight:800; letter-spacing:.025em; line-height:1.6; margin:0 0 16px; }
.h2-sub { font-size:.875rem; font-weight:500; color:var(--muted); margin-left:8px; }
.lead { font-size:1rem; line-height:2; color:var(--muted); margin:0 0 8px; max-width:640px; }
.note { font-size:.875rem; line-height:1.9; color:var(--muted); margin:12px 0 0; }

/* パネル（白い角丸カード） */
.panel { background:var(--white); border-radius:28px; padding:44px 44px 36px; }
.block { margin-top:40px; padding-top:32px; border-top:1px solid var(--line); }
.block .eyebrow { margin-bottom:6px; }

/* 数字とカンマ注釈 */
.num { display:inline-block; font-variant-numeric:tabular-nums; font-weight:900; letter-spacing:.01em; line-height:1; padding-bottom:1.25em; white-space:nowrap; }
.comma { position:relative; display:inline-block; }
.comma small { position:absolute; top:100%; left:50%; transform:translateX(-50%); margin-top:.22em; font-size:max(.875rem,.3em); font-weight:700; line-height:1; white-space:nowrap; letter-spacing:0; }
.unit { margin-left:.2em; font-size:.7em; font-weight:800; }
.p-sen { color:var(--sen); } .p-man { color:var(--man); } .p-oku { color:var(--oku); } .p-cho { color:var(--cho); } .p-yen { color:var(--yen); }
.tips { background:var(--soft); border-radius:20px; padding:12px 24px 4px; overflow-x:auto; }
.tip-row { font-size:clamp(1.5rem,4.5vw,2.25rem); padding:12px 0 0; text-align:right; border-bottom:1px dashed #d8d4c8; }
.tip-row:last-child { border-bottom:none; }

/* ボタン共通 */
button { font:inherit; color:inherit; cursor:pointer; -webkit-tap-highlight-color:transparent; }
.pill-button { min-height:52px; padding:8px 9px 8px 25px; display:inline-flex; align-items:center; gap:28px; color:var(--white); background:var(--ink); border:none; border-radius:50px; font-size:.9375rem; font-weight:700; transition:transform .2s; }
.button-icon { display:grid; place-items:center; width:34px; height:34px; border-radius:50%; background:var(--yellow); color:var(--ink); font:1.375rem/1 sans-serif; }
.text-button { background:none; border:none; padding:12px 4px; font-size:.875rem; font-weight:700; color:var(--muted); min-height:44px; }
@media (hover:hover) { .pill-button:hover { transform:translateY(-3px); } .text-button:hover { text-decoration:underline; text-underline-offset:5px; } }

/* 選択カード（モード・単位） */
.choices { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.choices.four { grid-template-columns:repeat(4,1fr); }
.choice { text-align:left; display:flex; flex-direction:column; gap:4px; padding:18px 20px; min-height:44px; background:var(--paper); border:2px solid transparent; border-radius:20px; transition:transform .2s, background .2s; }
.choice.on { background:var(--yellow); }
.choice-name { font-weight:800; font-size:1.0625rem; display:flex; align-items:center; gap:8px; flex-wrap:wrap; line-height:1.4; }
.choice-key { font-size:.875rem; font-weight:500; color:var(--muted); }
.choice-desc { font-size:.875rem; color:var(--muted); line-height:1.6; }
.check { display:inline-grid; place-items:center; width:22px; height:22px; border-radius:50%; border:2px solid var(--ink); font-size:.875rem; font-weight:900; background:var(--white); }
.choice.on .check { background:var(--ink); color:var(--yellow); }
@media (hover:hover) { .choice:hover { transform:translateY(-2px); } }

/* 設定（問題数・表示・制限） */
.setting { display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin:0 0 12px; }
.setting-name { font-weight:700; min-width:5em; font-size:.9375rem; }
.pills { display:flex; gap:8px; flex-wrap:wrap; }
.pill { border:1px solid var(--line); background:var(--white); border-radius:999px; padding:8px 18px; min-height:44px; font-size:.875rem; font-weight:700; }
.pill.on { background:var(--yellow); border-color:var(--yellow); }
.hint-toggle { display:flex; align-items:center; gap:10px; margin:16px 0 0; cursor:pointer; font-size:.9375rem; }
.hint-toggle input { width:20px; height:20px; accent-color:var(--ink); }
.start-foot { display:flex; align-items:center; gap:28px; flex-wrap:wrap; margin-top:40px; padding-top:32px; border-top:1px solid var(--line); }
.start-foot .note { margin:0; }

/* 出題 */
.hud { display:flex; align-items:center; gap:20px; flex-wrap:wrap; font-size:.875rem; font-weight:700; letter-spacing:.04em; color:var(--muted); margin:8px 4px 16px; }
.hud .progress { color:var(--ink); font-size:1rem; }
.hud .time { font-variant-numeric:tabular-nums; margin-left:auto; min-width:4.5em; text-align:right; }
.setting-hud { color:var(--ink); }
.question { padding:36px 40px 32px; }
.label { font-size:.875rem; color:var(--muted); margin:0 0 8px; font-weight:800; letter-spacing:.1em; }
.big { font-size:clamp(1.9rem,7vw,3.75rem); text-align:center; padding:12px 0 4px; overflow-x:auto; }
.big.ja { font-weight:500; font-size:clamp(1.5rem,5vw,2.375rem); padding-bottom:20px; }
.big.ja b { font-weight:900; }
.ask { text-align:center; margin:16px 0 12px; font-weight:800; }
.options { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.opt { display:flex; align-items:center; gap:12px; min-height:60px; font-size:1.125rem; font-weight:800; font-variant-numeric:tabular-nums; text-align:left; padding:12px 20px; background:var(--paper); border:2px solid transparent; border-radius:18px; transition:transform .2s; }
.opt kbd { font:inherit; font-size:.875rem; font-weight:700; color:var(--muted); background:var(--white); border-radius:8px; width:28px; height:28px; display:grid; place-items:center; flex:none; }
@media (hover:hover) { .opt:not(:disabled):hover { transform:translateY(-2px); } }
.opt.right { background:var(--mint); }
.opt.right::after { content:'◯ 正解'; margin-left:auto; font-size:.875rem; }
.opt.wrong { background:var(--pink); }
.opt.wrong::after { content:'✕'; margin-left:auto; font-size:.875rem; }
.opt:disabled { cursor:default; }
.opt:disabled:not(.right):not(.wrong) { opacity:.5; }
.pair { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.pair-card { flex-direction:column; align-items:stretch; padding:20px; min-height:140px; }
.pair-card .num { font-size:clamp(1.25rem,4vw,2.125rem); align-self:center; }
.pair-card .label { margin-bottom:12px; }
.pair-card.right::after, .pair-card.wrong::after { margin:8px auto 0; }
.flashed { visibility:hidden; }
.is-flashed { position:relative; }
.is-flashed::after { content:'？'; position:absolute; inset:0; display:grid; place-items:center; color:var(--muted); font-weight:900; font-size:1em; pointer-events:none; }
.big.ja.is-flashed::after { content:'約 ？'; }

.feedback { margin-top:16px; min-height:8px; }
.feedback.ok, .feedback.ng { border-radius:24px; padding:24px 28px; background:var(--mint); display:grid; grid-template-columns:1fr auto; gap:8px 24px; align-items:center; }
.feedback.ng { background:var(--pink); }
.verdict { margin:0; font-weight:900; font-size:1.25rem; grid-column:1; }
.verdict .sub { font-size:.875rem; color:var(--muted); font-weight:700; margin-left:12px; }
.explain { margin:0; font-variant-numeric:tabular-nums; line-height:1.9; grid-column:1; }
.feedback .pill-button { grid-column:2; grid-row:1 / span 2; }

/* 結果 */
.result-head { display:flex; align-items:center; gap:28px; padding:32px 36px; margin-bottom:16px; }
.rank { flex:0 0 96px; height:96px; display:grid; place-items:center; font-size:3.25rem; font-weight:900; border-radius:28px; background:var(--soft); }
.rank-S { background:var(--yellow); } .rank-A { background:var(--mint); } .rank-B { background:var(--blue); } .rank-C { background:var(--pink); }
.score { margin:0 0 4px; font-weight:800; font-size:1.0625rem; }
.msg { margin:0; color:var(--muted); font-size:.9375rem; }
.status { display:inline-block; padding:3px 12px; border-radius:20px; background:var(--yellow); color:var(--ink); font-size:.875rem; font-weight:700; }
.table-wrap { padding:8px 16px; overflow-x:auto; }
.result-table { width:100%; border-collapse:collapse; font-size:.875rem; }
.result-table th, .result-table td { padding:10px 12px; text-align:left; border-bottom:1px solid var(--line); font-variant-numeric:tabular-nums; }
.result-table tbody tr:last-child td { border-bottom:none; }
.result-table th { font-weight:800; color:var(--muted); letter-spacing:.06em; }
.result-table tr.ng td:nth-child(4) { color:#a3232f; font-weight:700; }
.result-table .num-cell { text-align:right; }
.result-table td { white-space:nowrap; }
.actions { display:flex; gap:20px; align-items:center; flex-wrap:wrap; margin-top:24px; }

@media (max-width:1000px) { .page-shell { width:calc(100% - 40px); } .panel { padding:32px 28px 28px; } .choices, .choices.four { grid-template-columns:repeat(2,1fr); } }
@media (max-width:700px) {
  .page-shell { width:calc(100% - 28px); }
  .site-header { min-height:90px; } .brand-symbol { width:40px; height:38px; font-size:1rem; border-radius:12px; } .brand strong { font-size:.9375rem; } .brand small { display:none; }
  .panel { padding:28px 20px 24px; border-radius:24px; } .question { padding:24px 18px 20px; }
  .choices, .choices.four, .options, .pair { grid-template-columns:1fr; }
  .feedback.ok, .feedback.ng { grid-template-columns:1fr; } .feedback .pill-button { grid-column:1; grid-row:auto; justify-self:start; }
  .result-head { gap:16px; padding:24px 20px; } .rank { flex-basis:72px; height:72px; font-size:2.5rem; border-radius:20px; }
  }
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } * { transition:none!important; } }
