:root {
  --bg: #ffffff;
  --surface: #f5f6f7;
  --surface-2: #eceef0;
  --line: #d6dadf;
  --line-soft: #e8ebee;
  --text: #1d2125;
  --muted: #5d6670;
  --accent: #a3262a;
  --link: #22549e;
  --parry: #3d6aa8;
  --perfect: #a3262a;
  --dodge: #4a7a5c;
  --font: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191c;
    --surface: #1d2125;
    --surface-2: #262b30;
    --line: #363d44;
    --line-soft: #2a3036;
    --text: #e4e7ea;
    --muted: #9ba4ad;
    --accent: #e0706b;
    --link: #8fb4f2;
    --parry: #7d9fd6;
    --perfect: #e0706b;
    --dodge: #84b495;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15.5px/1.55 var(--font); }
a { color: var(--link); }
h1, h2, h3 { line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.55rem; margin: 0 0 6px; }
h2 { font-size: 1.2rem; margin: 36px 0 8px; }
h3 { font-size: 1.02rem; margin: 26px 0 6px; }
p { margin: 0 0 12px; max-width: 72ch; }
ul { padding-left: 1.2em; max-width: 72ch; }
li { margin: 3px 0; }
code { font-family: inherit; background: var(--surface-2); padding: 0 4px; border-radius: 3px; font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
main:focus-visible { outline: none; }
.skip, .sr { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 8px; z-index: 20; background: var(--bg); padding: 6px 10px; }

/* frame */
.topbar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.version { color: var(--muted); font-size: 0.88rem; }
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.sidenav { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding: 18px 12px 24px 24px; }
.sidenav .group { margin: 0 0 16px; }
.sidenav .group-name { display: block; font-size: 0.82rem; color: var(--muted); margin: 0 0 4px 10px; }
.sidenav a {
  display: block; padding: 5px 10px; border-left: 3px solid transparent; color: var(--text);
  text-decoration: none; font-size: 0.95rem; border-radius: 0 3px 3px 0;
}
.sidenav a:hover { background: var(--surface); }
.sidenav a[aria-current="page"] { border-left-color: var(--accent); background: var(--surface); font-weight: 700; }
main { padding: 22px 28px 48px; min-width: 0; min-height: 70vh; outline: none; }
.page-intro { color: var(--muted); margin-bottom: 18px; }
.foot { border-top: 1px solid var(--line); padding: 14px 24px 28px; color: var(--muted); font-size: 0.85rem; }
.foot p { max-width: none; margin: 0; }

@media (max-width: 860px) {
  .topbar { padding: 10px 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidenav {
    position: sticky; top: 0; z-index: 10; display: flex; gap: 2px; overflow-x: auto; max-height: none;
    padding: 0 8px; background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none;
  }
  .sidenav .group { display: contents; }
  .sidenav .group-name { display: none; }
  .sidenav a { flex: none; border-left: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 10px 7px; }
  .sidenav a[aria-current="page"] { border-bottom-color: var(--accent); background: none; }
  main { padding: 16px 16px 40px; }
}

/* controls */
select, input[type="search"] {
  font: inherit; font-size: 0.95rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; min-height: 34px; max-width: 100%;
}
input[type="search"] { width: min(100%, 280px); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 0.93rem; color: var(--text); background: var(--bg); border: 0;
  border-right: 1px solid var(--line); padding: 5px 11px; cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button {
  font: inherit; font-size: 0.9rem; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 4px; padding: 3px 10px; cursor: pointer;
}
.chips button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
label.check { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; }
label.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin: 12px 0 8px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 0.85rem; color: var(--muted); }
button.action {
  font: inherit; font-size: 0.93rem; padding: 6px 12px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--text); background: var(--text); color: var(--bg);
}
button.action.secondary { background: var(--bg); color: var(--text); border-color: var(--line); }

/* tables */
.table-wrap { overflow-x: auto; margin: 8px 0 6px; border: 1px solid var(--line); border-radius: 4px; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { padding: 6px 10px; text-align: left; vertical-align: top; }
thead th { background: var(--surface-2); font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
tbody tr:nth-child(even) td { background: var(--surface); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: 0.7em; }
th[aria-sort="descending"]::after { content: " ▼"; font-size: 0.7em; }
td .sub { display: block; color: var(--muted); font-size: 0.82rem; }
.stat .internal { display: block; color: var(--muted); font-size: 0.78rem; }
.tag { display: inline-block; font-size: 0.82rem; padding: 0 6px; border-radius: 3px; background: var(--surface-2); margin: 1px 3px 1px 0; white-space: nowrap; }
.count { color: var(--muted); font-size: 0.88rem; margin: 6px 0 0; }

/* parry window calculator */
.calc { border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px 12px; margin: 6px 0 4px; }
.calc .toolbar { margin-top: 0; }
.lane { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 12px; margin: 8px 0; }
.lane-name { font-weight: 700; font-size: 0.95rem; line-height: 1.2; }
.lane-name small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.lane-bar {
  position: relative; height: 28px; border-right: 3px solid var(--accent);
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 12 - 1px), var(--line-soft) calc(100% / 12 - 1px) calc(100% / 12));
}
.fill { position: absolute; right: 0; top: 4px; bottom: 4px; transition: width 300ms ease-out; }
.fill.parry { background: var(--parry); }
.fill.perfect { background: var(--perfect); }
.fill.dodge { background: var(--dodge); }
.fill-label { position: absolute; top: 50%; transform: translateY(-50%); right: calc(100% + 8px); white-space: nowrap; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.axis { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; font-size: 0.78rem; color: var(--muted); }
.axis-scale { position: relative; height: 16px; }
.axis-scale span { position: absolute; transform: translateX(50%); white-space: nowrap; }
.axis-scale .strike { color: var(--accent); }
.calc-foot { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
@media (max-width: 640px) {
  .lane, .axis { grid-template-columns: 84px minmax(0, 1fr); gap: 8px; }
  .axis-scale span:first-child { display: none; }
  .fill-label { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) { .fill { transition: none; } }

/* list + detail */
.split { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 10px; }
.picker { border-right: 1px solid var(--line); padding-right: 12px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.picker h4 { margin: 12px 0 2px; font-size: 0.82rem; font-weight: 400; color: var(--muted); }
.picker h4:first-child { margin-top: 0; }
.picker button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 0.93rem; color: var(--text);
  background: none; border: 0; padding: 4px 8px; border-radius: 3px; cursor: pointer;
}
.picker button:hover { background: var(--surface); }
.picker button[aria-current="true"] { background: var(--surface-2); font-weight: 700; }
.picker-select { display: none; width: 100%; margin-bottom: 8px; }
.detail h2 { margin-top: 0; }
.detail .flavor { color: var(--muted); font-style: italic; }
.levels-extra { margin: 8px 0; padding-left: 0; list-style: none; }
.levels-extra li { margin: 3px 0; }
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .picker { display: none; }
  .picker-select { display: block; }
}

/* loadout */
.loadout { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 10px; }
.slots { min-width: 0; }
.slots fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 10px 0 12px; min-width: 0; }
.slots legend { font-weight: 700; padding: 0 8px 0 0; }
.slot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 6px 0; }
.slot select { width: 100%; }
.slot input[type="range"] { width: 100%; accent-color: var(--accent); }
.slot output { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.summary { width: 100%; border-collapse: collapse; margin: 0 0 8px; }
.summary th { text-align: left; font-weight: 400; color: var(--muted); padding: 5px 12px 5px 0; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.summary td { padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.summary td b { font-size: 1.05rem; }
.warn { color: var(--accent); }
@media (max-width: 860px) { .loadout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .stat .internal { display: none; } th, td { padding: 6px 8px; } }
