:root {
  color-scheme: dark;
  --ink: #f7f3e8;
  --muted: #b7b0a5;
  --panel: rgba(17, 20, 21, 0.78);
  --panel-strong: rgba(17, 20, 21, 0.94);
  --gold: #dfb452;
  --border: rgba(242, 222, 193, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 20%, rgba(223, 180, 82, 0.14), transparent 30rem),
    linear-gradient(140deg, #111516 0%, #24211c 54%, #101414 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.admin-locked .master-shell {
  display: none;
}

button,
.nav-link,
input {
  min-height: 2.75rem;
  padding: 0 1rem;
  background: #202326;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-decoration: none;
}

input {
  width: 100%;
  background: rgba(0, 0, 0, 0.38);
}

.danger-button {
  background: #341515;
  border-color: rgba(255, 132, 110, 0.38);
  color: #ffb5a9;
}

.master-shell {
  width: min(86rem, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.master-header,
.master-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.34);
}

.master-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1;
}

#adminStatus,
#leaderboardOption,
#updatedAt,
#emailTestStatus {
  margin-top: 0.45rem;
  color: var(--gold);
  font-weight: 900;
}

.master-panel {
  margin-top: 1rem;
  padding: 1rem;
}

.panel-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.panel-heading.simple {
  display: flex;
  justify-content: space-between;
  text-align: left;
}

.email-test-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.table-wrap {
  width: 100%;
  margin-top: 0.85rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 58rem;
}

th,
td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(242, 222, 193, 0.1);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

th small,
td small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: none;
}

tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.035);
}

.rank {
  color: var(--gold);
  font-weight: 950;
}

.player-name {
  font-weight: 950;
}

.space-list {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.feature-feedback-table-wrap table {
  min-width: 42rem;
}

.vote-count {
  font-weight: 950;
}

.vote-count.dislike {
  color: #ffb5a9;
}

.vote-count.like {
  color: var(--ink);
}

.vote-count.love {
  color: #7ce9b0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.status-pill.live {
  border-color: rgba(42, 214, 128, 0.35);
  color: #37df8d;
}

.status-pill.completed {
  border-color: rgba(223, 180, 82, 0.45);
  color: var(--gold);
}

.status-pill.ended_early {
  border-color: rgba(255, 132, 110, 0.35);
  color: #ff9d8b;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
}

.auth-overlay.visible {
  display: flex;
}

.auth-card {
  display: grid;
  gap: 0.75rem;
  width: min(28rem, 100%);
  padding: 1rem;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.5);
}

.auth-card h2 {
  margin: 0;
}

.auth-card input {
  width: 100%;
  min-height: 3.1rem;
  padding: 0 0.9rem;
  background: #090b0b;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 850;
}

.auth-card button {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  background: var(--gold);
  color: #15110a;
  line-height: 1.15;
}

.auth-card .auth-secondary-button {
  background: #202326;
  border: 1px solid var(--border);
  color: var(--ink);
}

.auth-message {
  margin-top: 0.8rem;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 760px) {
  .master-shell {
    width: calc(100vw - 1rem);
    padding-top: 0.5rem;
  }

  .master-header,
  .panel-heading.simple {
    display: grid;
  }

  .panel-heading {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }

  .panel-heading > div {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  table {
    min-width: 48rem;
  }
}
