/* ============================================================
   glo hostes — dark-red, modern theme (tablet-first)
   ============================================================ */
:root {
  --bg: #140a0d;
  --surface: #211318;
  --surface-2: #2c1a21;
  --surface-3: #38222a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f7eef0;
  --muted: #b89aa2;
  --red: #e4002b;
  --red-bright: #ff2d55;
  --red-deep: #9e0020;
  --grad: linear-gradient(135deg, #ff2d55 0%, #e4002b 48%, #b00020 100%);
  --ok: #35d29a;
  --warn: #ffb020;
  --bad: #ff5a6a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --tap: 54px;
}

* { box-sizing: border-box; }

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 620px at 50% -8%, rgba(228, 0, 43, 0.28), transparent 62%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 45, 85, 0.12), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

::selection { background: var(--red); color: #fff; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2rem);
  background: rgba(20, 10, 13, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
}
.brand-logo { height: 30px; width: auto; display: block; }
.brand-sub {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.site-header nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
}
.site-header nav a:hover { border-color: var(--red); background: rgba(228, 0, 43, 0.14); }

/* ---------- Layout ---------- */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem) 3rem;
}

h1 {
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.6rem;
}
h1 + p, h1 + .prompt { margin-top: 0; }
p { margin: 0 0 1rem; }
a { color: var(--red-bright); }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  margin: 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow);
}

/* ---------- Forms ---------- */
label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

input, textarea, select {
  width: 100%;
  min-height: var(--tap);
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: #8a7077; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--red-bright);
  box-shadow: 0 0 0 4px rgba(255, 45, 85, 0.22);
}
textarea { resize: vertical; min-height: 8rem; line-height: 1.5; }

/* Big centered code entry */
input.code-input {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.4em;
  padding-left: 0.4em;
}

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.85rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--grad);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(228, 0, 43, 0.32);
  transition: transform 0.08s, box-shadow 0.15s, filter 0.15s;
}
button:hover, .btn:hover { filter: brightness(1.06); box-shadow: 0 10px 28px rgba(228, 0, 43, 0.42); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled {
  background: #4b3138;
  color: #9b8288;
  box-shadow: none;
  cursor: not-allowed;
}
button.ghost, .btn.ghost, button.danger {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
button.danger { color: #ffb3bd; border-color: rgba(255, 90, 106, 0.5); }
button.danger:hover { background: rgba(255, 90, 106, 0.14); filter: none; }

/* Text links that sit under content */
.backlink { display: inline-block; margin-top: 1.25rem; color: var(--muted); font-weight: 600; }
.backlink:hover { color: var(--red-bright); }

.error {
  color: #ffd0d6;
  background: rgba(255, 90, 106, 0.14);
  border: 1px solid rgba(255, 90, 106, 0.4);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* ---------- Hero (join / landing) ---------- */
.hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.hero .hero-logo { height: 64px; width: auto; margin-bottom: 1rem; }
.hero .lead { color: var(--muted); font-size: 1.1rem; max-width: 30ch; margin: 0 auto 0.5rem; }

/* ---------- Challenge prompt & timer ---------- */
.prompt {
  white-space: pre-line;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  padding: 1rem 1.15rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0 1.25rem;
}

.timer {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  text-align: center;
}
.timer #timer-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.timer-expired { color: var(--bad); border-color: rgba(255, 90, 106, 0.5); }

.qr-reader {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 0.75rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}

/* ---------- Station grid ---------- */
.station-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  gap: 0.9rem;
}
@media (min-width: 680px) { .station-list { grid-template-columns: 1fr 1fr; } }

.station-item { display: flex; }
.station-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  min-height: 88px;
  padding: 1rem 1.15rem;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.1s, border-color 0.15s;
}
.station-card:hover { transform: translateY(-2px); border-color: var(--red); }
.station-number {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
}
.station-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.station-name { font-weight: 700; font-size: 1.1rem; line-height: 1.2; }

/* ---------- Status pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  width: fit-content;
}
.badge-CORRECT { color: var(--ok); border-color: rgba(53, 210, 154, 0.5); background: rgba(53, 210, 154, 0.12); }
.badge-PENDING_REVIEW { color: var(--warn); border-color: rgba(255, 176, 32, 0.5); background: rgba(255, 176, 32, 0.12); }
.badge-IN_PROGRESS { color: var(--red-bright); border-color: rgba(255, 45, 85, 0.5); background: rgba(255, 45, 85, 0.12); }
.badge-TIMED_OUT, .badge-INCORRECT { color: var(--bad); border-color: rgba(255, 90, 106, 0.5); background: rgba(255, 90, 106, 0.12); }

/* ---------- Result banners ---------- */
.result {
  font-size: 1.25rem;
  font-weight: 800;
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.result-ok { background: rgba(53, 210, 154, 0.14); border-color: rgba(53, 210, 154, 0.5); color: var(--ok); }
.result-pending { background: rgba(255, 176, 32, 0.14); border-color: rgba(255, 176, 32, 0.5); color: var(--warn); }
.result-bad { background: rgba(255, 90, 106, 0.14); border-color: rgba(255, 90, 106, 0.5); color: var(--bad); }

/* ---------- Tables (leaderboard / teams) ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  overflow: hidden;
}
thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-align: left;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 0.9rem 1rem; border-bottom: 1px solid var(--border); font-size: 1.05rem; }
tbody tr:last-child td { border-bottom: 0; }
.leaderboard .rank { width: 3.5rem; font-weight: 800; font-size: 1.2rem; text-align: center; }
.leaderboard .score, .code {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.leaderboard .score { color: var(--red-bright); text-align: right; }
.leaderboard tr.top-1 td { background: linear-gradient(90deg, rgba(228, 0, 43, 0.22), transparent); }
.leaderboard tr.top-2 td { background: linear-gradient(90deg, rgba(228, 0, 43, 0.12), transparent); }
.leaderboard tr.top-3 td { background: linear-gradient(90deg, rgba(228, 0, 43, 0.07), transparent); }
.code { letter-spacing: 0.12em; }

/* ---------- Staff ---------- */
.staff-links { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0.9rem; }
.staff-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.1s;
}
.staff-links a::after { content: "→"; color: var(--red-bright); font-size: 1.2rem; }
.staff-links a:hover { border-color: var(--red); transform: translateY(-2px); }
.inline-form { margin: 1.25rem 0; }

.review-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.4rem);
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}
.review-photo {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 0.6rem 0;
  display: block;
  border: 1px solid var(--border);
}
.review-form { margin-top: 0.9rem; }
.place-label { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.5rem; }
.place-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.place-btn {
  flex: 1 1 8rem;
  min-height: 62px;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.1;
}
.place-btn .place-pts { font-size: 0.82rem; font-weight: 600; opacity: 0.85; }
.place-buttons .danger { flex: 1 1 8rem; min-height: 62px; }

.answer-text {
  white-space: pre-wrap;
  background: var(--surface-3);
  border-left: 4px solid var(--red);
  margin: 0.6rem 0;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
}
.muted { color: var(--muted); font-size: 0.92rem; }
.word-check { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; }
.word-check span { font-weight: 700; white-space: nowrap; }
.word-check .ok { color: var(--ok); }
.word-check .missing { color: var(--bad); }
