:root {
  --bg: oklch(0.16 0.02 265);
  --surface: oklch(0.21 0.025 265);
  --surface-2: oklch(0.25 0.03 265);
  --text: oklch(0.93 0.01 265);
  --muted: oklch(0.65 0.02 265);
  --accent: oklch(0.585 0.215 275); /* discord blurple */
  --accent-hover: oklch(0.63 0.22 275);
  --danger: oklch(0.62 0.2 25);
  --ok: oklch(0.7 0.16 155);
  --radius: 12px;
  --border: oklch(0.32 0.03 265);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.6;
}

.container {
  width: min(880px, 100% - 32px);
  margin-inline: auto;
}

/* Header */
.header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: 12px;
  gap: 12px;
}
.logo { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; }

.user-area { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  font-size: 0.9rem;
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; display: block; }
.user-chip .avatar-fallback {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: white;
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
}

/* Hero */
.hero { padding-block: 48px 24px; }
.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.75rem);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.hero-sub { color: var(--muted); max-width: 60ch; margin: 0 0 24px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease-out, transform 0.1s ease-out;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: color-mix(in oklch, var(--danger) 12%, transparent); }
.btn svg { width: 20px; height: 20px; flex: none; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-block: 20px;
}
.card h2 { margin: 0; font-size: 1.15rem; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Participants */
.participants { list-style: none; margin: 0; padding: 0; }
.participants li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.participants li:last-child { border-bottom: none; }
.participants .score { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Registration form */
.reg-form { display: flex; flex-direction: column; gap: 14px; }
.reg-form label { font-size: 0.9rem; color: var(--muted); display: block; margin-bottom: 6px; }
.reg-form input {
  width: 100%;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
}
.reg-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.reg-success { display: flex; flex-direction: column; gap: 14px; }
.reg-ok { color: var(--ok); font-weight: 600; }

/* Dashboard frame */
.dashboard-frame-wrap { border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.dashboard-frame { width: 100%; height: 520px; border: 0; background: #fff; display: block; }

.link { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.link:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.auth-error { color: var(--danger); font-weight: 600; }

.footer { margin-top: auto; padding-block: 24px; border-top: 1px solid var(--border); font-size: 0.85rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 16px; }

/* Legal pages */
.legal { max-width: 75ch; padding-block: 32px 48px; }
.legal h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 4px; }
.legal h2 { font-size: 1.1rem; margin: 28px 0 8px; }
.legal p, .legal li { line-height: 1.7; }
.legal ul { padding-left: 22px; }
.legal code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
}

@media (max-width: 520px) {
  .card { padding: 16px; }
  .dashboard-frame { height: 380px; }
  .btn { width: 100%; justify-content: center; }
  .user-chip span.uname { display: none; }
}
