:root {
  color-scheme: dark;
  --bg: #0c1117;
  --panel: #151d26;
  --panel-2: #1d2833;
  --text: #edf3f8;
  --muted: #9fb0bf;
  --line: #2d3a46;
  --gold: #c9a45a;
  --red: #c85f59;
  --green: #5fb98c;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
  background: #101820;
  color: var(--text);
  border-radius: 6px;
}

button {
  min-height: 38px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--gold);
}

input,
select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
}

.shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.builder {
  min-height: calc(100vh - 48px);
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 1;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.patch {
  color: var(--muted);
  text-align: right;
}

.patch-inline {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.controls,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-weight: 700;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checkgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101820;
  color: var(--muted);
}

.check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--gold);
}

.check img {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
}

.check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option {
  min-height: 40px;
  color: var(--text);
}

.primary {
  height: 48px;
  border-color: #8f743a;
  background: var(--gold);
  color: #17140d;
  font-weight: 900;
}

.result {
  display: grid;
  gap: 18px;
}

.hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 420px;
  overflow: hidden;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111820;
  box-shadow: var(--shadow);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(12,17,23,.92), rgba(12,17,23,.45), rgba(12,17,23,.88));
}

.hero > div {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

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

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  color: var(--muted);
}

.rules ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 22px;
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--muted);
}

.build-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.icons,
.ability-priority,
.items,
.rune-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.runes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.rune-path {
  min-width: 0;
}

.rune-path-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 900;
}

.rune-path-title img {
  width: 34px;
  height: 34px;
}

.rune-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  width: 82px;
  color: var(--muted);
  text-align: center;
}

.tile img {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.tile strong,
.tile span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.item-row {
  display: grid;
  grid-template-columns: 34px 50px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
}

.item-row .step {
  color: var(--gold);
  font-weight: 900;
  text-align: center;
}

.item-row img {
  width: 50px;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.item-row strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile strong {
  margin-top: 5px;
  color: var(--text);
  font-size: 12px;
}

.tile span {
  font-size: 11px;
}

.ability {
  width: 92px;
}

.ability .letter {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #231e13;
  color: var(--gold);
  font-size: 30px;
  font-weight: 900;
}

.tile > .letter {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--gold);
  font-size: 26px;
  font-weight: 900;
}

.skill-order {
  display: grid;
  grid-template-columns: repeat(18, minmax(36px, 1fr));
  gap: 6px;
}

.skill {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101820;
  color: var(--muted);
  font-weight: 800;
}

.skill b {
  color: var(--text);
}

.share {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

@media (max-width: 1000px) {
  .layout,
  .build-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
    max-height: none;
  }
}

@media (max-width: 650px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .rules ol,
  .share {
    display: block;
  }

  .patch {
    margin-top: 8px;
    text-align: left;
  }

  .hero {
    min-height: 340px;
    padding: 22px;
  }

  .checkgrid {
    grid-template-columns: 1fr;
  }

  .skill-order {
    grid-template-columns: repeat(6, 1fr);
  }

  .share button {
    width: 100%;
    margin-top: 8px;
  }

  .runes {
    grid-template-columns: 1fr;
  }
}
