:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #101318;
  --surface-2: #14181e;
  --surface-3: #191e25;
  --line: #252b33;
  --line-strong: #343c47;
  --text: #d8dee8;
  --text-strong: #f0f3f7;
  --muted: #7d8794;
  --faint: #565f6b;
  --accent: #86a9d7;
  --win: #79c995;
  --win-soft: rgba(121, 201, 149, 0.1);
  --loss: #d47b82;
  --loss-soft: rgba(212, 123, 130, 0.1);
  --warn: #c8a568;
  --content: 1320px;
  --font: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas,
    "Noto Sans Mono CJK SC", "Microsoft YaHei UI", monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button { border: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { color: var(--bg); background: var(--accent); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); }

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 40px), var(--content));
  height: 50px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark { color: var(--accent); font-size: 13px; font-weight: 700; }
.brand strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
main { width: min(calc(100% - 40px), var(--content)); margin: 0 auto; }

.button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}
.button:hover { border-color: var(--muted); color: var(--text-strong); background: var(--surface-3); }
.button-primary { border-color: #54769f; color: #e8f2ff; background: #263d59; }
.button-primary:hover { border-color: var(--accent); background: #2c4665; }
.button-ghost { color: #a6afbb; background: transparent; }
.button.compact { min-height: 28px; padding: 0 10px; font-size: 10px; }
.button:focus-visible,
.tab:focus-visible,
.drop-zone:focus-visible,
input:focus-visible,
select:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

.landing {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: clamp(88px, 17vh, 160px) 0 60px;
}
.landing-head { margin-bottom: 19px; }
.eyebrow,
.dataset-kicker,
.section-heading span,
.insight-card > span,
.timeline-card > div:first-child > span {
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.landing h1 {
  margin: 5px 0 0;
  color: var(--text-strong);
  font-size: clamp(20px, 3vw, 27px);
  font-weight: 500;
  letter-spacing: -.03em;
}
.drop-zone {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 92px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  text-align: left;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: var(--surface-2); }
.drop-icon { display: grid; width: 32px; height: 32px; place-items: center; color: var(--muted); }
.drop-icon svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.5;
}
.drop-copy, .drop-copy strong, .drop-copy span { display: block; min-width: 0; }
.drop-copy strong { color: var(--text-strong); font-size: 12px; font-weight: 600; }
.drop-copy span { margin-top: 3px; color: var(--faint); font-size: 10px; }
.rep-location {
  margin-top: 14px;
  color: var(--muted);
  font-size: 10px;
}
.rep-location span { color: var(--faint); }
.rep-location p { margin: 5px 0 3px; }
.rep-location code {
  display: block;
  overflow-wrap: anywhere;
  color: #a6afbb;
  font: inherit;
}

.loading-view {
  display: flex;
  min-height: calc(100vh - 50px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}
.loading-view strong { margin-top: 5px; color: var(--text-strong); font-size: 12px; }
.loading-view span { color: var(--muted); font-size: 10px; }
.loader-ring {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.dashboard { padding: 20px 0 48px; }
.dataset-bar {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.dataset-copy { min-width: 0; }
.dataset-bar h2 {
  max-width: min(720px, 66vw);
  margin: 2px 0 1px;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dataset-bar p {
  margin: 0;
  overflow: hidden;
  color: var(--faint);
  font-size: 8px;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dataset-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.notice {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 2px solid var(--warn);
  color: #bcae91;
  background: #15140f;
  font-size: 9px;
}
.notice strong, .notice span { display: inline; }
.notice span::before { content: " "; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 10px 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.metric {
  min-width: 0;
  min-height: 82px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.metric span, .metric b, .metric small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric span { color: var(--muted); font-size: 9px; }
.metric b {
  margin: 5px 0 2px;
  color: var(--text-strong);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -.04em;
}
.metric small { color: var(--faint); font-size: 8px; }
.metric.cyan b, .metric.win b, .metric.positive b { color: var(--win); }
.metric.pink b { color: var(--accent); }
.metric.loss b, .metric.negative b { color: var(--loss); }

.tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
.tab {
  min-width: 88px;
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 15px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 10px;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { color: var(--text-strong); background: var(--surface-3); box-shadow: inset 0 -2px var(--accent); }
.panel { border: 1px solid var(--line); border-top: 0; background: var(--surface); }
.tab-panel:not([hidden]) { animation: panel-in 100ms ease-out; }

.toolbar {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 155px 130px auto;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}
.search-field {
  display: grid;
  min-width: 0;
  min-height: 30px;
  grid-template-columns: 27px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  background: var(--bg);
}
.search-field:focus-within { border-color: var(--accent); }
.search-field svg {
  width: 14px;
  justify-self: center;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.5;
}
.search-field input {
  min-width: 0;
  height: 28px;
  padding: 0 8px 0 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 10px;
}
.search-field input::placeholder { color: var(--faint); }
.toolbar select {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 25px 0 9px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  color: var(--muted);
  background: var(--bg);
  font-size: 10px;
}
.toolbar select:focus { border-color: var(--accent); }
.result-count { min-width: 54px; color: var(--faint); font-size: 9px; text-align: right; }

.match-list-head, .match-row {
  display: grid;
  grid-template-columns: 104px minmax(250px, 1fr) 22px minmax(250px, 1fr) 88px 56px;
  align-items: center;
  column-gap: 4px;
}
.match-list-head {
  min-height: 27px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  background: var(--bg);
  font-size: 8px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.match-list-head > span:nth-child(2) { padding-right: 5px; text-align: right; }
.match-list-head > span:nth-child(4) { padding-left: 5px; text-align: left; }
.match-row { min-height: 66px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.match-row:last-child { border-bottom: 0; }
.match-row:hover { background: var(--surface-2); }
.match-row time, .match-duration, .match-result { min-width: 0; }
.match-row time b, .match-row time small, .match-duration b, .match-duration small, .match-result small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-row time b, .match-duration b { color: #abb4bf; font-size: 10px; font-weight: 600; }
.match-row time small, .match-duration small, .match-result small { margin-top: 2px; color: var(--faint); font-size: 8px; }

.player-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 48px;
  align-items: center;
  gap: 9px;
  width: 100%;
  max-width: 300px;
  min-height: 56px;
  min-width: 0;
  justify-self: end;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: inherit;
  text-decoration: none;
  text-align: right;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.player-cell.reverse {
  grid-template-columns: 48px minmax(0, 1fr) auto;
  justify-self: start;
  text-align: left;
}
.player-cell .avatar { grid-column: 3; grid-row: 1; }
.player-cell > div { grid-column: 2; grid-row: 1; width: 100%; min-width: 0; }
.player-cell .winner-mark { grid-column: 1; grid-row: 1; }
.player-cell.reverse .avatar { grid-column: 1; }
.player-cell.reverse .winner-mark { grid-column: 3; }
.player-cell[href]:hover {
  border-color: var(--line-strong);
  background: var(--surface-3);
}
.player-cell[href]:hover strong { color: var(--accent); }
.player-cell[href]:hover .avatar { border-color: var(--accent); }
.player-cell[href]:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
  background: var(--surface-3);
}
.player-cell strong, .player-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-cell strong { color: #c5ccd5; font-size: 12px; font-weight: 650; line-height: 1.25; }
.player-cell small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.player-cell.winner strong { color: var(--text-strong); }
.avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 1px;
  background: var(--bg);
  object-fit: cover;
}
.winner .avatar { border-color: var(--win); }
.avatar.tiny { width: 26px; height: 26px; }
.avatar.large { width: 58px; height: 58px; }
.winner-mark {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid #477859;
  color: var(--win);
  background: var(--win-soft);
  font-size: 8px;
  font-weight: 700;
}
.versus { color: var(--faint); font-size: 9px; text-align: center; }
.match-owner-missing { color: var(--warn); font-size: 8px; }
.match-row-invalid { opacity: .72; }
.match-result { text-align: center; }
.result-badge {
  display: inline-flex;
  min-width: 30px;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--bg);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .04em;
}
.result-badge.known, .result-badge.win, .result-badge.victory {
  border-color: #477859;
  color: var(--win);
  background: var(--win-soft);
}
.result-badge.loss, .result-badge.defeat {
  border-color: #7a484d;
  color: var(--loss);
  background: var(--loss-soft);
}
.match-duration { text-align: right; }
.load-more { display: flex; width: calc(100% - 16px); margin: 8px; }
.empty-state {
  display: flex;
  min-height: 160px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}
.empty-state strong { color: var(--text); font-size: 11px; font-weight: 500; }
.empty-state span { margin-top: 4px; color: var(--faint); font-size: 9px; }

.section-heading {
  display: flex;
  min-height: 55px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.section-heading h3 { margin: 2px 0 0; color: var(--text-strong); font-size: 14px; font-weight: 500; }
.section-heading p { max-width: 520px; margin: 0; color: var(--faint); font-size: 9px; text-align: right; }
.data-table { width: 100%; overflow-x: auto; }
.table-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) 65px minmax(180px, 1fr) 120px 70px;
  align-items: center;
  gap: 12px;
  min-width: 760px;
  min-height: 52px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
}
.table-row:last-child { border-bottom: 0; }
.table-row:not(.table-head):hover { background: var(--surface-2); }
.table-head {
  min-height: 27px;
  color: var(--faint);
  background: var(--bg);
  font-size: 8px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.table-player, .table-player b, .table-player small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-player b { color: var(--text); font-size: 10px; font-weight: 600; }
.table-player small { margin-top: 2px; color: var(--faint); font-size: 7px; }
.table-player a, .steam-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 2px;
}
.table-player a:hover, .steam-link:hover { color: var(--accent); text-decoration-color: var(--accent); }
.steam-links {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
}
.steam-id {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.steam-id:not(.unavailable):hover { color: var(--accent); }
.steam-id.unavailable { color: var(--faint); }
.steam-client {
  flex: 0 0 auto;
  padding: 1px 3px;
  border: 1px solid var(--line-strong);
  color: var(--faint);
  font-size: 6px;
  letter-spacing: .06em;
}
.steam-client:hover { border-color: var(--accent); color: var(--accent); }
.opponent-characters {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  overflow-x: auto;
  padding: 3px 0;
}
.mini-character {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  color: #aeb6c0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-character > span { display: block; min-width: 0; }
.mini-character small { display: block; margin-top: 1px; color: var(--faint); font-size: 6px; }
.rate { color: var(--text-strong); font-size: 12px; font-weight: 500; }

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--line);
}
.character-card {
  display: grid;
  grid-template-columns: 22px 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 76px;
  padding: 8px 10px;
  background: var(--surface);
}
.character-card:hover { background: var(--surface-2); }
.rank { align-self: start; color: var(--faint); font-size: 8px; }
.character-copy { min-width: 0; }
.character-copy h4 {
  margin: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.character-copy p {
  margin: 2px 0 7px;
  overflow: hidden;
  color: var(--faint);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usage-bar { width: 100%; height: 2px; overflow: hidden; background: var(--line); }
.usage-bar i { display: block; height: 100%; min-width: 2px; background: var(--accent); }
.character-card > strong { color: var(--text); font-size: 13px; font-weight: 500; }
.character-rate { min-width: 78px; text-align: right; }
.character-rate strong { display: block; color: var(--text-strong); font-size: 15px; font-weight: 500; }
.character-rate small { display: block; margin-top: 3px; color: var(--faint); font-size: 6px; white-space: nowrap; }
.character-rate .trend.up { color: var(--win); }
.character-rate .trend.down { color: var(--loss); }

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--line);
}
.insight-card { min-width: 0; background: var(--surface); }
.insight-card.signal { min-height: 92px; padding: 13px; }
.insight-card.signal b {
  display: block;
  margin: 7px 0 3px;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.insight-card.signal p { margin: 0; color: var(--faint); font-size: 8px; }
.timeline-card {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 150px minmax(0, 1fr);
  min-height: 190px;
  padding: 13px;
}
.timeline-card > div:first-child {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  padding: 2px 13px 17px 0;
  border-right: 1px solid var(--line);
}
.timeline-card > div:first-child b { color: var(--text); font-size: 13px; font-weight: 500; line-height: 1.25; }
.timeline-bars {
  display: flex;
  min-width: 0;
  height: 162px;
  align-items: flex-end;
  gap: clamp(4px, 1.5vw, 14px);
  padding: 11px 4px 2px 15px;
  background-image: repeating-linear-gradient(to top, transparent 0 39px, var(--line) 39px 40px);
}
.timeline-bars label {
  position: relative;
  display: grid;
  min-width: 14px;
  height: 100%;
  flex: 1 1 0;
  grid-template-rows: minmax(0, 1fr) 14px;
  align-items: end;
  justify-items: center;
  gap: 4px;
  color: var(--faint);
  font-size: 7px;
}
.timeline-bars label i { width: min(14px, 70%); align-self: end; background: #587699; }
.timeline-bars label b { position: absolute; margin-top: -16px; color: var(--text); font-size: 7px; opacity: 0; }
.timeline-bars label:hover b { opacity: 1; }
.winrate-card {
  position: relative;
  grid-template-columns: 150px minmax(0, 1fr);
  padding-bottom: 28px;
}
.winrate-chart {
  width: 100%;
  height: 160px;
  overflow: visible;
}
.chart-grid { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 5; }
.chart-area { fill: rgba(134, 169, 215, .06); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-point { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.trend-legend {
  position: absolute;
  right: 16px;
  bottom: 8px;
  left: 177px;
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-size: 7px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 16px;
  bottom: 16px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 9px 11px;
  border: 1px solid #477859;
  border-radius: 2px;
  color: #b6ddc4;
  background: #101914;
  font-size: 9px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.toast.error { border-color: #7a484d; color: #e5adb1; background: #1b1113; }
.toast.visible { opacity: 1; transform: translateY(0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes panel-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1050px) {
  .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .match-list-head, .match-row {
    grid-template-columns: 92px minmax(190px, 1fr) 20px minmax(190px, 1fr) 78px 52px;
    column-gap: 3px;
  }
  .player-cell, .player-cell.reverse { gap: 6px; padding-right: 3px; padding-left: 3px; }
}

@media (max-width: 820px) {
  .topbar, main { width: min(calc(100% - 24px), var(--content)); }
  .dashboard { padding-top: 12px; }
  .dataset-bar { align-items: flex-start; flex-direction: column; }
  .dataset-bar h2 { max-width: calc(100vw - 50px); }
  .dataset-actions { width: 100%; }
  .dataset-actions .button { flex: 1; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-field { grid-column: 1 / -1; }
  .result-count { grid-column: 1 / -1; text-align: left; }
  .match-list-head { display: none; }
  .match-list { display: grid; gap: 1px; padding: 1px; background: var(--line); }
  .match-row {
    grid-template-areas: "date date date" "p1 versus p2" "result result duration";
    grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
    gap: 7px 4px;
    min-height: 0;
    padding: 7px;
    border-bottom: 0;
    background: var(--surface);
  }
  .match-row time {
    display: flex;
    grid-area: date;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
  }
  .match-row time small, .match-result small, .match-duration small { margin-top: 0; }
  .match-row time + .player-cell { grid-area: p1; }
  .match-row .versus { grid-area: versus; }
  .match-row .player-cell.reverse { grid-area: p2; }
  .match-result { display: flex; grid-area: result; align-items: center; gap: 7px; text-align: left; }
  .match-duration { grid-area: duration; }
  .insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar, main { width: min(calc(100% - 16px), var(--content)); }
  .topbar { height: 46px; }
  .landing { padding: 72px 0 40px; }
  .drop-zone { grid-template-columns: 28px minmax(0, 1fr); min-height: 104px; padding: 14px; }
  .drop-zone .button { grid-column: 1 / -1; width: 100%; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 68px; padding: 10px; }
  .metric b { font-size: 18px; }
  .tabs { margin-right: -8px; margin-left: -8px; border-right: 0; border-left: 0; }
  .tab { min-width: 78px; padding: 0 11px; }
  .panel { margin-right: -8px; margin-left: -8px; border-right: 0; border-left: 0; }
  .toolbar { grid-template-columns: 1fr; }
  .search-field, .result-count { grid-column: 1; }
  .match-row { gap: 7px 3px; padding: 7px 5px; }
  .player-cell {
    grid-template-columns: auto minmax(0, 1fr) 44px;
    gap: 5px;
    max-width: none;
    min-height: 52px;
    padding: 3px;
    text-align: right;
  }
  .player-cell.reverse { grid-template-columns: 44px minmax(0, 1fr) auto; text-align: left; }
  .player-cell strong { font-size: clamp(9px, 2.55vw, 11px); }
  .player-cell small { margin-top: 2px; font-size: clamp(7px, 2vw, 8.5px); }
  .avatar { width: 44px; height: 44px; }
  .section-heading { min-height: 48px; padding: 8px; }
  .section-heading h3 { font-size: 12px; }
  .section-heading p { display: none; }
  .character-grid, .insight-grid { grid-template-columns: 1fr; }
  .timeline-card { grid-template-columns: 1fr; min-height: 220px; }
  .timeline-card > div:first-child {
    min-height: 43px;
    padding: 0 0 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .timeline-bars { height: 160px; padding-left: 0; overflow-x: auto; }
  .timeline-bars label { min-width: 22px; }
  .winrate-card { grid-template-columns: 1fr; padding-bottom: 28px; }
  .winrate-chart { height: 150px; }
  .trend-legend { left: 13px; }
  .toast { right: 8px; bottom: 8px; max-width: calc(100vw - 16px); }
}

@media (max-width: 360px) {
  .match-row { grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); padding-right: 3px; padding-left: 3px; }
  .player-cell { grid-template-columns: auto minmax(0, 1fr) 38px; gap: 4px; padding-right: 1px; padding-left: 1px; }
  .player-cell.reverse { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .player-cell strong { font-size: 9px; letter-spacing: -.04em; }
  .player-cell small { font-size: 7px; }
  .avatar { width: 38px; height: 38px; }
  .winner-mark { width: 15px; height: 15px; font-size: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
