/* ============================================
   Snacky Dash — Styles
   Premium dark theme with glassmorphism,
   neon accents, and smooth animations.
   ============================================ */

/* ── Reset & Base ── */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: #08081A;
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    color: #E8E8F0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ── Game Container ── */

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;   /* fallback */
    height: 100dvh;  /* mobil címsor-független */
    overflow: hidden;
    background: #08081A;
}

#gameCanvas, #overlayCanvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#overlayCanvas {
    pointer-events: none;
    z-index: 2;
}

#gameCanvas {
    z-index: 1;
}

/* ── Screen Overlays ── */

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: auto;
}

.overlay {
    background: rgba(8, 8, 26, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.screen-content {
    text-align: center;
    padding: 32px 28px;
    max-width: 440px;
    width: 90%;
    background: rgba(20, 20, 60, 0.6);
    border: 1px solid rgba(100, 100, 200, 0.15);
    border-radius: 20px;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    max-height: 90vh;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* ── Game Title ── */

.game-title {
    font-family: 'Bangers', cursive;
    font-size: clamp(2rem, 6vw, 3.2rem);
    letter-spacing: 3px;
    background: linear-gradient(135deg, #FF6B35, #F7DC6F, #FF6B35);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
    text-shadow: none;
    margin-bottom: 8px;
    line-height: 1.2;
}

.title-emoji {
    font-size: 0.8em;
    -webkit-text-fill-color: initial;
    animation: bounce 2s ease-in-out infinite;
}

.title-emoji:last-child {
    animation-delay: 0.3s;
}

@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.subtitle {
    font-size: 1rem;
    color: #AEB6BF;
    margin-bottom: 6px;
    font-weight: 300;
}

.game-desc {
    font-size: 0.85rem;
    color: #8E99A4;
    line-height: 1.5;
    margin-bottom: 12px;
    padding: 0 8px;
    font-weight: 300;
}

.high-score {
    font-size: 0.95rem;
    color: #F1C40F;
    font-weight: 600;
    margin-bottom: 16px;
    min-height: 1.2em;
}

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 36px;
    border: none;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn-primary {
    background: linear-gradient(135deg, #E74C3C, #FF6B35);
    color: #FFF;
    box-shadow:
        0 4px 15px rgba(231, 76, 60, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow:
        0 6px 25px rgba(231, 76, 60, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-submit {
    background: linear-gradient(135deg, #2ECC71, #27AE60);
    color: #FFF;
    padding: 12px 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
    white-space: nowrap;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(46, 204, 113, 0.45);
}

.btn-submit:disabled {
    background: linear-gradient(135deg, #1A8F4E, #177A43);
    cursor: default;
    transform: none;
    opacity: 0.85;
}

/* ── Controls Info ── */

.controls-info {
    margin: 20px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-item {
    font-size: 0.85rem;
    color: #8E99A4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.control-label {
    color: #BDC3C7;
    font-weight: 400;
}

kbd {
    display: inline-block;
    padding: 2px 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: #D0D0E0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.touch-icon {
    font-size: 0.9rem;
}

.game-tips {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #95A5A6;
}

/* ── Game Over ── */

.gameover-title {
    font-family: 'Bangers', cursive;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    letter-spacing: 4px;
    color: #E74C3C;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.4);
    margin-bottom: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.gameover-content {
    max-width: 480px;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.run-stats {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 72px;
}

.stat-icon {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.stat-value {
    font-family: 'Bangers', cursive;
    font-size: 1.2rem;
    color: #F1C40F;
    letter-spacing: 1px;
}

.stat-label {
    font-size: 0.65rem;
    color: #95A5A6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-label {
    font-size: 0.85rem;
    color: #95A5A6;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.score-value {
    font-family: 'Bangers', cursive;
    font-size: clamp(2rem, 6vw, 3rem);
    background: linear-gradient(135deg, #F1C40F, #FF6B35);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

/* ── Leaderboard Form ── */

.form-label {
    font-size: 0.85rem;
    color: #AEB6BF;
    margin-bottom: 10px;
}

.input-group {
    display: flex;
    gap: 8px;
    justify-content: center;
}

#email-input {
    flex: 1;
    max-width: 220px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #E8E8F0;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#email-input:focus {
    border-color: rgba(100, 150, 255, 0.4);
    box-shadow: 0 0 12px rgba(100, 150, 255, 0.15);
}

#email-input.error {
    border-color: #E74C3C;
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.2);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

#email-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* ── Leaderboard Table ── */

.leaderboard-section {
    margin-bottom: 20px;
}

.lb-title {
    font-family: 'Bangers', cursive;
    font-size: 1.3rem;
    letter-spacing: 2px;
    color: #F1C40F;
    margin-bottom: 12px;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.lb-table thead th {
    padding: 6px 10px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7F8C8D;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-table tbody tr {
    transition: background 0.15s;
}

.lb-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.lb-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.lb-rank {
    font-weight: 700;
    text-align: center;
    width: 40px;
}

.lb-email {
    color: #BDC3C7;
    text-align: left;
}

.lb-score {
    color: #F1C40F;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.lb-top3 .lb-score {
    color: #FF6B35;
}

.lb-empty {
    color: #7F8C8D;
    font-style: italic;
    padding: 16px;
}

/* ── Responsive ── */

@media (max-width: 600px) {
    .screen-content {
        padding: 20px 16px;
        border-radius: 14px;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    #email-input {
        max-width: 100%;
    }

    .game-tips {
        flex-direction: column;
        gap: 6px;
    }

    .controls-info {
        margin: 14px 0 12px;
    }
}

@media (max-height: 500px) {
    .screen-content {
        padding: 12px 16px;
    }

    .game-title {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }

    .subtitle {
        display: none;
    }

    .controls-info {
        margin: 8px 0;
    }
}

/* ── Portrait (mobil, álló) ── */

@media (max-aspect-ratio: 1/1) {
    .screen-content {
        padding: 20px 16px;
        max-height: 96dvh;
        overflow-y: auto;
    }

    .game-title {
        font-size: 2.2rem;
    }

    .game-desc {
        font-size: 0.85rem;
    }

    .controls-info {
        align-items: flex-start;
        gap: 10px;
    }

    .control-item {
        justify-content: flex-start;
    }

    .game-tips {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-primary {
        width: 100%;
        max-width: 320px;
        font-size: 1.3rem;
        padding: 16px 24px;
        touch-action: manipulation;
    }

    .stat-item {
        flex: 1 0 45%;
        min-width: 0;
    }

    .leaderboard-section {
        max-height: 30dvh;
        overflow-y: auto;
    }
}

/* ── Scrollbar (for leaderboard overflow) ── */

.screen-content::-webkit-scrollbar {
    width: 4px;
}

.screen-content::-webkit-scrollbar-track {
    background: transparent;
}

.screen-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.screen-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ═══════════════ B2S — regisztráció + ranglista ═══════════════ */
.reg-form { margin: 16px 0; text-align: left; }
.reg-form input[type="text"], .reg-form input[type="email"], .reg-form select {
    width: 100%; padding: 10px 14px; margin: 6px 0;
    border: 2px solid rgba(255,255,255,.15); border-radius: 10px;
    background: rgba(255,255,255,.06); color: #fff; font-family: inherit; font-size: 15px;
    box-sizing: border-box;
}
.reg-form input:focus { outline: none; border-color: #ffd23f; }
.form-hint { font-size: 12px; opacity: .7; margin: 6px 0 10px; line-height: 1.4; }
.form-error { color: #ff6b6b; font-size: 13px; margin: 8px 0; }
.autocomplete { position: relative; }
.autocomplete-results {
    position: absolute; z-index: 30; left: 0; right: 0; max-height: 200px; overflow-y: auto;
    background: #1a1a3a; border: 2px solid rgba(255,255,255,.15); border-radius: 10px;
}
.autocomplete-item {
    display: block; width: 100%; padding: 10px 14px; text-align: left;
    background: none; border: none; color: #fff; font-size: 14px; cursor: pointer;
}
.autocomplete-item:hover, .autocomplete-item:focus { background: rgba(255,210,63,.15); }
.autocomplete-add { color: #ffd23f; }
.btn-link {
    display: block; background: none; border: none; padding: 2px 0; margin: 2px 0 6px;
    color: #ffd23f; opacity: .75; font-family: inherit; font-size: 12px;
    text-decoration: underline; cursor: pointer;
}
.btn-link:hover { opacity: 1; }
.school-new { padding: 8px; border: 1px dashed rgba(255,210,63,.4); border-radius: 10px; margin: 6px 0; }
.age-row { margin: 10px 0; }
.radio-row, .checkbox-row {
    display: flex; align-items: flex-start; gap: 10px;
    margin: 8px 0; font-size: 14px; cursor: pointer;
}
.radio-row input, .checkbox-row input { margin-top: 3px; accent-color: #ffd23f; }
.checkbox-row a { color: #ffd23f; }
.btn-ghost {
    background: transparent; border: 2px solid rgba(255,255,255,.25);
    color: #fff; padding: 10px 18px; border-radius: 12px; cursor: pointer;
    font-family: inherit; font-size: 14px;
}
.btn-ghost:hover { border-color: #ffd23f; }
.save-result { margin: 12px 0; font-size: 15px; line-height: 1.6; }
.save-result .sr-good { color: #7bed9f; }
.save-result .sr-warn { color: #ffd23f; }
.player-badge { font-size: 14px; opacity: .9; margin: 8px 0; }
.player-badge a { color: #ffd23f; cursor: pointer; margin-left: 8px; font-size: 12px; }
.lb-tabs { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.lb-tab {
    background: rgba(255,255,255,.06); border: 2px solid transparent; color: #fff;
    padding: 8px 14px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 13px;
}
.lb-tab.active { border-color: #ffd23f; background: rgba(255,210,63,.12); }
.lb-note { font-size: 12px; opacity: .7; margin: 4px 0 8px; }
.lb-own td { color: #ffd23f; font-weight: 700; }
.lb-cache-note { font-size: 11px; opacity: .6; }

/* ── Dorko-póló skinek: ruhatára (menü) + feloldás-banner ── */

#skin-section {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.skin-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #95A5A6;
    margin-bottom: 4px;
}

#skin-preview {
    display: block;
    margin: 0 auto;
    width: 170px;
    height: 170px;
}

#skin-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
}

.skin-btn {
    padding: 7px 12px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: var(--skin-color, rgba(255, 255, 255, 0.06));
    color: #ECF0F1;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.skin-btn:not(.locked):hover {
    transform: translateY(-2px);
    border-color: #F1C40F;
}

.skin-btn.locked {
    opacity: 0.55;
    cursor: default;
    background: rgba(255, 255, 255, 0.05);
}

.skin-btn.active {
    border-color: #F1C40F;
    box-shadow: 0 0 0 3px rgba(241, 196, 15, 0.25);
}

.skin-unlock-banner {
    margin: 14px auto 4px;
    padding: 12px 18px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.22), rgba(230, 126, 34, 0.22));
    border: 1px solid rgba(241, 196, 15, 0.6);
    color: #F8E8C8;
    font-size: 0.95rem;
    line-height: 1.45;
    animation: skin-pop 0.5s ease;
}

.skin-unlock-sub {
    font-size: 0.78rem;
    color: #C8B89A;
}

@keyframes skin-pop {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* ── PWA telepítési hint (menü) ── */
.install-hint {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 12px auto 0;
    padding: 12px 40px 12px 16px;
    max-width: 380px;
    border: 1px solid rgba(241, 196, 15, 0.45);
    border-radius: 12px;
    background: rgba(241, 196, 15, 0.08);
    text-align: center;
}
.install-hint-text {
    font-size: 0.85rem;
    line-height: 1.45;
    color: #ECF0F1;
}
.install-hint-sub { color: #B9C2D0; font-size: 0.8rem; }
.install-hint-share {
    display: inline-block;
    border: 1px solid #B9C2D0;
    border-radius: 4px;
    padding: 0 5px;
    font-size: 0.85em;
}
.install-hint-btn { padding: 8px 22px; font-size: 0.9rem; }
.install-hint-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    color: #95A5A6;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}
.install-hint-close:hover { color: #ECF0F1; }

/* a natív select lenyíló option-listája fehér hátterű → a fehér szöveg olvashatatlan volt */
.reg-form select option { color: #1A1A2E; background: #FFFFFF; }


/* ── Menu actions & Hero Start Button ── */
.menu-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 16px auto 20px;
    width: 100%;
    max-width: 320px;
}

.btn-start-highlight {
    width: 100%;
    font-size: 1.35rem !important;
    padding: 16px 28px !important;
    background: linear-gradient(135deg, #2ECC71, #27AE60) !important;
    box-shadow: 0 4px 18px rgba(46, 204, 113, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    letter-spacing: 2px !important;
    animation: pulse-start 2.2s ease-in-out infinite;
}

.btn-start-highlight:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 25px rgba(46, 204, 113, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

@keyframes pulse-start {
    0%, 100% {
        box-shadow: 0 4px 18px rgba(46, 204, 113, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 6px 26px rgba(46, 204, 113, 0.75), 0 0 16px rgba(46, 204, 113, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
        transform: scale(1.02);
    }
}

/* ── B2S: nyereményblokk (game over + regisztrációs overlay) ── */
.prize-block {
    margin: 16px auto;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 210, 63, 0.12), rgba(255, 140, 66, 0.08));
    border: 1px solid rgba(255, 210, 63, 0.35);
    border-radius: 12px;
    max-width: 420px;
    text-align: left;
}
.prize-title {
    font-family: 'Bangers', cursive;
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: #ffd23f;
    margin: 0 0 10px;
    text-align: center;
    text-shadow: 0 0 12px rgba(255, 210, 63, 0.35);
}
.prize-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.prize-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #eef2f5;
}
.prize-item strong { color: #ffd23f; }
.prize-item em { color: #95a5a6; font-style: normal; font-size: 0.8rem; }
.prize-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
@media (max-width: 480px) {
    .prize-block { padding: 10px 12px; margin: 12px auto; }
    .prize-item { font-size: 0.82rem; }
}
