/* :root contains common structural variables, theme-specific variables are in theme classes */
:root {
    --font-stack: 'Raleway', sans-serif;
    --container-max-width: 980px;
    --transition-speed-fast: 0.25s;
    --transition-speed-normal: 0.4s;
    --transition-speed-slow: 0.7s;
    --border-radius-small: 6px;
    --border-radius-medium: 10px;
    --border-radius-large: 12px;
    --shadow-soft: 0 5px 15px rgba(0,0,0,0.1);
    --shadow-medium: 0 8px 25px rgba(0,0,0,0.15);
    --shadow-strong: 0 12px 35px rgba(0,0,0,0.2);
}

/* --- THEME DEFINITIONS (Keep these as they were, or add more) --- */
/* Theme 1: Hades (Dark Red - Default) */
body.theme-hades {
    --bg-gradient-start: #1A1A1A; --bg-gradient-mid: #2C2A28; --bg-gradient-end: #201E1C;
    --ui-bg-color: rgba(35, 32, 30, 0.75); --ui-border-color: rgba(80, 75, 70, 0.5);
    --text-primary: #E8E8E8; --text-secondary: #B0B0B0; --text-tertiary: #777;
    --accent-primary: #C70039; --accent-secondary: #FF5733; --accent-tertiary: #900C3F;
    --border-color-inputs: #4A4A4A; --input-bg-color: #1F1F1F;
    --success-color: #DAA520; --error-color: var(--accent-secondary);
    --button-text-color: var(--text-primary);
    --quote-widget-bg: rgba(20, 20, 20, 0.88); --quote-widget-text: var(--text-secondary); --quote-widget-icon: var(--accent-secondary);
    --progress-bar-bg: var(--accent-tertiary); --progress-bar-fill: var(--accent-secondary);
    --tooltip-bg: var(--accent-primary); --tooltip-text: var(--text-primary);
    --loader-symbol-color: var(--accent-secondary);
    --dropdown-bg: #282523; --dropdown-item-hover-bg: #3a3633; --dropdown-border: var(--accent-tertiary);
    --focus-ring-color: var(--accent-secondary);
}

/* Theme 2: Cerulean (Pastel Blue) */
body.theme-cerulean {
    --bg-gradient-start: #E0F2FE; --bg-gradient-mid: #B9E2F5; --bg-gradient-end: #A7D8F0;
    --ui-bg-color: rgba(255, 255, 255, 0.8); --ui-border-color: rgba(150, 190, 220, 0.6);
    --text-primary: #2C3E50; --text-secondary: #577590; --text-tertiary: #88A2B8;
    --accent-primary: #5D9CEC; --accent-secondary: #82B1FF; --accent-tertiary: #457FCA;
    --border-color-inputs: #A0BBDC; --input-bg-color: #F0F8FF;
    --success-color: #4CAF50; --error-color: #EF5350;
    --button-text-color: #FFFFFF;
    --quote-widget-bg: rgba(220, 235, 250, 0.92); --quote-widget-text: var(--text-primary); --quote-widget-icon: var(--accent-primary);
    --progress-bar-bg: var(--accent-tertiary); --progress-bar-fill: var(--accent-primary);
    --tooltip-bg: var(--accent-primary); --tooltip-text: #fff;
    --loader-symbol-color: var(--accent-primary);
    --dropdown-bg: #f0f8ff; --dropdown-item-hover-bg: #d6eaff; --dropdown-border: var(--accent-tertiary);
    --focus-ring-color: var(--accent-primary);
}
/* (Include Tiramisu, Nebula, Forest themes as before, adding dropdown and focus variables) */
body.theme-tiramisu {
    --bg-gradient-start: #4A3B31; --bg-gradient-mid: #7B685C; --bg-gradient-end: #A98F78;
    --ui-bg-color: rgba(245, 235, 220, 0.85); --ui-border-color: rgba(120, 100, 80, 0.6);
    --text-primary: #3E2723; --text-secondary: #6D4C41; --text-tertiary: #8D6E63;
    --accent-primary: #8D6E63; --accent-secondary: #A1887F; --accent-tertiary: #5D4037;
    --border-color-inputs: #BCAAA4; --input-bg-color: #EFEBE9;
    --success-color: #795548; --error-color: #BF360C;
    --button-text-color: #FFF3E0;
    --quote-widget-bg: rgba(60, 45, 35, 0.92); --quote-widget-text: #EFEBE9; --quote-widget-icon: #D7CCC8;
    --progress-bar-bg: var(--accent-tertiary); --progress-bar-fill: var(--accent-primary);
    --tooltip-bg: var(--accent-primary); --tooltip-text: var(--button-text-color);
    --loader-symbol-color: var(--accent-primary);
    --dropdown-bg: #EFEBE9; --dropdown-item-hover-bg: #D7CCC8; --dropdown-border: var(--accent-tertiary);
    --focus-ring-color: var(--accent-primary);
}
body.theme-nebula {
    --bg-gradient-start: #0F0C29; --bg-gradient-mid: #302B63; --bg-gradient-end: #24243E;
    --ui-bg-color: rgba(40, 35, 70, 0.8); --ui-border-color: rgba(80, 75, 120, 0.5);
    --text-primary: #EAEAEA; --text-secondary: #B0B0D0; --text-tertiary: #8888AA;
    --accent-primary: #8A2BE2; --accent-secondary: #9370DB; --accent-tertiary: #4B0082;
    --border-color-inputs: #504A78; --input-bg-color: #1A1830;
    --success-color: #32CD32; --error-color: #FF6347;
    --button-text-color: var(--text-primary);
    --quote-widget-bg: rgba(25, 20, 50, 0.9); --quote-widget-text: var(--text-secondary); --quote-widget-icon: var(--accent-secondary);
    --progress-bar-bg: var(--accent-tertiary); --progress-bar-fill: var(--accent-primary);
    --tooltip-bg: var(--accent-primary); --tooltip-text: var(--text-primary);
    --loader-symbol-color: var(--accent-secondary);
    --dropdown-bg: #1A1830; --dropdown-item-hover-bg: #302B63; --dropdown-border: var(--accent-tertiary);
    --focus-ring-color: var(--accent-secondary);
}
body.theme-forest {
    --bg-gradient-start: #223B2F; --bg-gradient-mid: #3C5A4E; --bg-gradient-end: #5A826A;
    --ui-bg-color: rgba(200, 210, 190, 0.8); --ui-border-color: rgba(100, 120, 110, 0.5);
    --text-primary: #1A2C25; --text-secondary: #4A6157; --text-tertiary: #6B8378;
    --accent-primary: #4CAF50; --accent-secondary: #81C784; --accent-tertiary: #388E3C;
    --border-color-inputs: #79998A; --input-bg-color: #E8F5E9;
    --success-color: #FF8F00; --error-color: #D32F2F;
    --button-text-color: #FFFFFF;
    --quote-widget-bg: rgba(30, 50, 40, 0.92); --quote-widget-text: #D0E0D8; --quote-widget-icon: var(--accent-secondary);
    --progress-bar-bg: var(--accent-tertiary); --progress-bar-fill: var(--accent-primary);
    --tooltip-bg: var(--accent-primary); --tooltip-text: #fff;
    --loader-symbol-color: var(--accent-primary);
    --dropdown-bg: #E8F5E9; --dropdown-item-hover-bg: #C8E6C9; --dropdown-border: var(--accent-tertiary);
    --focus-ring-color: var(--accent-primary);
}


/* --- LOADING SCREEN --- */
#loading-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-gradient-start); display: flex; flex-direction: column;
    justify-content: center; align-items: center; z-index: 9999;
    opacity: 1; transition: opacity var(--transition-speed-slow) ease-out, visibility var(--transition-speed-slow) ease-out;
}
#loading-screen.loaded { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-symbol { font-size: 5em; color: var(--loader-symbol-color); animation: pulseSymbol 2s infinite ease-in-out; margin-bottom: 20px; }
#loading-screen p { font-size: 1.2em; color: var(--text-secondary); }
@keyframes pulseSymbol { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.1); opacity: 1; } }

/* Parallax Background Layer */
#parallax-bg-layer {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(145deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
    z-index: -1; /* Behind everything */
    transition: background var(--transition-speed-normal) ease;
    /* JS will handle transform for parallax */
}

/* --- GENERAL STYLES (using CSS Vars) --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    /* Background is now on #parallax-bg-layer */
    color: var(--text-primary); font-family: var(--font-stack); font-weight: 300;
    padding: 40px 20px; display: flex; flex-direction: column; align-items: center;
    min-height: 100vh; line-height: 1.7;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    transition: color var(--transition-speed-normal) ease; overflow-x: hidden;
}

.container {
    background-color: var(--ui-bg-color); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 30px 40px 40px 40px; border-radius: var(--border-radius-large);
    border: 1px solid var(--ui-border-color); box-shadow: var(--shadow-strong);
    width: 100%; max-width: var(--container-max-width); text-align: center;
    transition: background-color var(--transition-speed-normal) ease, border-color var(--transition-speed-normal) ease;
    margin-top: 20px; z-index: 1; /* Above parallax bg */
}

/* Site Header & Palette Switcher */
.site-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.site-header h1 { margin-bottom: 0; font-size: 2.8em; } /* Main content H1 */
#password-gate h1 { font-weight: 100; color: var(--text-primary); font-size: 3.5em; letter-spacing: 4px; margin-bottom: 30px; text-shadow: 0 3px 6px rgba(0,0,0,0.2), 0 0 15px var(--accent-tertiary); transition: color var(--transition-speed-normal) ease, text-shadow var(--transition-speed-normal) ease; }

#palette-container { position: relative; } /* For dropdown positioning */
#palette-switcher-button {
    background: none; border: none; font-size: 1.6em; color: var(--accent-primary);
    cursor: pointer; padding: 10px; border-radius: 50%;
    transition: transform var(--transition-speed-fast) ease, color var(--transition-speed-fast) ease;
}
#palette-switcher-button:hover, #palette-switcher-button:focus-visible {
    transform: scale(1.1) rotate(15deg); color: var(--accent-secondary);
    outline: none;
}
#palette-switcher-button:focus-visible {
    box-shadow: 0 0 0 2px var(--ui-bg-color), 0 0 0 4px var(--focus-ring-color);
}

#theme-dropdown {
    position: absolute; top: 120%; right: 0;
    background-color: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: var(--border-radius-medium);
    box-shadow: var(--shadow-medium);
    z-index: 100;
    width: 220px;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: opacity var(--transition-speed-fast) ease, transform var(--transition-speed-fast) ease, visibility var(--transition-speed-fast) ease;
    visibility: hidden;
}
#theme-dropdown.active { opacity: 1; transform: translateY(0) scale(1); visibility: visible; }
.theme-option {
    display: flex; align-items: center; padding: 10px 15px;
    cursor: pointer; transition: background-color var(--transition-speed-fast) ease;
    border-bottom: 1px solid var(--ui-border-color);
}
.theme-option:last-child { border-bottom: none; }
.theme-option:hover, .theme-option:focus-visible { background-color: var(--dropdown-item-hover-bg); outline: none; }
.theme-option.current-theme { font-weight: 600; background-color: var(--dropdown-item-hover-bg); }
.theme-color-preview { width: 20px; height: 20px; border-radius: 50%; margin-right: 10px; border: 1px solid var(--text-tertiary); }
.theme-name { font-size: 0.95em; color: var(--text-primary); }
.theme-description { font-size: 0.8em; color: var(--text-secondary); margin-left: auto; }


h2 { font-weight: 300; color: var(--accent-secondary); font-size: 2.2em; margin-top: 50px; margin-bottom: 20px; letter-spacing: 1px; transition: color var(--transition-speed-normal) ease; }
p, label { font-size: 1.1em; color: var(--text-secondary); margin-bottom: 15px; transition: color var(--transition-speed-normal) ease; }
.intro-text { color: var(--text-primary); font-size: 1.2em; margin-bottom: 25px; }

input[type="text"], input[type="password"] {
    background-color: var(--input-bg-color); border: 1px solid var(--border-color-inputs);
    color: var(--text-primary); padding: 14px 20px; border-radius: var(--border-radius-small);
    font-family: var(--font-stack); font-size: 1em; font-weight: 300;
    margin: 10px 0 20px 0; width: 100%; max-width: 450px;
    transition: all var(--transition-speed-fast) ease;
}
input[type="text"]::placeholder, input[type="password"]::placeholder { color: var(--text-secondary); opacity: 0.7; }
input[type="text"]:focus, input[type="password"]:focus {
    outline: none; border-color: var(--accent-secondary);
    box-shadow: 0 0 0 2px var(--ui-bg-color), 0 0 0 4px var(--focus-ring-color); /* Clearer focus */
}

button { /* General buttons like puzzle submit */
    background: linear-gradient(145deg, var(--accent-secondary), var(--accent-primary));
    color: var(--button-text-color); border: 1px solid var(--accent-tertiary);
    padding: 12px 30px; border-radius: var(--border-radius-small); font-family: var(--font-stack);
    font-weight: 500; font-size: 1.05em; cursor: pointer;
    transition: all var(--transition-speed-fast) ease; text-transform: uppercase; letter-spacing: 1px;
    box-shadow: var(--shadow-soft);
}
button:hover, button:focus-visible {
    background: linear-gradient(145deg, var(--accent-primary), var(--accent-tertiary));
    transform: translateY(-2px);
    box-shadow: 0 6px 12px color-mix(in srgb, var(--accent-primary) 30%, black), 0 2px 4px color-mix(in srgb, var(--accent-primary) 20%, black);
    outline: none;
}
button:focus-visible {
    box-shadow: 0 0 0 2px var(--ui-bg-color), 0 0 0 4px var(--focus-ring-color), 0 6px 12px color-mix(in srgb, var(--accent-primary) 30%, black) ;
}
button:active { transform: translateY(0px); box-shadow: var(--shadow-soft); }
button:disabled {
    background: var(--border-color-inputs); color: var(--text-secondary); cursor: not-allowed;
    transform: none; box-shadow: none; opacity: 0.7;
    border-color: color-mix(in srgb, var(--border-color-inputs) 80%, black);
}
button:disabled.unlocked-puzzle { /* Special style for unlocked puzzle buttons */
    background: var(--success-color);
    color: var(--button-text-color);
    opacity: 1;
    border-color: color-mix(in srgb, var(--success-color) 70%, black);
    cursor: default;
}


.hidden { display: none !important; }
.puzzle-section { margin-top: 50px; padding-top: 30px; border-top: 1px solid var(--ui-border-color); transition: border-color var(--transition-speed-normal) ease; }
.puzzle-section:first-of-type { border-top: none; margin-top: 30px; }

.revealed-info {
    background-color: color-mix(in srgb, var(--ui-bg-color) 60%, black 5%); padding: 20px; margin-top: 20px;
    border-radius: var(--border-radius-medium); border-left: 5px solid var(--success-color); text-align: left;
    font-size: 1.15em; font-weight: 300; box-shadow: var(--shadow-soft);
    transition: all var(--transition-speed-normal) ease;
}
.revealed-info p { color: var(--text-primary); margin-bottom: 8px; }
.revealed-info strong { color: var(--success-color); font-weight: 500; transition: color var(--transition-speed-normal) ease; }

.error-message { color: var(--error-color); font-weight: 400; margin-top: 10px; font-size: 0.95em; transition: color var(--transition-speed-normal) ease; }

#all-revealed-message {
    margin-top: 60px; padding: 30px; background-color: color-mix(in srgb, var(--ui-bg-color) 40%, black 5%);
    border: 1px solid var(--accent-primary); border-radius: var(--border-radius-large);
    box-shadow: 0 0 20px color-mix(in srgb, var(--accent-primary) 25%, transparent);
    transition: all var(--transition-speed-normal) ease;
}
#all-revealed-message h2 { color: var(--accent-secondary); font-size: 2.5em; margin-top: 0; text-shadow: 0 0 10px var(--accent-tertiary); }
#all-revealed-message p { color: var(--text-primary); font-size: 1.3em; }

/* --- PROGRESS BAR --- */
#progress-bar-container {
    width: 100%; max-width: 500px; margin: 30px auto;
    background-color: color-mix(in srgb, var(--ui-border-color) 50%, transparent);
    border-radius: var(--border-radius-medium); padding: 4px; position: relative; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
#progress-bar {
    height: 16px; width: 0%; background: linear-gradient(90deg, var(--progress-bar-bg), var(--progress-bar-fill));
    border-radius: calc(var(--border-radius-medium) - 3px); /* Slightly smaller radius */
    transition: width var(--transition-speed-normal) ease-out, background var(--transition-speed-normal) ease;
}
#progress-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 0.8em; font-weight: 600; color: var(--text-primary); text-shadow: 0 1px 1px rgba(0,0,0,0.4); }

/* --- QUOTE WIDGET (Fixed max-width) --- */
#quote-widget {
    position: fixed; bottom: 25px; right: 25px;
    background-color: var(--quote-widget-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    color: var(--quote-widget-text); padding: 12px 15px; border-radius: var(--border-radius-medium);
    box-shadow: var(--shadow-medium); display: flex; align-items: center; z-index: 1000;
    transition: background-color var(--transition-speed-normal) ease, color var(--transition-speed-normal) ease;
    max-width: 320px; /* Fixed max-width */
}
#quote-text-display {
    font-size: 0.9em; font-style: italic; margin-right: 12px;
    line-height: 1.4; display: inline-block; /* For animations */
    /* overflow: hidden; text-overflow: ellipsis; white-space: nowrap; /* If you want ellipsis for very long quotes */
}
#quote-trigger-button {
    background: none; border: none; font-size: 1.5em; /* Icon size */
    color: var(--quote-widget-icon); cursor: pointer; padding: 8px; border-radius: 50%;
    transition: color var(--transition-speed-fast) ease, transform var(--transition-speed-fast) ease;
    flex-shrink: 0; user-select: none;
}
#quote-trigger-button:hover, #quote-trigger-button:focus-visible {
    transform: scale(1.1); color: color-mix(in srgb, var(--quote-widget-icon) 80%, white);
    outline: none;
}
#quote-trigger-button:focus-visible {
    box-shadow: 0 0 0 2px var(--quote-widget-bg), 0 0 0 4px var(--focus-ring-color);
}

/* Quote Animations (Fade In/Out) */
.quote-fade-out { animation: quoteFadeOut var(--transition-speed-fast) forwards ease-in; }
.quote-fade-in { animation: quoteFadeIn var(--transition-speed-normal) forwards ease-out; }

@keyframes quoteFadeOut { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes quoteFadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }

/* --- BACK TO TOP BUTTON --- */
#back-to-top {
    position: fixed; bottom: 30px; left: 30px;
    background-color: var(--accent-primary); color: var(--button-text-color);
    border: none; border-radius: 50%; width: 50px; height: 50px;
    font-size: 1.2em; display: flex; justify-content: center; align-items: center;
    cursor: pointer; box-shadow: var(--shadow-medium);
    opacity: 0; visibility: hidden; transform: translateY(20px);
    transition: opacity var(--transition-speed-fast) ease, visibility var(--transition-speed-fast) ease, transform var(--transition-speed-fast) ease, background-color var(--transition-speed-normal) ease;
    z-index: 999;
}
#back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
#back-to-top:hover, #back-to-top:focus-visible { background-color: var(--accent-secondary); transform: translateY(-2px) scale(1.05); outline: none;}
#back-to-top:focus-visible {
    box-shadow: 0 0 0 2px var(--ui-bg-color), 0 0 0 4px var(--focus-ring-color), var(--shadow-medium);
}


/* --- TOOLTIPS (Enhanced) --- */
[data-tooltip] { position: relative; }
[data-tooltip]::before, [data-tooltip]::after {
    position: absolute; visibility: hidden; opacity: 0;
    transition: opacity var(--transition-speed-fast) 0.1s ease, visibility var(--transition-speed-fast) 0.1s ease, transform var(--transition-speed-fast) 0.1s ease;
    pointer-events: none; z-index: 1001;
}
[data-tooltip]::before { /* The tooltip text box */
    content: attr(data-tooltip); background-color: var(--tooltip-bg);
    color: var(--tooltip-text); padding: 8px 12px; border-radius: var(--border-radius-small);
    font-size: 0.9em; font-weight: 500; white-space: nowrap;
    bottom: 135%; left: 50%; transform: translateX(-50%) translateY(5px); /* Start slightly lower */
    box-shadow: var(--shadow-soft);
}
[data-tooltip]::after { /* The little arrow */
    content: ''; border-style: solid; border-width: 6px;
    border-color: var(--tooltip-bg) transparent transparent transparent;
    bottom: calc(135% - 6px); left: 50%; transform: translateX(-50%) translateY(5px);
}
[data-tooltip]:hover::before, [data-tooltip]:hover::after,
[data-tooltip]:focus-within::before, [data-tooltip]:focus-within::after { /* Show on focus of child */
    visibility: visible; opacity: 1; transform: translateX(-50%) translateY(0);
}


/* --- FOOTER --- */
footer { margin-top: 60px; padding-top: 25px; border-top: 1px solid var(--ui-border-color); transition: border-color var(--transition-speed-normal) ease; }
footer p { font-size: 0.9em; color: var(--text-secondary); text-align: center; }