:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --gold: #f0d78a;
  --green: #3fb950;
  --green-2: #238636;
  --blue: #79c0ff;
  --red: #f85149;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--blue); text-decoration: none; }
.container { width: min(1140px, 92%); margin: 0 auto; }

.nav {
  background: rgba(13,17,23,0.92);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(8px);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; }
.logo { font-size: 22px; font-weight: 800; color: var(--gold); letter-spacing: -0.5px; }
.nav-links { display: flex; gap: 20px; align-items: center; font-size: 14px; }
.nav-links a { color: var(--text); }
.nav-links a:hover { color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--green-2); color: #fff; border: none; border-radius: 8px;
  padding: 10px 18px; font-weight: 600; cursor: pointer; transition: transform .15s, filter .15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-block { width: 100%; padding: 14px; }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }

.hero { padding: 80px 0 60px; background: radial-gradient(circle at 80% 20%, rgba(240,215,138,0.08), transparent 35%); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.hero-text h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.05; font-weight: 800; margin-bottom: 20px; }
.lead { font-size: 18px; color: var(--muted); margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.ticker { display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); padding: 10px 16px; border-radius: 8px; font-size: 14px; }
.badge { background: var(--surface-2); color: var(--gold); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }

.hero-visual { display: flex; justify-content: center; }
.board-preview { position: relative; width: min(420px, 90%); aspect-ratio: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.35); }
.chess-mini { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%; border-radius: 8px; overflow: hidden; }
.chess-mini div { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; min-width: 0; min-height: 0; font-size: clamp(14px, 3.5vw, 28px); line-height: 1; }
.chess-mini .w { background: #f0d9b5; color: #222; }
.chess-mini .b { background: #b58863; color: #222; }
.cam-feed {
  position: absolute; bottom: 14px; right: 14px; width: 110px; height: 82px;
  background: #000; border: 2px solid var(--green); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 10px; color: #fff; text-align: center; padding: 6px;
}
.cam-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

.section { padding: 70px 0; }
.section-alt { background: var(--surface); }
.section-title { font-size: 30px; font-weight: 700; text-align: center; margin-bottom: 42px; color: var(--gold); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; text-align: center; }
.step-num { width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: #000; font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.step h3 { margin-bottom: 10px; }
.step p { color: var(--muted); font-size: 14px; }

.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pricing-card, .prizes-card { background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 32px; }
.pricing-card.featured { border-color: var(--gold); }
.pricing-card h3, .prizes-card h3 { font-size: 22px; margin-bottom: 14px; }
.price { font-size: 48px; font-weight: 800; color: var(--gold); }
.price span { font-size: 18px; color: var(--muted); font-weight: 500; }
.price-note { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.pricing-card ul { list-style: none; margin-bottom: 24px; }
.pricing-card li { padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text); font-size: 15px; }
.prizes-card { display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.prize-row { display: flex; gap: 14px; align-items: flex-start; }
.prize-row .icon { font-size: 28px; }
.prize-row p { color: var(--muted); font-size: 14px; }

.events-table { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.event-row { display: grid; grid-template-columns: 2fr 1fr 1.4fr 1fr; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); align-items: center; }
.event-row:last-child { border-bottom: 0; }
.event-row.head { background: var(--surface-2); font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; }
.event-row span:last-child { text-align: right; }

.footer { border-top: 1px solid var(--border); padding: 40px 0; background: var(--bg); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; font-size: 14px; }
.footer p, .footer a { color: var(--muted); }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer a:hover { color: var(--gold); }

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.auth-card { width: min(420px, 92%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; }
.auth-card h2 { margin-bottom: 22px; font-size: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 12px 14px; border-radius: 8px; font-size: 15px;
}
.form-group input:focus { outline: none; border-color: var(--blue); }
.form-message { margin-top: 14px; font-size: 14px; min-height: 20px; }
.form-message.error { color: var(--red); }
.form-message.ok { color: var(--green); }

.dashboard { padding: 28px 0 60px; }
.dashboard-grid { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
.sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; height: fit-content; }
.sidebar-user { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.sidebar-user strong { display: block; font-size: 18px; }
.sidebar-user span { color: var(--muted); font-size: 13px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar nav a { padding: 10px 12px; border-radius: 8px; color: var(--text); font-size: 14px; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--surface-2); color: var(--gold); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 20px; }
.panel h3 { margin-bottom: 16px; font-size: 18px; color: var(--gold); }
.wallet-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.wallet-balance { font-size: 32px; font-weight: 800; color: var(--green); }
.status-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.status-row.active { color: var(--green); }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { color: var(--muted); font-weight: 600; }
.data-table tr:last-child td { border-bottom: 0; }

.game-wrap { padding: 20px 0; }
.game-grid { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.board-area { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.board-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
#chessboard { max-width: 560px; margin: 0 auto; }
.side-panel { display: flex; flex-direction: column; gap: 16px; }
.cam-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.cam-box h4 { font-size: 13px; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; }
.cam-frame { width: 100%; aspect-ratio: 4/3; background: #000; border-radius: 10px; object-fit: cover; }
.cam-status { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.warn { background: var(--red); box-shadow: 0 0 6px var(--red); }

.controls { display: flex; gap: 10px; flex-wrap: wrap; }
.controls .btn { flex: 1; min-width: 110px; padding: 10px; font-size: 13px; }
.move-list { font-family: ui-monospace, monospace; font-size: 13px; color: var(--muted); max-height: 180px; overflow-y: auto; padding-right: 6px; }

.clocks { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.clock { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; min-width: 110px; text-align: center; }
.clock.active { border-color: var(--green); }
.clock-time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock-label { font-size: 11px; color: var(--muted); text-transform: uppercase; }

#qr-wrap { margin-top: 16px; display: none; }
#qr-img { max-width: 220px; border-radius: 10px; }

@media (max-width: 900px) {
  .hero-grid, .pricing-grid, .game-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .board-preview { margin: 0 auto; }
}
