:root {
  --bg: #fbf6ef;
  --card: #ffffff;
  --ink: #2b2420;
  --muted: #7a6e66;
  --line: #ece3d8;
  --a: #ff7a59;
  --a-soft: #ffe6dd;
  --b: #3d8bfd;
  --b-soft: #e1edff;
  --chip: #f5eee5;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .07);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1714;
    --card: #25211d;
    --ink: #f3ece4;
    --muted: #a99d92;
    --line: #3a332d;
    --a: #ff8c6e;
    --a-soft: #4a2c22;
    --b: #6aa6ff;
    --b-soft: #1f3150;
    --chip: #322c26;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1714; --card: #25211d; --ink: #f3ece4; --muted: #a99d92; --line: #3a332d;
  --a: #ff8c6e; --a-soft: #4a2c22; --b: #6aa6ff; --b-soft: #1f3150; --chip: #322c26;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, select { font: inherit; color: inherit; }
a { color: var(--b); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }

.wrap { max-width: 920px; margin: 0 auto; padding: 32px 16px 48px; }

.hero { text-align: center; margin-bottom: 20px; }
.hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -.02em;
}
.hero h1::after { content: " 👟"; }
.hero p { margin: 6px auto 0; max-width: 520px; color: var(--muted); font-size: 1.05rem; }

.gender {
  display: flex;
  width: max-content;
  margin: 0 auto 22px;
  padding: 4px;
  background: var(--chip);
  border-radius: 999px;
}
.gender button {
  border: 0;
  background: none;
  padding: 8px 22px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}
.gender button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.pickers {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: start;
}
.card {
  background: var(--card);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}
#cardA { border-top: 6px solid var(--a); }
#cardB { border-top: 6px solid var(--b); }

.label { display: block; font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.label.small { margin-top: 18px; }

.brand-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--line);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23998877' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border-radius: 14px;
  padding: 12px 40px 12px 14px;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
}
.brand-select:focus-visible, button:focus-visible { outline: 3px solid var(--b); outline-offset: 2px; }

.sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.size {
  min-width: 52px;
  padding: 8px 6px;
  border: 0;
  border-radius: 12px;
  background: var(--chip);
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease;
}
.size:hover { transform: translateY(-1px); }
.size[aria-checked="true"] { background: var(--a); color: #fff; }

.swap {
  align-self: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform .2s ease;
}
.swap:hover { transform: rotate(180deg); }

.result { margin-top: 18px; }
.big {
  font-size: clamp(3.2rem, 11vw, 4.6rem);
  font-weight: 900;
  line-height: 1;
  color: var(--b);
  letter-spacing: -.02em;
}
.big .eu { font-size: .35em; vertical-align: .9em; letter-spacing: .04em; }
.big.none { color: var(--muted); }
.equation { margin: 10px 0 12px; font-weight: 800; font-size: 1.1rem; }
.facts { margin: 0; display: grid; gap: 6px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 12px; }
.facts div:first-child { background: var(--a-soft); }
.facts div:last-child { background: var(--b-soft); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; white-space: nowrap; }
.verdict { margin: 14px 0 4px; font-weight: 700; }
.result .muted { margin: 4px 0 0; font-size: .95rem; }

.scale-card, .table-card, .notes {
  margin-top: 18px;
  background: var(--card);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.scale-card h2 { margin: 0; font-size: 1.15rem; font-weight: 900; }
.scale-card > p { margin: 4px 0 18px; font-size: .95rem; }

.scale { position: relative; padding-left: 110px; }
.lane { display: flex; align-items: center; height: 54px; margin-left: -110px; }
.lane-name { width: 110px; flex: none; font-weight: 800; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane-track { position: relative; flex: 1; height: 100%; border-bottom: 2px dashed var(--line); }
.dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: .78rem;
  background: var(--chip);
  white-space: nowrap;
}
.lane.a .dot.on { background: var(--a); color: #fff; z-index: 1; transform: translate(-50%, -50%) scale(1.15); }
.lane.b .dot.on { background: var(--b); color: #fff; z-index: 1; transform: translate(-50%, -50%) scale(1.15); }
.dot b { font-weight: 800; }
.ruler { height: 34px; }
.ruler-track { position: relative; height: 100%; border-top: 2px solid var(--ink); }
.tick { position: absolute; top: 0; width: 2px; height: 6px; background: var(--muted); transform: translateX(-50%); }
.tick.whole { height: 11px; background: var(--ink); }
.tick i { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .8rem; font-weight: 700; color: var(--muted); }
.cm-unit { position: absolute; right: 0; top: 14px; font-size: .75rem; color: var(--muted); display: none; }
.marker {
  position: absolute;
  top: -4px;
  bottom: 30px;
  left: calc(110px + (100% - 110px) * var(--x) / 100);
  border-left: 2px dashed var(--a);
  pointer-events: none;
}

.table-card summary, .foot summary { cursor: pointer; font-weight: 800; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
th:nth-child(1), td:nth-child(1) { color: var(--a); font-weight: 800; }
th:nth-child(3), td:nth-child(3) { color: var(--b); font-weight: 800; }
tr.current td { background: var(--chip); }

.notes p { margin: 0; }
.notes p + p { margin-top: 8px; }

.foot { margin-top: 26px; color: var(--muted); font-size: .92rem; }
.foot p { margin: 0 0 10px; }
.foot ul { columns: 2; padding-left: 18px; }

@media (max-width: 700px) {
  .pickers { grid-template-columns: 1fr; }
  .swap { justify-self: center; transform: rotate(90deg); }
  .swap:hover { transform: rotate(270deg); }
}
@media (max-width: 560px) {
  .scale { padding-left: 0; }
  .lane { margin-left: 0; flex-direction: column; align-items: stretch; height: auto; }
  .lane-name { width: auto; font-size: .85rem; padding: 0 0 2px; }
  .lane-track { flex: none; height: 44px; }
  .dot { min-width: 30px; height: 30px; font-size: .7rem; }
  .marker { left: calc(var(--x) * 1%); top: 18px; }
  .size { min-width: 46px; }
  .foot ul { columns: 1; }
}
