/* Hex Battle — Emerald */
:root {
    --hb-accent: #10B981;
    --hb-accent-light: #6EE7B7;
    --hb-accent-dark: #065F46;
    --hb-glow: rgba(16, 185, 129, 0.55);
    --hb-bg: #02160E;
    --hb-surface: #07221A;
    --hb-surface-light: #0D3326;
    --hb-text: #D1FAE5;
    --hb-text-dim: #88A89A;
    --hb-success: #34D399;
    --hb-gold: #FBBF24;
    --hb-danger: #F87171;
    --hb-foe: #EF4444;
    --hb-friend: #34D399;
    --hb-neutral: #4B5563;
}

.hb-layout {
    display: flex; justify-content: center; gap: 20px;
    max-width: 1300px; 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(--hb-surface);
    border: 1px dashed var(--hb-text-dim); display: flex; align-items: center;
    justify-content: center; color: var(--hb-text-dim); font-size: 12px; border-radius: 8px;
}
#hexbattle-app { flex: 1; max-width: 900px; min-width: 320px; color: var(--hb-text); }

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

.hb-header { text-align: center; padding: 36px 0 24px; }
.hb-logo { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.hb-hex {
    width: 38px; height: 44px; display: inline-block;
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    filter: drop-shadow(0 0 12px var(--hb-glow));
}
.hb-hex--p { background: linear-gradient(160deg, #34D399, #10B981); }
.hb-hex--n { background: linear-gradient(160deg, #6B7280, #374151); transform: translateY(-6px); }
.hb-hex--e { background: linear-gradient(160deg, #F87171, #DC2626); }

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

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

.hb-rules { margin: 0; padding-left: 1.1rem; color: var(--hb-text-dim); font-size: 0.92rem; line-height: 1.6; }
.hb-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(--hb-accent), var(--hb-accent-light));
    color: #02160E; box-shadow: 0 6px 18px var(--hb-glow);
}
.btn--primary:hover { box-shadow: 0 10px 24px var(--hb-glow); }
.btn--outline { background: transparent; border: 1.5px solid var(--hb-accent); color: var(--hb-accent-light); }
.btn--outline:hover { background: rgba(16,185,129,0.12); }
.btn--ghost { background: transparent; color: var(--hb-text-dim); }
.btn--ghost:hover { color: var(--hb-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(5, 1fr); gap: 8px;
    background: var(--hb-surface); padding: 12px; border-radius: 12px;
    border: 1px solid var(--hb-surface-light); margin-bottom: 14px;
}
.hud__cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hud__label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; color: var(--hb-text-dim); }
.hud__value { font-family: 'JetBrains Mono', monospace; font-size: 1.1rem; font-weight: 700; color: var(--hb-accent-light); }
.hud__gold { color: var(--hb-gold); }
.hud__friend { color: var(--hb-friend); }
.hud__foe { color: var(--hb-foe); }
.hud__score { color: var(--hb-accent-light); }

.hb-stage {
    position: relative; display: flex; justify-content: center;
    background: var(--hb-bg); border-radius: 14px; border: 1px solid var(--hb-surface-light);
    padding: 8px; box-shadow: 0 14px 40px rgba(0,0,0,0.5);
}
#hb-canvas {
    background: radial-gradient(ellipse at center, #062E20 0%, #02160E 100%);
    border-radius: 8px; display: block; max-width: 100%; height: auto;
    cursor: pointer;
}
.hb-banner {
    position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
    font-family: 'Syne', sans-serif; font-size: 1.2rem; color: var(--hb-accent-light);
    background: rgba(2,22,14,0.85); padding: 8px 18px; border-radius: 10px;
    border: 1px solid var(--hb-accent); opacity: 0; transition: opacity 0.3s ease;
    pointer-events: none;
}
.hb-banner.show { opacity: 1; }

.hb-action-panel {
    background: var(--hb-surface); border-radius: 12px; padding: 12px;
    border: 1px solid var(--hb-surface-light); margin-top: 12px;
}
.hb-panel-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.9rem; }
.hb-panel-label { color: var(--hb-text-dim); font-family: 'Syne', sans-serif; text-transform: uppercase; letter-spacing: 2px; font-size: 0.75rem; }
.hb-action-row { display: flex; gap: 8px; flex-wrap: wrap; }

.hb-actions { display: flex; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

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

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

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