:root {
  --gold: #e8c76a;
  --gold-dim: #e8c76a22;
  --gold-mid: #e8c76a55;
  --red: #d64c3f;
  --green: #4caf82;
  --bg: #0c0c0f;
  --bg2: #111116;
  --bg3: #16161c;
  --border: #22222a;
  --border2: #2a2a35;
  --text: #e0ddd5;
  --text-dim: #6a6870;
  --text-mid: #9a9898;
  --bounty: #e8624a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, #1a140022 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 100%, #0d1a0f18 0%, transparent 60%),
    var(--bg);
}

/* HEADER */
.header {
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #0c0c0fee;
  backdrop-filter: blur(12px);
  z-index: 100;
}

.logo {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.8rem;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-shadow: 0 0 40px var(--gold-mid);
  cursor: pointer;
  background: none;
  border: none;
}

.logo em { color: var(--text-dim); font-style: normal; }

.pill {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: var(--gold-dim);
  border: 1px solid var(--gold-mid);
  color: var(--gold);
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
}

/* LAYOUT */
.page { max-width: 540px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
.page-wide { max-width: 960px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }

/* TYPE */
h1 {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(3rem, 8vw, 5rem);
  letter-spacing: 0.04em;
  color: var(--gold);
  line-height: 0.95;
  margin-bottom: 0.4rem;
  text-shadow: 0 0 60px var(--gold-dim);
}

h2 {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.9rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-bottom: 1.25rem;
}

.sub {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

/* CARDS */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-glow {
  background: var(--bg2);
  border: 1px solid var(--gold-mid);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 0 30px var(--gold-dim), inset 0 0 30px #e8c76a06;
  position: relative;
  overflow: hidden;
}

.card-glow::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* FORMS */
label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  font-family: 'DM Mono', monospace;
}

input[type=text],
input[type=number],
input[type=password],
textarea,
select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 1rem;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

input[type=range] {
  -webkit-appearance: none;
  height: 3px;
  background: var(--border2);
  border: none;
  padding: 0;
  cursor: pointer;
  margin-bottom: 0.5rem;
  width: 100%;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 0 12px var(--gold-mid);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.8rem 1.75rem;
  background: var(--gold);
  color: var(--bg);
  font-family: 'Bebas Neue', cursive;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: center;
}

.btn:hover:not(:disabled) { background: #f0d480; box-shadow: 0 0 24px var(--gold-mid); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-mid);
}
.btn-ghost:hover:not(:disabled) { background: var(--gold-dim); box-shadow: none; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover:not(:disabled) { background: #e85a4d; box-shadow: 0 0 20px #d64c3f40; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover:not(:disabled) { background: #5dc895; box-shadow: 0 0 20px #4caf8240; }
.btn-bounty { background: var(--bounty); color: #fff; }
.btn-bounty:hover:not(:disabled) { background: #f07060; }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.95rem; width: auto; }
.btn-xs { padding: 0.3rem 0.75rem; font-size: 0.85rem; width: auto; }

/* TOKEN BAR */
.token-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg2);
  border: 1px solid var(--gold-mid);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.token-num {
  font-family: 'Bebas Neue', cursive;
  font-size: 2.2rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  line-height: 1;
  text-shadow: 0 0 30px var(--gold-mid);
}

.token-lbl {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 0.15rem;
  font-family: 'DM Mono', monospace;
}

/* MESSAGES */
.msg {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  line-height: 1.6;
  margin-top: 0.75rem;
  font-family: 'DM Mono', monospace;
}

.msg-ok   { background: #4caf8218; border: 1px solid #4caf8240; color: var(--green); }
.msg-err  { background: #d64c3f18; border: 1px solid #d64c3f40; color: var(--red); }
.msg-info { background: #4a8fe818; border: 1px solid #4a8fe840; color: #7ab4f0; }
.msg-warn { background: #e8c76a18; border: 1px solid var(--gold-mid); color: var(--gold); }

/* TABS */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  padding: 0.6rem 1.25rem;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }
.tab.on { color: var(--gold); border-bottom-color: var(--gold); }

/* GRID */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.75rem; }

/* STAT */
.stat { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; text-align: center; }
.stat-n { font-family: 'Bebas Neue', cursive; font-size: 2rem; color: var(--gold); line-height: 1; }
.stat-l { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-dim); margin-top: 0.3rem; }

/* EVENT CARD */
.ev-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.5rem; margin-bottom: 1rem;
  position: relative; overflow: hidden;
}
.ev-card.final { border-color: var(--gold-mid); box-shadow: 0 0 30px var(--gold-dim); }
.ev-card::after { content:''; position:absolute; top:0; left:0; right:0; height:2px; background: linear-gradient(90deg, var(--gold), transparent); }

.mult {
  display: inline-block;
  background: var(--gold-dim); border: 1px solid var(--gold-mid);
  color: var(--gold); font-family: 'Bebas Neue', cursive;
  font-size: 1.4rem; padding: 0.15rem 0.6rem; border-radius: 4px;
  letter-spacing: 0.05em; margin-bottom: 0.75rem;
}
.mult.final { font-size: 1.8rem; background: #e8c76a35; box-shadow: 0 0 16px var(--gold-mid); }

.ev-title { font-family: 'Bebas Neue', cursive; font-size: 1.5rem; letter-spacing: 0.03em; margin-bottom: 0.4rem; }
.ev-desc  { font-size: 0.8rem; color: var(--text-dim); line-height: 1.6; }

/* BET PREVIEW */
.bet-preview {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg); border: 1px solid var(--border2);
  border-radius: 6px; padding: 0.75rem 1rem; margin: 1rem 0;
}
.win-amt  { font-family: 'Bebas Neue', cursive; font-size: 1.2rem; color: var(--green); }
.lose-amt { font-family: 'Bebas Neue', cursive; font-size: 1.2rem; color: var(--red); }
.amt-lbl  { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim); font-family: 'DM Mono', monospace; }

/* CHALLENGE CARD */
.ch-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 0.75rem;
  cursor: pointer; transition: all 0.2s;
  display: flex; justify-content: space-between; align-items: center;
}
.ch-card:hover { border-color: var(--gold-mid); transform: translateX(3px); }
.ch-title  { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.ch-locked { font-size: 0.7rem; color: var(--text-dim); }
.ch-payout { font-family: 'Bebas Neue', cursive; font-size: 1.6rem; color: var(--gold); white-space: nowrap; }

/* DUEL CODE */
.duel-code {
  font-family: 'Bebas Neue', cursive;
  font-size: 3.5rem; letter-spacing: 0.2em;
  color: var(--gold); text-align: center;
  text-shadow: 0 0 40px var(--gold-mid);
  background: var(--bg); border: 1px solid var(--gold-mid);
  border-radius: 8px; padding: 1.5rem; margin: 1rem 0;
}

/* LEADERBOARD */
.lb-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1rem; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  margin-bottom: 0.4rem; transition: border-color 0.15s;
}
.lb-row.first { border-color: var(--gold-mid); background: #e8c76a08; }
.lb-row.last  { border-color: #d64c3f40; background: #d64c3f08; }
.lb-rank { font-family: 'Bebas Neue', cursive; font-size: 1.4rem; color: var(--text-dim); width: 2.5rem; text-align: center; }
.lb-rank.first { color: var(--gold); }
.lb-rank.last  { color: var(--red); }
.lb-name   { flex: 1; font-weight: 700; }
.lb-tokens { font-family: 'Bebas Neue', cursive; font-size: 1.4rem; }
.lb-tokens.up   { color: var(--green); }
.lb-tokens.down { color: var(--red); }
.lb-tokens.eq   { color: var(--text-dim); }

.bounty-tag {
  font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  background: #e8624a20; border: 1px solid #e8624a50; color: var(--bounty);
  padding: 0.2rem 0.5rem; border-radius: 100px;
  font-family: 'DM Mono', monospace; margin-left: 0.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 #e8624a30; }
  50%      { box-shadow: 0 0 0 5px #e8624a00; }
}

/* QR BOX */
.qr-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.5rem; text-align: center;
}
.qr-url { font-size: 0.58rem; color: var(--text-dim); word-break: break-all; margin-top: 0.75rem; font-family: 'DM Mono', monospace; }

/* HONOURS BOARD */
.honour-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.25rem 1.5rem; margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 1rem;
  animation: fadeUp 0.5s ease both;
}
.honour-card.loser { border-color: var(--red); background: #d64c3f08; }
.honour-icon { font-size: 2rem; flex-shrink: 0; }
.honour-title { font-family: 'Bebas Neue', cursive; font-size: 1.2rem; color: var(--gold); letter-spacing: 0.05em; }
.honour-card.loser .honour-title { color: var(--red); }
.honour-name { font-size: 0.85rem; color: var(--text-dim); margin-top: 0.15rem; }
.honour-stat { font-family: 'DM Mono', monospace; font-size: 0.75rem; color: var(--text-mid); margin-top: 0.15rem; }

/* SETUP WARNING */
.setup-warn {
  background: #d64c3f12; border: 1px solid #d64c3f40;
  border-radius: 10px; padding: 1.5rem; margin-bottom: 2rem;
}
.setup-warn h3 { color: var(--red); font-family: 'Bebas Neue', cursive; font-size: 1.2rem; margin-bottom: 0.5rem; }
.setup-warn p, .setup-warn li { font-size: 0.8rem; color: #cc9988; line-height: 1.8; }
.setup-warn code { background: var(--bg); padding: 0.1rem 0.4rem; border-radius: 3px; color: var(--gold); font-family: 'DM Mono', monospace; }

/* TABLE */
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th { text-align:left; padding:0.6rem 0.75rem; font-size:0.6rem; letter-spacing:0.18em; text-transform:uppercase; color:var(--text-dim); border-bottom:1px solid var(--border); font-family:'DM Mono',monospace; }
td { padding:0.8rem 0.75rem; border-bottom:1px solid var(--border); vertical-align:middle; }
tr:last-child td { border-bottom:none; }
tr:hover td { background:var(--bg3); }

hr { border:none; border-top:1px solid var(--border); margin:1.5rem 0; }

/* ANIMATIONS */
@keyframes fadeUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
.fade-up { animation: fadeUp 0.4s ease both; }

@keyframes revealDrama {
  0%   { opacity:0; transform:scale(0.8) translateY(20px); }
  60%  { transform:scale(1.05) translateY(-4px); }
  100% { opacity:1; transform:scale(1) translateY(0); }
}
.reveal-anim { animation: revealDrama 0.6s cubic-bezier(0.175,0.885,0.32,1.275) both; }

/* MOBILE */
@media (max-width:600px) {
  .g3, .g4 { grid-template-columns: 1fr 1fr; }
  .header { padding: 1rem; }
  h1 { font-size: 3rem; }
}
@media (max-width:400px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}
