:root {
  --primary: #155eef;
  --primary-dark: #0b46bd;
  --ink: #172033;
  --muted: #5d687b;
  --line: #dfe5ee;
  --surface: #fff;
  --background: #f5f7fb;
  --error: #c62828;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--background); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif; line-height: 1.7; }
button, input { font: inherit; }
.container { width: min(1080px, calc(100% - 32px)); margin-inline: auto; }
.site-header {
  position: relative;
  color: #fff;
  background: #09233e url("assets/running-hero.png") center / cover no-repeat;
}
.site-header::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(3, 22, 42, 0.94) 0%, rgba(4, 28, 52, 0.8) 43%, rgba(4, 28, 52, 0.12) 78%); }
.hero { position: relative; z-index: 1; padding-block: 64px 72px; }
.eyebrow { margin: 0 0 8px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em; }
h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1.25; letter-spacing: -0.03em; }
.hero-title-row { display: flex; align-items: center; gap: 24px; }
.distance-toggle { display: flex; flex: 0 1 310px; align-items: center; gap: 10px; padding: 7px 10px 7px 14px; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.42); border-radius: 12px; backdrop-filter: blur(8px); }
.distance-toggle > span { font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.distance-toggle select { min-width: 0; width: 100%; padding: 8px 32px 8px 10px; color: var(--ink); background: #fff; border: 0; border-radius: 8px; font-weight: 700; cursor: pointer; }
.distance-toggle select:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.45); outline-offset: 3px; }
.share-menu { position: relative; flex: 0 0 auto; }
.share-toggle { width: auto; min-width: 86px; padding: 12px 18px; color: var(--primary-dark); background: #fff; }
.share-toggle:hover { color: #fff; background: var(--primary); }
.share-options { position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; display: grid; min-width: 150px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.share-options[hidden] { display: none; }
.share-menu:hover .share-options,.share-menu:focus-within .share-options { display: grid; }
.share-options a,.share-options button { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 11px 13px; color: var(--ink); background: #fff; text-align: left; text-decoration: none; font-size: 0.86rem; font-weight: 800; transition: background 0.2s, color 0.2s; }
.share-options a:last-child,.share-options button:last-child { border-bottom: 0; }
.share-options a:hover,.share-options button:hover { color: #fff; background: var(--primary); }
.lead { max-width: 720px; margin: 18px 0 0; font-size: 1.06rem; opacity: 0.92; }
main { padding-block: 48px 72px; }
.calculator-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card, .result-section, .standards, .about { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { padding: 28px; }
.card-heading { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.card-heading h2, .section-heading h2, .about h2 { margin: 0; font-size: 1.35rem; line-height: 1.4; }
.card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 0.9rem; }
.step { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; color: var(--primary); background: #eaf1ff; border-radius: 50%; font-weight: 800; }
.time-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pace-inputs { grid-template-columns: repeat(2, 1fr); }
.time-inputs label { position: relative; }
.time-inputs label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.time-inputs input { width: 100%; height: 54px; padding: 8px 38px 8px 12px; color: var(--ink); background: #fff; border: 1px solid #bdc7d8; border-radius: 10px; font-size: 1.15rem; font-weight: 700; }
.time-inputs input:focus { outline: 3px solid rgba(21, 94, 239, 0.18); border-color: var(--primary); }
.time-inputs small { position: absolute; right: 12px; bottom: 14px; color: var(--muted); }
.error-message { min-height: 1.7em; margin: 8px 0; color: var(--error); font-size: 0.86rem; font-weight: 700; }
button { width: 100%; padding: 14px 18px; color: #fff; background: var(--primary); border: 0; border-radius: 10px; cursor: pointer; font-weight: 800; transition: background 0.2s, transform 0.2s; }
button:hover { background: var(--primary-dark); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid rgba(21, 94, 239, 0.3); outline-offset: 3px; }
.result-section, .standards, .about { margin-top: 28px; padding: 32px; scroll-margin-top: 16px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading .eyebrow { color: var(--primary); }
.section-heading > p { margin: 0; color: var(--muted); font-size: 0.9rem; text-align: right; }
.result-summary { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; margin-bottom: 32px; border: 1px solid var(--line); border-radius: 12px; }
.summary-item { padding: 22px; background: #f9fbff; border-left: 1px solid var(--line); }
.summary-item:first-child { border-left: 0; }
.summary-item span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 0.86rem; }
.summary-item strong { font-size: clamp(1.05rem, 2.5vw, 1.4rem); white-space: nowrap; }
.primary-result { color: var(--primary-dark); background: #edf3ff; }
h3 { margin: 0 0 12px; font-size: 1.05rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 14px 18px; border-bottom: 1px solid var(--line); }
thead th { color: var(--muted); background: #f3f6fa; font-size: 0.83rem; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody td { font-variant-numeric: tabular-nums; font-weight: 700; }
.note { margin: 12px 0 0; color: var(--muted); font-size: 0.82rem; }
.about p { margin: 12px 0 0; color: var(--muted); }
footer { padding: 24px 0; color: var(--muted); background: #e9edf4; text-align: center; font-size: 0.85rem; }
footer p { margin: 0; }

@media (min-width: 721px) and (max-width: 900px) {
  .result-summary { grid-template-columns: repeat(2, 1fr); }
  .summary-item:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
  .summary-item:nth-child(4) { border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .site-header { background-position: 67% center; }
  .site-header::before { background: linear-gradient(90deg, rgba(3, 22, 42, 0.94), rgba(4, 28, 52, 0.64)); }
  .hero { padding-block: 44px 50px; }
  .hero-title-row { display: block; }
  .distance-toggle { max-width: 100%; margin-top: 20px; }
  .share-menu { display: inline-block; margin-top: 14px; }
  .share-options { right: auto; left: 0; }
  main { padding-block: 28px 52px; }
  .calculator-grid { grid-template-columns: 1fr; }
  .card, .result-section, .standards, .about { padding: 22px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 8px; text-align: left; }
  .result-summary { grid-template-columns: 1fr; }
  .summary-item { border-top: 1px solid var(--line); border-left: 0; }
  .summary-item:first-child { border-top: 0; }
}

@media (max-width: 390px) {
  .container { width: min(100% - 20px, 1080px); }
  .card, .result-section, .standards, .about { padding: 18px; }
  .time-inputs { gap: 8px; }
  .time-inputs input { padding-left: 9px; padding-right: 30px; }
  .time-inputs small { right: 8px; }
  th, td { padding: 12px; }
}

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