/* KAIZEN × HYROX — dark-only, black / red / yellow */

:root {
  color-scheme: dark;
  --ink: #0a0a0a;
  --ink-2: #131313;
  --ink-3: #1c1c1c;
  --line: #2a2a2a;
  --paper: #f5f2ec;
  --paper-2: #bdb8ad;
  --paper-3: #8a857b;
  --red: #c8102e;
  --red-deep: #8e0b20;
  --yellow: #f2c230;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1120px;
  --ring: 0 0 0 3px var(--ink), 0 0 0 6px var(--yellow);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  font-size: 1.05rem;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
body::after { /* grain */
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
a, button, input, [role="button"] { touch-action: manipulation; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--display); line-height: 1; letter-spacing: .01em; text-wrap: balance; margin: 0; }
h2 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; text-transform: uppercase; margin-bottom: .6em; }
h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: .5em; }
p { margin: 0 0 1em; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: .92rem; color: var(--paper-2); }
[hidden] { display: none !important; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 4px; }

/* skip link */
.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  background: var(--yellow); color: var(--ink); padding: .6rem 1rem; font-weight: 600; text-decoration: none;
}
.skip:focus-visible { top: 8px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem 1rem;
  padding: .6rem var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.menu-btn { display: none; }
.brand img { width: 120px; height: auto; }
.brand-text { font-family: var(--display); font-weight: 800; font-size: 2rem; letter-spacing: .06em; position: relative; }
.dot { position: absolute; width: .32em; height: .32em; border-radius: 50%; background: var(--red); left: .56em; top: -.12em; }
.nav { display: flex; gap: .15rem; flex-wrap: wrap; justify-content: center; min-width: 0; }
.nav a {
  color: var(--paper-2); text-decoration: none; font-weight: 600; font-size: .9rem; text-transform: uppercase; letter-spacing: .06em;
  padding: .4rem .6rem; border-radius: 4px; transition: color .15s ease, background-color .15s ease;
}
.nav a:hover { color: var(--paper); background: var(--ink-3); }
.nav a[aria-current="true"] { color: var(--yellow); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang-btn, .seg-btn {
  min-height: 44px; min-width: 44px;
  background: transparent; color: var(--paper-2); border: 0; font: inherit; font-weight: 600; cursor: pointer;
  padding: .4rem .8rem; transition: color .15s ease, background-color .15s ease;
}
.lang-btn:hover, .seg-btn:hover { color: var(--paper); background: var(--ink-3); }
.lang-btn[aria-pressed="true"], .seg-btn[aria-pressed="true"] { background: var(--red); color: #fff; }
.lang-btn:focus-visible, .seg-btn:focus-visible { border-radius: 0; box-shadow: inset 0 0 0 3px var(--yellow); }

/* layout */
main { position: relative; z-index: 1; }
.section, .hero {
  max-width: var(--max); margin-inline: auto;
  padding-block: clamp(3rem, 8vw, 6rem);
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
  scroll-margin-top: calc(var(--header-height, 90px) + 16px);
  border-top: 1px solid var(--line);
}
.hero { border-top: 0; padding-top: clamp(4rem, 12vw, 8rem); padding-bottom: clamp(3rem, 8vw, 5rem); }
.hero .lead { margin-top: .5rem; }
.cols { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.prose { min-width: 0; }
.lead { font-size: 1.2rem; color: var(--paper-2); max-width: 60ch; }

/* hero */
.kicker { color: var(--yellow); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: .9rem; }
.display { position: relative; display: inline-block; font-size: clamp(3.4rem, 12vw, 8.5rem); font-weight: 800; text-transform: uppercase; margin-bottom: .2em; }
.display > span:last-child { position: relative; z-index: 1; }
.cta-row { display: flex; gap: .8rem; flex-wrap: wrap; margin: 1.25rem 0 0; }
.note { font-size: .9rem; color: var(--paper-3); }

/* buttons */
.btn {
  min-height: 44px; max-width: 100%; justify-content: center; text-align: center;
  display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: .05em; text-transform: uppercase;
  padding: .75rem 1.4rem; border-radius: 6px; border: 2px solid transparent;
  transition: transform .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-deep); }
.btn-ghost { border-color: var(--paper-3); color: var(--paper); }
.btn-ghost:hover { border-color: var(--paper); }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-yellow:hover { background: #ffd34d; }
.btn-sm { font-size: .95rem; padding: .45rem .9rem; }

/* stamp label (echo of the 改善 seal) */
.stamp {
  display: inline-block; color: var(--red); border: 2px solid var(--red); padding: .15rem .6rem;
  font-family: var(--display); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 1rem;
  transform: rotate(-1.5deg); margin-bottom: 1rem;
}

/* stats */
.stats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.stat { background: var(--ink-2); border: 1px solid var(--line); border-left: 4px solid var(--red); padding: 1rem; min-width: 0; }
.stat-num { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 5vw, 3rem); line-height: 1; color: var(--yellow); }
.stat-label { display: block; margin-top: .3rem; font-weight: 600; }
.stat-foot { display: block; font-size: .8rem; color: var(--paper-3); }

/* segmented control */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 1.2rem; }
.station-cards { display: none; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-variant-numeric: tabular-nums; }
.bench-table { min-width: 0; }
th, td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--display); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .95rem; color: var(--paper-2); background: var(--ink-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num-col { color: var(--paper-3); font-family: var(--display); font-weight: 700; }
td.load-cell { font-weight: 600; color: var(--yellow); white-space: nowrap; }
td.name-cell { font-weight: 600; white-space: nowrap; }
td.std-cell { color: var(--paper-2); font-size: .95rem; min-width: 220px; }

.penalties { margin-top: 2rem; }
.pen-list, .rox-list { margin: 0; display: grid; gap: .4rem; }
.pen-list div, .rox-list div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--line); padding: .4rem 0; }
.pen-list dt, .rox-list dt { color: var(--paper-2); min-width: 0; }
.pen-list dd, .rox-list dd { margin: 0; font-weight: 600; color: var(--yellow); font-variant-numeric: tabular-nums; }
.pen-list div { flex-direction: column; gap: .2rem; }
.rox-list dd { white-space: nowrap; }
.pen-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); column-gap: 2rem; margin-bottom: 1.5rem; }

/* cards */
.card { background: var(--ink-2); border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem; min-width: 0; }
.card h3 { margin-top: 0; }
.card-tag { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 3px; margin-bottom: .6rem; }
.tag-official { background: var(--red); color: #fff; }
.tag-placeholder { background: transparent; color: var(--yellow); border: 1px dashed var(--yellow); }
.card.placeholder { border-style: dashed; border-color: var(--yellow); }
.card-cite { font-size: .85rem; color: var(--paper-3); margin-bottom: .8rem; }
.card-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 1rem 0; }
.card-stats div { min-width: 0; }
.card-stats b { display: block; font-family: var(--display); font-size: 1.5rem; color: var(--yellow); line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card-stats span { font-size: .78rem; color: var(--paper-3); }
.card-body { color: var(--paper-2); font-size: .98rem; }
.card-source { font-size: .8rem; color: var(--paper-3); margin-top: .5rem; }

/* calculator */
.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-bottom: .8rem; }
.calc label { display: grid; gap: .25rem; font-size: .85rem; color: var(--paper-2); font-weight: 600; }
.calc input {
  font: inherit; font-size: 1.1rem; font-variant-numeric: tabular-nums; color: var(--paper); background: var(--ink-3);
  border: 1px solid var(--line); border-radius: 6px; padding: .5rem .7rem; width: 100%; min-width: 0;
}
.calc input:focus-visible { border-color: var(--yellow); box-shadow: none; }
.calc-error { color: var(--yellow); font-weight: 600; font-size: .9rem; }
.calc-out { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.calc-out div { border-top: 2px solid var(--red); padding-top: .4rem; min-width: 0; }
.calc-out dt { font-size: .8rem; color: var(--paper-3); }
.calc-out dd { margin: 0; font-family: var(--display); font-size: 1.8rem; font-weight: 800; color: var(--paper); line-height: 1.1; }

/* takeaways */
.takeaways { margin-top: 2rem; background: var(--yellow); color: var(--ink); border-radius: 8px; padding: 1.5rem; }
.takeaways h3 { color: var(--ink); }
.takeaways ol { margin: 0; padding-left: 1.3rem; display: grid; gap: .5rem; font-weight: 500; }
.takeaways li::marker { font-family: var(--display); font-weight: 800; color: var(--red); }

/* links */
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.link-item { display: block; text-decoration: none; color: inherit; background: var(--ink-2); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; min-width: 0; transition: border-color .15s ease, transform .15s ease; }
.link-item:hover { border-color: var(--red); transform: translateY(-2px); }
.link-item strong { display: block; font-family: var(--display); font-size: 1.3rem; font-weight: 700; }
.link-item span { color: var(--paper-2); font-size: .95rem; }
.link-item .card-tag { margin: 0 0 .3rem; }

/* instagram */
.ig-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.ig-card { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; color: inherit; background: var(--ink-2); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; height: 100%; min-width: 0; transition: border-color .15s ease, transform .15s ease; }
.ig-card:hover { border-color: var(--yellow); transform: translateY(-2px); }
.ig-handle { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--yellow); overflow-wrap: anywhere; }
.ig-name { font-weight: 600; }
.ig-role { color: var(--paper-2); font-size: .92rem; }
.ig-card.placeholder { border-style: dashed; border-color: var(--yellow); }

/* player */
.player { position: relative; aspect-ratio: 16 / 9; max-width: 100%; width: min(100%, 800px); background: var(--ink-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 1rem; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* sources & footer */
.sources h2 { font-size: 2rem; }
.source-list { padding-left: 1.3rem; display: grid; gap: .35rem; font-size: .9rem; color: var(--paper-2); }
.source-list a { color: var(--paper); overflow-wrap: anywhere; }
.foot { border-top: 1px solid var(--line); padding: 2rem var(--gutter); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--paper-3); font-size: .9rem; position: relative; z-index: 1; padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
.foot p { margin: 0; }
.foot a { color: var(--paper); }

/* placeholders in text (e.g. missing logo) */
.ph { color: var(--yellow); border: 1px dashed var(--yellow); padding: 0 .3rem; border-radius: 3px; font-size: .85em; }

/* Card layouts: shared rows align content without fixed heights or clipped text. */
.card h3 { line-height: 1.2; text-wrap: pretty; }
.card-body { font-size: 1rem; line-height: 1.7; }
.card-cite { color: var(--paper-2); line-height: 1.5; }
.card-tag { justify-self: start; align-self: start; letter-spacing: .05em; }
.link-item { height: 100%; }
.link-list > li, .ig-grid > li { min-width: 0; }
.link-item strong { display: block; line-height: 1.25; margin-bottom: .6rem; }
.link-item > span:last-child { display: block; line-height: 1.65; }
.ig-name { line-height: 1.45; }
.ig-role { line-height: 1.6; }

@media (min-width: 701px) {
  #science-cards, #course-cards { align-items: stretch; row-gap: 1.25rem; }
  #science-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #science-cards > .card {
    display: grid; grid-template-rows: subgrid; grid-row: span 5; gap: 1rem;
    padding: 1.5rem;
  }
  #science-cards .card > * { margin: 0; }
  #science-cards .card h3 { font-size: 1.75rem; }
  #science-cards .card-stats { display: flex; flex-direction: column; gap: .85rem; }
  #science-cards .card-stats > div { padding-bottom: .85rem; border-bottom: 1px solid var(--line); }
  #science-cards .card-stats b { font-size: 1.6rem; line-height: 1.25; overflow-wrap: normal; }
  #science-cards .card-stats span { display: block; font-size: .9rem; color: var(--paper-2); margin-top: .2rem; line-height: 1.45; }
  #science-cards .btn, #course-cards .btn { align-self: end; justify-self: start; font-size: 1rem; }
  #course-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #course-cards > .card { display: grid; grid-template-rows: subgrid; grid-row: span 4; gap: .9rem; padding: 1.5rem; }
  #course-cards .card > * { margin: 0; }
  #course-cards h3 { font-size: 1.75rem; }
  #pacing > .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  #pacing > .cols > .card { padding: 1.5rem; }
  #pacing > .cols > .calc { grid-column: 1 / -1; }
  .calc-grid, .calc-out { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
  .calc label { grid-template-rows: 1fr auto; font-size: .95rem; }
  .calc input { min-height: 48px; }
  .calc-out dt { font-size: .9rem; color: var(--paper-2); }
  .calc-out dd { margin-top: .35rem; }
  #calc .small { max-width: 85ch; }
  .link-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
  .link-item { padding: 1.4rem; }
  .link-item strong { font-size: 1.5rem; }
  .ig-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
  .ig-card { padding: 1.4rem; gap: .65rem; }
  .ig-handle { font-size: 1.35rem; }
}
@media (min-width: 701px) and (max-width: 1050px) {
  #science-cards { grid-template-columns: minmax(0, 1fr); }
  #science-cards > .card { grid-row: auto; grid-template-rows: auto; }
  #science-cards .card-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ig-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .top { grid-template-columns: auto auto; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; font-size: .82rem; min-height: 44px; display: flex; align-items: center; }
  .lang { justify-self: end; }
}
@media (max-width: 700px) {
  body::after { display: none; }
  .top { gap: .5rem; padding-block: .5rem; }
  .top.nav-ready { grid-template-columns: 1fr auto auto; }
  .brand { min-height: 44px; }
  .brand img { width: 100px; }
  .lang { grid-column: 2; grid-row: 1; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    grid-column: 3; grid-row: 1; min-height: 44px; padding: .5rem .65rem;
    border: 1px solid var(--line); border-radius: 6px; background: var(--ink-3);
    color: var(--paper); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  }
  .menu-icon { width: 14px; height: 10px; border-block: 2px solid currentColor; }
  .menu-btn[aria-expanded="true"] { color: var(--yellow); border-color: var(--yellow); }
  .nav-ready .nav { display: none; }
  .nav-ready.menu-open .nav {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem;
    margin: 0; padding: .5rem 0; max-height: 65dvh; overflow-y: auto;
  }
  .nav-ready .nav a { white-space: normal; background: var(--ink-2); padding: .65rem .75rem; }
  .hero { padding-block: 2.75rem 3rem; }
  .display { font-size: clamp(3rem, 12.5vw, 5.25rem); line-height: .98; }
  h2 { font-size: clamp(2rem, 8.5vw, 3rem); line-height: 1.05; }
  h3 { line-height: 1.15; overflow-wrap: anywhere; }
  .lead { font-size: 1.05rem; line-height: 1.6; }
  .cols, .cols-3 { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .cta-row .btn { width: 100%; }
  .stats { gap: .75rem; }
  .stat { padding: .85rem; }
  .stat:nth-child(n+3) { grid-column: 1 / -1; }
  .stat-num { font-size: 2.5rem; }
  .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
  .seg-btn { background: var(--ink-2); min-height: 48px; }
  .stations-desktop { display: none; }
  .station-cards { display: grid; gap: .85rem; }
  .station-card { padding: 1rem; background: var(--ink-2); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
  .station-heading { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1rem; }
  .station-heading h3 { margin: 0; font-size: 1.6rem; }
  .station-number { font: 800 1.35rem var(--display); color: var(--yellow); }
  .station-facts { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: .75rem; margin: 0 0 .9rem; }
  .station-facts dt { font-size: .8rem; color: var(--paper-2); }
  .station-facts dd { margin: .2rem 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
  .station-facts div:last-child dd { color: var(--yellow); }
  .station-standard { margin: 0; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .95rem; color: var(--paper-2); }
  .card, .takeaways { padding: 1rem; }
  .card .btn { width: 100%; }
  .bench-table { table-layout: fixed; }
  .bench-table th, .bench-table td { padding: .65rem .35rem; font-size: .85rem; letter-spacing: 0; overflow-wrap: anywhere; }
  .bench-table th:first-child { width: 36%; }
  .card-stats { grid-template-columns: 1fr; gap: .65rem; }
  .card-stats div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: center; gap: .75rem; padding-bottom: .65rem; border-bottom: 1px solid var(--line); }
  .card-stats span { font-size: .85rem; color: var(--paper-2); }
  .calc label { grid-template-rows: 1fr auto; }
  .calc input { min-height: 48px; }
  .calc-out dd { font-size: 1.65rem; }
  .source-list { gap: .65rem; }
  .source-list a { display: inline-block; padding-block: .35rem; }
  .foot a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (max-width: 360px) {
  .lang-btn { padding-inline: .5rem; }
  .menu-btn { gap: .35rem; padding-inline: .5rem; }
  .station-facts { grid-template-columns: 1fr; }
  .calc-grid, .calc-out { gap: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
  .btn:hover, .link-item:hover, .ig-card:hover { transform: none; }
}

.rox-list + .small { margin-top: .85rem; }
