/* ── Q*bert — Amber Theme ── */
:root {
    --qb-accent: #F59E0B;
    --qb-accent-light: #FCD34D;
    --qb-accent-dark: #B45309;
    --qb-glow: rgba(245, 158, 11, 0.55);
    --qb-bg: #190F00;
    --qb-surface: #281600;
    --qb-surface-light: #3A2200;
    --qb-text: #FEF3C7;
    --qb-text-dim: #C3A06B;
    --qb-gold: #FACC15;
    --qb-danger: #F87171;
    --qb-purple: #A855F7;
    --qb-green: #34D399;
}

.qb-layout { display: flex; justify-content: center; gap: 20px; max-width: 1200px; margin: 0 auto; padding: 20px; min-height: calc(100vh - 80px); }
.ad-slot { width: 160px; flex-shrink: 0; }
.ad-slot--left, .ad-slot--right { display: flex; align-items: flex-start; }
.ad-placeholder--vertical { width: 160px; height: 600px; background: var(--qb-surface); border: 1px dashed var(--qb-text-dim); display: flex; align-items: center; justify-content: center; color: var(--qb-text-dim); font-size: 12px; border-radius: 8px; }

#qbert-app { flex: 1; max-width: 760px; min-width: 320px; color: var(--qb-text); }

.screen { display: none; }
.screen.active { display: block; animation: qbFade 0.3s ease; }
@keyframes qbFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.qb-header { text-align: center; padding: 36px 0 24px; }
.qb-logo {
    display: inline-block;
    width: 60px; height: 60px;
    background:
        conic-gradient(from 45deg, #F59E0B 0deg 120deg, #B45309 120deg 240deg, #FCD34D 240deg 360deg);
    transform: rotate(45deg);
    border-radius: 8px;
    margin-bottom: 14px;
    box-shadow: 0 0 30px var(--qb-glow);
    animation: qbSpin 6s linear infinite;
}
@keyframes qbSpin { from { transform: rotate(45deg); } to { transform: rotate(405deg); } }

.qb-header h1 { font-family: 'Syne', sans-serif; font-size: 2.6rem; font-weight: 800; color: var(--qb-accent-light); letter-spacing: 4px; margin: 0; text-shadow: 0 0 26px var(--qb-glow); }
.subtitle { color: var(--qb-text-dim); font-size: 1rem; margin-top: 8px; }

.card { background: var(--qb-surface); border-radius: 14px; padding: 20px; margin-bottom: 16px; border: 1px solid var(--qb-surface-light); }
.card__title { font-family: 'Syne', sans-serif; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; color: var(--qb-accent-light); margin-bottom: 14px; }

.difficulty-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.diff-btn {
    background: var(--qb-surface-light); border: 1.5px solid transparent; color: var(--qb-text);
    padding: 14px 8px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    font-family: 'DM Sans', sans-serif; font-size: 0.85rem;
}
.diff-btn:hover { transform: translateY(-2px); border-color: var(--qb-accent); }
.diff-btn.selected { background: linear-gradient(135deg, var(--qb-accent-dark), var(--qb-accent)); border-color: var(--qb-accent-light); box-shadow: 0 0 16px var(--qb-glow); }
.diff-icon { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: 700; color: var(--qb-accent-light); }
.diff-btn.selected .diff-icon { color: #fff; }
.diff-desc { font-size: 0.72rem; color: var(--qb-text-dim); }
.diff-btn.selected .diff-desc { color: rgba(255,255,255,0.85); }

.qb-rules { margin: 0; padding-left: 1.1rem; color: var(--qb-text-dim); font-size: 0.92rem; line-height: 1.6; }
.qb-rules li + li { margin-top: 6px; }

.btn { font-family: 'DM Sans', sans-serif; font-weight: 600; border-radius: 10px; border: none; cursor: pointer; padding: 12px 22px; transition: transform 0.12s ease, box-shadow 0.12s ease; font-size: 0.95rem; }
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: linear-gradient(135deg, var(--qb-accent), var(--qb-accent-light)); color: #190F00; box-shadow: 0 6px 18px var(--qb-glow); }
.btn--primary:hover { box-shadow: 0 10px 24px var(--qb-glow); }
.btn--outline { background: transparent; border: 1.5px solid var(--qb-accent); color: var(--qb-accent-light); }
.btn--outline:hover { background: rgba(245, 158, 11, 0.12); }
.btn--ghost { background: transparent; color: var(--qb-text-dim); }
.btn--ghost:hover { color: var(--qb-accent-light); }
.btn--lg { padding: 16px 36px; font-size: 1.05rem; }
.btn--sm { padding: 8px 14px; font-size: 0.85rem; }
.menu-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 18px; }

#game-hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; background: var(--qb-surface); padding: 14px; border-radius: 12px; border: 1px solid var(--qb-surface-light); margin-bottom: 14px; }
.hud__cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hud__label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--qb-text-dim); }
.hud__value { font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 700; color: var(--qb-accent-light); }

.qb-canvas-wrap { display: flex; justify-content: center; background: var(--qb-surface); border: 1px solid var(--qb-surface-light); border-radius: 14px; padding: 12px; box-shadow: 0 12px 36px rgba(0,0,0,0.45); }
#qb-canvas { background: radial-gradient(ellipse at center, #221400 0%, #060300 90%); border-radius: 8px; max-width: 100%; height: auto; display: block; cursor: pointer; }

.qb-touch { display: none; gap: 12px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.touch-btn {
    width: 64px; height: 64px; background: var(--qb-surface);
    border: 1.5px solid var(--qb-accent); color: var(--qb-accent-light);
    border-radius: 12px; font-size: 1.5rem; cursor: pointer; user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.touch-btn:active { transform: scale(0.92); }
.qb-actions { display: flex; justify-content: center; margin-top: 16px; }

.result-card, .lb-card { background: var(--qb-surface); border-radius: 16px; padding: 36px 28px; border: 1px solid var(--qb-surface-light); text-align: center; max-width: 480px; margin: 40px auto; box-shadow: 0 18px 36px rgba(0,0,0,0.4); }
.result-card h2 { font-family: 'Syne', sans-serif; font-size: 2rem; color: var(--qb-accent-light); letter-spacing: 4px; margin: 0 0 12px; text-shadow: 0 0 24px var(--qb-glow); }
.result-score { font-family: 'JetBrains Mono', monospace; font-size: 3rem; font-weight: 700; color: var(--qb-gold); margin: 8px 0; }
.result-detail { color: var(--qb-text-dim); font-size: 0.95rem; margin-bottom: 18px; line-height: 1.6; }
#nickname { width: 100%; padding: 12px 14px; border-radius: 10px; background: var(--qb-bg); color: var(--qb-text); border: 1.5px solid var(--qb-surface-light); font-family: 'DM Sans', sans-serif; font-size: 0.95rem; margin-bottom: 12px; box-sizing: border-box; }
#nickname:focus { outline: none; border-color: var(--qb-accent); }
.result-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }

.lb-card h2 { font-family: 'Syne', sans-serif; color: var(--qb-accent-light); letter-spacing: 4px; margin-bottom: 18px; text-shadow: 0 0 24px var(--qb-glow); }
#leaderboard-list { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; counter-reset: lb; }
#leaderboard-list li { counter-increment: lb; display: flex; justify-content: space-between; padding: 10px 14px; background: var(--qb-bg); margin-bottom: 6px; border-radius: 8px; border: 1px solid var(--qb-surface-light); font-family: 'DM Sans', sans-serif; }
#leaderboard-list li::before { content: counter(lb); color: var(--qb-accent-light); font-weight: 700; margin-right: 10px; min-width: 24px; }
#leaderboard-list li:nth-child(1) { border-color: var(--qb-gold); }
#leaderboard-list li:nth-child(1)::before { color: var(--qb-gold); }
#leaderboard-list .lb-score { font-family: 'JetBrains Mono', monospace; color: var(--qb-accent-light); font-weight: 600; }

@media (max-width: 900px) {
    .qb-layout { flex-direction: column; padding: 12px; }
    .ad-slot { width: 100%; }
    .ad-placeholder--vertical { width: 100%; height: 90px; }
    .qb-header h1 { font-size: 2rem; letter-spacing: 2px; }
    #game-hud { grid-template-columns: repeat(2, 1fr); }
    .qb-touch { display: flex; }
}
