:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #19212e;
  --muted: #667085;
  --line: #d9dee8;
  --line-strong: #bec7d6;
  --gold: #b98522;
  --gold-soft: #fff2d6;
  --teal: #087f8c;
  --teal-soft: #dff6f4;
  --build-a: #087f8c;
  --build-a-soft: rgba(8, 127, 140, 0.16);
  --build-b: #b98522;
  --build-b-soft: rgba(185, 133, 34, 0.18);
  --red: #a33b3b;
  --green: #216e4e;
  --soft: #fbfcff;
  --input: #ffffff;
  --hover: #fbfffe;
  --topbar: rgba(255, 255, 255, 0.88);
  --brand-bg: #19212e;
  --brand-ink: #ffffff;
  --shadow: 0 18px 50px rgba(20, 31, 47, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10141b;
  --panel: #171d27;
  --ink: #eef3f8;
  --muted: #9ca7b7;
  --line: #2b3544;
  --line-strong: #465468;
  --gold: #e0b35a;
  --gold-soft: rgba(224, 179, 90, 0.15);
  --teal: #56d6cc;
  --teal-soft: rgba(86, 214, 204, 0.14);
  --build-a: #56d6cc;
  --build-a-soft: rgba(86, 214, 204, 0.18);
  --build-b: #e0b35a;
  --build-b-soft: rgba(224, 179, 90, 0.18);
  --red: #ff7d86;
  --green: #6be3a3;
  --soft: #1d2531;
  --input: #121923;
  --hover: #17262a;
  --topbar: rgba(18, 25, 35, 0.92);
  --brand-bg: #eef3f8;
  --brand-ink: #121923;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(8, 127, 140, 0.08), transparent 260px),
    var(--bg);
}

.site-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.site-content {
  min-width: 0;
}

.ad-rail {
  display: none;
}

.ad-box {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  width: 160px;
  min-height: 600px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--muted);
  text-align: center;
  box-shadow: var(--shadow);
}

.ad-box span {
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ad-box strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.ad-box ins {
  width: 100%;
  min-height: 600px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.22rem;
  line-height: 1.1;
}

h2 {
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h3 {
  font-size: 1rem;
}

#patchMeta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.brand-tagline {
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.25;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost-button,
.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--input);
  color: var(--ink);
  text-decoration: none;
}

.ghost-button:hover,
.source-link:hover {
  border-color: var(--teal);
}

.loading-state {
  display: grid;
  gap: 6px;
  max-width: 560px;
  margin: 80px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.loading-state strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(500px, 1fr) minmax(300px, 380px);
  gap: 18px;
  padding: 18px;
  align-items: start;
}

.view-tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.view-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.view-tabs button.active {
  background: var(--teal);
  color: var(--brand-ink);
}

:root[data-view="builder"] .compare-view,
:root[data-view="compare"] .builder-view {
  display: none;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.champion-panel,
.build-panel,
.output-panel,
.comparison-panel {
  padding: 16px;
}

.comparison-panel {
  grid-column: 2 / 4;
}

:root[data-view="compare"] .comparison-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.84rem;
}

.build-heading {
  align-items: start;
}

.build-heading h2 {
  margin-bottom: 4px;
}

.build-tab-wrap {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: min(330px, 100%);
}

.build-tabs {
  display: flex;
  gap: 4px;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  overflow-x: auto;
}

.build-tabs button {
  flex: 0 0 auto;
  min-height: 30px;
  min-width: 38px;
  max-width: 118px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.build-tabs button.active {
  background: var(--teal);
  color: var(--brand-ink);
}

.build-actions,
.preset-toolbar {
  display: flex;
  align-items: end;
  gap: 8px;
}

.preset-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  margin-bottom: 12px;
}

.popular-build-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.popular-build-card {
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  text-align: left;
  color: var(--ink);
}

.popular-build-card:hover {
  border-color: var(--teal);
}

.popular-build-card strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.build-card-items {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.build-card-items img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--line);
}

.build-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.build-card-stat {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--input);
}

.build-card-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.build-card-stat b {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
}

.build-card-source {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.icon-button {
  min-width: 34px;
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 850;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--input);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(8, 127, 140, 0.18);
  border-color: var(--teal);
}

.level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

output {
  min-width: 34px;
  text-align: right;
  color: var(--teal);
  font-weight: 800;
}

.range {
  width: 100%;
  accent-color: var(--teal);
}

.champion-hero {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  min-height: 74px;
}

.champion-hero img {
  width: 74px;
  height: 74px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  background: var(--line);
}

#championTitle {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.mini-stat span,
.stat-label,
.passive-card small,
.ability-card small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.2;
}

.mini-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 1.02rem;
}

.ability-section,
.manual-panel,
.output-panel section {
  margin-top: 18px;
}

.ability-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ability-card,
.passive-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.ability-card img,
.passive-card img {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--line);
}

.ability-card p,
.passive-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.build-slots {
  display: grid;
  grid-template-columns: repeat(6, minmax(64px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.rune-section {
  margin: 4px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.rune-section .panel-heading {
  margin-bottom: 10px;
}

.rune-builder {
  display: grid;
  gap: 10px;
}

.rune-style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.rune-slots {
  display: grid;
  gap: 8px;
}

.rune-slot {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.rune-slot img {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--line);
}

.rune-slot select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--input);
  color: var(--ink);
}

.rune-shards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.build-slot {
  position: relative;
  min-height: 92px;
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--soft);
}

.build-slot.filled {
  border-style: solid;
}

.build-slot img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: block;
  margin-bottom: 6px;
}

.build-slot span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 31px;
  font-size: 0.76rem;
  line-height: 1.25;
}

.remove-slot {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(25, 33, 46, 0.18);
  border-radius: 999px;
  background: var(--input);
  color: var(--red);
  line-height: 1;
}

.shop-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 190px);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.item-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 9px;
  max-height: calc(100vh - 322px);
  min-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.item-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  gap: 9px;
  align-items: start;
  min-height: 88px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
}

.item-card:hover {
  border-color: var(--teal);
  background: var(--hover);
}

.item-card img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--line);
}

.item-card strong {
  display: block;
  line-height: 1.2;
  font-size: 0.88rem;
}

.item-card p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.item-card small {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-weight: 700;
}

.add-item {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 1.1rem;
  font-weight: 800;
}

.scenario-panel {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.passive-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.option-row input[type="number"] {
  width: 92px;
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--input);
  color: var(--ink);
}

.option-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.stat-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stat-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 88px 82px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  background: var(--input);
  border-bottom: 1px solid var(--line);
}

.stat-row:nth-child(2n) {
  background: var(--soft);
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-value {
  text-align: right;
  font-weight: 800;
}

.stat-delta {
  text-align: right;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 750;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.manual-input {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.manual-input input {
  min-height: 34px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 8px;
  background: var(--input);
  color: var(--ink);
}

.passive-summary {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.comparison-panel {
  display: grid;
  gap: 14px;
}

.comparison-heading {
  align-items: end;
  margin-bottom: 0;
}

.comparison-heading h2 {
  margin-bottom: 4px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.compare-card {
  min-height: 104px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 8px;
  background: var(--soft);
}

.compare-card[data-leader="a"] {
  border-left-color: var(--build-a);
}

.compare-card[data-leader="b"] {
  border-left-color: var(--build-b);
}

.compare-card > span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.2;
}

.compare-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.compare-values strong {
  font-size: 0.98rem;
}

.compare-values small {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 850;
  text-align: right;
}

.compare-bars {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.compare-bar-row {
  display: grid;
  grid-template-columns: minmax(58px, 0.55fr) minmax(0, 1fr) 64px;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.compare-track,
.damage-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.compare-fill,
.damage-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
}

.compare-fill.a,
.damage-fill.a {
  background: var(--build-a);
}

.compare-fill.b,
.damage-fill.b {
  background: var(--build-b);
}

.damage-settings {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 112px)) 64px;
  gap: 8px;
  align-items: end;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
}

.damage-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.damage-row {
  display: grid;
  grid-template-columns: minmax(124px, 0.8fr) minmax(132px, 0.8fr) repeat(2, minmax(190px, 1.25fr)) minmax(96px, 0.55fr);
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 10px 12px;
  background: var(--input);
  border-bottom: 1px solid var(--line);
}

.damage-row:nth-child(2n + 1):not(.header) {
  background: var(--soft);
}

.damage-row:last-child {
  border-bottom: 0;
}

.damage-row.header {
  position: sticky;
  top: 78px;
  z-index: 5;
  min-height: 34px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.damage-cell {
  min-width: 0;
}

.damage-cell strong {
  display: block;
  font-size: 0.96rem;
  line-height: 1.2;
}

.damage-cell span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.damage-visual {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.damage-track {
  height: 7px;
}

.winner-a {
  color: var(--build-a);
  font-weight: 850;
}

.winner-b {
  color: var(--build-b);
  font-weight: 850;
}

.winner-even {
  color: var(--muted);
  font-weight: 850;
}

.passive-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  width: fit-content;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #7a5317;
  font-size: 0.72rem;
  font-weight: 800;
}

.passive-tag.calculated {
  background: var(--teal-soft);
  color: var(--teal);
}

.empty-note {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 0.88rem;
}

.site-footer {
  display: grid;
  gap: 6px;
  padding: 16px 18px 24px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.site-footer a {
  color: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.legal-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px;
}

.legal-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.legal-panel h2 {
  margin-top: 4px;
}

.legal-panel p,
.legal-panel li {
  color: var(--muted);
  line-height: 1.55;
}

.legal-panel ul {
  margin: 0;
  padding-left: 20px;
}

@media (min-width: 1540px) {
  .site-frame {
    grid-template-columns: 176px minmax(0, 1500px) 176px;
    gap: 16px;
    justify-content: center;
    padding: 0 16px;
  }

  .ad-rail {
    display: block;
    padding-top: 88px;
  }

  .ad-box {
    position: sticky;
    top: 88px;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: minmax(260px, 330px) minmax(360px, 1fr);
  }

  .output-panel,
  .comparison-panel {
    grid-column: 1 / -1;
  }

  .compare-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar,
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell,
  .shop-toolbar {
    grid-template-columns: 1fr;
  }

  .build-slots {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
  }

  .item-results {
    max-height: none;
  }

  .stat-row {
    grid-template-columns: minmax(94px, 1fr) 80px 70px;
  }

  .comparison-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .compare-grid,
  .damage-settings,
  .damage-row {
    grid-template-columns: 1fr !important;
  }

  .damage-row.header {
    display: none;
  }
}
