/* Hanoi — Burnt Amber */
:root {
    --hn-accent: #B45309;
    --hn-accent-light: #F59E0B;
    --hn-accent-dark: #78350F;
    --hn-bg: #1A0E04;
    --hn-surface: #271708;
    --hn-surface-light: #38210E;
    --hn-text: #FBE9CC;
    --hn-text-dim: #C9A57A;
    --hn-pole: #92400E;
    --hn-base: #4D2607;
    --hn-success: #34D399;
    --hn-gold: #FACC15;
    --hn-danger: #F87171;

    --d1: #fde68a;
    --d2: #fbbf24;
    --d3: #f59e0b;
    --d4: #d97706;
    --d5: #b45309;
    --d6: #92400e;
    --d7: #7c2d12;
}

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

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

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

.hn-header { text-align: center; padding: 36px 0 24px; }
.hn-logo { display: inline-block; padding: 12px 18px; background: var(--hn-surface); border-radius: 12px; border: 1px solid var(--hn-surface-light); margin-bottom: 14px; }
.hn-mini { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hn-disc-mini { height: 7px; background: linear-gradient(180deg, var(--hn-accent-light), var(--hn-accent)); border-radius: 4px; box-shadow: 0 0 12px rgba(245,158,11,0.45); width: var(--w); }
.hn-header h1 { font-family: 'Syne', sans-serif; font-size: 2.4rem; font-weight: 800; color: var(--hn-accent-light); letter-spacing: 6px; margin: 0; text-shadow: 0 0 24px rgba(245,158,11,0.4); }
.subtitle { color: var(--hn-text-dim); font-size: 1rem; margin-top: 8px; }

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

.diff-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.diff-btn { background: var(--hn-surface-light); border: 1.5px solid transparent; color: var(--hn-text); padding: 12px 6px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: 'DM Sans', sans-serif; font-size: 0.8rem; transition: transform 0.12s ease, border-color 0.12s ease; }
.diff-btn:hover { transform: translateY(-2px); border-color: var(--hn-accent-light); }
.diff-btn.selected { background: linear-gradient(135deg, var(--hn-accent-dark), var(--hn-accent)); border-color: var(--hn-accent-light); }
.diff-icon { font-family: 'JetBrains Mono', monospace; font-size: 1.1rem; font-weight: 700; color: var(--hn-accent-light); }
.diff-btn.selected .diff-icon { color: #fff; }
.diff-desc { font-size: 0.7rem; color: var(--hn-text-dim); }

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

.hn-board {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    padding: 18px;
    background: var(--hn-surface);
    border: 1px solid var(--hn-surface-light);
    border-radius: 16px;
    height: 360px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.5);
    position: relative;
}
.hn-tower {
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
    border-radius: 10px;
}
.hn-tower:hover { background: rgba(245,158,11,0.06); }
.hn-tower.selected { background: rgba(245,158,11,0.15); box-shadow: inset 0 0 0 2px var(--hn-accent-light); }
.hn-pole {
    position: absolute;
    bottom: 28px; left: 50%;
    width: 12px; height: 280px;
    background: linear-gradient(180deg, #6b3a14, var(--hn-pole));
    border-radius: 6px 6px 0 0;
    transform: translateX(-50%);
}
.hn-base {
    position: absolute;
    bottom: 0; left: 4%;
    width: 92%; height: 28px;
    background: linear-gradient(180deg, var(--hn-base), #2a1505);
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.hn-discs {
    position: absolute;
    bottom: 28px; left: 0; right: 0;
    display: flex; flex-direction: column-reverse;
    align-items: center;
    gap: 2px;
    pointer-events: none;
}
.hn-disc {
    height: 24px;
    border-radius: 6px;
    border: 1.5px solid rgba(0,0,0,0.45);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 0 6px rgba(255,255,255,0.18);
    transition: transform 0.18s ease, opacity 0.18s ease;
    display: flex; align-items: center; justify-content: center;
    color: rgba(0,0,0,0.7);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.85rem;
}
.hn-disc[data-size="1"] { background: var(--d1); width: 30%; }
.hn-disc[data-size="2"] { background: var(--d2); width: 40%; }
.hn-disc[data-size="3"] { background: var(--d3); width: 50%; }
.hn-disc[data-size="4"] { background: var(--d4); width: 60%; }
.hn-disc[data-size="5"] { background: var(--d5); width: 70%; color: #fde68a; }
.hn-disc[data-size="6"] { background: var(--d6); width: 80%; color: #fde68a; }
.hn-disc[data-size="7"] { background: var(--d7); width: 90%; color: #fde68a; }
.hn-disc.lift { transform: translateY(-180px); }
.hn-disc.invalid { animation: hnShake 0.4s ease; }
@keyframes hnShake { 0%,100% { transform: translateX(0); } 25%,75% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }

.hn-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

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

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

@media (max-width: 900px) {
    .hn-layout { flex-direction: column; padding: 12px; }
    .ad-slot { width: 100%; }
    .ad-placeholder--vertical { width: 100%; height: 90px; }
    .diff-grid { grid-template-columns: repeat(3, 1fr); }
    .hn-board { height: 280px; }
    .hn-pole { height: 220px; }
    .hn-disc { height: 18px; }
}
