:root {
    /* Base Colors - Default (Night) */
    --color-bg-top: #050505;
    --color-bg-bottom: #200b30;
    --color-sun: #ff007f;
    --color-sun-glow: rgba(255, 0, 127, 0.6);
    --color-grid: #ff007f;
    --color-text: #00ffff;
    --color-text-glow: rgba(0, 255, 255, 0.8);
    --color-btn-border: #00ffff;
    
    /* Sun/Moon Position */
    --celestial-y: 50%;
    --celestial-scale: 1;
}

/* Time Phases Variables */
[data-phase="dawn"] {
    --color-bg-top: #2d1b4e;
    --color-bg-bottom: #ff71ce;
    --color-sun: #ffeb3b;
    --color-sun-glow: rgba(255, 235, 59, 0.6);
    --color-grid: #01cdfe;
    --color-text: #fffb96;
    --color-text-glow: rgba(255, 251, 150, 0.8);
    --color-btn-border: #01cdfe;
}

[data-phase="day"] {
    --color-bg-top: #00a9fe;
    --color-bg-bottom: #b5ffff;
    --color-sun: #ffeb3b;
    --color-sun-glow: rgba(255, 235, 59, 0.8);
    --color-grid: #fff;
    --color-text: #050505;
    --color-text-glow: transparent;
    --color-btn-border: #00a9fe;
}

[data-phase="sunset"] {
    --color-bg-top: #f92c85;
    --color-bg-bottom: #ff8b00;
    --color-sun: #ff007f;
    --color-sun-glow: rgba(255, 0, 127, 0.8);
    --color-grid: #b967ff;
    --color-text: #fff;
    --color-text-glow: rgba(255, 255, 255, 0.5);
    --color-btn-border: #b967ff;
}

[data-phase="night"] {
    /* Using root defaults */
}

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

body {
    background-color: #000;
    color: var(--color-text);
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    transition: background 2s ease, color 2s ease;
}

.text-glow {
    text-shadow: 0 0 10px var(--color-text-glow);
}

/* CRT Effects */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: 998;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 999;
}

/* Background & Sun */
.background-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, var(--color-bg-top) 0%, var(--color-bg-bottom) 100%);
    transition: background 2s ease-in-out;
    z-index: 1;
}

.sun-moon {
    position: absolute;
    left: 50%;
    top: var(--celestial-y);
    width: 300px;
    height: 300px;
    margin-left: -150px;
    margin-top: -150px;
    border-radius: 50%;
    background: linear-gradient(to bottom, var(--color-sun) 30%, transparent 100%);
    box-shadow: 0 0 60px var(--color-sun-glow);
    transition: top 1s ease-out, background 2s ease, box-shadow 2s ease;
    transform: scale(var(--celestial-scale));
    z-index: 2;
    /* Grid cutoff illusion */
    clip-path: polygon(0 0, 100% 0, 100% 80%, 0 80%);
}

/* 3D Grid */
.grid-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 40%;
    perspective: 400px;
    overflow: hidden;
    z-index: 3;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 10%);
}

.grid-3d {
    position: absolute;
    bottom: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: 
        linear-gradient(var(--color-grid) 2px, transparent 2px),
        linear-gradient(90deg, var(--color-grid) 2px, transparent 2px);
    background-size: 50px 50px;
    background-position: 0 0;
    transform: rotateX(60deg);
    animation: gridMove 2s linear infinite;
    transition: background-image 2s ease;
}

@keyframes gridMove {
    0% { background-position: 0 0; }
    100% { background-position: 0 50px; }
}

/* UI Layer */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.cyber-button {
    background: transparent;
    border: 1px solid var(--color-btn-border);
    color: var(--color-text);
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    text-shadow: 0 0 5px var(--color-text-glow);
}

.cyber-button:hover {
    background: var(--color-btn-border);
    color: #000;
}

.weather-log {
    margin-top: 10px;
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
}

.center-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.clock {
    font-size: 8rem;
    font-weight: 700;
    letter-spacing: 5px;
    margin-bottom: 2rem;
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pomodoro-display {
    font-size: 4rem;
    margin-bottom: 10px;
}

.flash {
    animation: pomodoroFlash 1s ease-out 3;
}

@keyframes pomodoroFlash {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; text-shadow: 0 0 30px #fff; }
}

/* Rain Overlay */
.rain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="100"><rect width="1" height="15" fill="rgba(0,255,255,0.4)"/></svg>');
    animation: rainDrop 0.5s linear infinite;
    display: none;
}

.rain-overlay.active {
    display: block;
    opacity: 1;
}

@keyframes rainDrop {
    0% { background-position: 0 0; }
    100% { background-position: 0 100vh; }
}

/* Glitch Overlay */
.glitch-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0000aa;
    color: #fff;
    z-index: 2000;
    padding: 50px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.glitch-overlay.active {
    display: flex;
    animation: crtGlitch 0.2s steps(2) infinite;
}

.ascii-art {
    white-space: pre;
    font-family: monospace;
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.kernel-panic {
    font-family: 'VT323', monospace;
    font-size: 2rem;
}

@keyframes crtGlitch {
    0% { filter: hue-rotate(0deg) contrast(1.2); transform: translate(0); }
    20% { filter: hue-rotate(90deg) contrast(2); transform: translate(-5px, 5px); }
    40% { filter: hue-rotate(180deg) invert(1); transform: translate(5px, -5px); }
    60% { filter: hue-rotate(270deg) contrast(0.8); transform: translate(-5px, -5px); }
    80% { filter: hue-rotate(360deg); transform: translate(5px, 5px); }
    100% { filter: hue-rotate(0deg); transform: translate(0); }
}

/* New Timer Styles */
.timer-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
}

.timer-settings {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'VT323', monospace;
}

.cyber-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--color-btn-border);
    color: var(--color-text);
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    padding: 2px 10px;
    width: 70px;
    outline: none;
    text-shadow: 0 0 5px var(--color-text-glow);
    transition: all 0.3s ease;
}

.cyber-input:focus {
    box-shadow: 0 0 15px var(--color-btn-border);
    background: rgba(0, 255, 255, 0.1);
}

.cyber-input::-webkit-inner-spin-button,
.cyber-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
