/* Basic Reset & Fullscreen Setup */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevents scrollbars */
    font-family: Arial, Helvetica, sans-serif; /* Basic fallback font */
    /* Default background for body, JS will override */
    background-color: black;
}

body {
    display: flex;
    flex-direction: column; /* Stack timer above controls */
    transition: background-color 0.3s ease; /* Smooth color transition */
}

/* Timer Display Area */
#timer-display-container {
    flex-grow: 1; /* Takes up all available vertical space except controls */
    display: flex;
    flex-direction: column; /* Stack children vertically */
    justify-content: center; /* Center vertically in the available space */
    align-items: center;    /* Center horizontally */
    /* Default background for timer area, JS will override */
    background-color: black;
    /* Default color for timer digits, JS will override */
    /* color: red; This will be set on #timer-digits directly */
    transition: background-color 0.3s ease; /* Smooth color transition */
}

#timer-digits {
    font-size: 27vw; /* Initial font-size, JS can change this */
    font-family: 'Arial Black', Gadget, sans-serif;
    font-weight: bold;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    color: red; /* Default timer digits color, JS will override */
    transition: color 0.3s ease; /* Smooth color transition for digits */
}

/* Controls Area */
#controls-area {
    background-color: #DDA0DD; /* Light purple */
    /* Default text color for this area, JS will override */
    color: red;
    font-weight: bold;
    font-family: 'Arial', sans-serif;

    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allow items to wrap if screen is too narrow */

    font-size: 3vh; /* Adjusted base font size for controls area */
    padding: 1.5vh 1vh; /* Adjusted padding */
    line-height: 1.2;

    flex-shrink: 0;
    transition: color 0.3s ease; /* Smooth color transition for text in this bar */
}

.controls-row {
    width: 100%; /* Make each row take full width */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px 0; /* Add a little vertical padding between rows */
    flex-wrap: wrap; /* Allow items within a row to wrap if needed, though less likely with 3 rows */
}

#controls-text {
    margin: 0 10px; /* Space around text */
}

.control-button {
    background-color: rgba(255, 255, 255, 0.08); /* Subtle background to make it button-like */
    /* Default color for button text, JS will override */
    color: red;
    /* Default border color, JS will override */
    border: 2px solid red;
    border-radius: 5px;
    padding: 0.4vh 1.2vh; /* Slightly adjusted padding */
    font-size: inherit;
    font-weight: bold;
    cursor: pointer;
    margin: 0.5vh 5px; /* Allow vertical margin for wrapping */
    min-width: 2.5em;
    text-align: center;
    transition: background-color 0.2s ease, color 0.3s ease, border-color 0.3s ease;
}

.control-button:hover {
    /* Consider making this based on current font color with JS, or a more neutral effect */
    background-color: rgba(255, 255, 255, 0.15); /* Slightly more opaque on hover */
}

.control-button:active {
    /* Consider making this based on current font color with JS, or a more neutral effect */
    background-color: rgba(255, 255, 255, 0.22); /* Even more opaque on active */
}

.color-picker-label {
    margin-left: 10px;
    margin-right: 5px;
    font-size: 0.9em; /* Slightly smaller label */
}

.color-picker {
    width: 3.5vh; /* Make them somewhat square based on controls area font-size */
    height: 3.5vh;
    border: 1px solid #888; /* Simple border */
    border-radius: 3px;
    padding: 0; /* Remove default padding */
    cursor: pointer;
    margin-right: 5px;
    vertical-align: middle; /* Align with labels/text */
}
/* Attempt to hide the default browser text/preview inside the color input for a cleaner look */
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}
input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}


.control-separator {
    margin: 0 10px;
    opacity: 0.5;
}


/*
Specific for font control buttons if needed, but general .control-button should cover it.
This rule is commented out to prevent "empty ruleset" errors.
.font-control-btn {
}
*/

/* Optional: For the square colon dots (styles unchanged) */
/*
.colon { ... }
.colon-dot { ... }
*/

#progress-bar-container {
    width: 80%; /* Width of the progress bar area */
    height: 15px; /* Height of the progress bar */
    background-color: rgba(128, 128, 128, 0.2); /* Faint background for the container */
    border-radius: 5px;
    margin: 10px auto 0; /* Margin to position it below digits, and auto for horizontal centering */
    overflow: hidden; /* Ensures the inner bar respects the border radius */
}

#progress-bar {
    height: 100%;
    width: 100%; /* Initial width */
    background-color: red; /* Default color, JS will sync with timer digits */
    border-radius: 5px; /* Match container for a smooth look */
    transition: width 0.25s linear, background-color 0.3s ease; /* Smooth width and color changes */
}

.progress-bar-flashing {
    animation: flash-animation 1s infinite;
}

@keyframes flash-animation {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Dropdown Menu Styling */
.dropdown {
    position: relative;
    display: inline-block;
    margin: 0 10px;
}

.dropdown-content {
    display: none;
    position: absolute;
    bottom: 100%; /* Position above the button */
    right: 0;
    background-color: rgba(0, 0, 0, 0.85);
    min-width: 300px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    border-radius: 8px;
    z-index: 1;
    padding: 15px;
    margin-bottom: 10px;
    border: 2px solid; /* Border color will be set by JS to match font color */
}

.dropdown-content.show {
    display: block;
}

.dropdown-section {
    padding: 8px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 8px;
}

.dropdown-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.dropdown-section span {
    margin-right: 10px;
}

.dropdown-section .control-button,
.dropdown-section select {
    margin: 3px;
}

/* Arrow indicator for dropdown */
.dropdown::after {
    content: '';
    position: absolute;
    display: none;
    bottom: -10px;
    right: 15px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: currentColor transparent transparent transparent;
    z-index: 2;
}

.dropdown.active::after {
    display: block;
}