:root {
  --bg: #0b0c0b;
  --panel: #151715;
  --panel2: #1c1f1c;
  --text: #f1f2ed;
  --muted: #aeb4aa;
  --line: #353a35;
  --accent: #d9c467;
  --accent-text: #171407;
  --good: #98dfa8;
  --danger: #ef9a88;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(
      circle at top left,
      rgba(217, 196, 103, 0.1),
      transparent 32rem
    ),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    sans-serif;
}

button,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.site-header {
  width: min(1180px, calc(100% - 30px));
  min-height: 70px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--accent);
  font: 700 1.4rem Georgia, serif;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 12px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

.shell {
  width: min(1180px, calc(100% - 30px));
  margin: auto;
  padding: 38px 0 70px;
}

.centered {
  text-align: center;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 22px;
}

.hero h1 {
  margin: 0 0 8px;
  font: 700 clamp(2.5rem, 7vw, 5rem) Georgia, serif;
  overflow-wrap: anywhere;
}

.team-label-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}

.current-badge {
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(152, 223, 168, 0.14);
  color: var(--good);
  font-size: 0.78rem;
  font-weight: 800;
}

.muted,
small {
  color: var(--muted);
}

.hero-actions,
.invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.select,
.small-button {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  color: var(--text);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.button:not(.secondary) {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
}

.button.secondary {
  background: transparent;
}

.button:disabled {
  opacity: 0.72;
  cursor: default;
}

.wide {
  width: 100%;
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.metrics {
  margin: 0 0 22px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metrics article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.metrics span,
.metrics strong {
  display: block;
}

.metrics span {
  color: var(--muted);
  font-size: 0.8rem;
}

.metrics strong {
  margin-top: 7px;
  font-size: 1.8rem;
}

.invite-panel {
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  align-items: center;
  gap: 28px;
  border-color: rgba(217, 196, 103, 0.62);
}

.invite-panel h2 {
  margin-top: 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
}

.invite-actions {
  margin-top: 22px;
}

.code-fallback {
  margin: 20px 0 0;
  color: var(--muted);
}

.code-fallback strong {
  color: var(--text);
  letter-spacing: 0.12em;
}

.qr-frame {
  padding: 16px;
  border-radius: 16px;
  background: white;
}

.qr-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  gap: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
  font-size: 0.8rem;
}

.member-list {
  display: grid;
  gap: 10px;
}

.member-row {
  min-width: 0;
  padding: 12px;
  border-radius: 11px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: var(--panel2);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(217, 196, 103, 0.16);
  color: var(--accent);
  font-weight: 900;
}

.member-identity {
  min-width: 0;
}

.member-identity strong,
.member-identity small {
  display: block;
}

.member-identity strong {
  overflow-wrap: anywhere;
}

.member-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.role {
  color: var(--muted);
  text-transform: capitalize;
  font-size: 0.8rem;
}

.role.captain {
  color: var(--accent);
  font-weight: 800;
}

.small-button {
  min-height: 36px;
  padding: 7px 10px;
  cursor: pointer;
}

.captain-help {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.current-team-panel {
  align-self: start;
}

.current-team-panel h2 {
  margin-top: 0;
}

.history-section {
  margin-top: 30px;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.history-title {
  font-size: 1.08rem;
}

.history-meta,
.round-summary {
  color: var(--muted);
}

.history-score {
  text-align: right;
}

.history-score strong,
.history-score small {
  display: block;
}

.history-score strong {
  font-size: 2rem;
}

.participants {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.participants span {
  color: var(--muted);
}

.empty {
  color: var(--muted);
}

@media (max-width: 900px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .invite-panel,
  .top-grid {
    grid-template-columns: 1fr;
  }

  .qr-frame {
    width: min(100%, 390px);
    margin-inline: auto;
  }
}

@media (max-width: 680px) {
  .site-header,
  .hero,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .site-header {
    padding: 14px 0;
  }

  .hero-actions,
  .invite-actions {
    width: 100%;
  }

  .hero-actions > *,
  .invite-actions > * {
    flex: 1;
  }

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

  .member-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .member-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 54px;
  }

  .history-top {
    flex-direction: column;
  }

  .history-score {
    text-align: left;
  }
}
