/* ── Design system: mmx3.pl-go ─────────────────────────────── */
:root {
  --ds-bg:        #F5F0E8;
  --ds-bg-white:  #FDFAF5;
  --ds-bg-navy:   #0D3B66;
  --ds-navy-light:#1a4f85;
  --ds-text:      #1C1917;
  --ds-muted:     #6B6560;
  --ds-accent:    #C4704A;
  --ds-border:    #DDD8CF;
  --ds-cream:     #FAF0CA;
  --gold:   #C9A227;
  --silver: #8A8A8A;
  --bronze: #A9713B;
}

.dark {
  --ds-bg:        #1a1714;
  --ds-bg-white:  #221e1b;
  --ds-bg-navy:   #08243f;
  --ds-navy-light:#0f3a63;
  --ds-text:      #FAF0CA;
  --ds-muted:     #A8998A;
  --ds-accent:    #D4835A;
  --ds-border:    #3a322c;
  --ds-cream:     #FAF0CA;
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ds-bg);
  color: var(--ds-text);
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s, color 0.25s;
}

/* ── Logo ──────────────────────────────────────────────────── */
.logo {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ds-text);
  text-decoration: none;
  white-space: nowrap;
}
.logo-accent { color: var(--ds-accent); }
.logo-sm { font-size: 1rem; }

/* ── Top bar ───────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  background: var(--ds-bg-white);
  border-bottom: 1px solid var(--ds-border);
}
.title-group {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.title {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.5rem, 3.5vw, 2.6rem);
  line-height: 1.1;
  color: var(--ds-text);
}
.subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ds-accent);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Live indicator ────────────────────────────────────────── */
.live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  border: 1px solid color-mix(in srgb, var(--ds-accent) 25%, transparent);
  background: color-mix(in srgb, var(--ds-accent) 10%, transparent);
  color: var(--ds-accent);
}
.live-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ds-accent);
  animation: pulse 1.6s ease-in-out infinite;
}
.live-offline {
  border-color: var(--ds-border);
  background: transparent;
  color: var(--ds-muted);
}
.live-offline .live-dot { background: var(--ds-muted); animation: none; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ds-accent) 55%, transparent); opacity: 1; }
  70%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ds-accent) 0%, transparent); opacity: 0.7; }
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-outline {
  border: 1.5px solid var(--ds-bg-navy);
  color: var(--ds-bg-navy);
  background: transparent;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.dark .btn-outline { border-color: var(--ds-accent); color: var(--ds-accent); }
.btn-outline:hover { background: var(--ds-bg-navy); color: var(--ds-cream); }
.dark .btn-outline:hover { background: var(--ds-accent); color: var(--ds-bg); }
.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Workshop picker ───────────────────────────────────────── */
.ws-select {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ds-text);
  background: var(--ds-bg-white);
  border: 1px solid var(--ds-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  min-height: 2.5rem;
  max-width: 14rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ws-select:focus {
  outline: none;
  border-color: var(--ds-accent);
  box-shadow: 0 0 0 3px rgba(196, 112, 74, 0.15);
}

/* ── Layout ────────────────────────────────────────────────── */
main {
  max-width: 1080px;
  margin: 1.75rem auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

.card {
  background: var(--ds-bg-white);
  border: 1px solid var(--ds-border);
  border-radius: 8px;
  color: var(--ds-text);
}

/* ── Podium ────────────────────────────────────────────────── */
.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.podium-card {
  background: var(--ds-bg-white);
  border: 1px solid var(--ds-border);
  border-top: 4px solid var(--rank-accent, var(--ds-accent));
  border-radius: 8px;
  padding: 1.25rem 1.25rem 1.5rem;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.podium-card.is-first { transform: translateY(-8px); box-shadow: 0 8px 18px rgba(0,0,0,0.10); }
.podium-medal { font-size: 2rem; line-height: 1; }
.podium-nick {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.35rem;
  margin: 0.4rem 0 0.1rem;
  color: var(--ds-text);
  overflow-wrap: anywhere;
}
.podium-meta { display: flex; justify-content: center; gap: 0.5rem; margin-top: 0.5rem; }

.pill {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--rank-accent, var(--ds-accent)) 12%, transparent);
  color: var(--rank-accent, var(--ds-accent));
  border: 1px solid color-mix(in srgb, var(--rank-accent, var(--ds-accent)) 25%, transparent);
}

/* ── Table ─────────────────────────────────────────────────── */
.table-card { padding: 0.5rem 0.5rem 0.25rem; overflow: hidden; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
thead tr { background: var(--ds-bg); }
th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ds-muted);
  border-bottom: 2px solid var(--ds-border);
}
td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--ds-border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 0.2s; }
tbody tr:hover { background: color-mix(in srgb, var(--ds-accent) 5%, transparent); }

.rank { font-size: 1.2rem; font-weight: 700; width: 3rem; font-variant-numeric: tabular-nums; }
.nick { font-weight: 600; overflow-wrap: anywhere; }
.count { font-variant-numeric: tabular-nums; color: var(--ds-muted); }
.time { font-variant-numeric: tabular-nums; }
.step { color: var(--ds-muted); font-size: 0.88rem; }

tr.top-1 .nick { color: var(--ds-accent); }

/* Row flash when a participant advances */
@keyframes row-flash {
  from { background: color-mix(in srgb, var(--ds-accent) 28%, transparent); }
  to   { background: transparent; }
}
tr.advanced { animation: row-flash 1.8s ease-out; }

/* ── Progress cells ────────────────────────────────────────── */
.progress { white-space: nowrap; }
.cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  margin-right: 3px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ds-muted);
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
}
.cell.done {
  color: var(--ds-cream);
  background: var(--ds-bg-navy);
  border-color: var(--ds-bg-navy);
}
.cell.last {
  background: var(--ds-accent);
  border-color: var(--ds-accent);
  color: #fff;
}

/* ── Empty / footer ────────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--ds-muted);
  padding: 2.5rem 1rem;
  display: none;
}
footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  color: var(--ds-muted);
  font-size: 0.85rem;
  padding: 1.75rem 1rem 2.5rem;
}
.dot { margin: 0 0.4rem; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 720px) {
  .podium { grid-template-columns: 1fr; }
  .podium-card.is-first { transform: none; }
}
@media (max-width: 640px) {
  .col-step, .step { display: none; }
  .topbar { flex-wrap: wrap; }
  .title-group { order: 3; flex-basis: 100%; }
}
