:root {
    --bg-color: #000000;
    --fg-color: #ffffff;
    --dim-color: #333333;
    --scanline-color: rgba(255, 255, 255, 0.03);
    --font-family: 'Courier New', Courier, monospace;
}

body.inverted {
    --bg-color: #f0f0f0;
    --fg-color: #333333;
    --dim-color: #cccccc;
    --scanline-color: rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--bg-color);
    color: var(--fg-color);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    transition: background-color 0.8s ease, color 0.8s ease;
}

.terminal-container,
.terminal-content,
.progress-track,
.progress-fill,
.theme-btn,
.countdown-box div {
    transition: color 0.8s ease, background-color 0.8s ease, border-color 0.8s ease, text-shadow 0.8s ease;
}

.terminal-container {
    display: inline-block;
    padding: 20px;
    border-radius: 5px;
    position: relative;
    user-select: none;
    max-width: 95vw;
}

@media (max-width: 600px) {
    .terminal-container {
        font-size: 0.8rem;
        padding: 10px;
    }
    .header {
        font-size: 1.2rem;
    }
    .box-time {
        font-size: 1rem;
    }
}

.terminal-border-top,
.terminal-border-bottom {
    white-space: pre;
    font-size: 1.2rem;
    line-height: 1;
}

.terminal-content {
    border-left: 2px solid transparent;
    border-right: 2px solid transparent;
    padding: 20px 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    font-size: 1.5rem;
    font-weight: bold;
}

.countdown-box {
    margin-bottom: 30px;
    white-space: pre;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.box-time {
    font-size: 1.2rem;
}

.box-labels {
    font-size: 0.8rem;
    color: var(--fg-color);
    opacity: 0.8;
}

.progress-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 20px;
    box-sizing: border-box;
    padding: 0 10px; 
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.progress-track {
    width: 100%;
    height: 1.5rem;
    background-color: transparent;
    position: relative;
    border: 1px solid var(--dim-color);
    /* Dotted background for empty part to simulate ░ */
    background-image: radial-gradient(var(--dim-color) 20%, transparent 20%);
    background-size: 4px 4px;
}

.progress-fill {
    height: 100%;
    background-color: var(--fg-color);
    width: 0%;
    position: absolute;
    top: 0;
    left: 0;
    /* Create visual separation between blocks */
    background-image: linear-gradient(to right, var(--bg-color) 2px, transparent 1px);
    background-size: 10px 100%; 
}

/* CRT Scanline effect */
body::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, var(--scanline-color), rgba(255, 255, 255, 0.01), var(--scanline-color));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    transition: background 0.8s ease;
}

.controls {
    position: absolute;
    top: 10px;
    right: 20px;
    z-index: 10;
}

.theme-btn {
    background: transparent;
    border: none;
    color: var(--fg-color);
    font-family: inherit;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.theme-btn:hover {
    opacity: 1;
}

/* Flicker effect */
@keyframes flicker {
    0% { opacity: 0.97; }
    5% { opacity: 0.95; }
    10% { opacity: 0.9; }
    15% { opacity: 0.95; }
    20% { opacity: 0.98; }
    25% { opacity: 0.95; }
    30% { opacity: 0.9; }
    35% { opacity: 0.95; }
    40% { opacity: 0.98; }
    45% { opacity: 0.95; }
    50% { opacity: 0.9; }
    55% { opacity: 0.95; }
    60% { opacity: 0.98; }
    65% { opacity: 0.95; }
    70% { opacity: 0.9; }
    75% { opacity: 0.95; }
    80% { opacity: 0.98; }
    85% { opacity: 0.95; }
    90% { opacity: 0.9; }
    95% { opacity: 0.95; }
    100% { opacity: 1; }
}

.terminal-container {
    animation: flicker 0.1s infinite;
}

/* Typing effect for initial load */
.typing {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: .15em solid var(--fg-color);
    margin: 0 auto 30px auto;
    --typing-steps: 14;
    --typing-width: 14ch;
    animation: typing 2s steps(var(--typing-steps), end), blink-caret 1s ease-in-out infinite;
    width: var(--typing-width);
}

@keyframes typing {
    from { width: 0 }
    to { width: var(--typing-width); }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--fg-color); }
}

/* Glow effect */
.terminal-content {
    text-shadow: 0 0 5px var(--fg-color);
}
