:root {
  --bg: #f4efe6;
  --bg-accent: #efe6d7;
  --surface: rgba(255, 252, 247, 0.92);
  --surface-strong: #fffaf2;
  --text: #1c1a17;
  --muted: #6d6457;
  --line: rgba(28, 26, 23, 0.12);
  --primary: #005f73;
  --primary-strong: #0a9396;
  --success: #3b7a57;
  --warning: #c97b32;
  --error: #b23a48;
  --shadow: 0 20px 60px rgba(33, 28, 20, 0.08);
  font-family: "Prompt", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(10, 147, 150, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(201, 123, 50, 0.12), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

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

.button-danger {
  background: linear-gradient(135deg, #9e2a2b, #d1495b);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  text-decoration: none;
}

.button-link:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.button-link-compact {
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, #b45f06, #e09f3e);
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(180, 95, 6, 0.22);
}

.button-link-secondary {
  width: 100%;
  margin-top: 0.2rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #005f73, #0a9396);
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: white;
}

.page-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.site-title,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.05;
}

.site-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.site-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 0.45rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.75rem;
}

.content {
  display: grid;
  gap: 1.25rem;
}

.hidden {
  display: none;
}

.hero-card,
.panel,
.stat-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  display: grid;
  gap: 1rem;
}

.center-card {
  text-align: center;
  justify-items: center;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.dashboard-grid-top {
  align-items: start;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.9rem;
}

.stat-card {
  display: grid;
  gap: 0.3rem;
  min-height: 116px;
}

.score-link {
  margin-top: 0.3rem;
  font-size: 1rem;
}

.admin-stat {
  align-content: center;
}

.stat-value {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
}

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

.stack-form {
  display: grid;
  gap: 0.8rem;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.scan-panel {
  display: grid;
  gap: 1rem;
}

.scanner-shell {
  display: grid;
  gap: 0.85rem;
}

.scanner-view {
  width: min(100%, 460px);
  min-height: 280px;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #0f1720;
}

.scanner-view video {
  width: 100%;
  height: auto;
  display: block;
}

.scanner-view img {
  max-width: 100%;
}

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

.booth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.booth-card {
  border-radius: 22px;
  padding: 1rem;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  display: grid;
  gap: 1rem;
}

.booth-card-done {
  background: linear-gradient(135deg, rgba(10, 147, 150, 0.14), rgba(59, 122, 87, 0.2));
}

.booth-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.stack-meta {
  display: grid;
  gap: 0.2rem;
}

.booth-status {
  justify-items: end;
}

.booth-code {
  margin: 0 0 0.4rem;
  color: var(--primary);
  font-weight: 700;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(224, 159, 62, 0.18);
  color: #8a4f08;
  font-size: 0.8rem;
  font-weight: 700;
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flash {
  border-radius: 18px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.flash-success {
  border-color: rgba(59, 122, 87, 0.3);
}

.flash-error {
  border-color: rgba(178, 58, 72, 0.3);
}

.flash-warning {
  border-color: rgba(201, 123, 50, 0.3);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.85rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.link-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.link-row form {
  margin: 0;
}

.leaderboard-summary {
  margin-bottom: 1rem;
}

.leaderboard-current {
  background: rgba(10, 147, 150, 0.08);
}

.leaderboard-badge {
  display: inline-flex;
  margin-left: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(10, 147, 150, 0.14);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
}

@media (max-width: 720px) {
  .page-shell {
    padding: 1rem;
  }

  .site-header,
  .section-head,
  .booth-meta {
    grid-template-columns: 1fr;
    display: grid;
  }

  .booth-status {
    justify-items: start;
  }

  .site-nav {
    gap: 0.75rem;
  }

  .hero-card,
  .panel,
  .stat-card {
    border-radius: 22px;
    padding: 1rem;
  }

  .stat-row,
  .dashboard-grid,
  .booth-grid {
    grid-template-columns: 1fr;
  }

  .scanner-view {
    width: 100%;
    min-height: 240px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}
