:root {
  --gold: #f6b81c;
  --gold-deep: #e89c0c;
  --ink: #0d1424;
  --ink-2: #131c30;
  --panel: #1b2740;
  --panel-2: #22304e;
  --text: #eaf0fb;
  --muted: #9fb0cf;
  --ok: #54d18a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(246, 184, 28, 0.18), transparent 60%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--gold); text-decoration: none; }
h1, h2, h3 { line-height: 1.1; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 5vw, 48px);
  position: sticky; top: 0; z-index: 20;
  background: rgba(13, 20, 36, 0.78);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(246, 184, 28, 0.15);
}
.brand-logo { height: 30px; display: block; }
.site-nav { display: flex; gap: clamp(12px, 3vw, 28px); align-items: center; }
.site-nav a { color: var(--muted); font-weight: 600; font-size: 15px; }
.site-nav a:hover { color: var(--gold); }

/* Hero */
.hero {
  position: relative; text-align: center;
  padding: clamp(48px, 10vw, 110px) 20px clamp(40px, 7vw, 80px);
  overflow: hidden;
}
.hero-glow {
  position: absolute; inset: 0;
  background: radial-gradient(500px 300px at 50% 0%, rgba(246, 184, 28, 0.25), transparent 70%);
  pointer-events: none;
}
.hero-sun {
  width: 92px; height: 90px; margin-bottom: 18px;
  filter: drop-shadow(0 0 28px rgba(246, 184, 28, 0.65));
  animation: spin 22s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero h1 { font-size: clamp(32px, 6vw, 62px); margin: 0 0 16px; letter-spacing: -0.5px; }
.hero h1 .accent { color: var(--gold); }
.tagline { color: var(--muted); max-width: 620px; margin: 0 auto 28px; font-size: clamp(15px, 2vw, 19px); }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block; cursor: pointer; border: none;
  padding: 12px 24px; border-radius: 999px; font-weight: 700; font-size: 15px;
  font-family: inherit; transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: #2a1c00; box-shadow: 0 8px 24px rgba(246, 184, 28, 0.35); }
.btn-primary:hover { box-shadow: 0 10px 30px rgba(246, 184, 28, 0.55); }
.btn-ghost { background: transparent; color: var(--text); border: 1.5px solid rgba(255, 255, 255, 0.22); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

/* Joke section */
.joke { padding: 8px clamp(16px, 5vw, 48px) 0; max-width: 1000px; margin: 0 auto; }
.joke-card {
  background: linear-gradient(180deg, rgba(246, 184, 28, 0.12), rgba(246, 184, 28, 0.04));
  border: 1px solid rgba(246, 184, 28, 0.3); border-radius: 16px;
  padding: 20px clamp(18px, 3vw, 30px); text-align: center;
}
.joke-label { font-size: 13px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
.joke-src { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 12px; }
.joke-setup { font-size: clamp(17px, 2.4vw, 22px); font-weight: 600; margin: 6px 0 4px; }
.joke-punchline { font-size: clamp(16px, 2.2vw, 20px); color: var(--gold); margin: 6px 0 12px; font-weight: 700; }
.joke-punchline[hidden] { display: none; }
.joke-btn { padding: 8px 18px; font-size: 14px; }
.joke-btn[hidden] { display: none; }

/* Sections */
.section-title { text-align: center; font-size: clamp(24px, 4vw, 38px); margin: 0 0 32px; }
.games, .leaderboard { padding: clamp(40px, 7vw, 72px) clamp(16px, 5vw, 48px); max-width: 1000px; margin: 0 auto; }

/* Game cards */
.game-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.game-card {
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 18px; padding: 22px;
  text-align: center; transition: transform 0.15s ease, border-color 0.2s;
}
.game-card:hover { transform: translateY(-4px); border-color: rgba(246, 184, 28, 0.4); }
.game-card-art {
  height: 130px; border-radius: 12px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 64px;
}
.art-dino { background: linear-gradient(180deg, #2a3a5e, #1a2742); }
.art-flappy { background: linear-gradient(180deg, #355b86, #1a2742); }
.art-snake { background: linear-gradient(180deg, #2f5a4a, #1a2742); }
.art-whack { background: linear-gradient(180deg, #4a3a6e, #1a2742); }
.game-card h3 { margin: 0 0 8px; font-size: 22px; }
.game-card p { color: var(--muted); font-size: 15px; min-height: 44px; margin: 0 0 16px; }

/* Leaderboard */
.lb-tabs { display: flex; gap: 10px; justify-content: center; margin-bottom: 22px; flex-wrap: wrap; }
.lb-tab {
  cursor: pointer; font-family: inherit; font-weight: 700; font-size: 15px;
  padding: 10px 20px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: transparent; color: var(--muted);
}
.lb-tab.active { background: rgba(246, 184, 28, 0.14); border-color: var(--gold); color: var(--gold); }
.lb-list { list-style: none; padding: 0; margin: 0 auto; max-width: 540px; }
.lb-list li {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; border-radius: 12px; margin-bottom: 8px;
  background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.05);
}
.lb-rank { font-weight: 800; color: var(--gold); width: 34px; font-size: 17px; }
.lb-list li:nth-child(1) .lb-rank { font-size: 22px; }
.lb-name { flex: 1; font-weight: 600; }
.lb-score { font-variant-numeric: tabular-nums; font-weight: 800; }
.lb-empty { justify-content: center; color: var(--muted); }
.lb-list li.me { border-color: var(--gold); background: rgba(246, 184, 28, 0.1); }

/* Footer */
.site-footer { text-align: center; padding: 40px 20px 56px; border-top: 1px solid rgba(255, 255, 255, 0.06); color: var(--muted); }
.footer-logo { height: 26px; margin-bottom: 14px; opacity: 0.9; }
.site-footer p { margin: 6px 0; font-size: 14px; }
.footer-note { font-size: 13px; opacity: 0.8; }

/* Overlay */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 9, 18, 0.82); backdrop-filter: blur(6px); padding: 16px; }
.overlay[hidden] { display: none; }
.overlay-box {
  position: relative; width: min(860px, 96vw);
  background: linear-gradient(180deg, var(--panel-2), var(--ink-2));
  border: 1px solid rgba(246, 184, 28, 0.3); border-radius: 18px;
  padding: 22px clamp(16px, 3vw, 30px) 26px; text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.overlay-close { position: absolute; top: 12px; right: 16px; background: none; border: none; color: var(--muted);
  font-size: 30px; line-height: 1; cursor: pointer; }
.overlay-close:hover { color: var(--gold); }
.overlay-title { margin: 0 0 14px; font-size: 24px; color: var(--gold); }
.canvas-wrap { position: relative; }
#game-canvas {
  width: 100%; height: auto; max-height: 64vh; display: block; margin: 0 auto;
  background: #0e1830; border-radius: 12px; touch-action: manipulation;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.canvas-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: clamp(15px, 2.4vw, 20px); color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); pointer-events: none;
}
.canvas-hint[hidden] { display: none; }
.overlay-score { margin-top: 12px; font-weight: 700; font-size: 18px; }
.overlay-score #live-score { color: var(--gold); }

.gameover { margin-top: 14px; }
.gameover[hidden] { display: none; }
.gameover-final { font-size: 20px; margin: 4px 0; }
.gameover-final strong { color: var(--gold); }
.gameover-rank { color: var(--muted); margin: 2px 0 14px; min-height: 18px; }
.submit-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
#player-name {
  padding: 11px 16px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: var(--ink); color: var(--text); font-family: inherit; font-size: 15px; width: 200px; text-align: center;
}
#player-name:focus { outline: none; border-color: var(--gold); }
.submit-msg { min-height: 18px; margin: 10px 0 0; font-weight: 600; }
.submit-msg.ok { color: var(--ok); }
.submit-msg.err { color: #ff8d7a; }
