/* A-GPTプロジェクト 新しい画面(index.html・model.html)共通のスタイル */

:root {
  --bg: #f4efe4;   /* ベージュ(スマホがダークモードでも、この配色のまま) */
  --surface: #ffffff;
  --surface-2: #f0ede5;
  --ink: #1d1d1f;
  --ink-2: #55534e;
  --ink-3: #8a877f;
  --line: #e4e0d6;
  --accent: #d9480f;
  --accent-soft: #fff0e6;
  --good: #2b8a3e;
  --good-soft: #e9f7ec;
  --bad: #c92a2a;
  --bad-soft: #fdecec;
  --series-1: #d9480f;   /* 検証データ */
  --series-2: #a8a39a;   /* 学習データ */
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --radius: 14px;
  color-scheme: light;
}


* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: .02em;
}
a { color: var(--accent); text-underline-offset: 3px; }
b, strong { font-weight: 700; }
.num { font-feature-settings: "tnum"; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* ---------- 上のナビ ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 52px; }
.brand { font-weight: 900; color: var(--ink); text-decoration: none; letter-spacing: .04em; white-space: nowrap; }
.brand span { color: var(--accent); }
.model-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.model-tabs::-webkit-scrollbar { display: none; }
.model-tabs a {
  flex: none; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--ink-2); text-decoration: none;
}
.model-tabs a:hover { background: var(--surface-2); }
.model-tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* ---------- 見出し・文 ---------- */
.hero { padding: 56px 0 28px; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .12em; margin: 0 0 8px; }
h1 { font-size: clamp(30px, 7vw, 46px); line-height: 1.3; margin: 0 0 16px; font-weight: 900; letter-spacing: .01em; }
h2 { font-size: clamp(22px, 4.6vw, 28px); line-height: 1.4; margin: 0 0 12px; font-weight: 900; }
h3 { font-size: 17px; margin: 24px 0 8px; }
.lead { font-size: 17px; color: var(--ink-2); margin: 0 0 12px; }
.muted { color: var(--ink-3); font-size: 14px; }
section { padding: 36px 0; border-top: 1px solid var(--line); }
section:first-of-type { border-top: 0; }
.sec-no { font-size: 13px; font-weight: 700; color: var(--ink-3); letter-spacing: .1em; margin: 0 0 4px; }

/* ---------- 数字の帯 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0 0; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); min-width: 0;
}
.stat-label { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.stat-value { font-size: 22px; font-weight: 900; line-height: 1.35; margin-top: 2px; overflow-wrap: anywhere; }
.stat-value small { font-size: 13px; font-weight: 700; color: var(--ink-2); margin-left: 2px; }
.stat-sub { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin-top: 2px; }
a.q {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 900; text-decoration: none;
  margin-left: 6px; vertical-align: 3px; line-height: 1;
}
h2 a.q { width: 22px; height: 22px; font-size: 13px; vertical-align: 5px; }
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 19px; }
  /* スマホでは、上の数字は1行に1つ(ラベルは左、数字は右) */
  .hero .stats { grid-template-columns: 1fr; gap: 8px; }
  .hero .stat { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; }
  .hero .stat-value { font-size: 18px; white-space: nowrap; margin-top: 0; }
}

/* ---------- やっていること(手順) ---------- */
.steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; counter-reset: step; }
.steps li {
  display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.steps li::before {
  counter-increment: step; content: counter(step);
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px;
}
.steps b { display: block; font-size: 16.5px; }
.steps span { color: var(--ink-2); font-size: 14.5px; line-height: 1.7; display: block; }

/* ---------- モデルの一覧(進化) ---------- */
.evo { display: grid; gap: 12px; margin-top: 20px; }
.evo-card {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.evo-card:hover { transform: translateY(-1px); border-color: var(--accent); }
.evo-no {
  width: 64px; height: 64px; border-radius: 16px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 900; line-height: 1.1;
  color: #fff; background: hsl(var(--h, 20) 70% 48%);
}
.evo-no small { font-size: 10px; font-weight: 700; opacity: .85; letter-spacing: .08em; }
.evo-no span { font-size: 28px; }
.evo-body { min-width: 0; }
.evo-title { font-weight: 900; font-size: 17px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.evo-head { font-size: 14.5px; color: var(--ink-2); line-height: 1.6; margin: 2px 0 8px; }
.evo-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); }
.evo-meta b { color: var(--ink); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: hsl(var(--h, 20) 70% 50%); }
.evo-arrow { color: var(--ink-3); font-size: 22px; }
@media (max-width: 600px) {
  .evo-card { grid-template-columns: 52px 1fr; }
  .evo-no { width: 52px; height: 52px; border-radius: 13px; }
  .evo-no span { font-size: 22px; }
  .evo-arrow { display: none; }
}

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; line-height: 1; padding: 5px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); letter-spacing: .04em;
}
.badge.live { background: var(--accent-soft); color: var(--accent); }
.badge.live::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  margin-right: 5px; vertical-align: 1px; animation: pulse 1.4s ease-in-out infinite;
}
.badge.chat { background: var(--good-soft); color: var(--good); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- 用語集 ---------- */
.glossary { display: grid; gap: 10px; margin-top: 16px; }
.glossary details {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px;
}
.glossary summary {
  cursor: pointer; list-style: none; padding: 14px 0; font-weight: 700; display: flex; gap: 10px; align-items: baseline;
}
.glossary summary::-webkit-details-marker { display: none; }
.glossary summary::after { content: "+"; margin-left: auto; color: var(--ink-3); font-weight: 400; font-size: 20px; line-height: 1; }
.glossary details[open] summary::after { content: "−"; }
.glossary summary small { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.glossary p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.glossary details:target { border-color: var(--accent); }

/* ---------- 入力・ボタン ---------- */
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="text"] {
  flex: 1 1 220px; min-width: 0; font: inherit; font-size: 16px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
button {
  font: inherit; font-weight: 700; font-size: 15px; padding: 11px 20px; border-radius: 10px; border: 0;
  background: var(--ink); color: var(--bg); cursor: pointer;
}
button:hover { opacity: .88; }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: var(--surface-2); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chip {
  font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
}
.chip:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }

.seg { display: grid; grid-template-columns: 1fr 1fr; max-width: 460px; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { background: transparent; color: var(--ink-2); padding: 8px 16px; font-size: 14.5px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- 生成の結果 ---------- */
.outputs { display: grid; gap: 10px; margin-top: 16px; }
.output {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; font-size: 16.5px; line-height: 1.9; overflow-wrap: anywhere;
  animation: rise .25s ease both;
}
.output .pre { color: var(--accent); font-weight: 700; }
.output .tag { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 2px; font-weight: 700; }
.output.q { background: var(--surface-2); }
.output.muted-out { color: var(--ink-2); font-size: 15px; }
.placeholder { color: var(--ink-3); font-size: 15px; padding: 18px 0 4px; }
.notice {
  background: var(--accent-soft); border-radius: var(--radius); padding: 14px 16px; font-size: 15px; margin-top: 14px;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.spinner {
  display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 常識テスト ---------- */
.score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.score .big { font-size: 52px; font-weight: 900; line-height: 1; }
.score .of { font-size: 20px; font-weight: 700; color: var(--ink-2); }
.score .diff { font-size: 14px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--good-soft); color: var(--good); }
.score .diff.down { background: var(--bad-soft); color: var(--bad); }
.quiz-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 15px; }
.quiz-table th {
  text-align: left; font-size: 12.5px; color: var(--ink-3); font-weight: 700; padding: 8px 6px; border-bottom: 1px solid var(--line);
}
.quiz-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.quiz-table td.mark { width: 36px; text-align: center; font-size: 18px; font-weight: 900; }
.quiz-table tr.ok td.mark { color: var(--good); }
.quiz-table tr.ng td.mark { color: var(--bad); }
.quiz-table tr.na td { color: var(--ink-3); }
.quiz-table .cat { display: block; font-size: 11.5px; color: var(--ink-3); }
.quiz-table .ans b { font-weight: 700; }
.quiz-table .ans small { display: block; font-size: 12.5px; color: var(--ink-3); }
.quiz-table .ng .ans b { color: var(--bad); }
.pct { font-size: 12.5px; color: var(--ink-3); margin-left: 4px; }
.filter { margin-top: 12px; }

/* ---------- グラフ ---------- */
.chart { width: 100%; height: auto; display: block; margin-top: 12px; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: inherit; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-title { fill: var(--ink-2); font-size: 11.5px; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: 4px; margin-right: 6px; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 14px; }
.progress-line { font-size: 14px; color: var(--ink-2); margin-top: 10px; }

/* ---------- 前後のモデル・フッター ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 32px 0; border-top: 1px solid var(--line); }
.pager a {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-decoration: none; color: var(--ink); min-width: 0;
}
.pager a small { display: block; color: var(--ink-3); font-size: 12.5px; }
.pager a b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager .next { text-align: right; grid-column: 2; }
footer { padding: 28px 0 56px; color: var(--ink-3); font-size: 13.5px; border-top: 1px solid var(--line); }
footer a { color: var(--ink-2); }
.error { color: var(--bad); font-size: 14.5px; margin-top: 10px; }
.desc { color: var(--ink-2); margin: 0 0 12px; }
.seg button small { font-size: 11.5px; font-weight: 500; }
@media (max-width: 420px) { .seg button small { display: none; } }
