/* 白基調＋青アクセント。色だけに頼らず、線種・ラベルでも区別する。 */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f7fc;
  --line: #d7deea;
  --text: #1c2333;
  --muted: #566078;
  --blue: #1f5fd6;
  --blue-dark: #174aa8;
  --blue-soft: #e6eefc;
  --c-v: #1f5fd6;    /* 速度 v：青・太い実線 */
  --c-vx: #c2410c;   /* 水平成分：橙・破線 */
  --c-vy: #15803d;   /* 鉛直成分：緑・点線 */
  --c-path: #1c2333;
  --c-ghost: #8a93a6;
  --radius: 12px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-soft);
  line-height: 1.8;
  font-size: 16px;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.nowrap { white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
a { color: var(--blue-dark); }
:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* ヘッダー */
.site-header { background: #fff; border-bottom: 1px solid var(--line); padding: 20px 0 8px; }
.site-name { margin: 0; color: var(--blue); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.05em; }
h1 { margin: 4px 0 8px; font-size: 1.9rem; line-height: 1.3; }
.h1-sub { display: block; font-size: 1.05rem; font-weight: 500; color: var(--muted); margin-top: 4px; }
.lead { margin: 8px 0 12px; max-width: 46em; }
.review-banner { background: #fff8e6; border: 1px solid #f2d27a; border-radius: 8px; padding: 6px 12px; font-size: 0.9rem; margin: 0 0 12px; }

.steps ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.steps a {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; background: #fff; font-size: 0.92rem; min-height: 36px;
}
.steps a:hover { border-color: var(--blue); }
.steps .num, .badge {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 0.85rem; flex: none;
}
.badge { margin-right: 8px; width: 30px; height: 30px; font-size: 1rem; vertical-align: 2px; }

/* カード */
main { padding: 16px 0 32px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 16px 0; }
h2 { margin: 0 0 10px; font-size: 1.4rem; line-height: 1.4; }
h3 { font-size: 1.12rem; margin: 20px 0 6px; }
h4 { font-size: 1rem; margin: 0 0 4px; }
.assume { background: var(--blue-soft); border-color: #c5d6f6; }
.assume h2 { font-size: 1.1rem; }
.assume ul { margin: 0; padding-left: 1.2em; }

/* 予想 */
.quiz { border-top: 1px solid var(--line); padding: 12px 0 6px; }
.quiz .q { margin: 0 0 6px; }
.choices { display: grid; gap: 6px; }
.choices label {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; min-height: 44px;
}
.choices label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.choices input { margin-top: 0.45em; flex: none; }
details.answer { margin: 8px 0 4px; border-left: 4px solid var(--blue); background: var(--bg-soft); border-radius: 0 8px 8px 0; padding: 4px 12px; }
details.answer summary { cursor: pointer; font-weight: 700; color: var(--blue-dark); padding: 6px 0; min-height: 36px; }
details.answer p { margin: 6px 0; }

/* シミュレーター */
.sim-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.figure-wrap { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
#plot { display: block; width: 100%; height: 340px; touch-action: pan-y; }
.status { margin: 6px 0; font-weight: 700; color: var(--blue-dark); min-height: 1.8em; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.85rem; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 4px; }
.lg-path { stroke: var(--c-path); stroke-width: 2.5; }
.lg-ghost { stroke: var(--c-ghost); stroke-width: 2; stroke-dasharray: 6 4; }
.lg-v { stroke: var(--c-v); stroke-width: 4; }
.lg-v-head { fill: var(--c-v); }
.lg-vx { stroke: var(--c-vx); stroke-width: 3; stroke-dasharray: 6 3; }
.lg-vx-head { fill: var(--c-vx); }
.lg-vy { stroke: var(--c-vy); stroke-width: 3; stroke-dasharray: 1.5 3; stroke-linecap: round; }
.lg-vy-head { fill: var(--c-vy); }
.lg-mark { fill: #fff; stroke: var(--c-path); stroke-width: 1.5; }
.scale-note { font-size: 0.85rem; color: var(--muted); margin: 6px 0 0; }

.ctrl-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0 0 12px; }
.ctrl-group legend { font-weight: 700; padding: 0 6px; }
.slider-row { display: grid; grid-template-columns: 5.2em minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 6px 0; }
.slider-row label { font-size: 0.92rem; }
.slider-row input[type="range"] { width: 100%; height: 32px; accent-color: var(--blue); }
.num-input { white-space: nowrap; font-size: 0.92rem; }
.num-input input { width: 4.6em; font: inherit; padding: 4px 6px; border: 1px solid #aeb8cc; border-radius: 6px; }
output { font-variant-numeric: tabular-nums; min-width: 4.2em; text-align: right; }
.speed-row { grid-template-columns: 5.2em 1fr; }
select { font: inherit; padding: 6px; border-radius: 6px; border: 1px solid #aeb8cc; background: #fff; min-height: 40px; }
.hint { font-size: 0.82rem; color: var(--muted); margin: 4px 0 0; line-height: 1.6; }
.input-msg { font-size: 0.85rem; color: #9a3412; margin: 4px 0 0; min-height: 0; }
.input-msg:empty { display: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.btn {
  font: inherit; font-weight: 700; border: 1px solid var(--blue); color: var(--blue-dark); background: #fff;
  border-radius: 8px; padding: 8px 14px; min-height: 44px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--blue-soft); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.small { font-size: 0.9rem; padding: 6px 10px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row .btn { flex: 1 1 auto; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); flex: none; }

.readouts { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.readout-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--bg-soft); min-width: 0; }
.readout-box h3 { margin: 0 0 6px; font-size: 1rem; }
table.values { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.values th { text-align: left; font-weight: 500; padding: 2px 6px 2px 0; white-space: nowrap; }
table.values td { text-align: right; padding: 2px 4px; }
table.values td:last-child { text-align: left; color: var(--muted); }
.live-eq { font-size: 0.95rem; line-height: 1.7; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.live-eq p { margin: 0 0 8px; }
.live-eq .lbl { display: block; font-size: 0.82rem; color: var(--muted); }
.live-eq var { font-style: italic; font-family: "Times New Roman", serif; font-size: 1.08em; }
.live-eq .res { font-weight: 700; color: var(--blue-dark); }

/* 観察 */
.observe-list { padding-left: 1.4em; }
.observe-list li { margin: 0 0 14px; }
.observe-list p { margin: 2px 0; }
.do, .look { display: inline-block; font-size: 0.78rem; font-weight: 700; border-radius: 4px; padding: 0 6px; margin-right: 6px; }
.do { background: var(--blue-soft); color: var(--blue-dark); }
.look { background: #fdf0e6; color: #9a3412; }

/* 式 */
.math-block { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.col-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.note { font-size: 0.92rem; background: var(--bg-soft); border-radius: 8px; padding: 8px 12px; }
dl.cond dt { font-weight: 700; margin-top: 12px; }
dl.cond dd { margin: 0 0 0 1em; }
.tip { border: 2px solid var(--blue); border-radius: 10px; padding: 10px 14px; margin-top: 16px; }

/* 問題 */
.setup { background: var(--blue-soft); padding: 10px 12px; border-radius: 8px; }
.setup .btn, .setup-inline .btn { margin-left: 0; margin-top: 6px; display: inline-flex; }
.problem { border-top: 1px solid var(--line); padding-top: 4px; }
.problem h3 { margin-top: 14px; }

/* 次へ */
.next { border: 2px solid var(--blue); }
.pending { color: var(--muted); font-size: 0.95rem; }

.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 16px 0 24px; font-size: 0.88rem; color: var(--muted); }
.site-footer .small { font-size: 0.8rem; }

/* SVG 内 */
#plot text { font-family: var(--font); fill: var(--text); }
#plot .axis-label { font-size: 12px; fill: var(--muted); }
#plot .tick { font-size: 11px; fill: var(--muted); }
#plot .grid { stroke: #e8edf5; stroke-width: 1; }
#plot .ground { stroke: #3b4457; stroke-width: 2; }
#plot .path { fill: none; stroke: var(--c-path); stroke-width: 2.5; }
#plot .path-future { fill: none; stroke: var(--c-path); stroke-width: 1.2; stroke-dasharray: 2 4; opacity: 0.5; }
#plot .ghost { fill: none; stroke: var(--c-ghost); stroke-width: 2; stroke-dasharray: 7 5; }
#plot .ghost-label { font-size: 11px; fill: #5c6578; }
#plot .mark { fill: #fff; stroke: var(--c-path); stroke-width: 1.5; }
#plot .ball { fill: var(--blue); stroke: #0d2f73; stroke-width: 2; }
#plot .vec-v { stroke: var(--c-v); stroke-width: 4; }
#plot .vec-vx { stroke: var(--c-vx); stroke-width: 3; stroke-dasharray: 7 4; }
#plot .vec-vy { stroke: var(--c-vy); stroke-width: 3; stroke-dasharray: 1.5 4; stroke-linecap: round; }
#plot .head-v { fill: var(--c-v); }
#plot .head-vx { fill: var(--c-vx); }
#plot .head-vy { fill: var(--c-vy); }
#plot .vlabel { font-size: 14px; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
#plot .vlabel.v { fill: var(--c-v); }
#plot .vlabel.vx { fill: var(--c-vx); }
#plot .vlabel.vy { fill: var(--c-vy); }
#plot .pt-label { font-size: 12px; fill: var(--muted); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
#plot .apex-mark { fill: none; stroke: var(--muted); stroke-width: 1.5; }
#plot .refvec { stroke: var(--c-v); stroke-width: 2; }
#plot .refvec-head { fill: var(--c-v); }
#plot .refbox { fill: #fff; stroke: var(--line); }
#plot .ref-text { font-size: 11px; fill: var(--muted); }
#plot .scalebar { stroke: var(--text); stroke-width: 2; }

/* タブレット・スマホ */
@media (max-width: 900px) {
  .sim-layout { grid-template-columns: 1fr; }
  .readouts { grid-template-columns: 1fr 1fr; }
  .readouts .readout-box:first-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  body { font-size: 15px; }
  h1 { font-size: 1.55rem; }
  .card { padding: 16px 14px; border-radius: 10px; }
  .wrap { padding: 0 10px; }
  .readouts { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .slider-row { grid-template-columns: 4.6em minmax(0, 1fr) auto; gap: 6px; }
  .num-input input { width: 4.2em; }
  .steps a { font-size: 0.85rem; padding-right: 10px; }
}

/* ===== サイト共通（ヘッダー・パンくず・一覧・広告枠） ===== */
.global-nav { background: #fff; border-bottom: 1px solid var(--line); }
.global-nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.global-nav .brand { font-weight: 700; color: var(--blue-dark); text-decoration: none; font-size: 1.02rem; }
.global-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.global-nav ul a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; }
.global-nav ul a:hover, .global-nav ul a[aria-current="page"] { background: var(--blue-soft); color: var(--blue-dark); }
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin: 0 0 6px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.breadcrumb li + li::before { content: "›"; margin-right: 4px; color: #9aa4b8; }
.breadcrumb a { color: var(--muted); }
.hero { background: #fff; border-bottom: 1px solid var(--line); padding: 28px 0 22px; }
.hero h1 { font-size: 2rem; }
.subject-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.subject-card { display: block; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.subject-card:hover { border-color: var(--blue); box-shadow: 0 2px 10px rgba(31, 95, 214, .08); }
.subject-card h2 { margin: 0 0 4px; font-size: 1.25rem; color: var(--blue-dark); }
.subject-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.pub-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.pub-list a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); background: #fff; }
.pub-list a:hover { border-color: var(--blue); }
.pub-list .meta { display: block; font-size: 0.82rem; color: var(--muted); }
.unit-group { margin: 0 0 18px; }
.unit-group h3 { font-size: 1.05rem; margin: 14px 0 6px; border-left: 4px solid var(--blue); padding-left: 8px; }
.unit-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.unit-list li { font-size: 0.9rem; }
.unit-list a { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--blue); color: #fff; text-decoration: none; font-weight: 700; }
.unit-list .soon { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #f1f3f7; color: #6b7487; }
.legend-note { font-size: 0.85rem; color: var(--muted); }
.faq dt { font-weight: 700; margin-top: 14px; }
.faq dd { margin: 4px 0 0; }
.keyterms { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.keyterms li { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 0.88rem; }
.prose h2 { margin-top: 18px; }
.prose p, .prose li { max-width: 46em; }

/* 広告枠：本文の区切りにだけ置く。読み込み前から高さを確保して、ページがガタつかないようにする */
.ad-slot { margin: 28px auto; padding: 8px 0 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 300px; max-width: 760px; }
.ad-slot .ad-label { margin: 0 0 6px; font-size: 0.75rem; color: var(--muted); letter-spacing: .1em; }

@media (max-width: 760px) {
  .subject-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .global-nav .wrap { padding-top: 4px; padding-bottom: 4px; }
}
.table-wrap { overflow-x: auto; }
table.formula-table { border-collapse: collapse; width: 100%; font-size: 0.94rem; min-width: 520px; }
table.formula-table th, table.formula-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
table.formula-table thead th { background: var(--blue-soft); }
table.formula-table tbody th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
details.course > summary { cursor: pointer; list-style: none; }
details.course > summary::-webkit-details-marker { display: none; }
details.course > summary h2 { display: flex; align-items: center; gap: 10px; margin: 0; }
details.course > summary h2::before { content: "▶"; font-size: 0.8rem; color: var(--blue); transition: transform .15s; }
details.course[open] > summary h2::before { transform: rotate(90deg); }
details.course > summary .count { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
details.course[open] > summary { margin-bottom: 8px; }
@media (max-width: 600px) {
  table.formula-table { min-width: 0; font-size: 0.86rem; }
  table.formula-table th, table.formula-table td { padding: 5px 6px; }
  table.formula-table tbody th { white-space: normal; }
}
.num-input input.pending { border-color: #f59e0b; background: #fff8e6; }
.t-input-row { grid-template-columns: auto auto 1fr; }
.t-input-row label { white-space: nowrap; }
.t-input-row .btn { justify-self: start; }
.live-eq .lbl { margin-top: 2px; }

