:root {
  color-scheme: dark;
  --bg: #06080b;
  --panel: #10151c;
  --panel-2: #151b24;
  --panel-3: #222b36;
  --line: #283341;
  --line-strong: #425169;
  --text: #f4efe3;
  --muted: #aeb9c8;
  --dim: #6f7d8e;
  --gold: #c89b3c;
  --gold-2: #f0cf77;
  --cyan: #0ac8b9;
  --danger: #d35353;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --panel-width: 344px;
  --grid-max-width: 1080px;
  --font-ui: "Source Sans 3", ui-sans-serif, "Segoe UI", "Aptos", "Helvetica Neue", sans-serif;
  --font-display: "Marcellus", "Optima", Georgia, serif;
  font-family: var(--font-ui);
  font-size: 16px;
  letter-spacing: 0;
  line-height: 1.4;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.92  0 0 0 0 0.84  0 0 0 0 0.63  0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 60rem 38rem at 18% -8rem, rgba(10, 200, 185, 0.10), transparent 70%),
    radial-gradient(ellipse 50rem 32rem at 82% -4rem, rgba(200, 155, 60, 0.12), transparent 70%),
    radial-gradient(circle at 50% 140%, rgba(200, 155, 60, 0.06), transparent 60%),
    linear-gradient(168deg, #04060a 0%, #0a1019 52%, #060709 100%);
  color: var(--text);
  font-family: var(--font-ui);
  letter-spacing: 0;
  line-height: 1.4;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--panel-width) minmax(0, 1fr);
  min-height: 100vh;
}

.champion-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 18px 18px;
  border-right: 1px solid rgba(200, 155, 60, 0.28);
  background: rgba(9, 12, 17, 0.94);
  box-shadow: 14px 0 34px rgba(0, 0, 0, 0.25);
}

.panel-head {
  padding: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold-2);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
}

.panel-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.34rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.15;
}

.panel-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.35;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 13px;
  background: #0d1117;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.3;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 155, 60, 0.18);
}

.champion-filters {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: center;
  align-items: center;
  gap: 9px 7px;
  margin: 0 auto;
  padding: 2px 2px 4px;
}

.champion-filter {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: #0d1117;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  transform-origin: center;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.champion-filter:nth-child(6n + 1) { transform: rotate(-3deg)   translateY(1px)  scale(0.98); }
.champion-filter:nth-child(6n + 2) { transform: rotate(2.6deg)  translateY(-2px) scale(1.01); }
.champion-filter:nth-child(6n + 3) { transform: rotate(-1.6deg) translateY(2px)  scale(1); }
.champion-filter:nth-child(6n + 4) { transform: rotate(2.2deg)  translateY(-1px) scale(0.99); }
.champion-filter:nth-child(6n + 5) { transform: rotate(-3.4deg) translateY(2px)  scale(1.02); }
.champion-filter:nth-child(6n)     { transform: rotate(1.8deg)  translateY(-1px) scale(1); }

.champion-filter:hover {
  border-color: var(--line-strong);
  color: var(--text);
  transform: rotate(0deg) translateY(-2px) scale(1.08);
  z-index: 1;
}

.champion-filter.is-active {
  border-color: rgba(200, 155, 60, 0.88);
  background: rgba(200, 155, 60, 0.16);
  color: var(--gold-2);
  transform: rotate(0deg) translateY(0) scale(1.08);
  z-index: 1;
}

.champion-filter:active {
  transform: rotate(0deg) translateY(0) scale(0.96);
}

.champion-list {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 18px 0;
  scrollbar-color: var(--gold) transparent;
}

.champion-tile {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  border: 1px solid rgba(66, 81, 105, 0.7);
  border-radius: 7px;
  padding: 0;
  overflow: hidden;
  background: var(--panel);
  color: var(--text);
  contain: layout paint;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.champion-tile:hover,
.champion-tile:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

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

.champion-tile .champion-name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  min-width: 0;
  padding: 13px 5px 6px;
  overflow: hidden;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.86));
  color: #f7efe0;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.champion-tile .tile-count {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border: 2px solid rgba(7, 9, 13, 0.92);
  border-radius: 999px;
  background: #f1c84b;
  color: #151008;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.48);
}

.champion-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 160px;
  padding: 18px;
  border: 1px dashed rgba(66, 81, 105, 0.8);
  border-radius: var(--radius);
  background: rgba(13, 17, 23, 0.58);
  color: var(--muted);
  text-align: center;
}

.champion-empty strong {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.2;
}

.champion-empty span {
  max-width: 20ch;
  font-size: 0.84rem;
  line-height: 1.35;
}

.workspace {
  min-width: 0;
  padding: 24px clamp(20px, 2.4vw, 32px) 32px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto max-content;
  align-items: center;
  gap: 20px;
  margin: 0 auto 24px;
  max-width: var(--grid-max-width);
}

.workspace-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.24rem, 1.45vw, 1.58rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  justify-self: center;
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-count {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 400;
  line-height: 1;
  color: var(--gold-2);
}

.progress-sep {
  color: var(--dim);
  font-size: 0.85rem;
}

.progress-total {
  font-family: var(--font-ui);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--muted);
}

.progress-label {
  margin-left: 0.5em;
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
}

.actions {
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  border-radius: var(--radius);
  font-weight: 700;
  line-height: 1.2;
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-size: 0.92rem;
  white-space: nowrap;
  transition:
    padding 320ms cubic-bezier(0.22, 1, 0.36, 1),
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.button.is-confirmed {
  padding-right: 36px;
}

.button::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 11px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translate(0, -65%) rotate(-45deg) scale(0.3);
  transform-origin: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.button.is-confirmed::after {
  opacity: 1;
  transform: translate(0, -65%) rotate(-45deg) scale(1);
}

.button:disabled {
  cursor: progress;
  opacity: 0.78;
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .button::after {
    transition-duration: 0ms;
  }
}

.button.primary {
  border-color: var(--gold);
  background: var(--gold);
  color: #1c1610;
  letter-spacing: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 200, 0.32),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 1px 0 rgba(0, 0, 0, 0.35),
    0 8px 22px rgba(200, 155, 60, 0.18);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.button.primary:hover {
  background: var(--gold-2);
  border-color: var(--gold-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 215, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 1px 0 rgba(0, 0, 0, 0.35),
    0 10px 28px rgba(200, 155, 60, 0.26);
}

.button.primary:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 200, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 6px 16px rgba(200, 155, 60, 0.14);
}

.button.secondary {
  border-color: var(--line-strong);
  background: rgba(21, 27, 36, 0.86);
  color: var(--text);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button.secondary:hover {
  border-color: var(--gold);
  background: rgba(28, 35, 46, 0.94);
  color: var(--gold-2);
}

.grid-card {
  max-width: min(var(--grid-max-width), calc((100vh - 286px) * 2));
  margin: 0 auto;
  border: 1px solid rgba(200, 155, 60, 0.34);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(7, 9, 13, 0.9);
  box-shadow: var(--shadow);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  background: #040506;
}

.grid-slot {
  position: relative;
  display: grid;
  grid-template-rows: auto 42px;
  min-width: 0;
  min-height: 0;
  border: 1px solid #06080b;
  padding: 0;
  overflow: hidden;
  background: var(--panel-3);
  color: var(--text);
  contain: layout paint;
  cursor: pointer;
  transition: box-shadow 160ms ease;
}

.grid-slot::before {
  position: absolute;
  inset: 0;
  z-index: 2;
  box-sizing: border-box;
  border: 1px solid transparent;
  pointer-events: none;
  content: "";
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.grid-slot.is-selected {
  z-index: 2;
  outline: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.grid-slot.is-selected::before {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(240, 207, 119, 0.72);
}

.grid-slot:focus-visible {
  outline: none;
}

.grid-slot:focus-visible::before {
  border-color: var(--gold-2);
  box-shadow: inset 0 0 0 1px rgba(240, 207, 119, 0.86);
}

.grid-slot.has-champion .slot-art {
  background: #0a0d12;
}

.slot-art {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  padding: clamp(14px, 1.15vw, 18px);
  background:
    radial-gradient(ellipse at 50% 110%, rgba(200, 155, 60, 0.10), transparent 60%),
    linear-gradient(165deg, #1a232f 0%, #10161f 100%);
}

.slot-art img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 4px;
  object-fit: cover;
  box-shadow:
    0 1px 0 rgba(255, 240, 200, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.42);
}

@keyframes slotPortraitPulse {
  0%   { transform: scale(1); }
  32%  { transform: scale(1.022); }
  100% { transform: scale(1); }
}

.grid-slot.just-selected.has-champion .slot-art img {
  animation: slotPortraitPulse 520ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  .grid-slot.just-selected.has-champion .slot-art img {
    animation: none;
  }
}

.empty-text {
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.25;
  opacity: 0.65;
  transition: opacity 200ms ease, color 200ms ease;
}

.grid-slot:hover .empty-text,
.grid-slot.is-selected .empty-text {
  opacity: 1;
  color: var(--gold-2);
}

.slot-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 6px 8px 8px;
  background: linear-gradient(180deg, rgba(7, 8, 10, 0.88), rgba(7, 8, 10, 0.96));
  color: #fffaf0;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  text-align: center;
  text-wrap: balance;
}

.slot-label > span {
  min-width: 0;
}

.slot-champion-name {
  position: absolute;
  left: 18px;
  top: 18px;
  max-width: calc(100% - 70px);
  border: 1px solid rgba(255, 240, 200, 0.16);
  border-radius: 999px;
  padding: 4px 10px 5px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(38, 42, 48, 0.82), rgba(5, 7, 11, 0.82)),
    rgba(5, 7, 11, 0.9);
  backdrop-filter: blur(10px) saturate(115%);
  -webkit-backdrop-filter: blur(10px) saturate(115%);
  color: #fff7e8;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.78);
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 8px 18px rgba(0, 0, 0, 0.36);
}

.slot-clear {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid rgba(240, 207, 119, 0.42);
  border-radius: 999px;
  background: rgba(7, 9, 13, 0.88);
  color: var(--muted);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.slot-clear svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.slot-clear:hover,
.slot-clear:focus-visible {
  border-color: rgba(255, 182, 182, 0.86);
  background: rgba(89, 24, 24, 0.88);
  color: #ffd2d2;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
}

.slot-clear::after {
  content: attr(aria-label);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: max-content;
  max-width: 180px;
  border: 1px solid rgba(66, 81, 105, 0.8);
  border-radius: 6px;
  padding: 6px 8px;
  background: rgba(7, 9, 13, 0.96);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.slot-clear:hover::after,
.slot-clear:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.toast {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: min(360px, calc(100vw - 44px));
  transform: translateY(14px);
  border: 1px solid rgba(200, 155, 60, 0.52);
  border-radius: 10px;
  padding: 12px 18px;
  background: rgba(7, 9, 13, 0.94);
  backdrop-filter: blur(14px) saturate(128%);
  -webkit-backdrop-filter: blur(14px) saturate(128%);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow:
    0 14px 38px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 240, 200, 0.12);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 240ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.toast:has(.toast-portrait) {
  width: min(312px, calc(100vw - 44px));
  min-height: 70px;
  padding: 9px 16px 9px 9px;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-portrait {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border: 1px solid rgba(240, 207, 119, 0.68);
  border-radius: 7px;
  object-fit: cover;
}

.toast-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.toast-title,
.toast-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast-title {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.15;
}

.toast-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}

@media (max-width: 1100px) {
  :root {
    --panel-width: 286px;
  }

  .app-shell {
    grid-template-columns: var(--panel-width) minmax(0, 1fr);
  }

  .champion-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .champion-panel {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(200, 155, 60, 0.28);
  }

  .champion-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 270px;
  }

  .workspace {
    padding: 22px 12px 30px;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }

  .workspace-title {
    text-align: center;
    white-space: normal;
  }

  .progress {
    justify-content: center;
  }

  .actions {
    justify-self: stretch;
    justify-content: stretch;
  }

  .button {
    flex: 1 1 150px;
  }

  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-slot {
    grid-template-rows: auto 40px;
  }
}
