/* CSS variables for variables */
:root {
    --primary: #00f0ff;
    --primary-glow: rgba(0, 240, 255, 0.4);
    --secondary: #ff003c;
    --secondary-glow: rgba(255, 0, 60, 0.4);
    --accent: #a855f7;
    --bg-color: #050510;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    
    /* Animation Speeds */
    --transition-speed: 0.5s;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 1rem;
}

/* Starfield canvas */
#space-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    transition: filter var(--transition-speed) ease;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 1200px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

/* Typography styles */
.gaming-font {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.1em;
}

/* Header styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.glow-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--primary-glow);
    animation: rotateRing 6s linear infinite;
}

.icon-cog {
    width: 20px;
    height: 20px;
    color: #fff;
}

.logo-text {
    font-weight: 900;
    font-size: 1.3rem;
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px var(--primary-glow);
}

/* Main content grid */
.grid-main {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .grid-main {
        grid-template-columns: 1fr;
    }
}

/* Glass panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    transition: background-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.status-indicator.active-game {
    background-color: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-indicator.active-game.playing {
    background-color: var(--secondary);
    box-shadow: 0 0 10px var(--secondary);
    animation: flashLED 1s infinite alternate;
}

.main-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255,255,255,0.1);
}

/* Reactor Display Box */
.display-reactor {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: all var(--transition-speed) ease;
}

.reactor-core {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: relative;
    z-index: 2;
}

.temp-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.temp-number {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(180deg, #fff 60%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: background var(--transition-speed) ease;
}

.temp-number.secondary {
    font-size: 2.8rem;
    opacity: 0.85;
}

.temp-unit {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.reactor-divider {
    width: 2px;
    height: 60px;
    background: linear-gradient(180deg, transparent, var(--glass-border), transparent);
}

.reactor-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    z-index: 1;
    pointer-events: none;
    transition: background var(--transition-speed) ease;
}

/* Custom Range Slider */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.readout-label {
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    text-shadow: 0 0 5px var(--primary-glow);
}

.input-slider-wrapper {
    position: relative;
    width: 100%;
}

.custom-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    outline: none;
    border: 1px solid var(--glass-border);
    position: relative;
    z-index: 2;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 0 12px var(--primary);
    transition: transform 0.1s, border-color var(--transition-speed) ease;
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-track-fill {
    position: absolute;
    left: 0;
    top: 1px;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    z-index: 1;
    pointer-events: none;
    width: 50%; /* Set programmatically */
    transition: background var(--transition-speed) ease;
}

.slider-markers {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0 0.25rem;
}

/* Manual inputs */
.manual-input-box {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.neon-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

.neon-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.input-swap-arrow {
    margin-top: 1.2rem;
    color: var(--text-secondary);
}

.icon-swap {
    width: 20px;
    height: 20px;
}

/* Sub-card generic */
.glass-subcard {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
}

.subcard-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.label-sm {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.icon-bulb, .icon-trophy {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.fact-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Game Panel Views */
.game-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-dashboard-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
}

.mascot-chat {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
}

.mascot-avatar {
    width: 70px;
    height: 70px;
    color: var(--primary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0.5rem;
    flex-shrink: 0;
    transition: color var(--transition-speed) ease;
}

.mascot-svg {
    width: 100%;
    height: 100%;
}

.speech-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 0 16px 16px 16px;
    padding: 1rem;
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-primary);
    position: relative;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 15px;
    border-width: 0 8px 8px 0;
    border-style: solid;
    border-color: transparent var(--glass-border) transparent transparent;
}

/* Button stylings */
.glass-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: #fff;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon {
    width: 20px;
    height: 20px;
}

.glow-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.neon-border-blue {
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.neon-border-blue:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 25px var(--primary);
    transform: translateY(-3px);
}

/* Active Game screen */
.game-active-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-stats-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.stat-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.timer-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.timer-bar-fill {
    width: 100%;
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    transition: width 0.1s linear, background var(--transition-speed) ease;
}

.question-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
}

.question-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.choices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.choice-btn {
    padding: 1rem;
    font-weight: 600;
    font-size: 1rem;
}

.choice-btn.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.choice-btn.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.abort-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 700;
    margin: 0 auto;
}

.abort-btn:hover {
    text-shadow: 0 0 8px var(--secondary-glow);
}

/* Leaderboard */
.leaderboard-panel {
    display: flex;
    flex-direction: column;
}

.leaderboard-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.01);
}

.leaderboard-item.top-rank {
    background: rgba(168, 85, 247, 0.05);
    border-left: 3px solid var(--accent);
}

.rank-num {
    width: 24px;
    font-weight: 700;
    color: var(--text-secondary);
}

.leaderboard-item.top-rank .rank-num {
    color: var(--accent);
}

.player-name {
    flex: 1;
    font-weight: 500;
}

.player-score {
    font-weight: 700;
}

/* Footer styling */
.app-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--glass-border);
}

.arham-highlight {
    color: var(--primary);
    font-weight: 700;
}

.hidden {
    display: none !important;
}

/* Keyframe animations */
@keyframes rotateRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes flashLED {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Dynamic reactor colors based on class changes */
/* Freezing */
body.freezing {
    --primary: #00e5ff;
    --primary-glow: rgba(0, 229, 255, 0.3);
    --accent: #0088ff;
}
/* Cold */
body.cold {
    --primary: #00ffa2;
    --primary-glow: rgba(0, 255, 162, 0.3);
    --accent: #00a2ff;
}
/* Pleasant */
body.pleasant {
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.3);
    --accent: #34d399;
}
/* Warm */
body.warm {
    --primary: #f59e0b;
    --primary-glow: rgba(245, 158, 11, 0.3);
    --accent: #fbbf24;
}
/* Hot */
body.hot {
    --primary: #ef4444;
    --primary-glow: rgba(239, 68, 68, 0.3);
    --accent: #ec4899;
}
