:root { color-scheme: light dark; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif; color: #263044; background: #f5f1e8; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; line-height: 1.75; }
button, input { font: inherit; }
.lab { max-width: 880px; margin: 0 auto; padding: 22px; }
header { margin-bottom: 14px; }
.eyebrow { margin: 0 0 5px; color: #a34b2d; font-size: 12px; font-weight: 800; letter-spacing: .13em; }
h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); }
header > p { margin: 8px 0 0; color: #606b7d; }
.standalone-link { display: inline-flex; min-height: 44px; align-items: center; margin-top: 12px; padding: 8px 16px; border: 2px solid #a34b2d; border-radius: 9px; background: #a34b2d; color: #fff; font-weight: 800; text-decoration: none; }
.standalone-link:hover { background: #8d3e23; border-color: #8d3e23; }
.standalone-link:focus-visible { outline: 3px solid rgba(49,87,183,.4); outline-offset: 2px; }
.standalone-link[hidden] { display: none; }

.en { font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; }

/* タブ */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 2px solid #ddd8ce; }
.tab { min-height: 44px; padding: 8px 15px; border: 0; border-bottom: 3px solid transparent; border-radius: 9px 9px 0 0; background: none; color: #606b7d; cursor: pointer; font-weight: 800; }
.tab:hover { color: #263044; }
.tab[aria-selected="true"] { color: #a34b2d; border-bottom-color: #a34b2d; }
.tab:focus-visible { outline: 3px solid rgba(49,87,183,.3); outline-offset: 2px; }

.lead { margin: 0 0 20px; padding: 13px 15px; border: 1px solid #ddd8ce; border-radius: 12px; background: #fff; font-size: 14px; color: #55617a; }

.sec { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 26px 0 11px; font-size: clamp(17px, 2.4vw, 21px); }
.badge { flex: none; padding: 3px 9px; border-radius: 6px; background: #a34b2d; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.source { color: #8b93a4; font-size: 12px; font-weight: 400; }

.card { margin-bottom: 14px; padding: 17px; border: 1px solid #ddd8ce; border-radius: 13px; background: #fff; box-shadow: 0 8px 24px rgba(40,35,25,.06); }

/* 文法まとめ */
.kihon { margin-bottom: 14px; padding: 13px 15px; border-radius: 10px; background: #fff7e7; border: 1px solid #e8d5ab; }
.kihon-label { display: block; margin-bottom: 4px; color: #97702a; font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.kihon-en { font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 18px; line-height: 1.6; }
.kihon-en b { color: #a34b2d; }
.kihon-ja { margin-top: 3px; color: #606b7d; font-size: 14px; }

.points { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.points li { display: grid; grid-template-columns: auto 1fr; gap: 9px; align-items: start; font-size: 14.5px; }
.points li::before { content: "●"; color: #a34b2d; font-size: 9px; line-height: 2.3; }
code { padding: 1px 6px; border-radius: 5px; background: #e8eefc; color: #2c4c9b; font-family: "Lexend", ui-monospace, monospace; font-size: 13.5px; }

.table-scroll { overflow-x: auto; margin-top: 12px; }
.chart { width: 100%; border-collapse: collapse; font-size: 14px; }
.chart th, .chart td { padding: 8px 10px; border-bottom: 1px solid #e4e0d7; text-align: left; }
.chart th { color: #687386; font-size: 12.5px; }
.chart td:first-child { color: #a34b2d; white-space: nowrap; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 13px; }
.compare-box { padding: 12px 13px; border-radius: 10px; font-size: 13.5px; }
.compare-a { background: #e8eefc; }
.compare-b { background: #e2f3ea; }
.compare-tag { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 800; }
.compare-a .compare-tag { color: #2c4c9b; }
.compare-b .compare-tag { color: #176c4a; }
.compare-en { font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 15px; }
.compare-note { color: #55617a; }

.warn { margin-top: 13px; padding: 11px 14px; border-left: 4px solid #d26745; border-radius: 0 10px 10px 0; background: #fff4ed; font-size: 14px; }
.warn-tag { display: block; color: #a34024; font-size: 12.5px; font-weight: 800; }

/* 練習問題（1問ずつ） */
.drill-top { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.drill-count { flex: none; color: #606b7d; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.question-card { padding: 20px 18px 18px; }
.q-label { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.q-kind { color: #8b93a4; font-size: 13px; }
.q-ja { margin: 0 0 18px; font-size: 19px; font-weight: 700; line-height: 1.7; }

.answer-area { display: grid; gap: 12px; }
.sentence { font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 18px; line-height: 2.1; }
.sentence-gap { display: inline-block; min-width: 2.4em; padding: 0 6px; border-bottom: 3px solid #3157b7; color: #3157b7; text-align: center; }
.hint { color: #687386; font-size: 14px; }

/* 選択肢：縦積みの大きなボタン */
.choice-list { display: grid; gap: 10px; }
.choice { min-height: 56px; padding: 14px 18px; border: 2px solid #ccc6b9; border-radius: 12px; background: #fff; color: inherit; cursor: pointer; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 18px; text-align: left; }
.choice:hover:not(:disabled) { border-color: #3157b7; }
.choice:focus-visible { outline: 3px solid rgba(49,87,183,.35); outline-offset: 2px; }
.choice[aria-pressed="true"] { border-color: #3157b7; background: #e8eefc; color: #2c4c9b; font-weight: 700; }
.choice.ok { border-color: #278a64; background: #e2f3ea; color: #176c4a; font-weight: 800; }
.choice.ng { border-color: #d26745; background: #fff4ed; color: #a34024; }

/* 穴うめ */
input.blank { width: 7em; min-height: 48px; padding: 4px 8px; border: 0; border-bottom: 3px solid #3157b7; border-radius: 6px 6px 0 0; background: #f2f5fd; text-align: center; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 18px; color: inherit; }
input.blank-s { width: 4.5em; }
input.blank-l { width: 10em; }
input.blank:focus { outline: none; background: #e8eefc; }
input.full { display: block; width: 100%; min-height: 56px; padding: 14px 16px; border: 2px solid #ccc6b9; border-radius: 12px; background: #fff; font-size: 17px; color: inherit; }
input.full:focus { border-color: #3157b7; outline: 3px solid rgba(49,87,183,.16); }
.area-ok input, .area-ok .order-line { border-color: #278a64; background: #e2f3ea; }
.area-ng input, .area-ng .order-line { border-color: #d26745; background: #fff4ed; }

/* 語句タップ */
.order-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 64px; padding: 12px; border: 2px dashed #ccc6b9; border-radius: 12px; background: #faf8f3; }
.order-placeholder { color: #8b93a4; font-size: 15px; }
.fixed-word { padding: 6px 4px; color: #55617a; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 18px; font-weight: 600; }
.tile-bank { display: flex; flex-wrap: wrap; gap: 10px; }
.tile { min-height: 52px; padding: 12px 18px; border: 2px solid #ccc6b9; border-radius: 12px; background: #fff; color: inherit; cursor: pointer; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 18px; box-shadow: 0 2px 0 #ddd8ce; }
.tile:hover:not(:disabled) { border-color: #3157b7; }
.tile:focus-visible { outline: 3px solid rgba(49,87,183,.35); outline-offset: 2px; }
.tile-used { visibility: hidden; }
.tile-placed { min-height: 44px; padding: 8px 14px; border-color: #3157b7; background: #e8eefc; color: #2c4c9b; font-weight: 600; box-shadow: none; }

/* フィードバック */
.feedback { display: none; margin-top: 16px; padding: 14px 16px; border-radius: 12px; font-size: 15px; }
.feedback.show { display: grid; gap: 6px; }
.feedback.right { background: #e2f3ea; color: #176c4a; }
.feedback.wrong { background: #fff4ed; color: #a34024; }
.verdict { font-size: 19px; font-weight: 800; }
.feedback .answer { padding: 8px 12px; border-radius: 8px; background: rgba(255,255,255,.75); color: #263044; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 17px; }
.feedback .note { color: #55617a; font-size: 14px; }

/* 操作ボタン */
.drill-bar { display: grid; gap: 10px; margin-top: 18px; }
.wide { width: 100%; min-height: 56px; font-size: 17px; }
.action:disabled { opacity: .45; cursor: not-allowed; }
.drill-nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-top: 14px; }
.mini-action { min-height: 44px; padding: 8px 14px; border: 1px solid #ccc6b9; border-radius: 9px; background: transparent; color: #606b7d; cursor: pointer; font-size: 14px; font-weight: 700; }
.mini-action:hover:not(:disabled) { border-color: #8b93a4; color: #263044; }
.mini-action:disabled { opacity: .4; cursor: not-allowed; }
.mini-action:focus-visible { outline: 3px solid rgba(49,87,183,.35); outline-offset: 2px; }

/* 練習問題の結果 */
.result-card { text-align: center; padding: 30px 18px; }
.result-label { color: #8b93a4; font-size: 13px; font-weight: 800; letter-spacing: .1em; }
.miss-list { display: grid; gap: 8px; max-width: 460px; margin: 0 auto; text-align: left; }
.miss-row { display: grid; gap: 4px; width: 100%; padding: 12px 14px; border: 1px solid #f0cdbf; border-radius: 10px; background: #fff4ed; color: inherit; cursor: pointer; text-align: left; }
.miss-row:hover { border-color: #d26745; }
.miss-row:focus-visible { outline: 3px solid rgba(49,87,183,.35); outline-offset: 2px; }
.miss-ja { font-size: 14px; }
.miss-en { color: #a34024; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 15px; font-weight: 600; }
/* 単語クイズ */
.quiz { overflow: hidden; border: 1px solid #ddd8ce; border-radius: 13px; background: #fff; box-shadow: 0 8px 24px rgba(40,35,25,.06); }
.quiz-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid #e4e0d7; background: #faf8f3; }
.quiz-count { color: #606b7d; font-size: 13px; font-variant-numeric: tabular-nums; }
.progress { flex: 1 1 120px; min-width: 90px; height: 7px; overflow: hidden; border-radius: 999px; background: #e4e0d7; }
.progress-fill { height: 100%; border-radius: 999px; background: #a34b2d; transition: width .3s ease; }
.quiz-main { padding: 26px 18px 20px; text-align: center; }
.quiz-label { color: #8b93a4; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.quiz-word { margin: 6px 0 2px; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: clamp(26px, 6vw, 34px); word-break: break-word; }
.quiz-word-ja { font-family: inherit; font-size: clamp(22px, 5vw, 28px); font-weight: 800; }
.quiz-pos { margin-bottom: 18px; color: #8b93a4; font-size: 12.5px; }
.quiz-options { display: grid; gap: 9px; max-width: 430px; margin: 0 auto; }
.quiz-option { display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: center; min-height: 48px; padding: 11px 14px; border: 2px solid #ccc6b9; border-radius: 10px; background: #fff; color: inherit; cursor: pointer; text-align: left; font-size: 15px; }
.quiz-key { display: inline-grid; width: 22px; height: 22px; place-items: center; border: 1px solid #ccc6b9; border-radius: 5px; color: #8b93a4; font-size: 11px; }
.quiz-option:hover:not(:disabled) { border-color: #3157b7; }
.quiz-option:focus-visible { outline: 3px solid rgba(49,87,183,.3); outline-offset: 1px; }
.quiz-option:disabled { cursor: default; }
.quiz-option.ok { border-color: #278a64; background: #e2f3ea; color: #176c4a; font-weight: 800; }
.quiz-option.ng { border-color: #d26745; background: #fff4ed; color: #a34024; }
.quiz-feedback { min-height: 26px; margin-top: 15px; font-weight: 800; font-size: 14px; }
.quiz-feedback.right { color: #176c4a; }
.quiz-feedback.wrong { color: #a34024; }
.quiz-bar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; padding: 13px 16px; border-top: 1px solid #e4e0d7; }
.mode-group { display: flex; gap: 4px; padding: 3px; border: 1px solid #ddd8ce; border-radius: 9px; background: #faf8f3; }
.mode { min-height: 38px; padding: 5px 12px; border: 0; border-radius: 7px; background: none; color: #606b7d; cursor: pointer; font-size: 13px; font-weight: 800; }
.mode[aria-pressed="true"] { background: #a34b2d; color: #fff; }
.mode:focus-visible { outline: 3px solid rgba(49,87,183,.3); outline-offset: 1px; }

.quiz-result { padding: 32px 18px; }
.result-score { color: #a34b2d; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; font-size: 48px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result-of { color: #606b7d; font-size: 14px; }
.result-message { margin: 10px 0 18px; font-weight: 800; }
.miss-title { max-width: 430px; margin: 0 auto 7px; color: #687386; font-size: 13px; font-weight: 800; text-align: left; }
.miss-list { display: grid; gap: 5px; max-width: 430px; margin: 0 auto; text-align: left; }
.miss-row { display: grid; grid-template-columns: 1fr auto; gap: 11px; padding: 7px 11px; border-radius: 7px; background: #fff4ed; font-size: 14px; }
.miss-en { color: #a34024; font-family: "Lexend", "Helvetica Neue", Arial, sans-serif; }

@media (max-width: 680px) {
  .lab { padding: 14px 12px 28px; }
  .compare { grid-template-columns: 1fr; }
  .question-card { padding: 16px 14px 14px; }
  .q-ja { font-size: 18px; }
  .tab { flex: 1; padding: 8px 6px; font-size: 14px; text-align: center; }
  .quiz-bar, .drill-nav { gap: 8px; }
  .mode-group { width: 100%; }
  .mode { flex: 1; }
}

/* 指で押しやすいように、細かい操作系は最低44pxを確保する */
@media (pointer: coarse) {
  .tile, .choice, .action, .quiz-option { min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (prefers-color-scheme: dark) {
  :root { color: #edf1f8; background: #111722; }
  header > p, .lead, .kihon-ja, .compare-note, .drill-count, .quiz-count, .result-of, .ghost, .mini-action { color: #b8c1d0; }
  .tabs { border-bottom-color: #404b5e; }
  .tab { color: #b8c1d0; }
  .tab:hover { color: #edf1f8; }
  .tab[aria-selected="true"] { color: #ffad8f; border-bottom-color: #ffad8f; }
  .badge, .primary, .mode[aria-pressed="true"], .progress-fill { background: #b1573a; color: #fff; }
  .standalone-link { border-color: #b1573a; background: #b1573a; color: #fff; }
  .standalone-link:hover { border-color: #c4643f; background: #c4643f; }
  .lead, .card, .quiz, input.full, .choice, .tile, .quiz-option, .ghost { border-color: #4a566b; background: #1d2635; color: #edf1f8; }
  .quiz-top, .mode-group, .order-line, input.blank { border-color: #4a566b; background: #232d3f; }
  .tile { box-shadow: 0 2px 0 #151c27; }
  .kihon { border-color: #5c4a2c; background: #332b1d; }
  .kihon-label { color: #d9b268; }
  .kihon-en b, .result-score { color: #ffad8f; }
  code { background: #26334c; color: #9bb7ff; }
  .chart th, .source, .q-kind, .hint, .quiz-label, .quiz-pos, .miss-title, .result-label, .feedback .note, .order-placeholder, .fixed-word, .quiz-key { color: #97a1b3; }
  .chart th, .chart td, .quiz-top, .quiz-bar { border-color: #404b5e; }
  .compare-a { background: #26334c; }
  .compare-a .compare-tag { color: #9bb7ff; }
  .compare-b { background: #1d3a2e; }
  .compare-b .compare-tag { color: #74d3a5; }
  .warn { border-left-color: #d26745; background: #3b241d; }
  .warn-tag { color: #ffad8f; }
  /* 正誤の色 */
  .feedback.right, .choice.ok { color: #74d3a5; }
  .feedback.right, .choice.ok, .quiz-option.ok, .area-ok input, .area-ok .order-line { background: #1d3a2e; border-color: #3f8a66; }
  .quiz-option.ok { color: #74d3a5; }
  .feedback.wrong, .choice.ng { color: #ffad8f; }
  .feedback.wrong, .choice.ng, .quiz-option.ng, .miss-row, .area-ng input, .area-ng .order-line { background: #3b241d; border-color: #8c4a33; }
  .quiz-option.ng, .miss-en { color: #ffad8f; }
  .feedback .answer { background: rgba(0,0,0,.25); color: #edf1f8; }
  .choice[aria-pressed="true"], .tile-placed { border-color: #6c8ede; background: #26334c; color: #9bb7ff; }
  input.blank { border-bottom-color: #6c8ede; }
  input.blank:focus { background: #26334c; }
  .progress { background: #404b5e; }
  .mini-action { border-color: #4a566b; }
}
