/* ============================================================
   Jump Game — Sky Bounce Theme
   Accent: #38bdf8 (sky blue)   Dark: #0c1929
   Font: Syne (display) · DM Sans (body)
   ============================================================ */

/* ─── Layout: 3-column ─── */
.jump-layout {
    display: grid;
    grid-template-columns: 160px minmax(0, 440px) 160px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        ".       game   .      "
        "left    game   right  "
        ".       game   .      ";
    justify-content: center;
    gap: 1.5rem;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: calc(100vh - 60px);
}
.jump-layout .ad-slot--left  { grid-area: left; }
.jump-layout .ad-slot--right { grid-area: right; }

#jump-app {
    grid-area: game;
    text-align: center;
    position: relative;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.screen { display: none; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* ─── Cards ─── */
.card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.75rem;
}
.card__title {
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.75rem;
}

/* ─── Header ─── */
.jump-header {
    padding: 2rem 0 1rem;
}
.jump-header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: 8px;
    color: #fff;
    margin: 0;
    line-height: 1;
    background: linear-gradient(180deg, #e0f4ff 20%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.subtitle {
    color: rgba(255,255,255,0.35);
    font-size: 0.85rem;
    margin-top: 0.4rem;
    font-weight: 400;
    letter-spacing: 1px;
}
.control-hint {
    color: rgba(255,255,255,0.2);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.3px;
    line-height: 1.4;
}
.btn:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.btn--primary {
    background: #38bdf8;
    color: #fff;
    box-shadow: 0 2px 8px rgba(56,189,248,0.3);
}
.btn--primary:hover {
    background: #56c45a;
    box-shadow: 0 4px 16px rgba(56,189,248,0.35);
    transform: translateY(-1px);
}
.btn--primary:active { transform: translateY(0); }
.btn--primary:disabled {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.25);
    cursor: default;
    transform: none;
    box-shadow: none;
}
.btn--lg { padding: 0.8rem 2.4rem; font-size: 1rem; }
.btn--outline {
    background: transparent;
    color: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.12);
}
.btn--outline:hover {
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.04);
}
.btn--ghost {
    background: transparent;
    color: rgba(255,255,255,0.4);
    border: none;
    font-size: 0.85rem;
}
.btn--ghost:hover { color: rgba(255,255,255,0.6); }

.menu-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin: 1.2rem 0 0.5rem;
}

/* ─── Character Grid ─── */
.char-grid {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}
.char-card {
    width: 80px;
    height: 100px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0.4rem;
}
.char-card:hover:not(.locked) {
    border-color: rgba(56,189,248,0.4);
    background: rgba(56,189,248,0.05);
}
.char-card.selected {
    border-color: #38bdf8;
    background: rgba(56,189,248,0.08);
    box-shadow: 0 0 0 1px rgba(56,189,248,0.2);
}
.char-card.locked { opacity: 0.3; cursor: not-allowed; }
.char-card:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.char-card canvas { margin-bottom: 0.25rem; }
.char-card span { font-size: 0.7rem; color: rgba(255,255,255,0.45); font-weight: 500; }
.char-card.selected span { color: #38bdf8; }

.char-info {
    margin-top: 0.6rem;
    padding: 0.6rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 8px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    min-height: 40px;
}
.char-info .stat-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.15rem 0;
}
.char-info .stat-label { width: 55px; text-align: right; color: rgba(255,255,255,0.3); font-size: 0.75rem; }
.char-info .stat-track {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.char-info .stat-fill { height: 100%; background: #38bdf8; border-radius: 2px; transition: width 0.3s; }

/* ─── Difficulty ─── */
.difficulty-grid {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
}
.diff-btn {
    flex: 1;
    padding: 0.5rem 0.3rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}
.diff-btn:hover { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.6); }
.diff-btn.selected {
    border-color: #38bdf8;
    background: rgba(56,189,248,0.08);
    color: #38bdf8;
}
.diff-btn:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.diff-icon { font-size: 0.7rem; line-height: 1; }
.diff-desc {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.2);
    font-weight: 400;
}
.diff-btn.selected .diff-desc { color: rgba(56,189,248,0.6); }

/* ─── Volume ─── */
.volume-controls {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
}
.vol-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.vol-name { font-size: 0.75rem; color: rgba(255,255,255,0.35); width: 28px; text-align: right; font-weight: 500; }
.vol-slider { flex: 1; height: 4px; accent-color: #38bdf8; cursor: pointer; }
.vol-val { font-size: 0.7rem; color: rgba(255,255,255,0.3); width: 22px; text-align: right; font-variant-numeric: tabular-nums; }

/* ─── HUD ─── */
#game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}
.hud__cell { display: flex; flex-direction: column; gap: 0.1rem; }
.hud__cell--right { text-align: right; align-items: flex-end; }
.hud__label {
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255,255,255,0.25);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.hud__value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #38bdf8;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.hud__value--sub { font-size: 0.95rem; color: rgba(255,255,255,0.4); }
.hud__combo {
    font-size: 0.85rem;
    font-weight: 700;
    color: #38bdf8;
    animation: comboPulse 0.3s ease;
}
@keyframes comboPulse {
    0%   { transform: scale(1.4); }
    100% { transform: scale(1); }
}
.hud__item {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    background: rgba(255,102,0,0.15);
    color: #f59e0b;
}
.menu-best {
    color: rgba(56,189,248,0.6);
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0.4rem 0 0;
    font-variant-numeric: tabular-nums;
}

/* ─── Canvas ─── */
.canvas-wrap { position: relative; line-height: 0; }
#game-canvas {
    background: #e8f4f8;
    border: 1px solid rgba(255,255,255,0.06);
    border-top: none;
    border-radius: 0 0 12px 12px;
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    touch-action: none;
}

/* Mobile pause */
.mobile-pause-btn {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    color: rgba(255,255,255,0.6);
    font-size: 1rem;
    cursor: pointer;
    z-index: 50;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
@media (pointer: coarse) {
    .mobile-pause-btn { display: flex; align-items: center; justify-content: center; }
}

/* ─── Overlays ─── */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.overlay__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 2rem 3rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
}
.overlay__box h2 { color: #fff; font-size: 1.3rem; font-weight: 600; margin-bottom: 0.3rem; }

/* Pause Stats */
.pause-stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 0.8rem;
}
.pause-stat {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}
.pause-stat span {
    color: #38bdf8;
    font-weight: 600;
    margin-left: 0.3rem;
}

/* New Best */
.new-best-overlay {
    background: rgba(0,0,0,0.6) !important;
    pointer-events: none;
}
.new-best-text {
    color: #ffd54f !important;
    font-size: 2.8rem !important;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 0 40px rgba(255,213,79,0.5), 0 0 80px rgba(255,213,79,0.2);
    animation: newBestPulse 0.6s ease-out;
}
@keyframes newBestPulse {
    0%   { transform: scale(0.5); opacity: 0; }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* ─── Result Card ─── */
.result-card {
    max-width: 380px;
    margin: 2rem auto;
    padding: 2rem 1.5rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.result-card h2 { color: #fff; font-size: 1.3rem; font-weight: 600; margin-bottom: 0.3rem; }
.result-score { font-size: 2rem; font-weight: 800; color: #38bdf8; font-variant-numeric: tabular-nums; }
.result-best { font-size: 0.85rem; color: rgba(255,255,255,0.35); }
.result-actions { display: flex; gap: 0.6rem; margin-top: 0.8rem; }

#nickname {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    color: #e0e0e0;
    border-radius: 8px;
    width: 200px;
    text-align: center;
    transition: border-color 0.15s;
}
#nickname:focus { outline: none; border-color: #38bdf8; }
#nickname::placeholder { color: rgba(255,255,255,0.2); }

/* ─── Game Stats ─── */
.game-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
    margin: 0.5rem 0;
    width: 100%;
}
.game-stats .stat-item {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.game-stats .stat-item .stat-val {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ─── Leaderboard ─── */
.lb-card {
    max-width: 400px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    text-align: center;
}
.lb-card h2 {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}
#leaderboard-list {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}
#leaderboard-list li {
    display: flex;
    align-items: center;
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    transition: background 0.15s;
}
#leaderboard-list li:nth-child(odd) { background: rgba(255,255,255,0.02); }
#leaderboard-list li:hover { background: rgba(56,189,248,0.06); }
#leaderboard-list li .rank { color: rgba(255,255,255,0.3); font-weight: 700; width: 28px; font-size: 0.8rem; }
#leaderboard-list li:nth-child(1) .rank { color: #ffd54f; }
#leaderboard-list li:nth-child(2) .rank { color: #b0bec5; }
#leaderboard-list li:nth-child(3) .rank { color: #a1887f; }
#leaderboard-list li .lb-name { flex: 1; color: rgba(255,255,255,0.6); font-size: 0.85rem; }
#leaderboard-list li .lb-score { color: #38bdf8; font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
#leaderboard-list li .lb-time { color: rgba(255,255,255,0.2); font-size: 0.7rem; margin-left: 0.6rem; white-space: nowrap; }

/* ─── Responsive: Tablet ─── */
@media (max-width: 860px) {
    .jump-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "game";
        max-width: 440px;
        gap: 0;
    }
    .jump-layout .ad-slot--left, .jump-layout .ad-slot--right { display: none; }
    .jump-layout .ad-slot--top, .jump-layout .ad-slot--bottom {
        display: flex;
        grid-area: unset;
        justify-content: center;
        padding: 0.5rem 0;
    }
    .jump-layout {
        grid-template-areas:
            "top"
            "game"
            "bottom";
        grid-template-rows: auto 1fr auto;
    }
    .jump-layout .ad-slot--top { grid-area: top; }
    .jump-layout .ad-slot--bottom { grid-area: bottom; }
    .ad-placeholder--vertical { min-height: unset; position: static; }
    .ad-placeholder { min-height: 60px; padding: 1rem; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
    .new-best-text,
    .hud__combo { animation: none !important; }
}

/* ─── Responsive: Mobile ─── */
@media (max-width: 480px) {
    .jump-layout { padding: 0 0.5rem; }
    .jump-header h1 { font-size: 2rem; letter-spacing: 5px; }
    .card { padding: 0.8rem; }
    .char-card { width: 70px; height: 90px; }
    .difficulty-grid { gap: 0.3rem; }
    .diff-btn { padding: 0.4rem 0.2rem; font-size: 0.75rem; }
    .btn--lg { padding: 0.7rem 2rem; font-size: 0.9rem; }
    #nickname { width: 170px; }
    .result-card { margin: 1rem auto; padding: 1.5rem 1rem; }
    #game-hud { padding: 0.4rem 0.7rem; }
    .hud__value { font-size: 1.1rem; }
}

/* ─── Achievement Toast ─── */
.achievement-toast {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    background: linear-gradient(135deg, rgba(20,40,20,0.97), rgba(10,25,10,0.97));
    border: 1px solid rgba(56,189,248,0.6);
    border-radius: 12px;
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 15px rgba(56,189,248,0.2);
    z-index: 200;
    min-width: 200px;
    max-width: 320px;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease;
    opacity: 0;
}
.achievement-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.achievement-toast .ach-icon { font-size: 1.3rem; flex-shrink: 0; }
.achievement-toast .ach-body { display: flex; flex-direction: column; gap: 0.1rem; }
.achievement-toast .ach-label { font-size: 0.6rem; color: rgba(56,189,248,0.7); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.achievement-toast .ach-name { font-size: 0.85rem; color: #fff; font-weight: 700; }

/* ─── Achievement Summary (Game Over) ─── */
.achievement-summary { margin: 0.8rem 0; }
.ach-summary-title { font-size: 0.8rem; color: rgba(56,189,248,0.8); font-weight: 700; margin-bottom: 0.5rem; }
.ach-badge-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.ach-badge {
    font-size: 0.68rem;
    padding: 0.2rem 0.45rem;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}
.ach-badge.earned { background: rgba(56,189,248,0.15); border: 1px solid rgba(56,189,248,0.4); color: #38bdf8; }
.ach-badge.locked { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.25); }

/* ─── Tutorial Overlay ─── */
.tutorial-overlay { z-index: 300; background: rgba(0,0,0,0.85); }
.tutorial-box {
    max-width: 380px;
    padding: 1.8rem 1.6rem 1.2rem;
    text-align: left;
}
.tutorial-box h2 { font-size: 1.1rem; margin-bottom: 0.8rem; color: #38bdf8; }
.tut-content {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.7;
    min-height: 80px;
    margin-bottom: 1.2rem;
}
.tut-content b { color: #fff; }
.tut-items { display: flex; flex-direction: column; gap: 0.4rem; }
.tut-items div { display: flex; align-items: center; gap: 0.5rem; }
.tut-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.7rem;
    gap: 0.5rem;
}
.tut-step-indicator { font-size: 0.7rem; color: rgba(255,255,255,0.4); flex: 1; text-align: center; }
#tut-skip { display: block; margin: 0 auto; }
.btn--xs { padding: 0.25rem 0.7rem; font-size: 0.7rem; }
