:root {
    --bg-color: #0b0c10;
    --primary-color: #674ea7;
    --primary-neon: #a084e8;
    --text-main: #e0e0e0;
    --text-muted: #888;
    --glass-bg: rgba(103, 78, 167, 0.1);
    --glass-border: rgba(103, 78, 167, 0.3);
    
    --order-color: #45f3ff;
    --chaos-color: #ff2a2a;
    --xp-color: #39ff14;
    
    --font-heading: 'Changa One', sans-serif;
    --font-body: 'Imprima', sans-serif;
}

[data-theme="starry-night"] {
    --bg-color: #0b1d3a;
    --primary-color: #ffd700;
    --primary-neon: #ffea00;
    --text-main: #f0f8ff;
    --text-muted: #aab;
    --glass-bg: rgba(255, 215, 0, 0.05);
    --glass-border: rgba(255, 215, 0, 0.2);
    
    --order-color: #45f3ff;
    --chaos-color: #ff4500;
    --xp-color: #39ff14;
}

[data-theme="great-wave"] {
    --bg-color: #f4f4f4;
    --primary-color: #215e7c;
    --primary-neon: #0088cc;
    --text-main: #111;
    --text-muted: #555;
    --glass-bg: rgba(33, 94, 124, 0.08);
    --glass-border: rgba(33, 94, 124, 0.2);
    
    --order-color: #00aa00;
    --chaos-color: #cc0000;
    --xp-color: #215e7c;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.5s ease;
}

body::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(rgba(128, 128, 128, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(128, 128, 128, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -1;
    pointer-events: none;
}

/* Wrapper for full export */
#full-dashboard-capture {
    background-color: var(--bg-color);
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--glass-border);
}

.header-left { display: flex; flex-direction: column; gap: 1rem; }
.controls-row { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;}

.dashboard-header h1 {
    font-size: 2.5rem;
    color: var(--primary-neon);
    text-shadow: 0 0 10px rgba(var(--primary-neon), 0.5);
}

/* Stats Row: Clock & Leveling */
.stats-row { display: flex; align-items: center; gap: 2rem; margin-top: -0.5rem; }
.digital-clock { font-family: var(--font-heading); font-size: 1.2rem; color: var(--order-color); letter-spacing: 2px; text-shadow: 0 0 8px rgba(69, 243, 255, 0.4); }
.level-container { display: flex; flex-direction: column; gap: 0.2rem; width: 200px; }
.level-text { font-family: var(--font-heading); font-size: 0.9rem; color: var(--xp-color); letter-spacing: 1px; }
.xp-bar-bg { width: 100%; height: 6px; background: rgba(0, 0, 0, 0.2); border: 1px solid var(--glass-border); border-radius: 3px; overflow: hidden; }
.xp-bar-fill { height: 100%; background: var(--xp-color); width: 0%; transition: width 0.5s ease; box-shadow: 0 0 10px var(--xp-color); }

#world-state-indicator {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    letter-spacing: 3px;
    transition: all 0.3s ease;
}

.state-normal { border: 1px solid var(--text-muted); color: var(--text-muted); }
.state-order { border: 1px solid var(--order-color); color: var(--order-color); box-shadow: 0 0 15px rgba(69, 243, 255, 0.3), inset 0 0 10px rgba(69, 243, 255, 0.1); text-shadow: 0 0 5px var(--order-color); }
.state-chaos { border: 1px solid var(--chaos-color); color: var(--chaos-color); box-shadow: 0 0 15px rgba(255, 42, 42, 0.3), inset 0 0 10px rgba(255, 42, 42, 0.1); text-shadow: 0 0 5px var(--chaos-color); }

.dashboard-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    flex-grow: 1;
}

.left-column, .right-column { display: flex; flex-direction: column; gap: 2rem; }

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.2); }
.glass-card h2 { color: var(--primary-neon); margin-bottom: 0.5rem; font-size: 1.8rem; }
.subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* Theme Selector */
.theme-dropdown {
    background: transparent;
    color: var(--primary-neon);
    border: 1px solid var(--primary-color);
    padding: 0.4rem 0.8rem;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}
.theme-dropdown option { background: #111; color: #fff; }
[data-theme="great-wave"] .theme-dropdown option { background: #fff; color: #111; }

/* Sliders */
.pillar { margin-bottom: 1.5rem; padding: 0.5rem; border-radius: 4px; transition: background 0.3s; }
.pillar:hover { background: rgba(128, 128, 128, 0.1); }
.pillar-info { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-weight: bold; letter-spacing: 1px; align-items: center; }
.inline-edit-label { background: transparent; border: none; border-bottom: 1px dashed var(--glass-border); color: var(--text-main); font-family: var(--font-body); font-size: 0.9rem; font-weight: bold; outline: none; transition: border-color 0.3s; width: 150px; }
.inline-edit-label:focus { border-color: var(--primary-neon); }
.styled-slider { -webkit-appearance: none; width: 100%; height: 8px; background: rgba(128, 128, 128, 0.2); border-radius: 4px; outline: none; transition: background 0.3s; }
.styled-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--primary-neon); cursor: pointer; box-shadow: 0 0 10px var(--primary-neon); }
.average-container { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--glass-border); display: flex; justify-content: space-between; align-items: center; font-family: var(--font-heading); font-size: 1.2rem; }
.highlight { color: var(--primary-neon); font-size: 1.5rem; }

/* Pomodoro */
.timer-display { font-family: var(--font-heading); font-size: 4rem; text-align: center; color: var(--primary-neon); text-shadow: 0 0 15px var(--primary-color); margin: 1rem 0; letter-spacing: 5px; }
.timer-controls { display: flex; justify-content: center; gap: 1rem; }

/* Goals */
.goals-container { display: flex; flex-direction: column; gap: 0.8rem; margin-bottom: 1rem; }
.goal-group { display: flex; align-items: center; gap: 1rem; }
.goal-check { width: 20px; height: 20px; cursor: pointer; accent-color: var(--primary-neon); flex-shrink: 0; }
.goal-input { flex-grow: 1; background: transparent; border: none; border-bottom: 1px solid var(--glass-border); color: var(--text-main); font-family: var(--font-body); font-size: 1rem; padding: 0.5rem; outline: none; transition: border-color 0.3s; }
.goal-input:focus { border-color: var(--primary-neon); }
.goal-input.completed { text-decoration: line-through; color: var(--text-muted); }
.btn-delete-goal { background: transparent; border: none; color: var(--chaos-color); cursor: pointer; font-size: 1.2rem; opacity: 0.5; transition: opacity 0.3s; }
.btn-delete-goal:hover { opacity: 1; }

/* Weekly Planner Grid */
.planner-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1rem; padding: 1rem; background: rgba(128,128,128,0.05); border-radius: 8px;}
.planner-grid .day-card:last-child { grid-column: span 2; }
.day-card { background: rgba(128, 128, 128, 0.1); border: 1px solid var(--glass-border); border-radius: 6px; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem;}
.day-title { font-family: var(--font-heading); font-size: 0.9rem; color: var(--primary-neon); border-bottom: 1px solid var(--glass-border); padding-bottom: 0.2rem;}
.day-card textarea { border: none; background: transparent; padding: 0.2rem; min-height: 40px;}
.day-card textarea:focus { border: none; background: rgba(128, 128, 128, 0.1); }

textarea { width: 100%; background: rgba(128, 128, 128, 0.1); border: 1px solid var(--glass-border); border-radius: 4px; color: var(--text-main); font-family: var(--font-body); padding: 1rem; resize: vertical; outline: none; transition: border-color 0.3s; }
textarea:focus { border-color: var(--primary-neon); }
.mt-1 { margin-top: 1rem; }
.button-group { display: flex; gap: 1rem; }

/* Feynman Log & Roast */
.roast-display { min-height: 80px; margin-bottom: 1.5rem; font-style: italic; color: var(--text-main); border-left: 3px solid var(--primary-color); padding-left: 1rem; display: flex; align-items: center; }
.log-input-group { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.log-archive { max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.log-archive::-webkit-scrollbar { width: 6px; }
.log-archive::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 3px; }
.log-entry { background: rgba(128, 128, 128, 0.1); padding: 0.8rem; border-radius: 4px; border-left: 2px solid var(--primary-neon); font-size: 0.9rem; }
.log-date { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.2rem; }

/* Buttons */
.cyber-button { background: transparent; color: var(--primary-neon); border: 1px solid var(--primary-color); padding: 0.8rem 1.5rem; font-family: var(--font-heading); letter-spacing: 1px; cursor: pointer; border-radius: 4px; transition: all 0.3s ease; text-transform: uppercase; text-align: center; }
.cyber-button:hover { background: rgba(128, 128, 128, 0.2); box-shadow: 0 0 15px rgba(var(--primary-color), 0.4); }
.neon-button { background: var(--primary-color); color: #fff; }
.neon-button:hover { background: var(--primary-neon); box-shadow: 0 0 20px var(--primary-neon); }
.small-btn { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.import-label { display: inline-block; cursor: pointer; margin: 0; }

/* Toggle Switch */
.switch-container { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-heading); font-size: 0.9rem; color: var(--primary-neon); }
.switch-container input { opacity: 0; width: 0; height: 0; }
.slider { position: relative; cursor: pointer; width: 40px; height: 20px; background-color: rgba(128,128,128,0.5); border: 1px solid var(--glass-border); transition: .4s; border-radius: 34px; display: inline-block; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: var(--text-main); transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary-color); border-color: var(--primary-neon); }
input:checked + .slider:before { transform: translateX(20px); background-color: #fff; box-shadow: 0 0 5px #fff; }

/* Footer */
.lore-footer { margin-top: 2rem; text-align: center; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem;}
.lore-footer blockquote { font-style: italic; font-size: 1.1rem; color: var(--text-main); }
.lore-footer cite { display: block; margin-top: 0.5rem; font-family: var(--font-heading); color: var(--primary-neon); font-size: 0.9rem; letter-spacing: 1px; }
.footer-credits { font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--glass-border); padding-top: 1rem;}

/* CHAOS STATE GLITCH EFFECT */
body.chaos-active.glitch-enabled { animation: bgGlitch 0.3s infinite alternate; }
.chaos-active.glitch-enabled h1, .chaos-active.glitch-enabled h2 { animation: textGlitch 2s infinite; }

.chaos-active .glass-card { border-color: rgba(255, 42, 42, 0.4); box-shadow: 0 8px 32px 0 rgba(255, 42, 42, 0.1); }
.chaos-active .styled-slider::-webkit-slider-thumb { background: var(--chaos-color); box-shadow: 0 0 10px var(--chaos-color); }

.overlay-glitch { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(255, 0, 0, 0.05); pointer-events: none; z-index: 9999; opacity: 0; transition: opacity 0.5s; }
.chaos-active.glitch-enabled .overlay-glitch { opacity: 1; animation: noise 0.2s infinite; }

@keyframes textGlitch {
    0% { text-shadow: 2px 0 var(--chaos-color), -2px 0 var(--order-color); transform: skewX(0deg); }
    5% { text-shadow: -2px 0 var(--chaos-color), 2px 0 var(--order-color); transform: skewX(2deg); }
    10% { text-shadow: 2px 0 var(--chaos-color), -2px 0 var(--order-color); transform: skewX(-2deg); }
    15%, 100% { text-shadow: none; transform: skewX(0deg); }
}

@keyframes bgGlitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(-1px, -1px); }
    60% { transform: translate(2px, 1px); }
    80% { transform: translate(1px, -1px); }
    100% { transform: translate(0); }
}

@keyframes noise {
    0%, 100% { clip-path: inset(10% 0 80% 0); }
    20% { clip-path: inset(80% 0 10% 0); }
    40% { clip-path: inset(40% 0 50% 0); }
    60% { clip-path: inset(90% 0 5% 0); }
    80% { clip-path: inset(20% 0 60% 0); }
}

@media (max-width: 900px) {
    .dashboard-container { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; gap: 1rem; text-align: center; }
    .stats-row { flex-direction: column; gap: 0.5rem; }
    .controls-row { flex-wrap: wrap; justify-content: center; }
}
