:root {
    --bg-color: #030310;
    --card-bg: rgba(255, 255, 255, 0.03);
    --text-color: #f0f0ff;
    --primary-color: #00e5ff;
    --secondary-color: #ff00c8;
    --accent-color: #7000ff;
    --danger-color: #ff3d71;
    --success-color: #00ffa3;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-heading);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 900px;
    max-height: 1000px;
    background: #050515;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    background: radial-gradient(circle at center, rgba(112, 0, 255, 0.1) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

#ui-layer {
    position: relative;
    z-index: 10;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 30px;
}

#hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 40px;
}

.hud-item {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

#mic-status-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#mic-icon {
    font-size: 1.2rem;
}

.mic-active #mic-status-container {
    border-color: var(--success-color);
    box-shadow: 0 0 15px rgba(0, 255, 163, 0.2);
}

.mic-active #mic-icon {
    animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(3, 3, 16, 0.95);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    padding: 40px;
}

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

.hidden {
    display: none !important;
}

/* Typography */
.premium-title {
    font-size: 4.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
    letter-spacing: -2px;
}

.subtitle {
    font-size: 1.2rem;
    color: #888;
    margin-bottom: 40px;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 40px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-item.full-width {
    grid-column: span 2;
}

.setting-item label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Value Selector */
.value-selector {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.val-btn {
    width: 50px;
    height: 50px;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.val-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

#max-val-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    text-align: center;
    width: 80px;
    outline: none;
}

/* Op Grid */
.op-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.op-chip {
    cursor: pointer;
    position: relative;
}

.op-chip input {
    position: absolute;
    opacity: 0;
}

.op-chip span {
    display: block;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s;
    font-weight: 500;
}

.op-chip input:checked + span {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

/* TT Grid */
.tt-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.tt-chip {
    cursor: pointer;
    position: relative;
}

.tt-chip input {
    position: absolute;
    opacity: 0;
}

.tt-chip span {
    display: block;
    padding: 10px 5px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s;
    font-size: 0.9rem;
    font-weight: 500;
}

.tt-chip input:checked + span {
    background: rgba(255, 0, 200, 0.1);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(255, 0, 200, 0.2);
}

/* Inputs */
.game-input-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    color: white;
    font-family: var(--font-heading);
    font-size: 1rem;
    outline: none;
}

/* Buttons */
.glow-button {
    background: var(--primary-color);
    color: #000;
    border: none;
    padding: 18px 45px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(0, 229, 255, 0.3);
}

.glow-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 229, 255, 0.5);
}

/* Gameplay Area */
#game-play-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#question-container {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

#question-text {
    font-size: 8rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--text-color);
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
    transition: transform 0.3s;
}

.correct-flash #question-text {
    color: var(--success-color);
    text-shadow: 0 0 50px rgba(0, 255, 163, 0.5);
    transform: scale(1.1);
}

.wrong-flash #question-text {
    color: var(--danger-color);
    text-shadow: 0 0 50px rgba(255, 61, 113, 0.5);
    animation: shake 0.4s;
}

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

#input-container {
    width: 100%;
    max-width: 300px;
}

.game-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    font-size: 2rem;
    text-align: center;
    color: white;
    font-family: var(--font-mono);
    outline: none;
    transition: all 0.3s;
}

.game-input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2);
}

/* Game Over */
.final-stats {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.stat-row:last-child { margin-bottom: 0; }

.stat-row.highlight { color: var(--success-color); font-weight: 700; }
.stat-row.danger { color: var(--danger-color); font-weight: 700; }

.controls-row {
    display: flex;
    gap: 20px;
}

.secondary-button {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: white;
}

#fly-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    top: -200px;
    opacity: 0;
    z-index: 10;
    width: auto; /* Shrink to fit content */
}

#fly-sprite {
    width: 50px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
    mix-blend-mode: screen; /* Removes black background */
}

#question-text {
    font-size: 2rem;
    font-weight: 400;
    font-family: 'Press Start 2P', cursive;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
    background: rgba(0, 0, 0, 0.6);
    padding: 15px 25px;
    border-radius: 10px;
    border: 3px solid var(--primary-color);
    margin: 0;
    white-space: nowrap; /* Prevent wrapping which hides numbers */
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2);
}

#iron-man-sprite {
    position: absolute;
    width: 100px; /* Smaller Iron Man */
    height: auto;
    left: 50%;
    bottom: -150px;
    transform: translateX(-50%);
    filter: drop-shadow(0 0 20px rgba(255, 100, 0, 0.6));
    opacity: 0;
    z-index: 20;
    mix-blend-mode: screen; /* Removes black background */
}

#laser-beam {
    position: absolute;
    left: 50%;
    bottom: 80px;
    width: 6px;
    height: 0;
    background: linear-gradient(to top, #fff, var(--secondary-color));
    box-shadow: 0 0 20px var(--secondary-color), 0 0 40px var(--secondary-color);
    transform: translateX(-50%);
    opacity: 0;
    z-index: 15;
    border-radius: 3px;
}

/* Animations */
@keyframes fly-down {
    0% { top: -200px; opacity: 1; }
    100% { top: 100%; opacity: 1; }
}

@keyframes iron-man-fire {
    0% { bottom: -150px; opacity: 1; transform: translateX(-50%) scale(0.8); }
    30% { bottom: 10px; opacity: 1; transform: translateX(-50%) scale(1); }
    70% { bottom: 10px; opacity: 1; transform: translateX(-50%) scale(1); }
    100% { bottom: 110%; opacity: 1; transform: translateX(-50%) scale(1.2); }
}

@keyframes laser-shot {
    0% { height: 0; opacity: 1; }
    50% { height: 1000px; opacity: 1; }
    100% { height: 1000px; opacity: 0; }
}

@keyframes fly-explode {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.5); filter: brightness(10) hue-rotate(180deg); }
    100% { transform: scale(0); opacity: 0; }
}

.fly-active {
    animation: fly-down linear forwards;
}

.fly-hit {
    animation: fly-explode 0.4s ease-out forwards !important;
}

.iron-man-active {
    animation: iron-man-fire 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.laser-active {
    animation: laser-shot 0.4s ease-out forwards;
}

.correct-flash #question-text {
    color: var(--success-color);
    text-shadow: 0 0 50px rgba(0, 255, 163, 0.8);
}

.wrong-flash #question-text {
    color: var(--danger-color);
    text-shadow: 0 0 50px rgba(255, 61, 113, 0.8);
    animation: shake 0.4s;
}

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

/* Select styling */
select.game-input-small {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    padding-right: 45px;
    cursor: pointer;
}

select.game-input-small option {
    background: #151525;
    color: white;
}

/* Hide Spinners */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}
