:root {
  color-scheme: dark;
  --bg: #070a1a;
  --bg-2: #0c1129;
  --panel: #121633;
  --panel-2: #161c3e;
  --line: #232a54;
  --line-2: #2c3466;
  --text: #eef0ff;
  --muted: #8489b8;
  --accent: #a855f7;
  --accent-2: #14b8a6;
  --gold: #fbbf24;
  --danger: #ef4444;
  --radius: 12.5px;
  --radius-sm: 8.75px;
  --shadow: 0 7.5px 22.5px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 3.75px 12.5px rgba(0, 0, 0, 0.3);
  --scale: 1.25;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse 900px 500px at 5% 0%, rgba(88,28,135,0.32) 0%, transparent 55%),
    radial-gradient(ellipse 700px 600px at 95% 5%, rgba(13,59,82,0.38) 0%, transparent 55%),
    radial-gradient(ellipse 1100px 400px at 50% 100%, rgba(20,184,166,0.08) 0%, transparent 65%),
    radial-gradient(ellipse 500px 300px at 20% 55%, rgba(168,85,247,0.06) 0%, transparent 60%),
    linear-gradient(180deg, #040614, #07091f 50%, #060818);
  color: var(--text);
  overflow-x: hidden;
}

.container {
  max-width: 1375px;
  margin: 0 auto;
  padding: 15px 20px;
}

/* ---- Top bar ---- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12.5px;
}

.top-bar h1 {
  margin: 0;
  font-size: 22.5px;
  letter-spacing: 0.06em;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-right {
  display: flex;
  align-items: baseline;
  gap: 17.5px;
}

.lang-select {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7.5px;
  background: var(--panel);
  color: var(--text);
  font-size: 16.25px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.lang-select:hover,
.lang-select:focus {
  border-color: var(--accent);
}

.patch {
  margin: 0;
  color: var(--muted);
  font-size: 16.25px;
}

/* ---- Champion picker ---- */
.champ-picker {
  margin-bottom: 12.5px;
  background: rgba(18,22,51,0.55);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 15px 17.5px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(168,85,247,0.1);
}

.picker-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12.5px;
  margin-bottom: 10px;
}

.picker-title {
  margin: 0;
  font-size: 18.75px;
  font-weight: 600;
  color: var(--text);
}

.import-json-btn {
  background: rgba(168,85,247,0.15);
  border: 1px solid rgba(168,85,247,0.4);
  color: #c4b5fd;
  border-radius: 10px;
  padding: 6.25px 15px;
  font-size: 16.25px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.import-json-btn:hover {
  background: rgba(168,85,247,0.28);
  border-color: rgba(168,85,247,0.7);
}

/* Import modal additions */
.import-textarea {
  width: 100%;
  min-height: 250px;
  max-height: 55vh;
  background: rgba(9,12,30,0.8);
  border: 1px solid rgba(168,85,247,0.25);
  border-radius: 10px;
  color: #d8d7f8;
  font-family: monospace;
  font-size: 15px;
  padding: 12.5px;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.import-textarea:focus {
  border-color: rgba(168,85,247,0.6);
}

.import-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12.5px;
}

.import-error {
  color: #f87171;
  font-size: 15px;
  flex: 1;
}

.champ-search {
  width: 100%;
  padding: 8.75px 12.5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 18.75px;
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.champ-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.champ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
  gap: 5px;
  max-height: 300px;
  overflow-y: auto;
  padding: 2.5px;
  scrollbar-width: thin;
  scrollbar-color: #4f4cb0 transparent;
}

.champ-cell {
  position: relative;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
  aspect-ratio: 1;
}

.champ-cell:hover {
  border-color: var(--accent);
  transform: scale(1.08);
  z-index: 2;
}

.champ-cell.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.4);
}

.champ-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.champ-cell .label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 11.25px;
  text-align: center;
  padding: 2.5px 0;
  background: #000a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Build area (9:16 portrait) ---- */
.build-area {
  width: 675px;
  aspect-ratio: 9 / 16;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7.5px;
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}

.build-area.hidden {
  display: none;
}

/* ---- Card base (used for all panels) ---- */
.card {
  position: relative;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(22,28,62,0.97), rgba(12,17,41,0.98));
  padding: 12.5px 15px;
  box-shadow:
    0 4px 30px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(168,85,247,0.2),
    inset 0 -1px 0 rgba(0,0,0,0.15);
}

.card.hidden {
  display: none;
}

.card-heading {
  margin: 0 0 12.5px;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-hint {
  margin: 10px 2.5px 0;
  text-align: center;
}

/* ---- Hero card (merged with build) ---- */
.hero-card {
  padding: 12.5px 17.5px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(14,18,44,0.98) 0%, rgba(8,11,30,0.97) 100%);
}

.splash-bg {
  position: absolute;
  top: 0; left: 0;
  width: 80%; height: 100%;
  background-size: cover;
  background-position: center top;
  -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.75) 50%, rgba(0,0,0,0.25) 85%, transparent 100%);
  mask-image: linear-gradient(to right, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.75) 50%, rgba(0,0,0,0.25) 85%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.hero-card .card-header {
  position: relative;
  z-index: 1;
}

.hero-build-divider {
  position: relative;
  z-index: 1;
  margin: 10px 0 7.5px;
  border: none;
  height: 1px;
  background: linear-gradient(to right, rgba(168,85,247,0.4) 0%, rgba(168,85,247,0.15) 40%, transparent 80%);
}

.hero-build-heading {
  position: relative;
  z-index: 1;
}

.hero-card .sections,
.hero-card .card-hint {
  position: relative;
  z-index: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12.5px;
  flex-wrap: wrap;
}

.champ-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 140px;
}

.champ-icon {
  width: 65px;
  height: 65px;
  border-radius: 10px;
  border: 2px solid var(--gold);
  object-fit: cover;
  box-shadow:
    0 0 0 3px rgba(251,191,36,0.12),
    0 0 14px rgba(251,191,36,0.25),
    0 3px 10px rgba(0,0,0,0.4);
  flex-shrink: 0;
}

.champ-info { min-width: 0; }

.champ-name {
  margin: 0;
  font-size: 18.75px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 25%, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.champ-title {
  margin: 1.25px 0 5px;
  color: var(--muted);
  font-size: 13.75px;
  font-style: italic;
  letter-spacing: 0.02em;
}

.classification-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2.5px;
}

.classification-label {
  display: none;
}

.champ-tags,
.champ-msr {
  display: flex;
  gap: 6.25px;
  align-items: center;
  flex-wrap: wrap;
}

.tag {
  font-size: 11.25px;
  padding: 2.5px 10px;
  border-radius: 25px;
  background: rgba(168,85,247,0.14);
  border: 1px solid rgba(168,85,247,0.35);
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.msr-tag {
  font-size: 11.25px;
  padding: 2.5px 7.5px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.difficulty-row {
  display: flex;
  align-items: center;
  gap: 6.25px;
  margin-top: 5px;
}

.difficulty-label {
  font-size: 12.5px;
  color: var(--muted);
}

.difficulty-stars {
  display: inline-flex;
  gap: 1.25px;
  font-size: 13.75px;
  color: #40466b;
  line-height: 1;
  cursor: pointer;
}

.difficulty-stars span {
  transition: color .1s, text-shadow .1s;
}

.difficulty-stars span:hover ~ span {
  color: #40466b;
  text-shadow: none;
}

.difficulty-stars .on {
  color: var(--gold);
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.35);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 7.5px;
  flex-wrap: wrap;
}

.champ-radar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 6.25px;
  border: 1px solid rgba(168,85,247,0.18);
  border-radius: var(--radius-sm);
  background: rgba(9, 12, 30, 0.65);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 10px rgba(0,0,0,0.35);
}

.champ-radar svg {
  max-width: 110px;
  height: auto;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ---- Info grid (3 cols: runes | summoners+stats | situational) ---- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.info-card {
  padding: 12.5px 15px;
}

.middle-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.middle-block + .middle-block { border-top: 1px solid var(--line); padding-top: 10px; }

/* ---- Stats panel ---- */
.stats-cost {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 10px;
  background: rgba(9, 12, 30, 0.6);
  border: 1px solid var(--line);
  border-radius: 7.5px;
  margin-bottom: 7.5px;
}

.stats-cost-label {
  font-size: 15px;
  color: var(--muted);
}

.stats-cost-value {
  font-size: 16.25px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3.75px 7.5px;
  border-radius: 5px;
  font-size: 13.75px;
}

.stat-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

.stat-row .stat-label {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-row .stat-icon {
  width: 17.5px;
  height: 17.5px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 4px currentColor;
}

.stat-row .stat-value {
  color: var(--text);
  font-weight: 700;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msr-radar {
  flex-shrink: 0;
  touch-action: none;
}

.msr-radar-handle { cursor: grab; }
.msr-radar.is-dragging .msr-radar-handle,
.msr-radar-handle:active { cursor: grabbing; }
.msr-radar-handle:focus { outline: none; }

/* ---- Sections & items ---- */
.subtitle {
  margin: 0 0 12.5px;
  font-size: 17.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: #cfd2ff;
}

.subtitle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.sit-toggle-btn {
  border: 1px solid var(--line);
  background: rgba(9, 12, 30, 0.5);
  color: #c5c3f2;
  border-radius: 7.5px;
  font-size: 13.75px;
  padding: 5px 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.sit-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Horizontal item stages with arrows */
.sections {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 8px 27.5px;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.sections::-webkit-scrollbar { display: none; }

.build-section {
  display: flex;
  flex-direction: column;
  gap: 7.5px;
  align-items: flex-start;
  min-width: 0;
  flex: 0 0 auto;
  position: relative;
}

.build-section:not(:last-child)::after {
  content: "\2192";
  position: absolute;
  right: -25px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0.55;
}

/* items-row inside normal sections: single horizontal strip */
.build-section:not(.full-with-core) .items-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  justify-content: flex-start;
  min-height: 115px;
  scrollbar-width: none;
}
.build-section:not(.full-with-core) .items-row::-webkit-scrollbar { display: none; }

/* ---- Full section with nested Core ---- */
.full-with-core {
  align-items: flex-start;
  flex: 1 1 0;
  min-width: 0;
}

.full-with-core > .section-title {
  align-self: flex-start;
  margin-bottom: 4px;
}

/* Outer box for Build Completa */
.full-wrap {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: 100%;
  border: 1px solid rgba(168,85,247,0.22);
  border-radius: 10px;
  background: rgba(9, 12, 30, 0.5);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(168,85,247,0.08);
}

/* Core sub-box — left side, vertical layout with border box */
.core-sub {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 5px;
  padding: 7.5px 10px;
  border-right: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  background: rgba(168,85,247,0.04);
  overflow: visible;
  scrollbar-width: none;
}
.core-sub::-webkit-scrollbar { display: none; }

.core-sub-label {
  font-size: 11.25px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #c4b5fd;
  background: rgba(168,85,247,0.15);
  border: 1px solid rgba(168,85,247,0.28);
  border-radius: 25px;
  padding: 2.5px 10px;
  margin-right: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.core-sub .items-row {
  min-height: unset;
  padding: 0;
  border: none;
  background: none;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

/* Full items row — right side, takes remaining width */
.full-with-core .full-items-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 0;
  min-width: 0;
  min-height: 115px;
  padding: 7.5px 12.5px;
  border: none;
  background: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.full-with-core .full-items-row::-webkit-scrollbar { display: none; }

/* End items sub-box — right side wrapper, mirrors core-sub */
.end-sub {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 5px;
  padding: 7.5px 12.5px;
  flex: 1 1 0;
  min-width: 0;
  background: rgba(168,85,247,0.02);
}

.end-sub-label {
  font-size: 11.25px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #c4b5fd;
  background: rgba(168,85,247,0.15);
  border: 1px solid rgba(168,85,247,0.28);
  border-radius: 25px;
  padding: 2.5px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.end-sub .full-items-row {
  padding: 0;
  min-height: unset;
  width: 100%;
  flex-wrap: nowrap;
  align-items: center;
}

/* hide the duplicate dashed border for these inner rows */
.full-wrap .items-row {
  border: none;
}

.section-title {
  margin: 0;
  color: #9ca3f5;
  font-size: 11.25px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  align-self: center;
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.22);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}

.time-target {
  margin: 0;
  color: #d8d7f8;
  font-size: 18.75px;
  font-weight: 600;
  white-space: nowrap;
}

.items-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 3.75px;
  min-height: 115px;
  padding: 5px;
  border-radius: 6px;
  border: 1px dashed rgba(255,255,255,0.05);
  background: rgba(9,12,30,0.3);
  transition: border-color 0.15s, background 0.15s;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #4f4cb0 transparent;
}

.items-row.drag-over-row {
  border-color: var(--accent);
  background: rgba(168, 85, 247, 0.08);
}

.item-btn,
.item-chip {
  border: 1px solid var(--line-2);
  background: rgba(9, 12, 30, 0.7);
  border-radius: 6.25px;
  width: 100px;
  height: 100px;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Stack count badge (for repeated items like potions) */
.item-chip.stacked { border-color: var(--gold); }
.item-stack-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  min-width: 22.5px;
  height: 22.5px;
  padding: 0 6.25px;
  border-radius: 11.25px;
  background: var(--gold);
  color: #1a1400;
  font-size: 13.75px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  pointer-events: none;
}

.item-btn {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.item-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(168,85,247,0.4), 0 0 0 1px rgba(168,85,247,0.15);
}

.item-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.3), 0 0 12px rgba(168,85,247,0.2);
}

.item-chip img,
.item-btn img {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: cover;
}

.item-chip.missing,
.item-btn.missing {
  opacity: 0.35;
  color: #a7a5d8;
  font-size: 12.5px;
  text-align: center;
  line-height: 1.2;
  padding: 5px;
}

.divider {
  margin: 20px 0 17.5px;
  border-top: 1px solid var(--line);
}

/* ---- Situational list (vertical) ---- */
.sit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sit-list.hidden {
  display: none;
}

.sit-item {
  display: flex;
  align-items: center;
  gap: 7.5px;
  padding: 5px 7.5px;
  background: rgba(9, 12, 30, 0.55);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: grab;
  transition: border-color 0.15s, background 0.15s;
}

.sit-item:hover {
  border-color: var(--accent);
  background: rgba(168, 85, 247, 0.08);
}

.sit-item img {
  width: 45px;
  height: 45px;
  border-radius: 6.25px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line-2);
}

.sit-item-info {
  flex: 1;
  min-width: 0;
}

.sit-item-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.sit-item-name {
  font-size: 13.75px;
  font-weight: 600;
  color: #fbf9ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sit-item-gold {
  font-size: 12.5px;
  color: var(--accent);
  flex-shrink: 0;
}

.sit-item-note {
  font-size: 12.5px;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  outline: none;
  width: 100%;
  padding: 1.25px 0;
  margin-top: 1.25px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.sit-item-note::placeholder {
  color: var(--muted);
  font-style: italic;
}

.sit-item-note:focus {
  border-bottom-color: #7d79ee;
}

/* Static replacements for html2canvas capture */
.sit-item-note--static {
  display: block;
  border-bottom: none;
}

.build-desc--static {
  font-size: inherit;
  line-height: 1.5;
  padding: 8px;
}

.sit-item .sit-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #e04060;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.12s;
}

.sit-item:hover .sit-remove {
  opacity: 1;
}

/* ---- Loading message ---- */
.loading-msg {
  color: var(--muted);
  font-size: 17.5px;
  text-align: center;
  padding: 25px;
}

/* ---- Download button ---- */
.download-btn {
  background: linear-gradient(135deg, #6d28d9, var(--accent), #8b5cf6);
  background-size: 200% 100%;
  background-position: 0% 0%;
  color: #fff;
  border: none;
  border-radius: 8.75px;
  padding: 7.5px 17.5px;
  font-size: 13.75px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, background-position 0.3s;
  box-shadow: 0 2px 14px rgba(168,85,247,0.4), inset 0 1px 0 rgba(255,255,255,0.18);
  flex-shrink: 0;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(168,85,247,0.6);
  background-position: 100% 0%;
  filter: brightness(1.08);
}

.download-btn:active {
  transform: scale(0.97);
}

.download-btn.ghost {
  background: rgba(168,85,247,0.08);
  border: 1px solid rgba(168,85,247,0.3);
  color: #c4b5fd;
  box-shadow: none;
}

.download-btn.ghost:hover {
  border-color: var(--accent);
  background: rgba(168, 85, 247, 0.16);
  box-shadow: 0 0 14px rgba(168,85,247,0.2);
  transform: translateY(-1px);
}

.download-btn.downloading {
  opacity: 0.6;
  pointer-events: none;
}

/* ---- Item hover tooltip (rich) ---- */
.item-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 375px;
  min-width: 225px;
  padding: 12.5px 15px;
  background: #1a1840;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  font-size: 12px;
  color: var(--text);
}
.item-tooltip:not(.hidden) {
  opacity: 1;
}
.item-tooltip .tt-name {
  font-weight: 700;
  font-size: 16.25px;
  margin-bottom: 5px;
  color: #fff;
}
.item-tooltip .tt-gold {
  color: var(--accent);
  font-size: 13.75px;
  margin-bottom: 7.5px;
}
.item-tooltip .tt-stats {
  color: #a0e8ff;
  font-size: 13.75px;
  margin-bottom: 7.5px;
  line-height: 1.5;
}
.item-tooltip .tt-desc {
  color: var(--muted);
  font-size: 13.75px;
  line-height: 1.4;
}

/* ---- Empty section placeholder ---- */
.empty-placeholder {
  display: flex;
  align-items: center;
  gap: 7.5px;
  color: var(--muted);
  font-size: 15px;
  font-style: italic;
  padding: 10px 0;
}

/* ---- Build description textarea ---- */
.build-desc-wrap {
  display: flex;
  flex-direction: column;
}

.build-desc {
  width: 100%;
  padding: 7.5px 10px;
  border: 1px solid var(--line);
  border-radius: 7.5px;
  background: #1a1740;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: vertical;
  min-height: 45px;
  outline: none;
  overflow: hidden;
  transition: border-color 0.15s;
  field-sizing: content;
}

.build-desc:focus {
  border-color: #7d79ee;
}

.build-desc::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ---- Hint text ---- */
.hint {
  font-size: 13.75px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

/* ---- Add button (+) ---- */
.add-btn {
  border: 1px dashed var(--line-2);
  background: transparent;
  border-radius: 6.25px;
  width: 100px;
  height: 100px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 35px;
  color: var(--accent);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}

.add-btn:hover {
  border-color: var(--accent);
  color: #fff;
  background: rgba(168, 85, 247, 0.15);
  transform: translateY(-1px);
}

/* ---- Summoners section ---- */
.summoners-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summoners-selected {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.summoner-slot {
  width: 57.5px;
  height: 57.5px;
  border-radius: 7.5px;
  border: 1px solid var(--line-2);
  background: rgba(9, 12, 30, 0.6);
  color: #9c99d9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  font-size: 25px;
}

.summoner-slot:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.summoner-slot.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25);
}

.summoner-slot img {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  object-fit: cover;
}

/* ---- Summoner floating modal ---- */
.summoner-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: transparent;
  animation: fadeIn 0.12s ease;
}

.summoner-modal-overlay.hidden {
  display: none;
}

.summoner-modal {
  position: absolute;
  width: min(400px, calc(100vw - 20px));
  max-height: min(375px, calc(100vh - 20px));
  overflow: hidden;
  background: #1e1a4a;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.summoner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6.25px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: #4f4cb0 transparent;
}

.summoner-cell {
  border: 2px solid transparent;
  background: #1a1740;
  border-radius: 8.75px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3.75px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.summoner-cell:hover {
  border-color: #7d79ee;
  transform: translateY(-1px);
}

.summoner-cell.active {
  border-color: var(--accent);
}

.summoner-cell img {
  width: 37.5px;
  height: 37.5px;
  border-radius: 6.25px;
  object-fit: cover;
}

.summoner-cell-label {
  font-size: 11.25px;
  color: #d2d0f6;
  line-height: 1.1;
  text-align: center;
}

/* ---- Removable item chip ---- */
.item-chip.removable {
  cursor: grab;
  position: relative;
  transition: transform 0.12s, opacity 0.12s;
}

.item-chip.removable:hover {
  transform: scale(1.08);
}

.item-chip.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.item-chip.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #e7d38266;
  transform: scale(1.1);
}

.sit-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.sit-item.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px #e7d38266;
}

.item-chip.removable::after {
  content: "×";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e04060;
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}

.item-chip.removable:hover::after {
  opacity: 1;
}

/* ---- Modal overlay ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  width: min(850px, 100%);
  max-height: 80vh;
  background: linear-gradient(160deg, rgba(22,28,68,0.99), rgba(12,16,42,0.99));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 15px;
  padding: 22.5px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), inset 0 1px 0 rgba(168,85,247,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 21.25px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 32.5px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

/* ---- Tag filter pills inside modal ---- */
.modal-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.modal-controls .champ-search {
  flex: 1 1 0;
  min-width: 0;
}

.item-sort-select {
  flex-shrink: 0;
  padding: 6.25px 12.5px;
  font-size: 15px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}

.item-sort-select:hover,
.item-sort-select:focus {
  border-color: var(--accent);
}

.item-sort-select option {
  background: var(--panel-2);
  color: var(--text);
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6.25px;
}

.filter-tag {
  font-size: 13.75px;
  padding: 3.75px 11.25px;
  border-radius: 12.5px;
  border: 1px solid #4f4cb0;
  background: transparent;
  color: #b0aef0;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.filter-tag:hover {
  background: #3a3580;
}

.filter-tag.active {
  background: #5c58c8;
  color: #fff;
  border-color: #5c58c8;
}

/* ---- Item grid inside modal ---- */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(67.5px, 1fr));
  gap: 6.25px;
  overflow-y: auto;
  max-height: 50vh;
  padding: 5px;
  scrollbar-width: thin;
  scrollbar-color: #4f4cb0 transparent;
}

.item-cell {
  position: relative;
  border: 2px solid transparent;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  transition: border-color 0.12s, transform 0.1s;
}

.item-cell:hover {
  border-color: #7d79ee;
  transform: scale(1.1);
  z-index: 2;
}

.item-cell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.item-cell .item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 10px;
  text-align: center;
  padding: 1.25px 2.5px;
  background: #000b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-cell .item-gold {
  position: absolute;
  top: 2.5px;
  right: 3.75px;
  font-size: 11.25px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.8);
}

/* ================================================================
   RUNE SECTION
   ================================================================ */
.rune-section {
  display: flex;
  flex-direction: column;
  gap: 17.5px;
}

.rune-main-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.rune-main-row .rune-col {
  padding: 10px 7.5px;
  gap: 5px;
}

.rune-main-row .rune-col-label {
  font-size: 12.5px;
  letter-spacing: 0.4px;
  margin-bottom: 0;
}

.rune-main-row .rune-tree-row {
  gap: 5px;
  margin-bottom: 2.5px;
}

.rune-main-row .rune-tree-btn {
  width: 30px;
  height: 30px;
  border-width: 1px;
  padding: 1.25px;
}

.rune-main-row .rune-slot-row {
  gap: 5px;
  padding: 1.25px 0;
}

.rune-main-row .rune-slot-label {
  width: 12.5px;
  font-size: 9px;
}

.rune-main-row .rune-pick {
  width: 35px;
  height: 35px;
  border-width: 1px;
  padding: 1.25px;
}

.rune-main-row .rune-pick.keystone {
  width: 38.75px;
  height: 38.75px;
}

/* --- Column wrapper (primary / secondary / shards) --- */
.rune-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8.75px;
  border: 1px solid rgba(168,85,247,0.14);
  border-radius: 7.5px;
  background: rgba(26,23,64,0.75);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 2px 10px rgba(0,0,0,0.35);
}

.rune-col-label {
  font-size: 11.25px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 1px;
}

/* --- Tree selector row --- */
.rune-tree-row {
  display: flex;
  gap: 5px;
  margin-bottom: 2.5px;
}

.rune-tree-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 2.5px;
  cursor: pointer;
  opacity: .45;
  transition: opacity .15s, border-color .15s;
}

.rune-tree-btn:hover { opacity: .8; }

.rune-tree-btn.active {
  opacity: 1;
  border-color: var(--accent);
}

.rune-tree-btn.disabled {
  pointer-events: none;
  opacity: .2;
}

.rune-tree-btn img {
  width: 100%; height: 100%;
  border-radius: 50%;
}

/* --- Rune slot row --- */
.rune-slot-row {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 1.25px 0;
}

.rune-slot-label {
  font-size: 11.25px;
  color: var(--muted);
  width: 17.5px;
  text-align: center;
  flex-shrink: 0;
}

.rune-pick {
  width: 45px; height: 45px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 2.5px;
  cursor: pointer;
  opacity: .4;
  transition: opacity .15s, border-color .15s, transform .15s;
}

.rune-pick:hover { opacity: .75; transform: scale(1.1); }

.rune-pick.active {
  opacity: 1;
  border-color: var(--accent);
}

.rune-pick.keystone {
  width: 57.5px; height: 57.5px;
}

.rune-pick img {
  width: 100%; height: 100%;
  border-radius: 50%;
}

/* --- Shard row --- */
.shard-row {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 1.25px 0;
}

.shard-pick {
  width: 32.5px; height: 32.5px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 2.5px;
  cursor: pointer;
  opacity: .4;
  transition: opacity .15s, border-color .15s;
}

.shard-pick:hover { opacity: .75; }

.shard-pick.active {
  opacity: 1;
  border-color: var(--accent);
}

.shard-pick img {
  width: 100%; height: 100%;
  border-radius: 50%;
}

/* --- Compact rune summary (shown when all runes are selected) --- */
.rune-compact {
  display: flex;
  flex-direction: column;
  gap: 7.5px;
  padding: 10px 12.5px;
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: 10px;
  background: rgba(22,18,56,0.75);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 2px 12px rgba(0,0,0,0.3);
}

/* ----- Per-tree blocks with color-coded accents ----- */
:root {
  --tree-domination:  #d43d3d;   /* red    */
  --tree-precision:   #e5b84a;   /* gold   */
  --tree-sorcery:     #5a7fd4;   /* blue   */
  --tree-resolve:     #3ea77a;   /* green  */
  --tree-inspiration: #49c3c3;   /* cyan   */
}

.rune-tree-block {
  --tree-color: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7.5px;
  padding: 10px 12.5px 12.5px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--tree-color) 14%, transparent) 0%,
      color-mix(in srgb, var(--tree-color) 4%, transparent) 100%),
    rgba(10,14,34,0.65);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 2px 10px rgba(0,0,0,0.3);
}
.rune-tree-block::before {
  content: "";
  position: absolute;
  left: 0; top: 10%;
  width: 3.75px; height: 80%;
  background: var(--tree-color);
  border-radius: 3px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--tree-color) 60%, transparent);
}

.rune-tree-block.tree-domination  { --tree-color: var(--tree-domination); }
.rune-tree-block.tree-precision   { --tree-color: var(--tree-precision); }
.rune-tree-block.tree-sorcery     { --tree-color: var(--tree-sorcery); }
.rune-tree-block.tree-resolve     { --tree-color: var(--tree-resolve); }
.rune-tree-block.tree-inspiration { --tree-color: var(--tree-inspiration); }
.rune-tree-block.shards-tree      { --tree-color: #8489b8; }

.rune-tree-header {
  display: flex;
  align-items: center;
  gap: 7.5px;
}
.rune-tree-icon {
  width: 20px; height: 20px;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--tree-color) 70%, transparent));
}
.rune-tree-name {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tree-color);
}

.rune-compact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6.25px;
  align-items: center;
}

.rune-picked {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: var(--panel);
  padding: 2px;
  transition: transform .15s;
}

.rune-picked:hover { transform: scale(1.12); }

.rune-picked img {
  border-radius: 50%;
  display: block;
}

/* Use tree color for borders on picked runes inside their block */
.rune-tree-block .rune-picked.summary-keystone {
  border-color: var(--tree-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tree-color) 45%, transparent);
}
.rune-tree-block .rune-picked.summary-minor,
.rune-tree-block .rune-picked.summary-secondary {
  border-color: color-mix(in srgb, var(--tree-color) 70%, transparent);
}

.rune-picked.summary-keystone {
  width: 52.5px; height: 52.5px;
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(251,191,36,0.4);
}

.rune-picked.summary-keystone img { width: 47.5px; height: 47.5px; }

.rune-picked.summary-minor {
  width: 37.5px; height: 37.5px;
  border-color: var(--accent);
}

.rune-picked.summary-minor img { width: 32.5px; height: 32.5px; }

.rune-picked.summary-secondary {
  width: 35px; height: 35px;
  border-color: var(--accent-2);
}

.rune-picked.summary-secondary img { width: 30px; height: 30px; }

.rune-picked.summary-shard {
  width: 27.5px; height: 27.5px;
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
}

.rune-picked.summary-shard img { width: 22.5px; height: 22.5px; }

.rune-edit-btn {
  margin-top: 5px;
  align-self: flex-start;
  padding: 3.75px 12.5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: 20px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.rune-edit-btn:hover {
  background: rgba(168,85,247,0.2);
  border-color: rgba(168,85,247,0.55);
}

/* --- Preview pin button --- */
.rune-preview-pin {
  margin-top: 7.5px;
  align-self: flex-start;
  padding: 3.75px 12.5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.rune-preview-pin:hover {
  color: var(--text);
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.22);
}

/* --- Rune hover/pinned preview panel --- */
.rune-hover-preview {
  display: none;
  gap: 7.5px;
  margin-top: 7.5px;
}

.rune-hover-preview.is-pinned {
  display: flex;
}

.rune-preview-card {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 10px 7.5px;
  border: 1px solid rgba(168,85,247,0.15);
  border-radius: 8.75px;
  background: rgba(18,15,50,0.85);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.rune-preview-title {
  font-size: 11.25px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 2.5px;
}

.rune-preview-trees {
  display: flex;
  gap: 3.75px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.rune-mini-tree {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px; height: 25px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  opacity: .35;
  transition: opacity .15s, border-color .15s;
}

.rune-mini-tree img {
  width: 20px; height: 20px;
  border-radius: 50%;
}

.rune-mini-tree.active {
  opacity: 1;
  border-color: var(--accent);
}

.rune-mini-tree.blocked {
  opacity: .15;
  pointer-events: none;
}

.rune-preview-row {
  display: flex;
  align-items: center;
  gap: 6.25px;
  padding: 1.25px 0;
}

.rune-preview-label {
  font-size: 11.25px;
  color: var(--muted);
  width: 10px;
  text-align: center;
  flex-shrink: 0;
}

.rune-preview-empty {
  font-size: 15px;
  color: rgba(255,255,255,0.2);
}

.rune-preview-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--panel);
  padding: 1px;
}

.rune-preview-icon img {
  border-radius: 50%;
  display: block;
}

.rune-preview-icon.keystone {
  width: 40px; height: 40px;
  border-color: var(--gold);
}

.rune-preview-icon.keystone img { width: 35px; height: 35px; }

.rune-preview-icon.minor {
  width: 27.5px; height: 27.5px;
  border-color: rgba(168,85,247,0.5);
}

.rune-preview-icon.minor img { width: 22.5px; height: 22.5px; }

.rune-preview-icon.secondary {
  width: 25px; height: 25px;
  border-color: rgba(20,184,166,0.5);
}

.rune-preview-icon.secondary img { width: 16px; height: 16px; }

/* ---- Responsive ---- */
/* ================================================================
   RESPONSIVE — Always phone-width layout (base styles)
   ================================================================ */

  /* Base spacing */
  .container { padding: 10px; }

  /* Top bar */
  .top-bar {
    flex-direction: row;
    align-items: center;
    gap: 7.5px;
    margin-bottom: 10px;
  }
  .top-bar h1 { font-size: 18.75px; }
  .top-right { gap: 10px; }
  .patch { font-size: 13.75px; }

  /* Champ picker */
  .champ-grid {
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    max-height: 225px;
  }

  /* Build area */
  .build-area { gap: 7.5px; }
  .card { padding: 12.5px; }
  .hero-card { padding: 12.5px 12.5px 10px; overflow: hidden; }

  /* === HERO CARD — portrait layout === */
  /* Splash covers the top portion instead of the left side */
  .splash-bg {
    width: 100%;
    height: 45%;
    top: 0; left: 0;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.3) 55%, transparent 100%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.3) 55%, transparent 100%);
  }

  /* Stack header vertically */
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Champ info row: icon + name side by side */
  .champ-banner {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 12.5px;
  }

  .champ-icon {
    width: 65px;
    height: 65px;
    flex-shrink: 0;
  }

  .champ-name { font-size: 21.25px; }
  .champ-title { font-size: 12.5px; }

  /* Right side: radar + buttons stacked below champ info */
  .header-right {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .champ-radar svg { max-width: 100px; height: auto; }

  .header-actions {
    flex-direction: row;
    gap: 6.25px;
    flex: 1;
  }

  .header-actions .download-btn {
    flex: 1;
    text-align: center;
    padding: 6px 6px;
    font-size: 10px;
    white-space: nowrap;
  }

  /* Build sections: stacked vertically */
  .sections {
    flex-wrap: wrap;
    gap: 10px 15px;
    overflow-x: visible;
  }

  .build-section { flex: 1 1 auto; min-width: 0; }
  .build-section:not(.full-with-core) { flex: 1 1 100%; width: 100%; }

  .build-section:not(:last-child)::after { display: none; }

  /* Full build box: core on top, full below */
  .full-with-core {
    width: 100%;
    flex: 1 1 100%;
  }

  .full-wrap {
    flex-direction: column;
  }

  .core-sub {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }

  /* Item sizes */
  .items-row { gap: 3.75px; min-height: 85px; }
  .item-btn, .item-chip, .add-btn { width: 72.5px; height: 72.5px; }

  /* Info grid: single column */
  .info-grid { grid-template-columns: 1fr; gap: 7.5px; }
  .sit-card { grid-column: auto; }

  /* Runes: side-by-side columns → stacked */
  .rune-main-row { grid-template-columns: 1fr; gap: 7.5px; }
  .rune-tree-btn { width: 32.5px; height: 32.5px; }
  .rune-pick { width: 35px; height: 35px; }
  .rune-pick.keystone { width: 45px; height: 45px; }
  .shard-pick { width: 27.5px; height: 27.5px; }

  /* Compact rune summary */
  .rune-picked.summary-keystone { width: 45px; height: 45px; }
  .rune-picked.summary-keystone img { width: 40px; height: 40px; }
  .rune-picked.summary-minor { width: 32.5px; height: 32.5px; }
  .rune-picked.summary-minor img { width: 27.5px; height: 27.5px; }

  /* Summoners */
  .summoner-slot { width: 50px; height: 50px; }

  /* Situational */
  .sit-item { gap: 10px; padding: 7.5px; }
  .sit-item img { width: 37.5px; height: 37.5px; }

  /* Modal */
  .modal { max-height: 88vh; padding: 12.5px; border-radius: 12.5px; }
  .modal-controls { flex-direction: row; gap: 7.5px; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6.25px; }
  .summoner-grid { grid-template-columns: repeat(auto-fill, minmax(72.5px, 1fr)); }

/* ================================================================
   RESPONSIVE — Small phones (≤420px)
   ================================================================ */
@media (max-width: 420px) {
  .container { padding: 7.5px; }
  .top-bar h1 { font-size: 17.5px; }

  .champ-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    max-height: 200px;
  }

  .champ-name { font-size: 18.75px; }
  .champ-icon { width: 57.5px; height: 57.5px; }

  .champ-radar { display: none; } /* hide radar on very small screens */

  .header-actions .download-btn {
    font-size: 11.25px;
    padding: 6.25px 6.25px;
  }

  .item-btn, .item-chip, .add-btn { width: 65px; height: 65px; }
  .items-row { min-height: 77.5px; }

  .modal-controls { flex-direction: column; }
  .item-sort-select { width: 100%; }

  .item-grid { grid-template-columns: repeat(auto-fill, minmax(62.5px, 1fr)); }

  .champ-cell .label,
  .item-cell .item-label { font-size: 8.75px; }

  .card-hint { font-size: 11.25px; }
  .summoner-slot { width: 45px; height: 45px; }
}

/* ================================================================
   BUILD AREA COMPACTION — ensure everything fits inside 9:16 frame
   ================================================================ */
.build-area {
  /* Compact canvas tuned for vertical screenshots */
  width: 900px;
  height: auto;
  gap: 7.5px;
  overflow: visible;
}

/* The capture wrapper — exactly what gets exported as the image */
.capture-area {
  display: flex;
  flex-direction: column;
  gap: 7.5px;
  width: 100%;
  background: radial-gradient(circle at 20% 15%, #2e2a66, #151334 60%);
  padding: 17.5px;
  border-radius: 10px;
}

/* Starter + Early items stacked vertically within each section */
.build-area .build-section:not(.full-with-core) .items-row {
  flex-direction: column;
  align-items: flex-start;
  min-height: 0;
}

/* Put info sections (runes / summoners+stats / situational) in 3 columns */
.build-area .info-grid {
  grid-template-columns: 1fr 1fr;
  gap: 7.5px;
  align-items: stretch;
}
.build-area .info-grid .sit-card { grid-column: auto; }
.build-area .info-grid .runes-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.build-area .info-grid .runes-card .rune-section {
  flex: 1 1 auto;
  height: 100%;
}
.build-area .info-grid .runes-card .rune-compact {
  flex: 1 1 auto;
  height: 100%;
  justify-content: space-around;
}
/* When compact summary is shown, rune-section must let its child fill the height */
.build-area .info-grid .runes-card .rune-section:has(> .rune-compact) {
  display: flex;
}
.build-area .info-grid .runes-card .rune-section > .rune-compact {
  width: 100%;
}
.build-area .info-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.build-area .info-right .sit-card { flex: 1 1 auto; }

/* Bottom row of rune compact: shards + summoners side by side */
.runes-bottom-row {
  display: flex;
  flex-direction: row;
  gap: 7.5px;
  align-items: stretch;
}
.runes-bottom-row > .rune-tree-block {
  flex: 1 1 0;
}
.compact-summoners-row {
  display: flex;
  flex-direction: row;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}
.compact-summoner {
  width: 37.5px;
  height: 37.5px;
}

/* When the summoners are rendered inline in the compact rune summary,
   the static #summonersInline in runes-card is hidden. */
.build-area .info-grid .runes-card > #summonersInline {
  display: none;
}

.build-area .card {
  padding: 8.75px 11.25px;
  box-shadow: 0 2.5px 12.5px rgba(0,0,0,0.4), inset 0 1px 0 rgba(168,85,247,0.15);
}
.build-area .card-heading {
  margin: 0 0 6.25px;
  font-size: 11.25px;
  letter-spacing: 0.12em;
  padding-left: 7.5px;
}
.build-area .card-hint { display: none; }

/* Hero header */
.build-area .hero-card { padding: 12.5px 15px 7.5px; }
.build-area .champ-icon { width: 67.5px; height: 67.5px; }
.build-area .champ-name { font-size: 22.5px; line-height: 1.1; }
.build-area .champ-title { font-size: 13.75px; margin: 1.25px 0; }
.build-area .classification-row { margin-top: 3.75px; }
.build-area .difficulty-row { margin-top: 3.75px; font-size: 13.75px; }
.build-area .champ-tag { font-size: 12.5px; padding: 1.25px 8.75px; }
.build-area .msr-tag { font-size: 12.5px; padding: 1.25px 8.75px; }
.build-area .champ-radar svg { max-width: 100px; }
.build-area .hero-build-divider { margin: 6.25px 0 5px; }
.build-area .hero-build-heading { font-size: 13.75px; margin-bottom: 6.25px; }

/* The hero header should keep its original side-by-side layout at 720px */
.build-area .card-header {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12.5px;
}
.build-area .champ-banner { width: auto; flex: 1 1 auto; }
.build-area .header-right {
  width: auto;
  flex-direction: row;
  flex: 0 0 auto;
  gap: 12.5px;
}
.build-area .header-actions {
  flex-direction: column;
  flex: 0 0 auto;
}
.build-area .header-actions .download-btn {
  flex: 0 0 auto;
  font-size: 13.75px;
  padding: 7.5px 15px;
}

/* Build sections side by side */
.build-area .sections { gap: 7.5px 12.5px; flex-wrap: nowrap; }
.build-area .build-section { flex: 1 1 auto; width: auto; min-width: 0; }
.build-area .build-section:not(.full-with-core) { flex: 0 1 auto; width: auto; }
.build-area .section-title { font-size: 11.25px; padding: 2.5px 10px; }
.build-area .items-row {
  gap: 3.75px;
  min-height: 65px;
  overflow: visible;
  flex-wrap: wrap;
}
.build-area .items-row::-webkit-scrollbar { display: none; }
.build-area .full-with-core .full-items-row { overflow: visible; flex-wrap: wrap; }
.build-area .full-with-core .full-items-row::-webkit-scrollbar { display: none; }
.build-area .end-sub .full-items-row { flex-wrap: nowrap; align-items: center; }.build-area .item-btn,
.build-area .item-chip,
.build-area .add-btn { width: 57.5px; height: 57.5px; }
.build-area .full-with-core { flex: 1.4 1 auto; gap: 5px; }
.build-area .full-wrap { flex-direction: row; }
.build-area .core-sub {
  padding: 5px 7.5px;
  border-right: 1px solid rgba(255,255,255,0.07);
  border-bottom: none;
}

/* Description */
.build-area .desc-card { padding: 6.25px 11.25px; }
.build-area .build-desc {
  min-height: 27.5px;
  font-size: 12.5px;
  padding: 5px 7.5px;
  resize: none;
}

/* Runes */
.build-area .runes-card { padding: 7.5px 10px; }
.build-area .rune-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "primary primary"
    "secondary shards";
  gap: 7.5px;
  height: 100%;
  align-content: stretch;
}
.build-area .rune-section > .rune-main-row {
  display: contents;
}
.build-area .rune-section > .rune-main-row > .rune-col:nth-child(1) { grid-area: primary; align-self: stretch; }
.build-area .rune-section > .rune-main-row > .rune-col:nth-child(2) { grid-area: secondary; align-self: stretch; }
.build-area .rune-section > .rune-col { grid-area: shards; align-self: stretch; }
.build-area .rune-section .rune-col {
  display: flex;
  flex-direction: column;
}
.build-area .rune-section .rune-block,
.build-area .rune-section .shards-block {
  flex: 1 1 auto;
}
.build-area .rune-main-row { gap: 0; }
.build-area .rune-block { padding: 5px 7.5px; gap: 3.75px; }
.build-area .rune-tree-row { gap: 3.75px; }
.build-area .rune-tree-btn { width: 22.5px; height: 22.5px; }
.build-area .rune-row { gap: 3.75px; }
.build-area .rune-row-label { font-size: 10px; min-width: 12.5px; }
.build-area .rune-pick { width: 27.5px; height: 27.5px; }
.build-area .rune-pick.keystone { width: 35px; height: 35px; }
.build-area .rune-pick img { width: 22.5px; height: 22.5px; }
.build-area .rune-pick.keystone img { width: 30px; height: 30px; }
.build-area .shards-block { padding: 5px 7.5px; }
.build-area .shard-row { gap: 5px; }
.build-area .shard-row-label { font-size: 10px; min-width: 12.5px; }
.build-area .shard-pick { width: 27.5px; height: 27.5px; padding: 1.25px; }
.build-area .shard-pick img { width: 100%; height: 100%; }

/* Rune compact summary — sizes scale with the runes card (container query) */
.build-area .runes-card { container-type: inline-size; container-name: runes; }
.build-area .rune-summary-row { gap: 5px; padding: 5px 0; }

@container runes (min-width: 0) {
  .build-area .rune-picked.summary-keystone { width: 22cqw; height: 22cqw; }
  .build-area .rune-picked.summary-keystone img { width: 80%; height: 80%; }
  .build-area .rune-picked.summary-minor { width: 17cqw; height: 17cqw; }
  .build-area .rune-picked.summary-minor img { width: 80%; height: 80%; }
  .build-area .rune-picked.summary-secondary { width: 16cqw; height: 16cqw; }
  .build-area .rune-picked.summary-secondary img { width: 80%; height: 80%; }
  .build-area .rune-picked.summary-shard { width: 12cqw; height: 12cqw; }
  .build-area .rune-picked.summary-shard img { width: 80%; height: 80%; }
  .build-area .rune-edit-btn,
  .build-area .edit-runes-btn { font-size: 4cqw; padding: 1.2cqw 2.5cqw; }
}

/* Middle card (summoners + stats) */
.build-area .middle-block { margin-bottom: 6.25px; }
.build-area .summoners-section { gap: 5px; }
.build-area .summoner-slot { width: 42.5px; height: 42.5px; }
.build-area .stats-cost { font-size: 12.5px; padding: 3.75px 7.5px; }
.build-area .stats-list { gap: 2.5px; }
.build-area .stat-row { font-size: 12.5px; padding: 2.5px 5px; }

/* Situational */
.build-area .sit-card { padding: 7.5px 10px; }
.build-area .sit-list { gap: 3.75px; }
.build-area .sit-item { padding: 5px; gap: 6.25px; }
.build-area .sit-item img { width: 30px; height: 30px; }
.build-area .sit-item .sit-text { font-size: 11.25px; line-height: 1.2; }
.build-area .sit-toggle-btn { font-size: 11.25px; padding: 2.5px 7.5px; display: none; }

