:root {
    --bg-color: #0c0b1e;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #a855f7; /* Purple */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --needle-color: #fbbf24; /* Amber */
    --target-color: #22c55e; /* Green */
    --font-family: 'Outfit', 'Inter', sans-serif;
}

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

body {
    background: var(--bg-color);
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-color));
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Glassmorphism Panel */
.panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* Typography */
h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to bottom right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Dial Component */
.dial-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin: 3rem 0;
}

.dial-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.dial-background {
    fill: none;
    stroke: var(--glass-border);
    stroke-width: 40;
    stroke-linecap: round;
}

.target-arc {
    fill: none;
    stroke-width: 44;
    stroke-linecap: round;
    transition: opacity 0.3s ease;
}

#target-ui.hidden {
    opacity: 0;
    pointer-events: none;
}

.needle {
    stroke: var(--needle-color);
    stroke-width: 6;
    stroke-linecap: round;
    transition: transform 0.1s linear;
    filter: drop-shadow(0 0 8px var(--needle-color));
    cursor: grab;
}

.needle:active {
    cursor: grabbing;
}

/* Buttons and Inputs */
.btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}

.input-mc {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.8rem;
    border-radius: 8px;
    width: 100%;
    margin-bottom: 1rem;
    font-family: inherit;
}

/* Setup & Lobby Overlays */
* {
    box-sizing: border-box;
}

#setup-overlay, #lobby-overlay, #confirm-overlay {
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-primary);
    border-radius: 28px;
    padding: 1.5rem;
    
    /* Centering is now handled by the parent #modal-layer flexbox */
    position: relative;
    width: 90%;
    max-width: 420px;
    margin: auto;
    
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 1.2rem;
    
    z-index: 10001;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.9);
    animation: modalIn 0.3s ease-out;
    
    transform: translateX(-8px); /* Visual nudge for mobile centering */
    pointer-events: auto; 
}

#setup-overlay > *, #lobby-overlay > *, #confirm-overlay > * {
    pointer-events: auto; /* Keep buttons and inputs clickable */
}

/* X-Ray Mode for Slider Dragging */
#setup-overlay.is-dragging {
    opacity: 0.15;
    pointer-events: none; /* Allow interaction with slider but visual focus on dial */
}
#setup-overlay.is-dragging * {
    pointer-events: auto; /* Keep the slider inside interactive */
}

@keyframes modalIn {
    from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}


@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.btn-preset {
    font-size: 0.8rem;
    padding: 0.5rem;
    border-color: var(--glass-border);
    color: var(--text-muted);
}

.btn-preset:hover {
    border-color: var(--accent-primary);
    color: var(--text-main);
}

/* Toast Notifications */
.toast {
    background: rgba(10, 15, 30, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--accent-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
    font-weight: 600;
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    min-width: 200px;
    text-align: center;
}

.toast-error {
    border-color: #ef4444;
}

.toast-fade-out {
    animation: toastOut 0.4s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

/* Landing Screen */
#landing-screen {
    text-align: center;
    max-width: 400px;
}

/* Game Area */
#game-area {
    display: none;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
}

.spectrum-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 1rem;
    font-weight: 700;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.label-left { color: var(--accent-primary); }
.label-right { color: var(--accent-secondary); }

#play-area {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Clue Display */
.clue-display {
    font-size: 1.5rem;
    font-style: italic;
    color: var(--needle-color);
    text-align: center;
    margin: 1rem 0;
    min-height: 2rem;
}

/* Modal / Overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Animations */
@keyframes glow {
    0% { filter: drop-shadow(0 0 5px var(--accent-primary)); }
    50% { filter: drop-shadow(0 0 15px var(--accent-primary)); }
    100% { filter: drop-shadow(0 0 5px var(--accent-primary)); }
}

.glowing {
    animation: glow 2s infinite;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 600px) {
    h1 { font-size: 2.2rem; }
    .container { padding: 1rem; gap: 1.2rem; }
    .panel { padding: 1.5rem; border-radius: 20px; }
    .spectrum-labels { font-size: 0.9rem; }
    .clue-display { font-size: 1.2rem; }
    .dial-container { margin: 1.5rem 0; }
    #setup-overlay { inset: 0.5rem; padding: 1.2rem; }
    #player-summary { font-size: 0.65rem; padding: 0.4rem 0.8rem; }
}

