@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@700;800&display=swap');

:root {
    --bg-main: #050208;
    --bg-card: rgba(12, 8, 24, 0.82);
    --bg-glass: rgba(255, 255, 255, 0.025);
    --bg-surface: rgba(18, 12, 38, 0.6);
    --border-glass: rgba(255, 255, 255, 0.07);
    --border-glow: rgba(139, 92, 246, 0.4);
    --text-main: #edebf4;
    --text-soft: #9d97b5;
    --text-muted: #5e5878;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-bright: #c4b5fd;
    --cyan: #22d3ee;
    --green: #34d399;
    --green-glow: rgba(52, 211, 153, 0.3);
    --red: #f43f5e;
    --red-glow: rgba(244, 63, 94, 0.3);
    --yellow: #fbbf24;
    --pink: #ec4899;
    --orange: #fb923c;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-xl: 0 25px 60px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.03);
    --shadow-glow: 0 0 60px rgba(139, 92, 246, 0.12);
    --shadow-card: 0 30px 80px -20px rgba(0,0,0,0.8), 0 0 80px rgba(139,92,246,0.06);
    --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-main);
    background: var(--bg-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Noise texture overlay for premium feel */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.018;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ===== Ambient background ===== */
.neon-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.neon-grid::before {
    content: '';
    position: absolute;
    width: 700px;
    height: 700px;
    top: -200px;
    left: -160px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, rgba(99, 47, 224, 0.06) 40%, transparent 70%);
    filter: blur(90px);
    animation: floatOrb1 22s ease-in-out infinite;
}

.neon-grid::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    bottom: -120px;
    right: -120px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.12) 0%, rgba(251, 146, 60, 0.05) 40%, transparent 70%);
    filter: blur(90px);
    animation: floatOrb2 28s ease-in-out infinite;
}

/* Floating particles layer */
#particles-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.35);
    pointer-events: none;
    animation: particleFloat linear infinite;
}

/* ===== App layout ===== */
.app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Scenes ===== */
.scene {
    width: min(1100px, 100%);
    display: none;
}

.scene.is-active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: sceneIn 600ms var(--transition-smooth) both;
}

/* ===== Panels ===== */
.panel {
    width: min(780px, 100%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    backdrop-filter: blur(32px) saturate(1.5);
    -webkit-backdrop-filter: blur(32px) saturate(1.5);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    position: relative;
}

.panel-main {
    padding: clamp(36px, 5vw, 68px) clamp(28px, 4vw, 60px);
    text-align: center;
    position: relative;
}

/* Top highlight edge */
.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 8%;
    right: 8%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.45), rgba(236, 72, 153, 0.25), transparent);
    z-index: 1;
}

/* Bottom subtle glow */
.panel::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: 20%;
    right: 20%;
    height: 120px;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.08), transparent 70%);
    pointer-events: none;
}

.panel-kicker {
    margin: 0;
    color: var(--accent-light);
    font-weight: 700;
    font-size: clamp(11px, 1.4vw, 12px);
    letter-spacing: 0.28em;
    text-transform: uppercase;
    opacity: 0.7;
}

.panel-title {
    margin: 18px auto 14px;
    max-width: 680px;
    font-size: clamp(28px, 5vw, 52px);
    line-height: 1.05;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, var(--accent-bright) 40%, var(--pink) 80%, var(--orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.panel-text {
    margin: 0 auto;
    max-width: 560px;
    font-size: clamp(15px, 2vw, 18px);
    color: var(--text-soft);
    font-weight: 500;
    line-height: 1.55;
}

.panel-sub {
    margin: 14px auto 0;
    max-width: 560px;
    font-size: clamp(13px, 1.8vw, 15px);
    color: var(--text-muted);
    font-weight: 600;
    min-height: 1.4em;
    transition: color 300ms ease;
}

/* ===== Question Reroll ===== */
.question-reroll-wrap {
    margin: 28px auto 0;
    max-width: 580px;
    position: relative;
}

.question-display {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    background: var(--bg-surface);
    padding: 22px 26px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 300ms ease, background 300ms ease, box-shadow 300ms ease;
}

.question-display:hover {
    border-color: var(--border-glow);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.06);
}

.question-display-text {
    font-size: clamp(16px, 2.4vw, 21px);
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.35;
    text-align: center;
}

.question-display-text.roll-out {
    animation: rollOut 250ms var(--transition-smooth) forwards;
}

.question-display-text.roll-in {
    animation: rollIn 350ms var(--transition-smooth) forwards;
}

.btn-reroll {
    margin-top: 14px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    background: rgba(139, 92, 246, 0.06);
    color: var(--accent-light);
    font-family: inherit;
    font-weight: 700;
    font-size: clamp(12px, 1.5vw, 14px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 22px;
    cursor: pointer;
    transition: all 300ms ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-reroll:hover {
    background: rgba(139, 92, 246, 0.14);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--accent-bright);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.08);
}

.btn-reroll:active {
    transform: scale(0.96);
}

.btn-reroll .dice-icon {
    display: inline-block;
    font-size: 17px;
    transition: transform 400ms var(--transition-smooth);
}

.btn-reroll:hover .dice-icon {
    transform: rotate(180deg);
}

.btn-reroll.spinning .dice-icon {
    animation: diceSpin 400ms var(--transition-smooth);
}

/* ===== Primary CTA button ===== */
.btn-neon {
    margin-top: 28px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent) 0%, var(--pink) 60%, var(--orange) 100%);
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    font-size: clamp(14px, 1.9vw, 17px);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: clamp(14px, 2vw, 18px) clamp(30px, 4vw, 52px);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 20px rgba(139, 92, 246, 0.35),
        0 0 0 1px rgba(255,255,255,0.06) inset;
    transition: all 350ms var(--transition-smooth);
}

.btn-neon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 300ms ease;
}

.btn-neon:hover {
    transform: translateY(-3px);
    box-shadow:
        0 10px 35px rgba(139, 92, 246, 0.45),
        0 0 0 1px rgba(255,255,255,0.08) inset,
        0 0 60px rgba(139, 92, 246, 0.15);
}

.btn-neon:hover::before {
    opacity: 1;
}

.btn-neon:active {
    transform: translateY(0) scale(0.98);
    box-shadow:
        0 2px 12px rgba(139, 92, 246, 0.3),
        0 0 0 1px rgba(255,255,255,0.04) inset;
}

.is-hidden {
    display: none !important;
}

/* ===== Collect Scene ===== */
.question-text {
    margin: 20px auto 16px;
    max-width: 680px;
    font-size: clamp(22px, 4vw, 38px);
    line-height: 1.15;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--accent-bright) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.countdown {
    margin-top: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(80px, 16vw, 160px);
    line-height: 1;
    font-weight: 800;
    color: #fff;
    text-shadow:
        0 0 60px rgba(139, 92, 246, 0.5),
        0 0 120px rgba(139, 92, 246, 0.2);
    animation: pulseTimer 1000ms ease-in-out infinite;
}

.collect-call {
    margin: 14px 0 0;
    font-size: clamp(15px, 2.4vw, 22px);
    font-weight: 800;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-shadow: 0 0 30px rgba(52, 211, 153, 0.3);
}

.collect-meta {
    margin: 16px 0 0;
    font-size: clamp(13px, 1.8vw, 15px);
    color: var(--text-soft);
    font-weight: 600;
}

.collect-conn {
    color: var(--yellow);
    font-size: clamp(12px, 1.5vw, 14px);
    opacity: 0.8;
}

/* ===== Loading Scene ===== */
.loading-title {
    margin: 20px auto 18px;
    max-width: 680px;
    font-size: clamp(22px, 4vw, 36px);
    line-height: 1.1;
    font-weight: 800;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff 0%, var(--accent-bright) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-track {
    width: min(520px, 100%);
    margin: 22px auto 0;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
    position: relative;
}

.loading-fill {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--pink), var(--orange));
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.5);
    transition: width 240ms ease;
    position: relative;
}

.loading-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: -3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.9), 0 0 40px rgba(139, 92, 246, 0.5);
}

/* ===== Game Scene ===== */
.scene-game.is-active {
    align-items: stretch;
}

.game-wrap {
    width: min(920px, 100%);
    margin: 0 auto;
}

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

.hud-box {
    min-width: 160px;
    border-radius: 999px;
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 10px 22px;
    font-size: clamp(13px, 1.7vw, 15px);
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

#combo-value {
    display: inline-block;
    margin-left: 6px;
    color: var(--green);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
}

.combo-pop {
    animation: comboPop 420ms var(--transition-bounce);
}

.combo-shake {
    animation: comboShake 520ms ease;
}

/* ===== Game Card ===== */
.game-card {
    position: relative;
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    backdrop-filter: blur(32px) saturate(1.5);
    -webkit-backdrop-filter: blur(32px) saturate(1.5);
    box-shadow: var(--shadow-card);
    padding: clamp(24px, 3vw, 44px);
    min-height: clamp(480px, 68vh, 680px);
    overflow: hidden;
    /* Animated gradient border via box-shadow trick */
    border: 1px solid transparent;
    background-clip: padding-box;
}

/* Animated top edge highlight */
.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent) 20%,
        var(--pink) 50%,
        var(--cyan) 80%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: borderShimmer 6s linear infinite;
    opacity: 0.7;
}

/* Ambient corner glow */
.game-card::after {
    content: '';
    position: absolute;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    right: -140px;
    top: -140px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.06), transparent 70%);
    pointer-events: none;
}

.card-title {
    margin: 0;
    font-size: clamp(20px, 3.6vw, 36px);
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff, var(--accent-bright));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-main {
    margin-top: 24px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Viewer card layout */
.viewer-line {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 22px;
    align-items: center;
}

.viewer-avatar {
    width: clamp(72px, 10vw, 96px);
    height: clamp(72px, 10vw, 96px);
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.25);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    box-shadow:
        0 0 30px rgba(139, 92, 246, 0.12),
        0 0 0 4px rgba(139, 92, 246, 0.04);
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-soft);
    transition: border-color 300ms ease, box-shadow 300ms ease;
}

.viewer-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.viewer-avatar.hidden {
    background:
        repeating-linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.04),
            rgba(255, 255, 255, 0.04) 6px,
            transparent 6px,
            transparent 12px
        ),
        rgba(12, 8, 24, 0.9);
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.1em;
    border-color: rgba(255,255,255,0.06);
}

.viewer-meta {
    min-width: 0;
}

.viewer-nick {
    display: block;
    font-size: clamp(20px, 3.2vw, 34px);
    line-height: 1;
    font-weight: 900;
    color: #fff;
}

.viewer-text {
    display: block;
    margin-top: 10px;
    color: var(--text-soft);
    font-size: clamp(17px, 2.8vw, 28px);
    line-height: 1.25;
    font-weight: 700;
}

/* Anonymous card */
.anon-wrap {
    width: 100%;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    padding: clamp(18px, 2.6vw, 30px);
    position: relative;
}

.anon-wrap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.2), transparent);
}

.anon-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    font-size: clamp(12px, 1.6vw, 15px);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
}

.anon-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(139, 92, 246, 0.25);
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 900;
    color: var(--accent-light);
    background: rgba(139, 92, 246, 0.06);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.08);
}

.anon-message {
    margin: 0;
    font-size: clamp(20px, 3.2vw, 32px);
    line-height: 1.25;
    font-weight: 800;
    color: #fff;
}

/* ===== Option buttons ===== */
.card-options {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.option-btn {
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-main);
    border-radius: var(--radius-md);
    min-height: clamp(64px, 10vw, 84px);
    padding: 16px 18px;
    text-align: center;
    font-family: inherit;
    font-size: clamp(15px, 2.2vw, 21px);
    font-weight: 800;
    line-height: 1.2;
    /* no text-transform here — preserve original casing of chat messages */
    cursor: pointer;
    transition: all 280ms var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

/* Only uppercase for short UI label buttons (e.g. "ФЕЙК" / "РЕАЛЬНО ПИСАЛ") */
.option-btn.tone-danger,
.option-btn.tone-success {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Shimmer hover effect */
.option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
    transition: left 600ms ease;
}

.option-btn:hover:enabled::before {
    left: 100%;
}

.option-btn:hover:enabled {
    transform: translateY(-3px);
    border-color: var(--border-glow);
    background: rgba(139, 92, 246, 0.07);
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.35),
        0 0 30px rgba(139, 92, 246, 0.08);
}

.option-btn:active:enabled {
    transform: scale(0.97);
}

.option-btn:disabled {
    cursor: default;
}

.option-btn.tone-danger {
    border-color: rgba(244, 63, 94, 0.3);
    background: rgba(244, 63, 94, 0.05);
}

.option-btn.tone-danger:hover:enabled {
    border-color: rgba(244, 63, 94, 0.55);
    background: rgba(244, 63, 94, 0.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 30px var(--red-glow);
}

.option-btn.tone-success {
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(52, 211, 153, 0.05);
}

.option-btn.tone-success:hover:enabled {
    border-color: rgba(52, 211, 153, 0.55);
    background: rgba(52, 211, 153, 0.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 30px var(--green-glow);
}

.option-btn.correct {
    border-color: rgba(52, 211, 153, 0.7);
    background: rgba(52, 211, 153, 0.1);
    color: var(--green);
    box-shadow: 0 0 30px var(--green-glow), 0 0 0 2px rgba(52, 211, 153, 0.15);
    animation: answerPulse 600ms ease;
}

.option-btn.wrong {
    border-color: rgba(244, 63, 94, 0.7);
    background: rgba(244, 63, 94, 0.1);
    color: var(--red);
    box-shadow: 0 0 30px var(--red-glow), 0 0 0 2px rgba(244, 63, 94, 0.15);
    animation: answerShake 500ms ease;
}

/* ===== Feedback overlay ===== */
.feedback-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 200ms ease;
    background: rgba(5, 2, 8, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: var(--radius-xl);
    z-index: 10;
}

.feedback-stamp {
    transform: scale(0.5);
    font-size: clamp(38px, 9vw, 88px);
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0;
}

.feedback-note {
    margin-top: 14px;
    font-size: clamp(13px, 1.7vw, 18px);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
    /* no text-transform — preserve original casing of usernames and messages */
    letter-spacing: 0.02em;
    max-width: 80%;
    line-height: 1.4;
    text-align: center;
}

.feedback-overlay.show {
    opacity: 1;
}

.feedback-overlay.show .feedback-stamp {
    opacity: 1;
    animation: stampIn 450ms var(--transition-bounce) both;
}

.feedback-stamp.ok {
    color: var(--green);
    text-shadow: 0 0 50px rgba(52, 211, 153, 0.5), 0 0 100px rgba(52, 211, 153, 0.2);
}

.feedback-stamp.bad {
    color: var(--red);
    text-shadow: 0 0 50px rgba(244, 63, 94, 0.5), 0 0 100px rgba(244, 63, 94, 0.2);
}

/* ===== Settings grid ===== */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin: 28px auto 0;
    max-width: 580px;
    text-align: left;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    text-align: left;
    margin-bottom: 2px;
}

.setting-input {
    width: 100%;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    padding: 11px 14px;
    outline: none;
    transition: border-color 250ms ease, background 250ms ease, box-shadow 250ms ease;
}

.setting-input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.setting-input:focus {
    border-color: var(--border-glow);
    background: rgba(139, 92, 246, 0.05);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.06);
}

.setting-input-narrow {
    width: 72px;
    text-align: center;
    padding: 11px 8px;
    -moz-appearance: textfield;
}

.setting-input-narrow::-webkit-outer-spin-button,
.setting-input-narrow::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.setting-input-wide {
    width: 100%;
    margin-top: 10px;
}

.setting-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stepper-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-soft);
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 200ms ease;
    flex-shrink: 0;
}

.stepper-btn:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--border-glow);
    color: var(--accent-light);
}

.stepper-btn:active {
    transform: scale(0.92);
}

/* ===== Question actions row ===== */
.question-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-confirm {
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.25);
    color: var(--green);
}

.btn-confirm:hover {
    background: rgba(52, 211, 153, 0.14);
    border-color: rgba(52, 211, 153, 0.45);
    color: var(--green);
}

/* ===== Custom question wrap ===== */
.custom-question-wrap {
    margin-top: 12px;
}

/* ===== Mode toggle ===== */
.mode-toggle-wrap {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 28px auto 0;
    max-width: 340px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 4px;
}

.mode-btn {
    flex: 1;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 280ms ease;
}

.mode-btn:hover {
    color: var(--text-soft);
}

.mode-btn.is-active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.08));
    color: var(--accent-bright);
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.15);
}

/* ===== Result actions ===== */
.result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-neon-secondary {
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
    border: 1px solid var(--border-glass);
    animation: none;
}

.btn-neon-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===== Result scene ===== */
.result-score {
    color: var(--green);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
}

/* ===== Confetti canvas ===== */
.confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

/* ===== Animations ===== */
@keyframes sceneIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes floatOrb1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, 70px) scale(1.12); }
    66% { transform: translate(-50px, 130px) scale(0.93); }
}

@keyframes floatOrb2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-70px, -90px) scale(1.18); }
    66% { transform: translate(60px, -50px) scale(0.88); }
}

@keyframes pulseTimer {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.03);
        opacity: 0.8;
    }
}

@keyframes comboPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

@keyframes comboShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

@keyframes stampIn {
    0% { transform: scale(0.2); opacity: 0; }
    50% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes rollOut {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

@keyframes rollIn {
    0% { opacity: 0; transform: translateY(20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes diceSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes borderShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes answerPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@keyframes answerShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-4px); }
    30% { transform: translateX(4px); }
    45% { transform: translateX(-3px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-1px); }
}

/* ===== Mobile responsive ===== */
@media (max-width: 860px) {
    .app {
        padding: 12px;
    }

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

    .hud-box {
        min-width: 0;
        text-align: center;
        border-radius: var(--radius-sm);
    }

    .viewer-line {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }

    .card-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .panel-main {
        padding: 24px 18px 28px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .game-card {
        min-height: 480px;
        padding: 18px;
    }

    .question-text {
        font-size: clamp(18px, 7vw, 28px);
    }

    .option-btn {
        min-height: 68px;
        font-size: clamp(15px, 5vw, 20px);
    }

    .question-display {
        padding: 16px 18px;
    }

    .mode-toggle-wrap {
        flex-direction: column;
    }

    .result-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* ===== Scrollbar styling ===== */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.25);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.45);
}

/* ===== Selection ===== */
::selection {
    background: rgba(139, 92, 246, 0.3);
    color: #fff;
}
