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

body {
    font-family: "Inter", "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #2b1055, #1b0b2b 60%, #12071f 100%);
    color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow-x: hidden;
}

.glow {
    position: fixed;
    inset: -20%;
    background: radial-gradient(circle, rgba(255, 121, 198, 0.25), transparent 60%);
    filter: blur(40px);
    z-index: 0;
}

.app {
    position: relative;
    z-index: 1;
    width: min(980px, 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: block;
}

#game-screen.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    height: 100%;
}

.card {
    background: rgba(25, 16, 40, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
}

.badge {
    display: inline-flex;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 12px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.badge.success {
    background: rgba(72, 201, 176, 0.2);
}

.menu {
    background: rgba(25, 16, 40, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.menu-banner {
    position: relative;
    width: 100%;
    background: #1c1726;
}

.menu-banner-image {
    width: 100%;
    height: auto;
    display: block;
}

.menu-stats {
    position: absolute;
    left: 16px;
    bottom: 12px;
    display: flex;
    gap: 10px;
    padding: 6px 10px;
    background: rgba(15, 12, 22, 0.72);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.stat-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.menu-body {
    padding: 22px 26px 26px;
    display: grid;
    gap: 12px;
    background: rgba(35, 41, 50, 0.96);
}

.menu-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.7;
}

.menu-title {
    font-size: 28px;
    line-height: 1.2;
}

.menu-subtitle {
    font-size: 16px;
    opacity: 0.8;
}

.menu-author {
    font-size: 14px;
    opacity: 0.6;
}

.menu-variants {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    opacity: 0.85;
    flex-wrap: wrap;
}

.variant-buttons {
    display: flex;
    gap: 8px;
}

.variant-chip {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    padding: 6px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}

.variant-chip.active {
    background: #ffcf4a;
    color: #1b0b2b;
}

.menu-matches {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.8;
}

.menu-matches strong {
    font-size: 18px;
}

.menu-modes {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-top: 8px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    padding: 16px;
    color: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 68px;
}

.mode-title {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
}

.mode-subtitle {
    display: block;
    font-size: 12px;
    opacity: 0.6;
    font-weight: 500;
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn {
    border: none;
    border-radius: 14px;
    padding: 12px 22px;
    font-size: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.primary {
    background: linear-gradient(120deg, #ff7abf, #8f6cff);
    color: #fff;
    box-shadow: 0 12px 30px rgba(143, 108, 255, 0.4);
}

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

.topbar {
    background: rgba(36, 39, 48, 0.9);
    padding: 12px 16px;
    border-radius: 18px;
    margin-bottom: 16px;
    width: 100%;
}

.topbar-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    white-space: nowrap;
    width: 100%;
}

.stage-info {
    color: #fff;
    font-weight: 600;
}

.round-title {
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #f6e08a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.namebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 10px;
    width: 100%;
}

.name-pill {
    background: rgba(36, 39, 48, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
    padding: 8px 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    text-transform: lowercase;
    width: 100%;
}

.name-pill:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.name-pill:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.arena {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    overflow: hidden;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.arena::before,
.arena::after {
    content: '';
    position: absolute;
    inset: 0;
    top: 0;
    bottom: 0;
    width: 50%;
    background-size: cover;
    background-position: center;
    background-color: rgba(10, 8, 16, 0.2);
    background-blend-mode: multiply;
    filter: blur(8px);
    transform: scale(1.06);
    opacity: 0.5;
    z-index: 0;
    pointer-events: none;
}

.arena::before {
    left: 0;
    background-image: var(--left-bg);
}

.arena::after {
    right: 0;
    background-image: var(--right-bg);
}

.choice-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    padding: 14px;
    color: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.choice-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.choice-image {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 18px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
}

.choice-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.3);
    font-size: 14px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.vs {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 188px;
    pointer-events: none;
    z-index: 5;
}

.vs img {
    width: 100%;
    height: 100%;
    display: block;
}

.result {
    text-align: center;
}

.result h2 {
    font-size: 28px;
    margin: 14px 0 18px;
}

.winner-image {
    width: min(320px, 80vw);
    margin: 0 auto 24px;
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    background-size: cover;
    background-position: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.loading {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 18, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #fff;
    z-index: 5;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.loading.active {
    visibility: visible;
    opacity: 1;
}

.loader {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ff7abf;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 760px) {
    #game-screen {
        display: none;
    }

    #game-screen.active {
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .menu {
        width: 100%;
    }

    .app {
        padding: 8px;
    }

    .arena {
        grid-template-columns: 1fr 1fr;
        gap: 0;
        margin: 0;
        grid-template-rows: 1fr;
        height: auto;
        flex: 1;
        align-items: stretch;
    }

    .vs {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 80px;
        height: 150px;
    }

    .topbar-row {
        grid-template-columns: auto 1fr auto;
        text-align: left;
        gap: 8px;
        font-size: 12px;
    }

    .topbar-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .topbar {
        padding: 8px 10px;
        border-radius: 14px;
        margin-bottom: 6px;
    }

    .namebar {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin-bottom: 6px;
    }

    .name-pill {
        font-size: 12px;
        padding: 6px 8px;
    }

    .choice-card {
        padding: 0;
        border-radius: 0;
        width: 100%;
        height: 100%;
        border: none;
        background: transparent;
    }

    .choice-image {
        aspect-ratio: auto;
        height: 100%;
        border-radius: 0;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }

    .choice-header {
        font-size: 13px;
    }

    .menu-banner {
        height: 190px;
    }

    .menu-stats {
        flex-wrap: wrap;
        gap: 6px;
        left: 10px;
        right: 10px;
        justify-content: center;
    }
}
