:root {
  --bg: #111315;
  --bg-soft: #191c1f;
  --card: rgba(27, 31, 35, 0.92);
  --text: #f3efe8;
  --muted: #bbb3a4;
  --gold: #d6b27a;
  --gold-soft: #e7d3ae;
  --green: #6ea67c;
  --green-strong: #4f8b5f;
  --anthracite: #2b2f33;
  --danger: #c05d5d;
  --shadow: 0 18px 40px rgba(0,0,0,.35);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(214,178,122,.14), transparent 28%),
    radial-gradient(circle at bottom left, rgba(110,166,124,.14), transparent 24%),
    linear-gradient(180deg, #111315 0%, #171a1d 100%);
  min-height: 100vh;
}
.topbar {
  padding: 18px 18px 0;
}
.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold), var(--green));
  color: #111;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.mobile-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 20px 16px 48px;
}
.hero-card, .result-card, .info-card, .admin-card {
  background: var(--card);
  border: 1px solid rgba(231,211,174,.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.hero-card + .result-card,
.result-card + .info-card,
.hero-card + .info-card,
.admin-card + .admin-card { margin-top: 16px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .72rem;
  color: var(--gold);
  margin: 0 0 8px;
}
h1, h2, h3 { margin: 0 0 12px; line-height: 1.1; }
h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
h2 { font-size: clamp(1.5rem, 4.2vw, 2rem); }
h3 { font-size: 1.1rem; }
.subline, .muted, small, li, p { color: var(--muted); }
.quest-pill {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0 20px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(214,178,122,.08);
  border: 1px solid rgba(214,178,122,.2);
}
.quest-pill span { color: var(--gold-soft); font-size: .88rem; }
.field-row { display: grid; gap: 6px; margin-top: 16px; }
.field-label, .field-row label { font-weight: 700; color: var(--text); }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.05);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 1rem;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(214,178,122,.7);
  box-shadow: 0 0 0 4px rgba(214,178,122,.14);
}
.code-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}
.code-input {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 16px 8px;
}
.btn-primary, .btn-secondary {
  border: 0;
  border-radius: 16px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 58px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--green));
  color: #131313;
}
.btn-secondary {
  background: rgba(255,255,255,.08);
  color: var(--text);
}
.notice {
  padding: 14px 16px;
  border-radius: 16px;
  margin-top: 14px;
}
.notice.error { background: rgba(192, 93, 93, .16); color: #ffd3d3; }
.notice.success { background: rgba(110, 166, 124, .16); color: #d5f2dc; }
.result-card { text-align: center; }
.result-winner { border-color: rgba(110,166,124,.35); }
.result-correct { border-color: rgba(214,178,122,.35); }
.result-wrong { border-color: rgba(192,93,93,.35); }
.big { font-size: 3rem; margin-bottom: 8px; }
.rank-highlight {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(214,178,122,.12);
  color: var(--gold-soft);
}
.ranking-box {
  margin-top: 18px;
  text-align: left;
  background: rgba(255,255,255,.04);
  border-radius: 18px;
  padding: 14px;
}
.ranking-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ranking-list li {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.ranking-list li:last-child { border-bottom: 0; }
.info-card ul { margin: 0; padding-left: 18px; }
.coin-rain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.coin {
  position: absolute;
  top: -40px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff4cf, #d6b27a 55%, #a37b38 100%);
  animation: fall 2.8s linear infinite;
}
.coin:nth-child(odd) { background: radial-gradient(circle at 30% 30%, #e6ffe6, #9ccb91 55%, #4f8b5f 100%); }
.coin:nth-child(1) { left: 5%; animation-delay: .1s; }
.coin:nth-child(2) { left: 10%; animation-delay: .7s; }
.coin:nth-child(3) { left: 16%; animation-delay: 1.1s; }
.coin:nth-child(4) { left: 24%; animation-delay: .3s; }
.coin:nth-child(5) { left: 31%; animation-delay: 1.4s; }
.coin:nth-child(6) { left: 38%; animation-delay: .9s; }
.coin:nth-child(7) { left: 45%; animation-delay: .2s; }
.coin:nth-child(8) { left: 52%; animation-delay: 1.7s; }
.coin:nth-child(9) { left: 60%; animation-delay: .8s; }
.coin:nth-child(10) { left: 66%; animation-delay: 1.4s; }
.coin:nth-child(11) { left: 72%; animation-delay: .4s; }
.coin:nth-child(12) { left: 79%; animation-delay: 1.2s; }
.coin:nth-child(13) { left: 84%; animation-delay: .6s; }
.coin:nth-child(14) { left: 90%; animation-delay: 1.8s; }
.coin:nth-child(15) { left: 95%; animation-delay: 1s; }
@keyframes fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(340px) rotate(360deg); opacity: 0; }
}
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align: left;
  color: var(--muted);
}
th { color: var(--gold-soft); font-size: .92rem; }
.admin-layout {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 40px;
}
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
}
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.qr-box {
  display: grid;
  gap: 12px;
  justify-items: start;
}
@media (max-width: 780px) {
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .mobile-shell { padding-inline: 12px; }
  .hero-card, .result-card, .info-card, .admin-card { padding: 18px; border-radius: 20px; }
  .code-group { grid-template-columns: repeat(3, 1fr); }
  .btn-primary { grid-column: 1 / -1; }
}
