/* Hill Climb — Earthy Brown Theme */
:root {
    --hc-accent: #92400E;
    --hc-accent-light: #F59E0B;
    --hc-accent-dark: #5A2A05;
    --hc-glow: rgba(245, 158, 11, 0.45);
    --hc-bg: #0E0905;
    --hc-surface: #1D1308;
    --hc-surface-light: #2B1F12;
    --hc-text: #F5ECD8;
    --hc-text-dim: #B0997A;
    --hc-border: #3A2A18;
    --hc-success: #34D399;
    --hc-gold: #FACC15;
}

.hc-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(--hc-surface);
    border: 1px dashed var(--hc-text-dim);
    display: flex; align-items: center; justify-content: center;
    color: var(--hc-text-dim); font-size: 12px; border-radius: 8px;
}

#hillclimb-app {
    flex: 1; max-width: 720px; min-width: 320px; color: var(--hc-text);
}

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

.hc-header { text-align: center; padding: 36px 0 20px; }
.hc-logo-mark {
    display: inline-block; padding: 8px;
    background: var(--hc-surface); border-radius: 10px;
    border: 1.5px solid var(--hc-border);
    margin-bottom: 12px;
    box-shadow: 0 0 24px var(--hc-glow);
}
.hc-header h1 {
    font-family: 'Syne', sans-serif;
    font-size: 2.6rem; font-weight: 800;
    color: var(--hc-accent-light);
    letter-spacing: 4px; margin: 0;
    text-shadow: 0 0 26px var(--hc-glow);
}
.subtitle { color: var(--hc-text-dim); margin-top: 8px; }

.card {
    background: var(--hc-surface);
    border-radius: 14px; padding: 20px;
    margin-bottom: 16px; border: 1px solid var(--hc-border);
}
.card__title {
    font-family: 'Syne', sans-serif;
    font-size: 0.85rem; text-transform: uppercase;
    letter-spacing: 2px; color: var(--hc-accent-light);
    margin-bottom: 14px;
}
.difficulty-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.diff-btn {
    background: var(--hc-surface-light);
    border: 1.5px solid transparent;
    color: var(--hc-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;
    font-family: 'DM Sans', sans-serif; font-size: 0.85rem;
}
.diff-btn:hover { transform: translateY(-2px); border-color: var(--hc-accent-light); }
.diff-btn.selected {
    background: linear-gradient(135deg, var(--hc-accent-dark), var(--hc-accent));
    border-color: var(--hc-accent-light);
    box-shadow: 0 0 16px var(--hc-glow);
}
.diff-icon {
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
    color: var(--hc-accent-light);
}
.diff-btn.selected .diff-icon { color: #fff; }
.diff-desc { font-size: 0.72rem; color: var(--hc-text-dim); }
.diff-btn.selected .diff-desc { color: rgba(255,255,255,0.85); }

.hc-rules {
    margin: 0; padding-left: 1.1rem;
    color: var(--hc-text-dim);
    font-size: 0.92rem; line-height: 1.6;
}
.hc-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(--hc-accent), var(--hc-accent-light));
    color: #1A1207;
    box-shadow: 0 6px 18px rgba(146, 64, 14, 0.45);
}
.btn--outline {
    background: transparent;
    border: 1.5px solid var(--hc-accent-light);
    color: var(--hc-accent-light);
}
.btn--outline:hover { background: rgba(245, 158, 11, 0.12); }
.btn--ghost { background: transparent; color: var(--hc-text-dim); }
.btn--ghost:hover { color: var(--hc-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(--hc-surface);
    padding: 14px; border-radius: 12px;
    border: 1px solid var(--hc-border); margin-bottom: 12px;
}
.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(--hc-text-dim);
}
.hud__value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem; font-weight: 700;
    color: var(--hc-accent-light);
}

.hc-canvas-wrap {
    display: flex; justify-content: center; padding: 8px 0;
}
#hc-canvas {
    width: 100%; max-width: 640px;
    aspect-ratio: 8 / 5;
    height: auto;
    background: linear-gradient(180deg, #1a2942 0%, #2c3f5c 60%, #3a2a18 100%);
    border-radius: 12px;
    border: 1px solid var(--hc-border);
    box-shadow: 0 12px 36px rgba(0,0,0,0.5);
    display: block;
    touch-action: none;
}

.hc-touch {
    display: none;
    margin-top: 10px; gap: 8px;
}
.touch-btn {
    flex: 1;
    background: var(--hc-surface);
    border: 1.5px solid var(--hc-border);
    color: var(--hc-accent-light);
    padding: 22px 0;
    border-radius: 12px;
    font-size: 1rem; font-weight: 700;
    user-select: none;
    touch-action: manipulation;
}
.touch-btn:active { background: var(--hc-accent-dark); color: #fff; }

.hc-actions {
    display: flex; justify-content: center; margin-top: 12px;
}

.result-card, .lb-card {
    background: var(--hc-surface);
    border-radius: 16px;
    padding: 36px 28px;
    border: 1px solid var(--hc-border);
    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(--hc-accent-light);
    letter-spacing: 4px; margin: 0 0 12px;
}
.result-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3rem; font-weight: 700;
    color: var(--hc-gold); margin: 8px 0;
}
.result-detail {
    color: var(--hc-text-dim); font-size: 0.95rem;
    line-height: 1.6; margin-bottom: 18px;
}
#nickname {
    width: 100%; padding: 12px 14px;
    border-radius: 10px;
    background: var(--hc-bg); color: var(--hc-text);
    border: 1.5px solid var(--hc-border);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem; margin-bottom: 12px;
    box-sizing: border-box;
}
#nickname:focus { outline: none; border-color: var(--hc-accent-light); }
.result-actions {
    display: flex; gap: 10px; justify-content: center; margin-bottom: 10px;
}

.lb-card h2 {
    font-family: 'Syne', sans-serif;
    color: var(--hc-accent-light);
    letter-spacing: 4px; margin-bottom: 18px;
}
#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(--hc-bg); margin-bottom: 6px;
    border-radius: 8px; border: 1px solid var(--hc-border);
    font-family: 'DM Sans', sans-serif;
}
#leaderboard-list li::before {
    content: counter(lb);
    color: var(--hc-accent-light); font-weight: 700;
    margin-right: 10px; min-width: 24px;
}
#leaderboard-list li:nth-child(1) { border-color: var(--hc-gold); }
#leaderboard-list li:nth-child(1)::before { color: var(--hc-gold); }
#leaderboard-list .lb-score {
    font-family: 'JetBrains Mono', monospace;
    color: var(--hc-accent-light); font-weight: 600;
}

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