/* ── Centipede — Lime Theme ── */
:root {
    --cp-accent: #84CC16;
    --cp-accent-light: #BEF264;
    --cp-accent-dark: #4D7C0F;
    --cp-glow: rgba(132, 204, 22, 0.55);
    --cp-bg: #0A1300;
    --cp-surface: #122000;
    --cp-surface-light: #1E3300;
    --cp-text: #ECFCCB;
    --cp-text-dim: #8FA77A;
    --cp-gold: #FACC15;
    --cp-danger: #F87171;
    --cp-mushroom: #FB7185;
    --cp-spider: #C084FC;
}

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

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

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

.cp-header { text-align: center; padding: 36px 0 24px; }
.cp-logo { display: inline-flex; gap: 4px; margin-bottom: 14px; padding: 12px; background: var(--cp-surface); border-radius: 24px; border: 1px solid var(--cp-surface-light); }
.cp-logo span { width: 18px; height: 18px; border-radius: 50%; background: linear-gradient(135deg, var(--cp-accent), var(--cp-accent-dark)); box-shadow: 0 0 8px var(--cp-glow); animation: cpWave 1.6s ease-in-out infinite; }
.cp-logo span:nth-child(2) { animation-delay: 0.1s; }
.cp-logo span:nth-child(3) { animation-delay: 0.2s; }
.cp-logo span:nth-child(4) { animation-delay: 0.3s; }
.cp-logo span:nth-child(5) { animation-delay: 0.4s; }
.cp-logo span:nth-child(6) { animation-delay: 0.5s; background: linear-gradient(135deg, var(--cp-accent-light), var(--cp-accent)); }
@keyframes cpWave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

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

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

.difficulty-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.diff-btn {
    background: var(--cp-surface-light); border: 1.5px solid transparent; color: var(--cp-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(--cp-accent); }
.diff-btn.selected { background: linear-gradient(135deg, var(--cp-accent-dark), var(--cp-accent)); border-color: var(--cp-accent-light); box-shadow: 0 0 16px var(--cp-glow); }
.diff-icon { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; font-weight: 700; color: var(--cp-accent-light); }
.diff-btn.selected .diff-icon { color: #0A1300; }
.diff-desc { font-size: 0.72rem; color: var(--cp-text-dim); }
.diff-btn.selected .diff-desc { color: rgba(10,19,0,0.85); }

.cp-rules { margin: 0; padding-left: 1.1rem; color: var(--cp-text-dim); font-size: 0.92rem; line-height: 1.6; }
.cp-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(--cp-accent), var(--cp-accent-light)); color: #0A1300; box-shadow: 0 6px 18px var(--cp-glow); }
.btn--primary:hover { box-shadow: 0 10px 24px var(--cp-glow); }
.btn--outline { background: transparent; border: 1.5px solid var(--cp-accent); color: var(--cp-accent-light); }
.btn--outline:hover { background: rgba(132, 204, 22, 0.12); }
.btn--ghost { background: transparent; color: var(--cp-text-dim); }
.btn--ghost:hover { color: var(--cp-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(--cp-surface); padding: 14px; border-radius: 12px; border: 1px solid var(--cp-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(--cp-text-dim); }
.hud__value { font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 700; color: var(--cp-accent-light); }

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

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

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

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

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