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

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(85, 247, 255, 0.5) rgba(8, 12, 22, 0.7);
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: rgba(8, 12, 22, 0.7);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(85, 247, 255, 0.8), rgba(255, 106, 213, 0.8));
    border-radius: 999px;
    border: 2px solid rgba(8, 12, 22, 0.7);
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(85, 247, 255, 1), rgba(255, 106, 213, 1));
}

:root {
    --bg: #080b16;
    --card: rgba(12, 16, 28, 0.92);
    --glass: rgba(255, 255, 255, 0.08);
    --text: #f7f8ff;
    --muted: rgba(214, 220, 255, 0.7);
    --accent-1: #55f7ff;
    --accent-2: #ff6ad5;
    --accent-3: #ffc15a;
    --accent-4: #8b7bff;
    --shadow: rgba(3, 6, 16, 0.7);
}

body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(circle at 12% 20%, rgba(85, 247, 255, 0.18), transparent 45%),
        radial-gradient(circle at 86% 18%, rgba(255, 106, 213, 0.18), transparent 45%),
        radial-gradient(circle at 50% 85%, rgba(255, 193, 90, 0.2), transparent 55%),
        linear-gradient(180deg, #080b16 0%, #06080f 100%);
    color: var(--text);
    min-height: 100vh;
}

.glow-layer {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 14% 18%, rgba(85, 247, 255, 0.25), transparent 48%),
        radial-gradient(circle at 82% 20%, rgba(255, 106, 213, 0.25), transparent 48%),
        radial-gradient(circle at 65% 85%, rgba(255, 193, 90, 0.22), transparent 55%);
    pointer-events: none;
    z-index: 0;
    animation: pulseGlow 10s ease-in-out infinite;
}

.app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px 40px;
}

.screen {
    display: none;
    width: 100%;
    max-width: 860px;
}

.screen.active {
    display: block;
    animation: screenIn 0.45s ease;
}

.menu-card,
.result-card {
    background: linear-gradient(160deg, rgba(12, 16, 28, 0.96), rgba(10, 12, 22, 0.9));
    border-radius: 34px;
    padding: 34px;
    border: 1px solid rgba(85, 247, 255, 0.18);
    box-shadow: 0 30px 70px var(--shadow);
    backdrop-filter: blur(18px);
    position: relative;
    overflow: hidden;
}

.menu-shape {
    position: absolute;
    inset: -20% -30% auto auto;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(85, 247, 255, 0.25), transparent 65%);
    transform: rotate(25deg);
    filter: blur(2px);
}

.menu-content {
    position: relative;
    z-index: 1;
}

.logo-chip {
    display: inline-flex;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(85, 247, 255, 0.18);
    border: 1px solid rgba(85, 247, 255, 0.3);
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.tagline {
    color: var(--muted);
    margin-bottom: 22px;
}

.mode-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
    margin-bottom: 24px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(85, 247, 255, 0.12);
    border-radius: 20px;
    padding: 18px 20px;
    text-align: left;
    color: var(--text);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
    min-height: 68px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.mode-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.04), rgba(85, 247, 255, 0.18));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mode-card.selected {
    border-color: rgba(255, 106, 213, 0.7);
    box-shadow: 0 14px 26px rgba(255, 106, 213, 0.2);
    transform: translateY(-2px);
}

.mode-card.selected::after {
    opacity: 1;
}

.mode-card[data-mode='classic'] {
    background: linear-gradient(120deg, rgba(85, 247, 255, 0.22), rgba(12, 16, 28, 0.92));
    border-color: rgba(85, 247, 255, 0.35);
}

.mode-card[data-mode='time30'] {
    background: linear-gradient(120deg, rgba(255, 193, 90, 0.26), rgba(12, 16, 28, 0.92));
    border-color: rgba(255, 193, 90, 0.4);
}

.mode-card[data-mode='time60'] {
    background: linear-gradient(120deg, rgba(139, 123, 255, 0.26), rgba(12, 16, 28, 0.92));
    border-color: rgba(139, 123, 255, 0.4);
}

.mode-card[data-mode='survival'] {
    background: linear-gradient(120deg, rgba(255, 106, 213, 0.24), rgba(12, 16, 28, 0.92));
    border-color: rgba(255, 106, 213, 0.4);
}

.mode-card[data-mode='classic'] .mode-title {
    color: #8ffbff;
}

.mode-card[data-mode='time30'] .mode-title {
    color: #ffd18a;
}

.mode-card[data-mode='time60'] .mode-title {
    color: #b7adff;
}

.mode-card[data-mode='survival'] .mode-title {
    color: #ffb1e6;
}

.mode-title {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.mode-desc {
    font-size: 0.9rem;
    color: var(--muted);
}

.menu-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    border: none;
    border-radius: 18px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    color: var(--text);
    background: rgba(8, 12, 22, 0.7);
    box-shadow: inset 0 0 0 1px rgba(85, 247, 255, 0.12), 0 16px 32px rgba(3, 6, 16, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.05), rgba(85, 247, 255, 0.22));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn.primary {
    color: #050b14;
    background: linear-gradient(120deg, var(--accent-1), var(--accent-2));
    box-shadow: 0 18px 36px rgba(85, 247, 255, 0.3);
}

.btn.ghost {
    background: rgba(6, 10, 18, 0.6);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: inset 0 0 0 1px rgba(85, 247, 255, 0.2), 0 20px 36px rgba(3, 6, 16, 0.6);
}

.btn:hover:not(:disabled)::after {
    opacity: 1;
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.hud {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 18px;
    border-radius: 22px;
    background: rgba(8, 12, 22, 0.9);
    border: 1px solid rgba(85, 247, 255, 0.15);
    margin-bottom: 20px;
    box-shadow: inset 0 0 18px rgba(85, 247, 255, 0.05);
}

.hud-block {
    text-align: center;
    min-width: 90px;
}

.hud-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
}

.arena {
    background: linear-gradient(160deg, rgba(12, 16, 28, 0.95), rgba(8, 10, 18, 0.92));
    border-radius: 32px;
    padding: 32px;
    border: 1px solid rgba(85, 247, 255, 0.16);
    text-align: center;
    box-shadow: inset 0 0 24px rgba(85, 247, 255, 0.04);
}

.prompt {
    margin-bottom: 24px;
}

.prompt-word {
    font-size: 3.1rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: wordPulse 1.6s ease-in-out infinite;
}

.prompt-sub {
    margin-top: 10px;
    color: var(--muted);
}

.answer-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.answer-btn {
    border: none;
    border-radius: 18px;
    padding: 16px;
    font-weight: 700;
    color: #061018;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 24px rgba(3, 6, 16, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.answer-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
    opacity: 0.35;
}

.answer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(3, 6, 16, 0.5);
}

.result-card h2 {
    font-size: 3rem;
    margin-bottom: 12px;
}

.result-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.result-meta span {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}

.result-badge {
    display: inline-flex;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(85, 247, 255, 0.18);
    margin-bottom: 12px;
    font-weight: 700;
    border: 1px solid rgba(85, 247, 255, 0.25);
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 12, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
    overflow-y: auto;
}

.modal.hidden {
    display: none;
}

.modal-card {
    width: 100%;
    max-width: 500px;
    background: linear-gradient(160deg, rgba(12, 16, 28, 0.96), rgba(8, 10, 18, 0.92));
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(85, 247, 255, 0.2);
    max-height: 88vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.modal-card .result-actions {
    margin-top: 8px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 10px 12px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.stat-item span {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.stat-item strong {
    font-size: 1rem;
}

@media (max-width: 640px) {
    .app {
        padding: 22px 14px 32px;
    }

    h1 {
        font-size: 2rem;
    }

    .menu-card,
    .result-card,
    .arena {
        padding: 22px;
    }

    .prompt-word {
        font-size: 2.4rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .modal-card {
        padding: 16px;
        max-width: 92vw;
    }
}

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

@keyframes wordPulse {
    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(85, 247, 255, 0));
    }
    50% {
        transform: scale(1.03);
        filter: drop-shadow(0 0 18px rgba(85, 247, 255, 0.4));
    }
}

@keyframes pulseGlow {
    0%,
    100% {
        opacity: 0.9;
    }
    50% {
        opacity: 1;
    }
}
