:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --board-bg: rgba(30, 41, 59, 0.7);
    --cell-bg: rgba(51, 65, 85, 0.5);
    --board-padding: 15px;
    --transition-speed: 120ms;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --app-height: 100vh;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: #0f172a;
    color: var(--text-color);
    min-height: var(--app-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    user-select: none;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    padding: calc(var(--safe-top) + 20px) var(--safe-right) calc(var(--safe-bottom) + 20px) var(--safe-left);
}

body.app-shell {
    width: 100%;
}

button,
input,
.game-container {
    touch-action: manipulation;
}

.mobile-status-banner {
    position: fixed;
    top: calc(var(--safe-top) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 6000;
    width: min(92vw, 420px);
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #e2e8f0;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
}

.brand-splash {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 38%, rgba(59, 130, 246, 0.28), transparent 32%),
        radial-gradient(circle at 50% 62%, rgba(245, 158, 11, 0.22), transparent 34%),
        linear-gradient(180deg, rgba(8, 15, 30, 0.98), rgba(15, 23, 42, 0.98));
    transition: opacity 0.65s ease, visibility 0.65s ease;
}

.brand-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.brand-splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: brand-zoom 2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.brand-splash-logo {
    width: min(58vw, 300px);
    filter: drop-shadow(0 18px 45px rgba(56, 189, 248, 0.18)) drop-shadow(0 20px 50px rgba(245, 158, 11, 0.16));
}

.brand-splash-text {
    font-size: clamp(1rem, 2vw, 1.1rem);
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: rgba(241, 245, 249, 0.9);
    font-weight: 800;
}

.mobile-status-banner.is-error {
    border-color: rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

.global-credit {
    position: fixed;
    left: 50%;
    bottom: calc(var(--safe-bottom) + 10px);
    transform: translateX(-50%);
    z-index: 2100;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(10, 16, 32, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
    backdrop-filter: blur(8px);
    pointer-events: none;
}

.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(4, 10, 24, 0.84);
    backdrop-filter: blur(10px);
}

.confirm-modal-overlay[hidden] {
    display: none !important;
}

.confirm-modal-box {
    width: min(92vw, 380px);
    padding: 24px 22px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(19, 29, 54, 0.98), rgba(12, 19, 39, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.confirm-modal-box h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #f8fafc;
}

.confirm-modal-box p {
    color: #94a3b8;
    font-size: 0.96rem;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.confirm-modal-actions .btn-standard {
    margin: 0;
}

.status-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 5600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(12px);
}

.status-modal-overlay[hidden] {
    display: none !important;
}

.status-modal-box {
    width: min(92vw, 400px);
    padding: 24px 22px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(19, 30, 56, 0.98), rgba(10, 16, 31, 0.98));
    border: 1px solid rgba(125, 211, 252, 0.22);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.status-modal-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.34);
    color: #7dd3fc;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.status-modal-box h2 {
    margin-top: 14px;
    color: #f8fafc;
    font-size: 1.45rem;
}

.status-modal-box p {
    margin-top: 10px;
    color: #cbd5e1;
    font-size: 0.98rem;
    line-height: 1.55;
}

.status-modal-detail {
    min-height: 22px;
    margin-top: 12px;
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 700;
}

#btn-status-modal {
    width: 100%;
    margin-top: 18px;
}

.btn-install-app {
    width: 100%;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.12);
    color: #bae6fd;
    font-size: 0.95rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-install-app:hover {
    background: rgba(56, 189, 248, 0.18);
    transform: translateY(-1px);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2em;
}

.audio-toggle-row {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.legal-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.legal-link {
    color: #7dd3fc;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
}

.legal-link:hover {
    color: #bae6fd;
    text-decoration: underline;
}

.legal-copy {
    margin-top: 10px;
    color: rgba(148, 163, 184, 0.92);
    font-size: 0.78rem;
    line-height: 1.5;
    text-align: center;
}

.release-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 12px auto 0;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.26);
    background: rgba(15, 23, 42, 0.78);
    color: #bae6fd;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.profile-strip {
    width: 100%;
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.52));
    border: 1px solid rgba(125, 211, 252, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.profile-strip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-rank-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-rank {
    color: #f8fafc;
    font-size: 0.94rem;
    font-weight: 800;
}

.profile-level {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #7dd3fc;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profile-xp-label {
    color: #94a3b8;
    font-size: 0.76rem;
    font-weight: 700;
}

.profile-progress {
    width: 100%;
    height: 10px;
    margin-top: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(51, 65, 85, 0.8);
}

.profile-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #38bdf8, #e879f9);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
    transition: width 260ms ease;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.profile-stat {
    padding: 10px 8px;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.profile-stat-label {
    display: block;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-stat strong {
    display: block;
    margin-top: 6px;
    color: #f8fafc;
    font-size: 1rem;
}

.legal-page {
    justify-content: center;
    padding-bottom: calc(var(--safe-bottom) + 32px);
}

.legal-page-card {
    width: min(92vw, 760px);
    padding: 28px 24px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
}

.legal-page-card h1,
.legal-page-card h2 {
    color: #f8fafc;
}

.legal-page-card h1 {
    margin-bottom: 12px;
    font-size: clamp(2rem, 4vw, 2.6rem);
}

.legal-page-card h2 {
    margin: 24px 0 10px;
    font-size: 1.08rem;
}

.legal-page-card p {
    color: #cbd5e1;
    line-height: 1.7;
    font-size: 0.98rem;
}

.legal-back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 18px;
    color: #7dd3fc;
    font-weight: 800;
    text-decoration: none;
}

.btn-audio-toggle {
    flex: 1;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(15, 23, 42, 0.68);
    color: #cbd5e1;
    font-size: 0.84rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-audio-toggle:hover {
    color: #fff;
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(30, 41, 59, 0.9);
}

/* --- GAME UI STYLES --- */
.main-header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 14px;
    width: 100%;
}

.game-meta-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.game-action-bar {
    display: flex;
    justify-content: center;
    margin-top: 0;
}

.game-leave-btn {
    width: auto;
    min-width: 160px;
    padding: 11px 18px;
    border-color: rgba(248, 113, 113, 0.32);
    background: rgba(127, 29, 29, 0.22);
    color: #fecaca;
}

.game-leave-btn:hover {
    background: rgba(153, 27, 27, 0.32);
    border-color: rgba(248, 113, 113, 0.46);
}

@media screen and (min-width: 541px) and (max-width: 950px) {
    .main-header {
        margin-bottom: 14px;
        padding: 0 16px;
        padding-top: 16px;
    }

    .title {
        font-size: 3rem;
    }

    .subtitle {
        font-size: 1.65rem;
    }

    .instructions {
        font-size: 0.9rem;
        line-height: 1.35;
    }

    #room-info {
        font-size: 0.82rem !important;
        margin-top: 0 !important;
    }

    .game-meta-row {
        gap: 10px;
        margin-top: 4px;
    }

    .game-leave-btn {
        min-width: 0;
        padding: 8px 14px;
        font-size: 0.92rem;
        border-radius: 10px;
    }

    .global-credit {
        padding: 4px 10px;
        font-size: 0.67rem;
        bottom: calc(var(--safe-bottom) + 8px);
    }
}

.title {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(to right, #38bdf8, #e879f9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 15px rgba(232, 121, 249, 0.2);
}

.subtitle {
    font-size: 2rem;
    color: #facc15;
    -webkit-text-fill-color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.instructions {
    color: #94a3b8;
    font-size: 1rem;
}

.boards-wrapper {
    display: flex;
    gap: 50px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1100px;
    padding: 0 20px;
}

.player-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
}

.player-section h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.controls {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-top: 5px;
}

.player1-section h2 { color: #38bdf8; }
.player2-section h2 { color: #e879f9; }

.score-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 20px;
    text-align: center;
    min-width: 120px;
    margin-bottom: 20px;
}

.player1-section .score-box { border-color: rgba(56, 189, 248, 0.3); box-shadow: 0 0 15px rgba(56, 189, 248, 0.2); }
.player2-section .score-box { border-color: rgba(232, 121, 249, 0.3); box-shadow: 0 0 15px rgba(232, 121, 249, 0.2); }

.score-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #cbd5e1;
    margin-bottom: 4px;
}

.score-value {
    font-size: 1.7rem;
    font-weight: 900;
}

.game-container {
    position: relative;
    background: var(--board-bg);
    padding: var(--board-padding);
    border-radius: 16px;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    aspect-ratio: 1;
    touch-action: none;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.grid-cell {
    background: var(--cell-bg);
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tile-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2;
    pointer-events: none;
}

.tile-2 { --bg: #38bdf8; --text: #1e293b; }
.tile-4 { --bg: #818cf8; --text: #1e293b; }
.tile-8 { --bg: #c084fc; --text: #fff; }
.tile-16 { --bg: #e879f9; --text: #fff; }
.tile-32 { --bg: #f472b6; --text: #fff; }
.tile-64 { --bg: #fb7185; --text: #fff; }
.tile-128 { --bg: #facc15; --text: #1e293b; }
.tile-256 { --bg: #fde047; --text: #1e293b; }
.tile-512 { --bg: #a3e635; --text: #1e293b; }
.tile-1024 { --bg: #4ade80; --text: #1e293b; }
.tile-2048 { --bg: #2dd4bf; --text: #fff; }
.tile-super { --bg: #22d3ee; --text: #fff; }

.tile {
    position: absolute;
    top: calc(var(--board-padding) + var(--y) * (100% - var(--board-padding)) / 4);
    left: calc(var(--board-padding) + var(--x) * (100% - var(--board-padding)) / 4);
    width: calc((100% - 5 * var(--board-padding)) / 4);
    height: calc((100% - 5 * var(--board-padding)) / 4);
    
    background: var(--bg, #fff);
    color: var(--text, #1e293b);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    font-weight: 900;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1), inset 0 2px 0 rgba(255,255,255,0.2);
    
    transition: top var(--transition-speed) ease-in-out,
        left var(--transition-speed) ease-in-out,
        opacity 140ms ease;
    will-change: top, left;
}

.tile.tile-128, .tile.tile-256, .tile.tile-512 { font-size: 1.8rem; }
.tile.tile-1024, .tile.tile-2048, .tile.tile-super { font-size: 1.4rem; }

.tile-inner {
    width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
}

@keyframes appear { 0% { opacity: 0; transform: scale(0.6); } 100% { opacity: 1; transform: scale(1); } }
.tile-new .tile-inner { animation: appear 120ms ease 90ms backwards; }
@keyframes pop { 0% { transform: scale(0.92); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
.tile-merged .tile-inner { animation: pop 175ms ease-in-out 18ms backwards; }
.tile-preview {
    z-index: 3;
    opacity: 0.98;
}

.tile-preview .tile-inner {
    transform: scale(1);
}

.game-message {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    z-index: 100;
    backdrop-filter: blur(5px);
    border-radius: 16px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.game-message.active { display: flex; animation: fade-in 0.5s ease; }
.game-message p {
    font-size: 3rem;
    font-weight: 900;
    color: #ef4444;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    text-transform: uppercase;
}

@keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }

/* --- LANDING UI STYLES --- */
.landing-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 50%, #312e81 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    overflow: hidden;
    padding: calc(var(--safe-top) + 16px) calc(var(--safe-right) + 16px) calc(var(--safe-bottom) + 16px) calc(var(--safe-left) + 16px);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.cube {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    font-weight: 900;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: floatCube linear infinite;
    opacity: 0.15;
}
.cube-2 { width: 80px; height: 80px; background: #38bdf8; font-size: 2rem; color: #fff; left: 10%; top: 20%; animation-duration: 12s; }
.cube-4 { width: 120px; height: 120px; background: #c084fc; font-size: 3.5rem; color: #fff; right: 15%; top: 15%; animation-duration: 18s; animation-direction: reverse; }
.cube-8 { width: 100px; height: 100px; background: #facc15; font-size: 3rem; color: #1e293b; left: 20%; top: 70%; animation-duration: 15s; }
.cube-2048 { width: 150px; height: 150px; background: #f472b6; font-size: 4rem; color: #fff; right: 10%; bottom: 10%; animation-duration: 20s; animation-direction: reverse; }

@keyframes floatCube {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(180deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

.glass-panel {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 24px;
    padding: 50px;
    text-align: center;
    width: 90%;
    max-width: 500px;
    max-height: min(100%, calc(var(--app-height) - var(--safe-top) - var(--safe-bottom) - 32px));
    overflow-y: auto;
    z-index: 10;
}

.hero-title {
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 0.9;
    color: #fff;
    text-shadow: 0 10px 20px rgba(0,0,0,0.5);
    margin-bottom: 4px;
    margin-top: -10px;
}
.hero-subtitle {
    display: block;
    font-size: 1.4rem;
    background: linear-gradient(to right, #38bdf8, #e879f9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 10px;
}

.hero-desc {
    color: #cbd5e1;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.live-stats {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #a7f3d0;
    white-space: nowrap;
    flex-shrink: 0;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

#live-real-count {
    color: #34d399;
    font-size: 1.05rem;
}

.live-label-real {
    color: #6ee7b7;
    margin-right: 2px;
}

.live-sep {
    color: #475569;
    font-size: 0.85rem;
    margin: 0 2px;
}

#live-bot-count {
    color: #94a3b8;
    font-size: 1rem;
}

.live-label-bot {
    font-size: 0.9rem;
}

.lang-switcher {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
}
.lang-switcher button {
    background: rgba(15, 23, 42, 0.6);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.lang-switcher button.active {
    background: #38bdf8;
    color: #0f172a;
    border-color: #38bdf8;
}
.lang-switcher button:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.nickname-input {
    width: 100%;
    padding: 18px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid #38bdf8;
    color: white;
    font-size: 1.3rem;
    text-align: center;
    outline: none;
    font-family: inherit;
    font-weight: 800;
    margin-bottom: 25px;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
    transition: all 0.3s ease;
}

.nickname-input:focus {
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.6);
    border-color: #e879f9;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-mega {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 20px;
    border-radius: 16px;
    font-size: 1.4rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
    margin-bottom: 10px;
    font-family: inherit;
}

.btn-mega .btn-icon {
    margin-right: 10px;
}
.btn-mega small {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 5px;
}
.btn-mega:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.6);
}

.divider {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 700;
    margin: 20px 0;
    letter-spacing: 2px;
}

.room-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.btn-standard {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 12px;
    font-size: clamp(0.8rem, 2.5vw, 1.1rem);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-actions > .btn-standard {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
}

.btn-standard:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}
.alt-btn {
    background: #e879f9;
    border-color: #e879f9;
    color: #fff;
}
.alt-btn:hover {
    background: #d946ef;
}

.join-box {
    display: flex;
    gap: 10px;
}

.join-box input {
    flex: 2;
    padding: 15px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.2rem;
    text-align: center;
    outline: none;
    font-family: inherit;
    font-weight: 700;
    transition: border-color 0.2s;
    text-transform: uppercase;
}
.join-box input:focus { border-color: #e879f9; }
.join-box button { flex: 1; margin: 0; }

.room-code-display {
    font-size: 4rem;
    color: #facc15;
    margin: 20px 0;
    letter-spacing: 15px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(250,204,21,0.3);
}

.loader {
    width: 60px; height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.1);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.search-status-note {
    margin: -8px 0 18px;
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
    min-height: 40px;
    max-width: 280px;
}

#matchmaking-status {
    width: 100%;
    margin-top: 14px;
    min-height: 20px;
    color: #cbd5e1;
    font-weight: 700;
    font-size: 0.86rem;
    line-height: 1.4;
    text-align: center;
}

#matchmaking-status.is-error {
    color: #fca5a5;
}

#matchmaking-status.is-success {
    color: #86efac;
}

#matchmaking-status.is-info {
    color: #93c5fd;
}

#matchmaking-status.is-warning {
    color: #fde68a;
}

.matchmaking-note {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.matchmaking-note::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}

.matchmaking-note.is-passive::before {
    opacity: 0.45;
    box-shadow: none;
}

#matchmaking-status.is-error .matchmaking-note {
    background: rgba(127, 29, 29, 0.24);
    border-color: rgba(248, 113, 113, 0.2);
}

#matchmaking-status.is-success .matchmaking-note {
    background: rgba(20, 83, 45, 0.24);
    border-color: rgba(74, 222, 128, 0.2);
}

#matchmaking-status.is-info .matchmaking-note {
    background: rgba(30, 58, 138, 0.24);
    border-color: rgba(96, 165, 250, 0.22);
}

#matchmaking-status.is-warning .matchmaking-note {
    background: rgba(120, 53, 15, 0.22);
    border-color: rgba(250, 204, 21, 0.22);
}

/* Status + live stats side by side */
.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 4px;
    flex-wrap: nowrap;
    justify-content: center;
}

.server-status {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    white-space: nowrap;
    gap: 6px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}
.server-status.offline {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}
.pulse-dot {
    width: 8px; height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}
.server-status.offline .pulse-dot {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    animation: none;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); } 70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

@media screen and (max-width: 950px) {
    .boards-wrapper { flex-direction: column; align-items: center; gap: 30px; }
}

@media screen and (max-width: 540px) {
    body { padding: 0; margin: 0; }
    .boards-wrapper { padding: 10px; display: flex; flex-direction: column; width: 100%; max-width: 500px; margin: 0 auto; gap: 15px; }
    
    .title { font-size: 2.2rem; }
    .subtitle { font-size: 1.2rem; }
    .main-header { padding-top: 16px; }
    .game-meta-row { gap: 8px; margin-top: 4px; }
    #room-info { margin-top: 0 !important; font-size: 0.78rem !important; }
    .game-leave-btn { min-width: 0; padding: 8px 12px; font-size: 0.88rem; }
    
    .player1-section { 
        max-width: 100%; 
        width: 100%;
        order: 2; 
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas: "title score" "board board";
        align-items: center;
        gap: 10px;
        background: rgba(30, 41, 59, 0.4);
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.05);
        padding: 15px;
        box-sizing: border-box;
    }
    .player1-section h2 { grid-area: title; text-align: left; font-size: 1.1rem; margin: 0; line-height: 1.2; }
    .player1-section .score-box { grid-area: score; min-width: 80px; padding: 6px 12px; margin: 0; }
    .player1-section .score-label { font-size: 0.6rem; margin-bottom: 2px; }
    .player1-section .score-value { font-size: 1.4rem; }
    .player1-section .game-container { grid-area: board; padding: 8px; --board-padding: 8px; border-radius: 12px; width: 100%; margin: 0; }
    .player1-section .grid-container { gap: 8px; }
    .player1-section .tile { font-size: 1.6rem; }
    .player1-section .tile.tile-128, .player1-section .tile.tile-256, .player1-section .tile.tile-512 { font-size: 1.3rem; }
    .player1-section .tile.tile-1024, .player1-section .tile.tile-2048, .player1-section .tile.tile-super { font-size: 1rem; }
    .player1-section .game-message p { font-size: 2.2rem; }
    
    .player2-section { order: 1; display: grid; grid-template-columns: minmax(0, 1fr) 132px; grid-template-areas: "title board" "score board"; align-items: start; width: 100%; gap: 10px 12px; padding: 12px; background: rgba(30, 41, 59, 0.4); border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.05); }
    .player2-section h2 { grid-area: title; font-size: 1.05rem; margin: 0; text-align: left; line-height: 1.15; }
    .player2-section .controls { display: none; }
    .player2-section .score-box { grid-area: score; min-width: 74px; width: fit-content; padding: 6px 10px; margin: 0; border-radius: 8px; justify-self: start; align-self: start; margin-top: 2px; }
    .player2-section .score-label { font-size: 0.56rem; }
    .player2-section .score-value { font-size: 1.15rem; }
    .player2-section .game-container { grid-area: board; padding: 6px; --board-padding: 6px; border-radius: 10px; width: 132px; margin-left: auto; border: 2px solid rgba(232, 121, 249, 0.36); box-shadow: 0 8px 16px rgba(0,0,0,0.32); aspect-ratio: 1; align-self: start; }
    .player2-section .grid-container { gap: 6px; }
    .player2-section .grid-cell { border-radius: 4px; }
    .player2-section .tile { font-size: 0.88rem !important; border-radius: 4px; }
    .player2-section .game-message { border-radius: 10px; }
    .player2-section .game-message p { font-size: 0.9rem; text-shadow: none; font-weight: 800; line-height: 1.15; }

    .glass-panel { padding: 20px 15px; width: 95%; border-radius: 16px; margin: auto; }
    .hero-title { font-size: 3.2rem; display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-bottom: 5px; }
    .hero-subtitle { display: inline-block; font-size: 1.2rem; letter-spacing: 1px; }
    .hero-desc { font-size: 0.95rem; margin-bottom: 15px; }
    
    .nickname-input { padding: 12px; font-size: 1.1rem; margin-bottom: 15px; }
    .profile-strip { margin-bottom: 14px; padding: 12px; }
    .profile-strip-header { align-items: flex-start; flex-direction: column; gap: 8px; }
    .profile-stats { gap: 8px; }
    .profile-stat { padding: 8px 6px; }
    .profile-stat strong { font-size: 0.92rem; }
    .btn-mega { font-size: 1.1rem; padding: 14px 10px; white-space: normal; line-height: 1.2; }
    .btn-mega small { margin-top: 3px; font-size: 0.8rem; }
    .divider { margin: 15px 0; }
    .btn-standard { font-size: 1rem; padding: 12px; }
    
    .join-box { flex-direction: row; gap: 5px; width: 100%; }
    .join-box input { padding: 10px; font-size: 1rem; flex: 0 0 175px; width: 175px; text-align: center; }
    .join-box button { flex: 1; min-width: 0; padding: 10px 4px; font-size: 0.8rem; word-break: break-all; white-space: normal; line-height: 1.1; }
    
    .lang-switcher { margin-top: 15px; flex-wrap: wrap; width: 100%; justify-content: center; }
    .lang-switcher button { padding: 6px 4px; font-size: 0.8rem; flex: 1; text-align: center; }
    .audio-toggle-row { gap: 8px; }
    .btn-audio-toggle { padding: 10px 8px; font-size: 0.73rem; }
    
    .room-code-display { font-size: 2.5rem; letter-spacing: 3px; margin: 10px 0; }
    .cube { display: none; } 
}

@media screen and (max-height: 500px) and (orientation: landscape) {
    body { padding: 0; margin: 0; overflow: hidden; }
    
    /* Landing UI */
    .glass-panel { padding: 8px 15px; width: 90%; max-width: 600px; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 5px; }
    .hero-title { font-size: 1.8rem; margin: 0; display: inline-block; }
    .hero-subtitle { font-size: 0.9rem; letter-spacing: 2px; display: inline-block; }
    .hero-desc { display: none; }
    .nickname-input { margin: 0; padding: 6px; font-size: 0.9rem; width: 140px; }
    #menu-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; margin-top: 0; }
    .btn-mega { font-size: 0.9rem; padding: 6px 12px; margin: 0; }
    .btn-mega small { display: none; }
    .divider { margin: 0 5px; width: auto; padding: 0; }
    .room-actions { margin: 0; flex-direction: row; gap: 8px; }
    .btn-standard { font-size: 0.8rem; padding: 6px 8px; margin: 0; }
    .join-box { margin: 0; width: auto; }
    .join-box input { width: 60px; flex: 0 0 60px; padding: 6px; font-size: 0.8rem; }
    .room-code-display { font-size: 1.5rem; margin: 0; }
    .server-status { margin: 0; padding: 4px 8px; font-size: 0.7rem; width: auto; }
    .lang-switcher { margin-top: 0; width: auto; }
    .lang-switcher button { padding: 4px 8px; font-size: 0.7rem; }
    .audio-toggle-row { width: auto; margin-top: 0; }
    .btn-audio-toggle { padding: 6px 8px; font-size: 0.68rem; }
    
    /* Game UI */
    .main-header { display: flex; flex-direction: row; justify-content: space-between; align-items: center; padding: 6px 10px 0; margin: 0; min-height: 30px; }
    .main-header .title { font-size: 1.2rem; margin: 0; }
    .main-header .subtitle { font-size: 0.7rem; }
    #main-instructions { margin: 0; font-size: 0.8rem; min-height: unset; position: absolute; left: 50%; transform: translateX(-50%); top: 5px; z-index: 100; }
    .game-meta-row { gap: 6px; margin-top: 0; }
    #room-info { margin: 0; font-size: 0.75rem; }
    .game-action-bar { margin-top: 0; }
    .game-leave-btn { min-width: 0; padding: 6px 10px; font-size: 0.78rem; }

    .boards-wrapper { padding: 0; gap: 15px; margin-top: 5px; display: flex; flex-direction: row; justify-content: center; align-items: flex-start; }
    
    .player-section { width: 40vw; max-width: 200px; display: flex; flex-direction: column; align-items: center; background: transparent; border: none; padding: 0; box-shadow: none; order: unset; }
    .player1-section { display: flex; }
    .player-section h2 { font-size: 0.8rem; margin-bottom: 2px; text-align: center; width: 100%; justify-content: center; }
    .score-box { min-width: 60px; padding: 3px 8px; margin-bottom: 4px; margin-top: 0; align-self: center; justify-self: center; }
    .score-label { font-size: 0.5rem; margin-bottom: 0px; }
    .score-value { font-size: 1rem; }
    
    .game-container { padding: 4px; --board-padding: 4px; border-radius: 8px; width: 100%; aspect-ratio: 1; margin: 0; }
    .grid-container { gap: 4px; }
    .tile { font-size: 1rem; border-radius: 4px; }
    .grid-cell { border-radius: 4px; }
    .tile.tile-128, .tile.tile-256, .tile.tile-512 { font-size: 0.8rem; }
    .tile.tile-1024, .tile.tile-2048, .tile.tile-super { font-size: 0.6rem; }
    .game-message p { font-size: 1rem; }
    .cube { display: none; }
}

/* ═══════════════════════════════════════════════════════
   STATS BAR
═══════════════════════════════════════════════════════ */
.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 8px 16px;
    margin-bottom: 18px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #cbd5e1;
}
.stat-item { display: flex; align-items: center; gap: 5px; }
.stat-label { color: #64748b; font-size: 0.75rem; font-weight: 600; }
.stat-divider { width: 1px; height: 18px; background: rgba(255,255,255,0.1); }
#stat-wins { color: #34d399; }
#stat-losses { color: #f87171; }
#stat-best { color: #facc15; }

/* ═══════════════════════════════════════════════════════
   LEADERBOARD
═══════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════
   COUNTDOWN OVERLAY
═══════════════════════════════════════════════════════ */
.countdown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}
.countdown-number {
    font-size: 12rem;
    font-weight: 900;
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #38bdf8, #e879f9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    animation: countdown-pop 0.8s ease forwards;
}
@keyframes countdown-pop {
    0%   { transform: scale(1.5); opacity: 0; }
    30%  { transform: scale(1);   opacity: 1; }
    70%  { transform: scale(1);   opacity: 1; }
    100% { transform: scale(0.5); opacity: 0; }
}
.countdown-go {
    font-size: 7rem;
    background: linear-gradient(135deg, #10b981, #38bdf8) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.result-overlay {
    position: fixed;
    inset: 0;
    z-index: 2950;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 6, 23, 0.54);
    backdrop-filter: blur(8px);
}

.result-overlay[hidden] {
    display: none !important;
}

.result-overlay-card {
    position: relative;
    width: min(92vw, 430px);
    overflow: hidden;
    padding: 28px 24px 24px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.97), rgba(15, 23, 42, 0.9));
    box-shadow: 0 35px 90px rgba(0, 0, 0, 0.52);
    text-align: center;
    animation: result-card-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.result-overlay-glow {
    position: absolute;
    inset: auto -10% 52% -10%;
    height: 180px;
    opacity: 0.75;
    filter: blur(38px);
    pointer-events: none;
}

.result-badge {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.result-title {
    position: relative;
    z-index: 1;
    margin-top: 14px;
    font-size: clamp(2.1rem, 7vw, 3.3rem);
    font-weight: 900;
    line-height: 0.92;
    letter-spacing: 0.02em;
}

.result-reason {
    position: relative;
    z-index: 1;
    margin-top: 14px;
    color: #dbeafe;
    font-size: 1rem;
    line-height: 1.55;
}

.result-reward-row {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.result-reward-pill {
    padding: 12px 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.reward-label {
    display: block;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-reward-pill strong {
    display: block;
    margin-top: 6px;
    color: #f8fafc;
    font-size: 1.14rem;
    font-weight: 900;
}

.result-subline {
    position: relative;
    z-index: 1;
    margin-top: 16px;
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.45;
}

.result-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.result-action-btn {
    flex: 1;
    margin: 0;
}

.result-overlay.is-win .result-overlay-card {
    border-color: rgba(34, 197, 94, 0.24);
    background: linear-gradient(180deg, rgba(8, 26, 33, 0.97), rgba(11, 21, 38, 0.93));
}

.result-overlay.is-win .result-overlay-glow {
    background: radial-gradient(circle, rgba(45, 212, 191, 0.62), rgba(56, 189, 248, 0.18), transparent 72%);
}

.result-overlay.is-win .result-badge {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(74, 222, 128, 0.34);
}

.result-overlay.is-win .result-title {
    color: #ecfeff;
    text-shadow: 0 0 24px rgba(45, 212, 191, 0.34);
}

.result-overlay.is-lose .result-overlay-card {
    border-color: rgba(248, 113, 113, 0.24);
    background: linear-gradient(180deg, rgba(33, 13, 24, 0.97), rgba(22, 16, 34, 0.93));
}

.result-overlay.is-lose .result-overlay-glow {
    background: radial-gradient(circle, rgba(251, 113, 133, 0.54), rgba(239, 68, 68, 0.16), transparent 72%);
}

.result-overlay.is-lose .result-badge {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(248, 113, 113, 0.34);
}

.result-overlay.is-lose .result-title {
    color: #fff1f2;
    text-shadow: 0 0 24px rgba(248, 113, 113, 0.24);
}

.result-overlay.is-draw .result-overlay-card {
    border-color: rgba(250, 204, 21, 0.24);
    background: linear-gradient(180deg, rgba(42, 28, 12, 0.96), rgba(26, 21, 35, 0.92));
}

.result-overlay.is-draw .result-overlay-glow {
    background: radial-gradient(circle, rgba(250, 204, 21, 0.58), rgba(251, 191, 36, 0.14), transparent 72%);
}

.result-overlay.is-draw .result-badge {
    color: #fde68a;
    background: rgba(250, 204, 21, 0.12);
    border-color: rgba(250, 204, 21, 0.34);
}

.result-overlay.is-draw .result-title {
    color: #fefce8;
    text-shadow: 0 0 24px rgba(250, 204, 21, 0.22);
}

.player-section.is-highlighted {
    transform: translateY(-4px);
    filter: saturate(1.06);
}

.player-section.is-highlighted .game-container {
    box-shadow: 0 28px 60px rgba(8, 145, 178, 0.24);
    border-color: rgba(125, 211, 252, 0.26);
}

.player-section.is-muted {
    opacity: 0.74;
    filter: grayscale(0.12);
}

@keyframes result-card-in {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.94);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ═══════════════════════════════════════════════════════
   EMOJI REACTION BAR
═══════════════════════════════════════════════════════ */

@media (hover: none) {
    .btn-mega:hover,
    .btn-standard:hover,
    .btn-install-app:hover {
        transform: none;
        background: inherit;
        box-shadow: inherit;
    }
}

@keyframes brand-zoom {
    0% {
        opacity: 0;
        transform: scale(0.72);
    }
    30% {
        opacity: 1;
        transform: scale(1.04);
    }
    65% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1.06);
    }
}

@media screen and (max-width: 540px) {
    .mobile-status-banner {
        width: calc(100vw - 24px);
        font-size: 0.84rem;
        top: calc(var(--safe-top) + 8px);
    }

    .status-modal-box {
        width: calc(100vw - 24px);
        padding: 22px 18px;
    }

    .result-actions {
        flex-direction: column;
    }

    .global-credit {
        width: calc(100vw - 24px);
        font-size: 0.68rem;
        bottom: calc(var(--safe-bottom) + 8px);
    }
}


/* ═══════════════════════════════════════════════════════
   POWER-UP BAR
═══════════════════════════════════════════════════════ */
.powerup-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 8px 14px;
    flex-wrap: wrap;
    justify-content: center;
}
.powerup-charges {
    display: flex;
    gap: 5px;
    margin-right: 4px;
}
.charge-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}
.charge-dot.active {
    background: #facc15;
    box-shadow: 0 0 8px rgba(250,204,21,0.6);
    border-color: #facc15;
}
.powerup-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    color: #e2e8f0;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}
.powerup-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.15);
    transform: translateY(-1px);
}
.powerup-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}
.powerup-btn.ready {
    background: rgba(250,204,21,0.15);
    border-color: rgba(250,204,21,0.5);
    color: #facc15;
    box-shadow: 0 0 10px rgba(250,204,21,0.2);
}
.powerup-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(250,204,21,0.4);
    color: #facc15;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    z-index: 4000;
    animation: toast-pop 1.8s ease forwards;
    pointer-events: none;
    text-align: center;
}
@keyframes toast-pop {
    0%   { opacity: 0; transform: translate(-50%, -40%); }
    15%  { opacity: 1; transform: translate(-50%, -50%); }
    75%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%); }
}
