/* 一列の縦並び。PC・タブレット・スマホで並びを変えず、幅だけが変わる */
/* 色・文字はすべてここの変数から使う（ダークモードも同じ変数を差し替えるだけ） */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --fg: #1a1f2c;
  --muted: #5a6274;
  --line: #d9dee8;
  --accent: #27467f;
  --accent-fg: #ffffff;
  --accent-soft: #e6ecf7;
  --ok: #1d7047;
  --ok-bg: #e3f3ea;
  --ng: #b0281f;
  --ng-bg: #fbe8e6;
  --star: #b87d00;
  --font-ui: "Noto Sans JP", "Noto Sans TC", "Hiragino Sans", "Yu Gothic UI", "Microsoft JhengHei", system-ui, sans-serif;
  --font-question: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11141b;
    --surface: #1a1f2a;
    --fg: #e7e9ef;
    --muted: #9aa1b2;
    --line: #2f3646;
    --accent: #9db4e8;
    --accent-fg: #10162a;
    --accent-soft: #1f2a40;
    --ok: #74d3a0;
    --ok-bg: #15301f;
    --ng: #f2958c;
    --ng-bg: #3a1c1a;
    --star: #f0bf4c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11141b;
  --surface: #1a1f2a;
  --fg: #e7e9ef;
  --muted: #9aa1b2;
  --line: #2f3646;
  --accent: #9db4e8;
  --accent-fg: #10162a;
  --accent-soft: #1f2a40;
  --ok: #74d3a0;
  --ok-bg: #15301f;
  --ng: #f2958c;
  --ng-bg: #3a1c1a;
  --star: #f0bf4c;
  color-scheme: dark;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.7;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ヘッダー */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px;
}
.site-name { font-weight: 700; letter-spacing: 0.02em; color: var(--fg); text-decoration: none; }

main.wrap { padding-block: 28px 48px; }
.screen { display: grid; gap: 20px; }

h1 { margin: 0; font-size: 1.5rem; line-height: 1.3; text-wrap: balance; }
h2 { margin: 0; font-size: 1rem; }

.stack { display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > .btn { flex: 1 1 140px; }

/* ボタン・リンク */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 48px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { color: var(--accent-fg); background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.link {
  appearance: none;
  justify-self: start;
  padding: 0;
  font: inherit;
  text-align: left;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* 入力欄 */
.field { display: grid; gap: 6px; }
.field > span { font-size: 0.875rem; font-weight: 700; color: var(--muted); }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.lang select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 0.875rem; }
.note { margin: 0; font-size: 0.875rem; color: var(--muted); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 指示・問題 */
.instruction { margin: 0; font-size: 0.9375rem; font-weight: 700; color: var(--muted); }
.question {
  padding: 20px;
  font-family: var(--font-question);
  font-size: 1.375rem;
  line-height: 1.8;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.question u { text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* 選択肢 */
.choices { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  font: inherit;
  font-size: 1.0625rem;
  text-align: left;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
button.choice { cursor: pointer; }
button.choice:hover { background: var(--accent-soft); border-color: var(--accent); }
.letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.choice-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tag { flex: none; padding: 2px 8px; font-size: 0.75rem; font-weight: 700; border-radius: 999px; }
.tag-answer { color: var(--surface); background: var(--ok); }
.tag-yours { color: var(--fg); border: 1px solid currentColor; }
.choice.is-answer { background: var(--ok-bg); border-color: var(--ok); }
.choice.is-answer .letter { color: var(--ok); }
.choice.is-wrong { background: var(--ng-bg); border-color: var(--ng); }
.choice.is-wrong .letter { color: var(--ng); }

/* 答え合わせ */
.result { margin: 0; padding: 10px 16px; font-size: 1.25rem; font-weight: 700; border-radius: var(--radius); }
.result.is-ok { color: var(--ok); background: var(--ok-bg); }
.result.is-ng { color: var(--ng); background: var(--ng-bg); }

.explain { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.explain-body { line-height: 1.8; overflow-wrap: anywhere; }
.explain-body p { margin: 0; }

.save {
  appearance: none;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.save .star { font-size: 1.25rem; line-height: 1; color: var(--muted); }
.save[aria-pressed="true"] { border-color: var(--star); }
.save[aria-pressed="true"] .star { color: var(--star); }

/* 未ローンチ */
.soon {
  margin: 0;
  padding: 24px;
  font-size: 1.125rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* ---- 本番ページで足した部品 ---- */

h3 { margin: 0; font-size: 0.9375rem; }
p { margin: 0; }
.links { display: flex; flex-wrap: wrap; gap: 12px 20px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
small.note { font-weight: 400; }

.msg { margin: 0; white-space: pre-line; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--fg); }
.msg-error { color: var(--ng); background: var(--ng-bg); }
.msg-info { color: var(--fg); background: var(--accent-soft); }

.question-small { padding: 14px; font-size: 1.0625rem; }
.tutor-question { display: grid; gap: 8px; }

.chat { display: grid; gap: 10px; }
.bubble {
  max-width: 88%;
  padding: 10px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.bubble-user { justify-self: end; background: var(--accent-soft); border-color: transparent; }
.bubble-assistant { justify-self: start; background: var(--surface); }
.bubble.is-waiting { color: var(--muted); }

.panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel .btn { justify-self: start; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.badge-paid { color: var(--star); border-color: var(--star); }

.analysis-item { border-top: 1px solid var(--line); padding-top: 10px; }
.analysis-item summary { cursor: pointer; font-weight: 700; font-variant-numeric: tabular-nums; }
.analysis-text { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }

/* 画面の下の規約類のリンクと、規約類のページ（2026-11-11） */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 20px 0 32px; font-size: 13px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer a, .legal-links a { color: var(--muted); }
.legal { padding-bottom: 48px; line-height: 1.8; }
.legal h2 { font-size: 16px; margin: 28px 0 8px; }
.legal ol, .legal ul { padding-left: 1.4em; }
.legal-table { display: grid; grid-template-columns: minmax(8em, 14em) 1fr; border-top: 1px solid var(--line); }
.legal-table dt, .legal-table dd { margin: 0; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.legal-table dt { font-weight: 700; }
.legal-links { margin-top: 32px; font-size: 13px; }
@media (max-width: 560px) { .legal-table { grid-template-columns: 1fr; } .legal-table dt { border-bottom: none; padding-bottom: 0; } }
/* 登録を押したあとの案内（2026-11-11） */
.done-panel { background: var(--accent-soft); border-radius: var(--radius); padding: 28px 20px; margin: 8px 0 20px; text-align: center; }
.done-panel h2 { font-size: 20px; margin: 4px 0 12px; }
.done-panel p { margin: 8px 0; }
.done-mark { font-size: 40px; line-height: 1; margin: 0; color: var(--accent); }
.done-email { font-weight: 700; word-break: break-all; }
/* ---- 画面の作り直し（2026-11-11） ---- */
.header-tools { display: flex; align-items: center; gap: 12px; }
.header-link { font-size: 0.875rem; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; }
.header-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.stack-lg { display: grid; gap: 24px; }
.btn-large { min-height: 56px; font-size: 1.0625rem; }
.btn-small { min-height: 36px; padding: 4px 14px; font-size: 0.875rem; }

/* トップ */
.hero { display: grid; gap: 10px; padding: 8px 0 4px; }
.hero h1 { font-size: 1.75rem; }
.hero-lead { font-size: 1.0625rem; color: var(--fg); }
.points { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.points li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.point-mark { flex: none; display: grid; place-items: center; width: 26px; height: 26px; font-size: 0.8125rem; font-weight: 700; color: var(--accent-fg); background: var(--accent); border-radius: 50%; margin-top: 2px; }

/* 選択画面：カードの形の選択肢 */
.choice-group { margin: 0; padding: 0; border: 0; display: grid; gap: 10px; min-width: 0; }
.choice-group legend { padding: 0; margin-bottom: 10px; font-size: 0.875rem; font-weight: 700; color: var(--muted); }
.option-list { display: grid; gap: 10px; }
.option { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.option input { flex: none; width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--accent); }
.option-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.option-type { flex-direction: column; align-items: stretch; gap: 4px; padding: 14px 10px 12px; text-align: center; }
.option-type input { position: absolute; opacity: 0; pointer-events: none; }
.option-type .option-body { display: flex; flex-direction: column; align-items: center; gap: 0; width: 100%; }
.option-type .option-count { font-size: 0.8125rem; line-height: 1.5; }
.option-level { font-size: 1.5rem; line-height: 1.2; }
.option-type:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.option-title { font-weight: 700; }
.option-desc, .option-count { font-size: 0.875rem; color: var(--muted); }
.option-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.option-lock { font-size: 0.8125rem; font-weight: 700; color: var(--accent); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:has(input:disabled) { cursor: not-allowed; opacity: 0.7; }

/* 出題・答え合わせの上の帯 */
.status-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.status-text { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 0; }
.status-type { font-weight: 700; color: var(--fg); }

/* 答え合わせ */
.explain { border-top: 1px solid var(--line); }
.btn-ai { justify-self: start; color: var(--accent); border-color: var(--accent); }
.login-prompt { border-color: var(--accent); }

/* 画面の下に固定する操作（答え合わせ） */
.screen-with-bar { padding-bottom: 88px; }
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06); }
.action-inner { display: flex; gap: 12px; align-items: center; padding-block: 10px; }
.action-inner .btn-primary { flex: 1; min-height: 52px; font-size: 1.0625rem; }
.action-inner .save { flex: none; min-height: 52px; }

/* 結果 */
.score { text-align: center; gap: 6px; padding: 28px 18px; }
.score-type { font-weight: 700; color: var(--muted); }
.score-main { font-size: 1.5rem; font-weight: 700; }
.score-rate { font-size: 2.25rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }body:has(#screen-answer:not([hidden])) .site-footer { padding-bottom: 110px; }
.settings summary { cursor: pointer; font-weight: 700; list-style-position: inside; }
.settings[open] summary { margin-bottom: 4px; }