/* 既存ツール（voltage-divider-calc / resistor-color-code）と共通のデザイントークン */
:root {
  --ink: #1d2733;
  --muted: #667381;
  --paper: #f0f4f8;
  --surface: #ffffff;
  --line: #d8e0e8;
  --primary: #0f72b8;
  --primary-dark: #09598f;
  --primary-soft: #e3f0fa;
  --accent: #f4b740;
  --accent-soft: #fdf3dd;
  --focus-ring: rgba(15, 114, 184, 0.35);
  --shadow: 0 2px 12px rgba(29, 39, 51, 0.09);
  --radius: 10px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-dark); text-underline-offset: 3px; }
a:hover { color: var(--primary); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }

.page-shell, .content-shell, .site-footer-inner {
  width: min(1160px, calc(100% - 40px));
  margin-inline: auto;
}
/* パンくずと言語切替を1行に並べる（既存ツールのパンくず位置に合わせる） */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.language-switcher {
  display: flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.78rem;
  font-weight: 700;
}
.language-switcher a, .language-switcher span {
  min-width: 72px;
  padding: 5px 12px;
  border-radius: 999px;
  text-align: center;
  text-decoration: none;
}
.language-switcher [aria-current="page"] { color: #fff; background: var(--primary); }

/* ツール見出し: パンくず＋青下線付きヘッダー（既存ツール共通の型） */
.hero {
  padding: 20px 0 0;
}
.hero .page-shell {
  padding-bottom: 14px;
  border-bottom: 3px solid var(--primary);
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 700;
}
.breadcrumb a { color: var(--primary-dark); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--primary-dark);
  font-size: 0.87rem;
  font-weight: 900;
}
h1, h2, h3 { line-height: 1.28; }
h1 { margin: 0 0 6px; font-size: clamp(1.65rem, 2.8vw, 2.2rem); line-height: 1.2; }
.hero-lead { max-width: 860px; margin: 0; color: var(--muted); font-size: 0.97rem; font-weight: 700; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hero-badges span { padding: 4px 12px; border: 1px solid #bdd8ec; border-radius: 999px; color: var(--primary-dark); background: var(--primary-soft); font-size: 0.78rem; font-weight: 750; }

.calculator-section { padding: 24px 0 48px; }
.calculator-grid { display: grid; grid-template-columns: minmax(300px, .78fr) minmax(420px, 1.22fr); gap: 24px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.form-panel { position: sticky; top: 20px; padding: 28px; }
.panel-kicker { margin: 0 0 4px; color: var(--primary); font-size: .76rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.panel h2 { margin: 0 0 8px; font-size: 1.52rem; }
.panel-intro { margin: 0 0 24px; color: var(--muted); font-size: .9rem; }
.field { margin-bottom: 22px; }
.field > label, .field-label { display: block; margin-bottom: 8px; font-size: .88rem; font-weight: 800; }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: .75rem; }
.input-with-unit { display: grid; grid-template-columns: 1fr 96px; }
input[type="text"], select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bfc7d4;
  background: #fff;
  color: var(--ink);
}
input[type="text"] { padding: 10px 14px; border-radius: 10px 0 0 10px; font-size: 1.1rem; font-weight: 750; }
.input-with-unit select {
  border-left: 0;
  border-radius: 0 10px 10px 0;
  padding-inline: 12px;
  font-family: Arial, "Segoe UI Symbol", sans-serif;
  font-weight: 700;
}
.field > select { border-radius: 10px; padding-inline: 12px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.check-option { position: relative; }
.check-option input { position: absolute; opacity: 0; pointer-events: none; }
.check-option span { min-height: 44px; display: grid; place-items: center; padding: 8px; border: 1px solid #bfc7d4; border-radius: 10px; background: #fff; font-size: .82rem; font-weight: 750; }
.check-option input:checked + span { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.check-option input:focus-visible + span { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.calculate-button, .secondary-button {
  min-height: 46px;
  border-radius: 11px;
  font-weight: 800;
}
.calculate-button { width: 100%; border: 0; color: #fff; background: var(--primary); box-shadow: 0 4px 12px rgba(15,114,184,.22); }
.calculate-button:hover { background: var(--primary-dark); }
.form-error { margin: 14px 0 0; padding: 10px 12px; border-left: 4px solid #c64343; color: #812d2d; background: #fff0f0; font-size: .85rem; }

.result-stack { display: grid; gap: 18px; }
.top-result { overflow: hidden; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 26px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.result-head h2 { margin: 0; font-size: 1.12rem; }
.result-head p { margin: 2px 0 0; color: var(--muted); font-size: .78rem; }
.result-badges { display: flex; align-items: center; gap: 7px; }
.type-badge, .match-badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 9px; border-radius: 999px; font-size: .7rem; font-weight: 850; white-space: nowrap; }
.type-badge { color: var(--primary-dark); background: var(--primary-soft); }
.type-series { color: #74420c; background: #fff0d5; }
.type-parallel { color: #234d9c; background: #e7efff; }
.match-badge { margin-left: 5px; color: #7b3a08; background: var(--accent-soft); }
.top-result-body { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 28px; }
.top-combination { margin: 0; font-size: clamp(1.45rem, 3vw, 2.25rem); font-weight: 900; letter-spacing: -.035em; }
.top-combination, .top-equivalent, .metric strong, .value-link, .error-value {
  font-family: Arial, "Segoe UI Symbol", sans-serif;
}
.top-equivalent-label { margin: 18px 0 2px; color: var(--muted); font-size: .76rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.top-equivalent { margin: 0; color: var(--primary-dark); font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 900; line-height: 1.1; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 22px; }
.metric { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.metric span { display: block; color: var(--muted); font-size: .68rem; }
.metric strong { font-size: .88rem; }
/* 連携ボタン（主役）を上段・コピー（脇役）を下段の2段構成にする */
.result-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 20px; }
.secondary-button { padding: 8px 14px; border: 1px solid var(--primary); color: var(--primary-dark); background: #fff; }
.secondary-button:hover { background: var(--primary-soft); }
/* 色帯ツールへの連携リンク: 本ツールのアピールポイントなので主役級のボタンにする */
.color-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 8px 20px;
  border-radius: 11px;
  color: #fff;
  background: var(--primary);
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(15,114,184,.22);
}
.color-link-button::before { content: "🎨"; margin-right: 8px; }
.color-link-button:hover { color: #fff; background: var(--primary-dark); }
.small-link { font-size: .78rem; font-weight: 750; }
.copy-status { min-height: 1.2em; margin: 8px 0 0; color: var(--primary); font-size: .76rem; }

.circuit-wrap { display: grid; place-items: center; min-height: 250px; padding: 24px; border-radius: var(--radius); background: #eef4f9; }
.circuit-diagram { width: 100%; min-height: 150px; display: flex; align-items: center; justify-content: center; color: var(--primary-dark); }
.wire { width: 42px; height: 3px; flex: 0 1 42px; background: var(--primary); }
.branch { min-width: 92px; display: grid; justify-items: center; gap: 8px; }
.branch b { font-size: .75rem; white-space: nowrap; }
.resistor-shape { min-width: 72px; height: 34px; display: grid; place-items: center; border: 3px solid var(--primary); border-radius: 5px; color: var(--primary-dark); background: #fff; font-size: .72rem; font-weight: 900; }
.series-wire { width: 28px; height: 3px; background: var(--primary); }
.circuit-diagram[data-type="parallel"] { position: relative; }
.parallel-branches { position: relative; width: min(230px, 65%); display: grid; gap: 34px; padding: 9px 0; }
.parallel-branches::before, .parallel-branches::after { content: ""; position: absolute; top: 25px; bottom: 25px; width: 3px; background: var(--primary); }
.parallel-branches::before { left: 0; }
.parallel-branches::after { right: 0; }
.parallel-branches .branch { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }
.parallel-branches .branch::before, .parallel-branches .branch::after { content: ""; height: 3px; flex: 1; background: var(--primary); }
.parallel-branches .branch b { position: absolute; top: 36px; }

.candidate-panel { overflow: hidden; }
.candidate-header { padding: 22px 26px 14px; }
.candidate-header h2 { margin: 0; }
.candidate-header p { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 11px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { color: var(--muted); background: #fbfcfe; font-size: .68rem; letter-spacing: .035em; }
td { font-size: .78rem; }
th:nth-child(1), th:nth-child(2), td:nth-child(1), td:nth-child(2) { text-align: left; }
tr.is-best td { background: #f2f8fd; }
.rank { width: 25px; height: 25px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--muted); background: var(--paper); font-size: .68rem; font-weight: 850; }
.is-best .rank { color: #fff; background: var(--primary); }
.value-link { color: inherit; font-weight: 700; text-decoration-color: #b2bbc8; }
.error-value { color: var(--primary-dark); font-weight: 850; }

.content-section { padding: 70px 0; background: #fff; }
.content-shell { max-width: 900px; }
.content-shell > h2 { margin: 0 0 16px; font-size: clamp(1.65rem, 3vw, 2.25rem); }
.content-shell > p { color: #485268; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 32px 0 54px; padding: 0; list-style: none; counter-reset: steps; }
.steps li { position: relative; padding: 24px 20px 20px; border: 1px solid var(--line); border-radius: 14px; counter-increment: steps; }
.steps li::before { content: counter(steps); width: 30px; height: 30px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 50%; color: #fff; background: var(--primary); font-weight: 850; }
.steps strong { display: block; margin-bottom: 6px; }
.steps span { color: var(--muted); font-size: .84rem; }
.formula-box { margin: 26px 0; padding: 24px; border-left: 5px solid var(--accent); background: var(--accent-soft); }
.formula-box code { display: block; margin: 7px 0; color: #67350f; font-size: .96rem; font-weight: 800; }
.faq { margin-top: 50px; }
.faq h2 { margin-bottom: 18px; }
details { border-top: 1px solid var(--line); }
details:last-child { border-bottom: 1px solid var(--line); }
summary { padding: 18px 4px; cursor: pointer; font-weight: 800; }
details p { margin: 0; padding: 0 4px 20px; color: var(--muted); }
.related { margin-top: 54px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.related-card { display: block; min-height: 130px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); text-decoration: none; }
.related-card:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
.related-card strong { display: block; }
.related-card span { display: block; margin-top: 7px; color: var(--muted); font-size: .8rem; }

.site-footer { padding: 30px 0; border-top: 1px solid var(--line); background: var(--paper); }
.site-footer-inner { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: .76rem; }
.site-footer p { margin: 0; }

@media (max-width: 900px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .top-result-body { grid-template-columns: 1fr; }
  .circuit-wrap { min-height: 210px; }
}

@media (max-width: 640px) {
  .page-shell, .content-shell, .site-footer-inner { width: min(100% - 24px, 1160px); }
  .language-switcher a, .language-switcher span { min-width: 58px; padding-inline: 8px; }
  .hero { padding: 14px 0 0; }
  h1 { font-size: 1.6rem; }
  .calculator-section { padding: 22px 0 42px; }
  .form-panel, .top-result-body { padding: 20px; }
  .result-head, .candidate-header { padding-inline: 20px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { display: flex; justify-content: space-between; align-items: center; }
  .table-scroll { overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; padding: 0 12px 14px; }
  tr { padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
  tr.is-best { border-color: #8fbede; }
  td { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 2px; border: 0; text-align: right !important; white-space: normal; }
  td::before { content: attr(data-label); color: var(--muted); font-size: .68rem; font-weight: 700; }
  .steps, .related-grid { grid-template-columns: 1fr; }
  .content-section { padding: 50px 0; }
  .site-footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
