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

:root {
    --bg: #101124;
    --panel: rgba(255, 255, 255, 0.08);
    --panel-strong: rgba(255, 255, 255, 0.14);
    --text: #f8fbff;
    --muted: rgba(248, 251, 255, 0.72);
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 15%, rgba(124, 92, 255, 0.34), transparent 28%),
        radial-gradient(circle at 85% 12%, rgba(0, 210, 255, 0.24), transparent 26%),
        radial-gradient(circle at 50% 90%, rgba(255, 97, 166, 0.18), transparent 34%),
        linear-gradient(135deg, #090a1a 0%, #151839 55%, #0d2339 100%);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

body::before {
    animation: drift 18s linear infinite;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 54px 54px;
    content: "";
    inset: 0;
    pointer-events: none;
    position: fixed;
}

.page-wrapper {
    display: grid;
    gap: 24px;
    grid-template-columns: 160px minmax(0, 1fr) 160px;
    margin: 0 auto;
    max-width: 1420px;
    min-height: 100vh;
    padding: 22px;
}

.sidebar {
    min-height: 100vh;
}

.sidebar-left,
.sidebar-right {
    align-items: flex-start;
    display: flex;
    padding-top: 84px;
}

.sticky-ad {
    min-height: 600px;
    position: sticky;
    top: 20px;
    width: 160px;
}

.main-content {
    align-items: flex-start;
    display: flex;
    justify-content: center;
    padding: 18px 0;
}

.container {
    max-width: 720px;
    width: 100%;
}

.header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.back-button {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    color: #fff;
    font-weight: 700;
    padding: 8px 16px;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.eyebrow {
    color: #8cecff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    margin-bottom: 4px;
    text-align: right;
    text-transform: uppercase;
}

.title {
    font-size: clamp(2rem, 6vw, 3.1rem);
    line-height: 1;
    text-align: right;
    text-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}

.intro-panel,
.stats-bar,
.message-panel,
.best-card,
.game-article {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.intro-panel {
    animation: floatIn 0.6s ease both;
    display: grid;
    gap: 18px;
    margin-bottom: 16px;
    padding: 24px;
}

.intro-panel h2 {
    font-size: 1.55rem;
    margin-bottom: 8px;
}

.intro-panel p {
    color: var(--muted);
    line-height: 1.7;
}

.mode-picker {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, 1fr);
}

.mode-btn,
.start-btn,
.control-btn {
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    transition: transform 0.18s ease, filter 0.18s ease, background 0.18s ease;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.82);
    padding: 12px 10px;
}

.mode-btn.active {
    background: linear-gradient(135deg, #7c5cff, #00d2ff);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 210, 255, 0.22);
}

.start-btn {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: #fff;
    font-size: 1.08rem;
    padding: 16px;
    text-transform: uppercase;
}

.mode-btn:hover,
.start-btn:hover,
.control-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
}

.stats-bar {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 14px;
    padding: 14px;
    text-align: center;
}

.stats-bar span {
    color: var(--muted);
    font-size: 0.88rem;
}

.stats-bar strong {
    color: #fff;
    display: block;
    font-size: 1.5rem;
    margin-top: 2px;
}

.message-panel {
    color: #dff8ff;
    font-weight: 800;
    margin-bottom: 18px;
    min-height: 58px;
    padding: 18px 20px;
    text-align: center;
}

.message-panel.success {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.36);
}

.message-panel.danger {
    animation: shake 0.35s ease;
    background: rgba(244, 63, 94, 0.18);
    border-color: rgba(244, 63, 94, 0.36);
}

.pulse-board {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    margin: 18px auto;
    max-width: 560px;
}

.pulse-pad {
    aspect-ratio: 1;
    border: 0;
    border-radius: 32px;
    box-shadow: inset 0 -14px 34px rgba(0, 0, 0, 0.24), 0 18px 40px rgba(0, 0, 0, 0.32);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.pulse-pad::before {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent 62%);
    content: "";
    inset: 18%;
    opacity: 0.16;
    position: absolute;
}

.pulse-pad span {
    align-items: center;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    font-size: 1.4rem;
    font-weight: 900;
    height: 46px;
    justify-content: center;
    left: 18px;
    position: absolute;
    top: 18px;
    width: 46px;
}

.pulse-pad:disabled {
    cursor: not-allowed;
}

.pulse-pad.active,
.pulse-pad.user-hit {
    box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.82), 0 0 42px currentColor, 0 24px 60px rgba(255, 255, 255, 0.18);
    filter: brightness(1.35) saturate(1.25);
    transform: scale(1.04);
}

.pad-violet { background: linear-gradient(135deg, #7c3aed, #c084fc); color: #c084fc; }
.pad-cyan { background: linear-gradient(135deg, #0891b2, #67e8f9); color: #67e8f9; }
.pad-amber { background: linear-gradient(135deg, #d97706, #facc15); color: #facc15; }
.pad-rose { background: linear-gradient(135deg, #be123c, #fb7185); color: #fb7185; }

.progress-wrap {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    height: 12px;
    margin: 18px 0;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #8b5cf6, #06b6d4, #34d399);
    height: 100%;
    transition: width 0.2s ease;
    width: 0%;
}

.controls-row {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
    margin: 18px 0;
}

.control-btn {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    padding: 14px;
}

.control-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.ghost-btn {
    background: rgba(255, 255, 255, 0.08);
}

.best-card {
    align-items: center;
    display: grid;
    gap: 4px;
    grid-template-columns: 1fr auto;
    margin-bottom: 28px;
    padding: 18px 20px;
}

.best-card span,
.best-card small {
    color: var(--muted);
}

.best-card strong {
    color: #8cecff;
    font-size: 2rem;
    grid-row: span 2;
}

.game-article {
    color: rgba(255, 255, 255, 0.84);
    line-height: 1.8;
    padding: 32px;
}

.game-article h2 {
    color: #fff;
    font-size: 1.65rem;
    margin-bottom: 14px;
}

.game-article h3 {
    color: #9eeaff;
    font-size: 1.15rem;
    margin: 24px 0 10px;
}

.game-article p,
.game-article li {
    margin-bottom: 12px;
}

.game-article ul {
    padding-left: 22px;
}

.game-article a {
    color: #8cecff;
    font-weight: 800;
    text-decoration: none;
}

.game-article a:hover {
    text-decoration: underline;
}

@keyframes drift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(54px, 54px, 0); }
}

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

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

@media (max-width: 1024px) {
    .page-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}

@media (max-width: 640px) {
    .page-wrapper {
        padding: 16px;
    }

    .header {
        align-items: flex-start;
        flex-direction: column;
    }

    .eyebrow,
    .title {
        text-align: left;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .pulse-board {
        gap: 12px;
    }

    .pulse-pad {
        border-radius: 24px;
    }

    .controls-row,
    .mode-picker {
        grid-template-columns: 1fr;
    }

    .game-article {
        padding: 24px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}
