* { box-sizing: border-box; }

:root {
  color-scheme: light;
  --bg: oklch(96.8% 0.006 205);
  --surface: oklch(99% 0.004 205);
  --panel: oklch(94.4% 0.012 205);
  --line: oklch(84.5% 0.012 205);
  --ink: oklch(21% 0.018 220);
  --muted: oklch(47% 0.02 220);
  --accent: oklch(44% 0.095 178);
  --accent-soft: oklch(93.5% 0.035 178);
  --warn: oklch(48% 0.09 45);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 54px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklch, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 750;
}

.nav-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 750;
}

.nav .brand {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.identity {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.hero {
  display: grid;
  gap: 18px;
  align-items: end;
}

.kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 68px);
  line-height: .96;
  letter-spacing: 0;
}

.lede {
  max-width: 58ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.stats div {
  padding: 12px;
  background: var(--surface);
}

.stats dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.stats dd {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 900;
}

.controls {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: oklch(99.5% 0.004 205);
  color: var(--ink);
  font: inherit;
}

button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 13px;
  background: var(--accent);
  color: oklch(99% 0.004 205);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

button.secondary {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}

.statusline {
  min-height: 22px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.auth {
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.is-hidden {
  display: none;
}

.sets {
  display: grid;
  gap: 12px;
}

.set-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.set-card.is-final {
  border-color: oklch(66% 0.065 178);
  box-shadow: inset 3px 0 0 var(--accent);
}

.set-card.is-excluded {
  opacity: .62;
}

.set-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.set-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.set-head p,
.event-row p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.event-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.event-row.is-hook {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.index {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 900;
}

.event-row.is-hook .index {
  background: var(--surface);
  color: var(--accent);
}

.event-row h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
}

.event-row a {
  color: inherit;
  text-decoration: none;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badges span {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.set-actions {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
}

@media (min-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(460px, .58fr);
  }

  .controls {
    grid-template-columns: minmax(120px, .22fr) minmax(190px, .34fr) minmax(270px, 1fr) minmax(150px, .24fr) minmax(140px, .22fr) auto;
    align-items: end;
  }

  .set-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}
