:root {
    --bg: #07111f;
    --card: rgba(35, 58, 91, 0.82);
    --card-border: #8fe8ff;
    --text: #f5fbff;
    --muted: #9cb7d3;
    --cyan: #8fe8ff;
    --blue: #5f8dff;
    --green: #10E575;
    --red: #FF2A55;
    --orange: #ffaf61;
    --wait-gray: #5C6B73;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.35); 
}

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

body {
    min-height: 100vh;
    font-family: "JetBrains Mono", monospace;
    color: var(--text);
    background:
        radial-gradient(circle at top, rgba(83, 151, 246, 0.18), transparent 35%),
        linear-gradient(160deg, #050b13 0%, #112541 55%, #010306 100%);
    padding: 60px 20px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea,
select {
    font: inherit;
}

.hidden {
    display: none !important;
}

.page-glow {
    position: fixed;
    inset: auto auto 10% 50%;
    width: min(70vw, 700px);
    height: 300px;
    background: radial-gradient(circle, rgba(92, 157, 255, 0.18), transparent 70%);
    transform: translateX(-50%);
    pointer-events: none;
    filter: blur(20px);
}

.app-shell {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Logo styling */
.logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 15px;
}

.hero {
    text-align: center;
    margin-bottom: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 20px;
}

.intro,
.footer,
.whack-helper,
.mini-label {
    color: var(--muted);
}

.mini-label {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
}

h1 {
    font-size: 2.2rem;
    line-height: 0.95;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.intro {
    max-width: 720px;
    margin: 0 auto;
    line-height: 1.6;
    font-size: 1.08rem;
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card);
    border-radius: 8px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    padding: 18px;
}

.mode-list {
    display: grid;
    gap: 18px;
    max-width: 680px;
    margin: 0 auto;
}

.state {
    width: 100%;
}

.state-playing {
    min-height: 420px;
    padding-bottom: 0;
}

.game-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 420px;
    border-radius: 8px;
    overflow: hidden;
}

.game-hud {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-content {
    font-size: 1rem;
    color: var(--text);
    letter-spacing: 0.05em;
    font-weight: 500;
}

.game-panel-wrapper {
    flex: 1;
    display: flex;
    align-items: stretch;
}

.game-panel-wrapper > * {
    flex: 1;
    border-radius: 0;
}

.hover-button,
.answer-button,
.pixel {
    border: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.hover-button {
    position: relative;
    text-align: left;
    padding: 24px;
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--cyan);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: color 0.4s ease;
}

.hover-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

.hover-button:hover::before {
    opacity: 1;
}

.hover-button:hover {
    color: #051221;
    transform: translateY(-2px);
}

.hover-button .mode-name,
.hover-button .mode-copy {
    position: relative;
    z-index: 1;
}

.hover-button:hover .mode-name {
    color: #051221;
}

.hover-button:hover .mode-copy {
    color: rgba(5, 18, 33, 0.8);
}

.hover-button:hover,
.answer-button:hover,
.pixel:hover {
    transform: translateY(-1px);
}

.results-button {
    flex: 1;
    text-align: center;
}

.results-button * {
    position: relative;
    z-index: 2;
}

.hover-button.results-button:hover {
    color: #051221 !important;
}

.mode-name {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 1.4rem;
}

.mode-copy {
    display: block;
    color: var(--muted);
    line-height: 1.5;
}

.state-results {
    /* Card styling removed for cleaner results display */
}

.results-summary {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.result-line {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
}

.result-line strong {
    color: var(--cyan);
}

.stoplight-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero-stats {
    text-align: center;
}

.average-time {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.reaction-age,
.reaction-description {
    color: var(--cyan);
    font-size: 1.1rem;
}

.rounds-grid {
    display: flex;
    gap: 12px;
}

.round-box {
    flex: 1;
    padding: 16px;
    background: rgba(16, 229, 117, 0.1);
    border: 1px solid rgba(16, 229, 117, 0.3);
    border-radius: 6px;
    text-align: center;
}

.round-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.round-time {
    font-size: 1.3rem;
    font-weight: 700;
}

.results-actions {
    display: flex;
    gap: 14px;
    margin-top: 18px;
}

.reaction-panel,
.whack-panel {
    width: 100%;
    border-radius: 8px;
}

.reaction-panel {
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease;
}

.reaction-panel.entry {
    background: linear-gradient(160deg, rgba(92, 107, 115, 0.4), rgba(60, 70, 80, 0.85));
}

.reaction-panel.waiting {
    background: var(--wait-gray);
}

.reaction-panel.ready {
    background: var(--green);
}

.reaction-panel.result {
    background: linear-gradient(160deg, rgba(143, 232, 255, 0.22), rgba(23, 93, 132, 0.7));
}

.reaction-panel.early {
    background: var(--red);
    animation: shake 0.4s ease-in-out;
}

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

.panel-phase {
    font-size: clamp(2rem, 5vw, 4rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: white;
}

.panel-instruction {
    max-width: 28ch;
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.88);
}

.whack-panel {
    width: 100%;
    min-height: 360px;
    border-radius: 8px;
    border: none;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease;
}

.whack-panel.entry {
    background: linear-gradient(160deg, rgba(92, 107, 115, 0.4), rgba(60, 70, 80, 0.85));
}

.whack-panel.playing {
    background:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(180deg, rgba(17, 47, 33, 0.95), rgba(9, 20, 16, 0.95));
    background-size: 32px 32px, 32px 32px, auto;
    cursor: default;
    justify-content: flex-start;
    padding-top: 24px;
}


.pixel {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 24px rgba(16, 229, 117, 0.6);
    cursor: pointer;
    transition: none;
}

.pixel.hit {
    animation: pop 300ms ease-out forwards;
}

@keyframes pop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.5); opacity: 0; }
}

.pixel.hit::before {
    content: '';
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, var(--green) 0%, transparent 70%);
    animation: particle-burst 400ms ease-out;
    pointer-events: none;
}

@keyframes particle-burst {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.penalty-toast {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    background: rgba(255, 42, 85, 0.95);
    border-radius: 8px;
    color: white;
    font-weight: 700;
    animation: toast-slide 2s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes toast-slide {
    0% { transform: translate(-50%, -100%); opacity: 0; }
    10% { transform: translate(-50%, 0); opacity: 1; }
    90% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, -20px); opacity: 0; }
}

.whack-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hit-count {
    font-size: 4rem;
    font-weight: 700;
    text-align: center;
}

.skill-badge {
    color: var(--cyan);
    font-size: 1.2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-box {
    padding: 16px;
    background: rgba(16, 229, 117, 0.1);
    border: 1px solid rgba(16, 229, 117, 0.3);
    border-radius: 6px;
    text-align: center;
}

.stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.footer {
    text-align: center;
    margin-top: 22px;
    line-height: 1.6;
}

.footer a {
    color: var(--cyan);
}

@media (max-width: 980px) {
}

@media (max-width: 640px) {
    body {
        padding-inline: 14px;
    }

    .mode-card,
    .game-card {
        padding: 18px;
        border-radius: 8px;
    }

    .game-container {
        min-height: 380px;
    }

    .game-hud {
        height: 50px;
    }

    .hud-content {
        font-size: 0.9rem;
    }


    .average-time {
        font-size: 2.5rem;
    }

    .rounds-grid {
        flex-direction: column;
        align-items: stretch;
    }

    .round-box {
        max-width: none;
    }

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

    .hit-count {
        font-size: 3rem;
    }
}
