@font-face {
  font-family: "Noto Sans KR";
  src: url("fonts/noto-sans-kr-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans KR";
  src: url("fonts/noto-sans-kr-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans KR";
  src: url("fonts/noto-sans-kr-900.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

:root {
  --bg: #eef0f3;
  --card: #fff;
  --sunk: #f5f6f8;
  --ink: #11151b;
  --ink-2: #4f5762;
  --ink-3: #646b75;
  --line: #e3e6ea;
  --line-2: #eff1f3;
  --brand: #c8262d;
  --sel: #11151b;
  --sel-ink: #fff;
  --avg: #9aa1aa;
  --behind: #8a919a;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #d99600;
  --s5: #e06a9c;
  --s6: #6250d6;
  --r-great: #0b7a55;
  --r-good: #2e7d32;
  --r-mid: #e3a400;
  --r-low: #b9531c;
  --r-bad: #c53030;
  --r-ink: #fff;
  --r-mid-ink: #2a1d00;
  --card-shadow: 0 1px 2px rgba(17, 21, 27, .06);
  --segment-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  --popup-shadow: 0 12px 32px rgba(17, 21, 27, .14);
  --dialog-backdrop: rgba(17, 21, 27, .45);
  color-scheme: light;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --card: #1a1d22;
    --sunk: #22262c;
    --ink: #f1f3f5;
    --ink-2: #b1b7bf;
    --ink-3: #8a919a;
    --line: #2b2f36;
    --line-2: #23272d;
    --brand: #e5484d;
    --sel: #f1f3f5;
    --sel-ink: #0e1013;
    --avg: #8a919a;
    --behind: #6b727c;
    --s1: #3987e5;
    --s2: #e8642e;
    --s3: #1fb27e;
    --s4: #d99a10;
    --s6: #8f84ea;
    --card-shadow: none;
    --dialog-backdrop: rgba(0, 0, 0, .65);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
button, select { cursor: pointer; }
h1, h2, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.container {
  max-width: 1280px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.top-bar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 36px;
  min-height: 36px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--r-ink);
  font-size: 12px;
}

.account {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
}

#user-name {
  overflow: hidden;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.action:hover { background: var(--sunk); }

.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--card);
}

.primary:hover { background: var(--ink); opacity: .88; }

.view-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.link-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search {
  position: relative;
  flex: 1 1 360px;
  max-width: 360px;
  min-width: 0;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding-inline: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--sunk);
  color: var(--ink-3);
}

.search-field:focus-within { border-color: var(--ink); }

.search-field svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-field input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--ink);
}

.search-field input::placeholder { color: var(--ink-3); }

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  inset-inline: 0;
  max-height: min(360px, 60vh);
  overflow: auto;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--popup-shadow);
  list-style: none;
}

.search:focus-within .search-results:not([hidden]) { display: block; }

.search-results li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-weight: 700;
}

.face {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--sunk);
  color: var(--ink-3);
  font-weight: 700;
}

.face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-name { flex: 1; }

.slot-1 { --slot: var(--s1); }
.slot-2 { --slot: var(--s2); }
.slot-3 { --slot: var(--s3); }
.slot-4 { --slot: var(--s4); }
.slot-5 { --slot: var(--s5); }
.slot-6 { --slot: var(--s6); }

.slotted-face {
  outline: 2px solid var(--slot);
  outline-offset: 2px;
}

.small-action {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.small-action:hover:not(:disabled) { background: var(--sunk); }
.small-action:disabled { color: var(--ink-3); cursor: default; }
.small-action[aria-pressed="true"] {
  border-color: var(--sel);
  background: var(--sel);
  color: var(--sel-ink);
}

.filters, .tiers, .all-tier {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filters { padding-block: 16px 12px; }
.all-tier { gap: 4px 8px; }

.chip, .filter-select {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font-weight: 700;
  white-space: nowrap;
}

.filter-select { field-sizing: content; }

.chip:hover, .filter-select:hover { color: var(--ink); }

.chip[aria-pressed="true"] {
  border-color: var(--sel);
  background: var(--sel);
  color: var(--sel-ink);
}

.chip-count {
  margin-left: 4px;
  font-weight: 400;
}

.untiered {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
  gap: 16px;
  padding-bottom: max(48px, env(safe-area-inset-bottom));
}

.primary-column, .side-column { display: grid; gap: 16px; min-width: 0; }

.card {
  min-width: 0;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--card-shadow);
}

.card-heading, .terrain-header { padding: 16px 20px 0; }

.card-heading {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -.01em;
}

.card-body { padding: 12px 20px 20px; }
.stats-error { padding: 12px 20px 20px; }

.saved-view {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.saved-view h2 {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.view-dialog {
  width: min(360px, calc(100% - 32px));
  max-width: none;
  padding: 16px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--popup-shadow);
}

.view-dialog::backdrop { background: var(--dialog-backdrop); }
.view-dialog h2, .view-dialog label { font-size: 16px; font-weight: 700; }
.view-dialog .view-actions { justify-content: flex-end; margin-top: 16px; }

.view-dialog input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sunk);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 2;
  width: max-content;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  border-radius: 12px;
  background: var(--ink);
  color: var(--card);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.toast:not(:empty) { padding: 10px 16px; }

.baseline-profile {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 0 4px 8px;
}

.hero-face {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  outline-offset: 3px;
  font-size: 28px;
  font-weight: 900;
}

.champion-name {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.baseline-tags, .lineup-list, .momentum-marks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.baseline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag, .momentum-marks li {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.verdict {
  margin-top: 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.verdict strong { color: var(--slot); font-weight: 900; }

.baseline-ratings {
  display: flex;
  gap: 4px;
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}

.baseline-rating {
  display: flex;
  flex: 1;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 4px;
}

.baseline-rating dd { margin: 0; }
.baseline-rating dt, .lineup-games, .lineup-priority, .sample-message {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
}

.rating-value {
  display: inline-grid;
  place-items: center;
  height: 26px;
  min-width: 52px;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--r-ink);
  font-weight: 900;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.rating-great { background: var(--r-great); }
.rating-good { background: var(--r-good); }
.rating-mid { background: var(--r-mid); color: var(--r-mid-ink); }
.rating-low { background: var(--r-low); }
.rating-bad { background: var(--r-bad); }
.rating-none, .terrain-hatch {
  background: repeating-linear-gradient(135deg, var(--sunk) 0 4px, var(--line) 4px 5px);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
}

.lineup-list { display: grid; gap: 4px; }

.lineup-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
}

.lineup-row:hover, .lineup-row:has([aria-pressed="true"]) { background: var(--sunk); }
.lineup-identity { overflow-wrap: anywhere; }
.lineup-samples { display: flex; flex-wrap: wrap; column-gap: 4px; }
.lineup-games, .lineup-priority { font-weight: 400; white-space: nowrap; }
.lineup-actions { display: flex; gap: 4px; }

.rank-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.rank-heading h2 { font-size: inherit; }
.rank-heading .filter-select { padding-inline: 12px; }
.rank-tabs { display: flex; gap: 4px; padding: 8px 20px 4px; overflow-x: auto; }
.rank-tab {
  flex: none;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  font-weight: 700;
}

.rank-tab[aria-selected="true"] { background: var(--sunk); color: var(--ink); }
.rank-list { list-style: none; margin: 0; padding: 0 0 12px; }

.rank-row {
  display: grid;
  grid-template-columns: 24px auto minmax(0, 1fr) auto 30px;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
}

.rank-row:hover { background: var(--sunk); }
.rank-number { text-align: right; font-weight: 900; color: var(--ink-3); }
.rank-name { display: block; overflow-wrap: anywhere; }
.rank-caption { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.rank-games { color: var(--ink-3); font-size: 12px; }

.rank-add {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink-2);
  font-weight: 700;
}

.rank-add:hover:not(:disabled) { background: var(--sunk); }
.rank-add:disabled, .rank-add[aria-pressed="true"] { color: var(--ink-3); cursor: default; }
.rank-add[aria-pressed="true"] { border-color: transparent; background: var(--sunk); }
.rank-add[aria-pressed="true"]::before {
  content: "";
  width: 8px;
  height: 4px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg);
}

.momentum-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.momentum-legend::before {
  content: "";
  width: 20px;
  border-top: 2px dashed var(--avg);
}

.momentum-frame { position: relative; }

.momentum-chart {
  display: block;
  width: 100%;
  height: 240px;
  fill: var(--ink-3);
  font-size: 11px;
}

.momentum-zero { stroke: var(--line); }
.momentum-gridline { stroke: var(--line-2); }
.momentum-line-lead { color: var(--slot); fill: currentColor; }
.momentum-line-behind { color: var(--behind); fill: currentColor; }
.momentum-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.momentum-average, .power-average path {
  fill: none;
  stroke: var(--avg);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}
.momentum-hit { fill: transparent; }
.momentum-marker { stroke: var(--slot); }
.momentum-marker line { stroke-dasharray: 2 3; }
.momentum-marker circle { fill: var(--card); stroke-width: 2; }
.momentum-marker path {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.momentum-marks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.momentum-marks li { height: 28px; }

.momentum-tip {
  position: absolute;
  top: 32px;
  right: 8px;
  display: grid;
  gap: 4px;
  min-width: 144px;
  max-width: calc(100% - 16px);
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--popup-shadow);
  font-size: 12px;
  pointer-events: none;
}

.momentum-tip.tip-left { right: auto; left: 8px; }
.momentum-tip div { display: flex; justify-content: space-between; gap: 12px; }
.momentum-tip strong { font-size: 14px; font-weight: 900; text-align: right; }

.power-curve-header, .comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 16px 20px 0;
}

.power-curve-header .card-heading, .comparison-header .card-heading { padding: 0; }

.power-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--sunk);
}

.power-tab {
  border: 0;
  border-radius: 8px;
  padding: 5px 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.power-tab:hover, .power-tab[aria-selected="true"] {
  background: var(--card);
  color: var(--ink);
}

.power-tab[aria-selected="true"] { box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.power-series { opacity: .72; }
.power-series path, .power-average path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.power-series path { stroke: var(--slot); stroke-width: 2; }
.power-baseline { opacity: 1; }
.power-baseline path { stroke-width: 3.5; }
.power-average .power-dot { fill: var(--avg); }
.power-series .power-dot, .power-end .power-dot { fill: var(--slot); }
.power-end line { stroke: var(--slot); }
.power-end { pointer-events: none; }

.power-end-label {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding-left: 2px;
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
}

.power-end-label .face { width: 18px; height: 18px; outline-offset: 0; }
.power-end-label span:last-child { color: var(--ink-2); }
.power-tip { right: auto; }
.power-tip .face { width: 20px; height: 20px; }
.power-tip div { align-items: center; gap: 8px; }
.power-tip-row span:nth-child(2) { margin-right: auto; }
.power-tip-average { border-top: 1px solid var(--line); padding-top: 4px; }
.power-sample { word-break: keep-all; }
.momentum-frame + .power-sample { margin-top: 8px; }

.opponent-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opponent-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 8px 12px;
}

.opponent-button .face { width: 20px; height: 20px; outline-offset: 0; }

.comparison-names {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.comparison-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.comparison-name:last-child { flex-direction: row-reverse; text-align: right; }
.comparison-name .face { width: 32px; height: 32px; }

.comparison-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding-block: 6px;
}

.comparison-row > :last-child { text-align: right; }
.comparison-value, .comparison-missing { color: var(--ink-3); font-weight: 500; }
.comparison-winner { color: var(--ink); font-weight: 900; }
.comparison-winner::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-start: 6px;
  border-radius: 50%;
  background: var(--slot);
  vertical-align: middle;
}
.comparison-metric {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  word-break: keep-all;
}

.tier-curve-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tier-curve-button {
  display: block;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sunk);
  color: var(--ink);
  padding: 8px;
  text-align: left;
}

.tier-curve-button:hover, .tier-curve-button[aria-pressed="true"] {
  border-color: var(--ink);
}

.tier-curve-button[aria-pressed="true"] .tier-curve-title {
  background: var(--sel);
  color: var(--sel-ink);
}

.tier-curve-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 6px;
  border-radius: 8px;
  padding: 2px 6px;
}

.tier-curve-pane {
  display: grid;
  margin-top: 4px;
  aspect-ratio: 2 / 1;
}

.tier-curve { display: block; width: 100%; }
.tier-curve-placeholder { display: grid; place-items: center; border-radius: 8px; }

.terrain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.terrain-header .card-heading { padding: 0; }

.terrain-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--sunk);
}

.terrain-toggle button {
  min-width: 48px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.terrain-toggle button[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--segment-shadow);
}

.terrain-toggle button:disabled { opacity: .55; cursor: default; }

.terrain-table, .terrain-row { display: grid; gap: 4px; }
.terrain-row { grid-template-columns: 90px repeat(5, minmax(0, 1fr)); }

.terrain-label {
  display: grid;
  place-items: center;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.terrain-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.terrain-cell strong { font-weight: 900; }
.terrain-cell small { font-size: 12px; }

.terrain-legend, .terrain-scale {
  display: flex;
  align-items: center;
  gap: 6px;
}

.terrain-legend {
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 12px;
}

.terrain-ramp, .terrain-swatch { height: 10px; border-radius: 3px; }
.terrain-ramp { width: 72px; }
.terrain-swatch { width: 18px; border: 1px solid var(--line); }
.terrain-surface { width: 100%; height: 400px; }

.terrain-failure {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-block: 10px;
  color: var(--ink-2);
}

.access-card {
  max-width: 32rem;
  margin: 20px auto;
  padding: 12px 20px 20px;
}

body > .access-card { width: calc(100% - 32px); }

.access-card h1 {
  margin-bottom: 12px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -.03em;
}

@media (prefers-reduced-motion: no-preference) {
  .layout { transition: opacity 140ms ease-out; }
  .layout[aria-busy="true"] { opacity: .75; }
  .rank-fade { animation: rank-fade .18s ease-out; }
  .toast:not(:empty) { animation: toast-appear .25s cubic-bezier(.16, 1, .3, 1); }
  .power-fade { animation: power-fade 140ms ease-out; }
}

@keyframes rank-fade { from { opacity: .6; } }
@keyframes toast-appear { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes power-fade { from { opacity: 0; } }

@media (width < 1040px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "baseline" "lineup" "momentum" "power-curves" "head-to-head" "tier-curves" "terrain" "ranking";
  }

  .primary-column, .side-column { display: contents; }
  .baseline-card { grid-area: baseline; }
  .lineup-card { grid-area: lineup; }
  .momentum-card { grid-area: momentum; }
  .power-curve-card { grid-area: power-curves; }
  .head-to-head-card { grid-area: head-to-head; }
  .tier-curves-card { grid-area: tier-curves; }
  .terrain-card { grid-area: terrain; }
  .rank-card { grid-area: ranking; }
  #lineup { overflow-x: auto; }
  .lineup-list { display: flex; gap: 8px; }
  .lineup-row {
    flex: 0 0 176px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    border: 1px solid var(--line);
  }
  .lineup-actions { grid-column: 1 / -1; }
}

@media (width < 720px) {
  .top-bar-inner { gap: 8px; }
  .search { display: none; }
  .top-bar .action { padding-inline: 8px; }
  #user-name { display: none; }
  .filters { padding-block: 12px; }
  .card-heading, .terrain-header { padding-inline: 16px; }
  .power-curve-header, .comparison-header { padding-inline: 16px; }
  .card-body { padding: 12px 16px 16px; }
  .terrain-table, .terrain-row { gap: 3px; }
  .terrain-row { grid-template-columns: clamp(58px, 100vw - 300px, 90px) repeat(5, minmax(0, 1fr)); }
  .terrain-label { overflow-wrap: anywhere; }
  .terrain-cell { font-size: 12px; }
  .terrain-surface { height: 320px; }
  .access-card, .stats-error { padding: 16px; }
  .access-card h1 { font-size: 22px; }
  .champion-name, .hero-face { font-size: 22px; }
  .comparison-row { gap: 6px; }
  .tier-curve-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (width < 520px) {
  .saved-view .action { padding-inline: 8px; }
}

@media (width < 390px) {
  .top-bar-inner { gap: 6px; }
  .top-bar .action { padding-inline: 6px; }
}

@media (width < 360px) {
  .top-bar-inner:has(#view-actions:not([hidden])) .brand-name { display: none; }
}

[hidden] { display: none; }
