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

:root {
    --bg-primary: #0d1329;
    --bg-secondary: #1a2140;
    --bg-card: #252b4a;
    --accent-pink: #ff3b6f;
    --accent-pink-dark: #cc2f59;
    --accent-blue: #4a6cf7;
    --accent-orange: #ff6b35;
    --text-primary: #ffffff;
    --text-secondary: #8892b0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, #0a0f1f 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

.app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
}

.menu-screen {
    padding: 40px 20px;
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
    min-height: 100vh;
}

.menu-screen::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0px);
    background: var(--bg-primary);
    z-index: 11;
}

.menu-header {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 10;
    background: var(--bg-primary);
    padding-top: 40px;
    margin-top: -40px;
    padding-bottom: 4px;
}

.btn-webview-back {
    display: none;
}

.webview .btn-webview-back {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0;
    top: 40px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 12;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.menu-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.tabs-container {
    overflow-x: auto;
    margin-bottom: 20px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tabs {
    display: flex;
    gap: 8px;
    white-space: nowrap;
    padding: 0 4px;
}

.tab {
    padding: 14px 20px;
    border-radius: 9999px;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tab:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent-pink);
    border-color: var(--accent-pink);
    color: var(--text-primary);
}

.game-card.hidden {
    display: none;
}

.games-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.game-card {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease;
}

.game-card:hover {
    transform: translateX(4px);
    background: var(--bg-card);
}

.game-card:active {
    transform: scale(0.98);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 16px;
    overflow: hidden;
}

.card-icon {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.card-icon-emoji {
    font-size: 40px;
    line-height: 1;
}

/* Game-specific backgrounds */
.shlyapa-bg {
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
}

.kto-iz-nas-bg {
    background: linear-gradient(135deg, #ff922b 0%, #e8590c 100%);
}

.zayac-bg {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.heads-up-bg {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.five-seconds-bg {
    background: linear-gradient(135deg, #ff9500 0%, #e68600 100%);
}

.taboo-bg {
    background: linear-gradient(135deg, #e53935 0%, #c62828 100%);
}

.danetki-bg {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.spy-bg {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.never-have-bg {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.crocodile-bg {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.codenames-bg {
    background: linear-gradient(135deg, #e53935 0%, #1e88e5 100%);
}

.secrethitler-bg {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
}

.wavelength-bg {
    background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
}

.erotic-dice-bg {
    background: linear-gradient(135deg, #7c4dff 0%, #e91e63 100%);
}

.kamasutra-bg {
    background: linear-gradient(135deg, #ff3b6f 0%, #ff1744 100%);
}

.decoder-bg {
    background: linear-gradient(135deg, #10b981 0%, #065f46 100%);
}

.soobrazhariy-bg {
    background: linear-gradient(135deg, #f59e0b 0%, #16a34a 100%);
}

.hundred-to-one-bg {
    background: linear-gradient(135deg, #ff3b6f 0%, #4a6cf7 100%);
}

.quiz-bg {
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
}

.melody-bg {
    background: linear-gradient(135deg, #ff3b6f 0%, #4a6cf7 100%);
}

.truth-detector-bg {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
}

.drawful-bg {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.fibbage-bg {
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
}

.quiplash-bg {
    background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
}

.imaginarium-bg {
    background: linear-gradient(135deg, #9333ea 0%, #6d28d9 100%);
}

.tab[data-filter="dev"] {
    border-color: transparent;
    color: transparent;
}

.tab[data-filter="dev"]:hover {
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.2);
}

.tab[data-filter="dev"].active {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.25);
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 6px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-pink);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.player-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.card-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 480px) {
    .app {
        max-width: 100%;
    }

    .menu-screen {
        padding: 24px 12px;
        padding-top: calc(24px + env(safe-area-inset-top, 0px));
    }

    .menu-header {
        padding-top: 24px;
        margin-top: -24px;
    }

    .webview .btn-webview-back {
        top: 24px;
    }

    .menu-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .tabs-container {
        margin-bottom: 16px;
    }

    .tab {
        padding: 12px 16px;
        font-size: 13px;
    }

    .games-list {
        gap: 12px;
    }

    .game-card {
        padding: 12px;
        border-radius: 12px;
    }

    .game-card:hover {
        transform: translateY(-2px);
    }

    .card-image {
        width: 60px;
        height: 60px;
        margin-right: 12px;
    }

    .card-header {
        margin-bottom: 4px;
    }

    .card-title {
        font-size: 16px;
    }

    .player-badge {
        font-size: 11px;
        padding: 2px 8px;
    }

    .card-description {
        font-size: 13px;
        line-height: 1.3;
    }
}

@media (max-height: 600px) {
    .menu-screen {
        padding: 20px 16px;
        padding-top: calc(20px + env(safe-area-inset-top, 0px));
    }

    .menu-header {
        padding-top: 20px;
        margin-top: -20px;
    }

    .webview .btn-webview-back {
        top: 20px;
    }

    .menu-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .card-image {
        width: 64px;
        height: 64px;
    }

}

/* Tablet and larger devices */
@media (min-width: 768px) {
    .games-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .game-card {
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }

    .card-image {
        margin-right: 0;
        margin-bottom: 16px;
        width: 80px;
        height: 80px;
    }

    .card-content {
        width: 100%;
    }

    .card-header {
        justify-content: center;
    }

    .card-title {
        font-size: 16px;
    }

    .card-description {
        font-size: 13px;
    }
}
