/* Basic Reset & Font Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #1a1f26;
    background: linear-gradient(135deg, #2c3e50, #1a1f26);
    color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Ensure body takes full height */
    padding: 20px;
    overflow: hidden; /* Prevent scrollbars if clock slightly exceeds */
}

/* Background Analog Clock */
.analog-clock {
    position: fixed; /* Position relative to the viewport */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Further increased size for better visibility */
    width: clamp(550px, 95vw, 850px);
    height: clamp(550px, 95vw, 850px);
    /* Brighter transparent circle */
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    /* More prominent border for better visibility */
    border: 6px solid rgba(255, 255, 255, 0.4);
    /* Ensure it's behind the timer container */
    z-index: -1;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    /* Add translateX to ensure rotation aligns with center */
    transform: translateX(-50%) rotate(0deg); /* Start rotation from 0 */
    transform-origin: bottom center; /* Rotate around the bottom center point */
    background-color: #e0e0e0; /* Default light hand color */
    border-radius: 5px 5px 0 0;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.hour-hand {
    width: 8px;
    height: 25%;
    background-color: #bdc3c7; /* Greyish white */
}

.minute-hand {
    width: 6px;
    height: 35%;
    background-color: #ecf0f1; /* White */
}

.second-hand {
    width: 3px;
    height: 40%;
    background-color: #e74c3c; /* Red accent */
}

.center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background-color: #e74c3c; /* Match second hand */
    border-radius: 50%;
    border: 3px solid #ecf0f1;
    z-index: 10; /* Above hands */
}

/* Main Timer Container */
.timer-container {
    /* Semi-transparent dark background - Adjust alpha (0.7) for more/less clock visibility */
    background-color: rgba(44, 62, 80, 0.70);
    padding: 30px 40px;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    /* Blur effect on the background behind this container */
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 500px;
    width: 100%;
    /* Position relative needed for z-index stacking */
    position: relative;
    /* Higher z-index to ensure it's above the analog clock */
    z-index: 1;
}

h1 {
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 15px;
    font-weight: 500;
    color: #ecf0f1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Date Display */
.date-display {
    font-size: 1em;
    color: #bdc3c7;
    margin-bottom: 25px;
    min-height: 1.2em; /* Prevent layout shift while loading */
}

/* Input Area */
.input-area {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-group label {
    font-size: 0.9em;
    margin-bottom: 5px;
    color: #bdc3c7;
}

.input-group input {
    width: 70px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.2);
    color: #e0e0e0;
    border-radius: 5px;
    text-align: center;
    font-size: 1.1em;
    appearance: textfield;
    -moz-appearance: textfield;
}
.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Time Display */
.time-display {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2.5rem, 10vw, 4.5rem);
    font-weight: 700;
    margin-bottom: 30px;
    color: #ffffff;
    text-shadow: 0 4px 10px rgba(0,0,0,0.6);
    letter-spacing: 2px;
    padding: 10px 0;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 25px;
    font-size: 1em;
    font-weight: 400;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}
.btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}
.btn.start { background-color: #27ae60; }
.btn.start:not(:disabled):hover { background-color: #229954; }
.btn.pause { background-color: #f39c12; }
.btn.pause:not(:disabled):hover { background-color: #e67e22; }
.btn.reset { background-color: #c0392b; }
.btn.reset:not(:disabled):hover { background-color: #a93226; }

/* Status Message */
.status-message {
    margin-top: 20px;
    font-size: 1.1em;
    min-height: 1.5em;
    font-weight: bold;
    color: #f39c12;
}

/* Visual Cue for Time Up */
.time-up {
    color: #e74c3c !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); text-shadow: 0 4px 10px rgba(231, 76, 60, 0.6); }
    50% { transform: scale(1.03); text-shadow: 0 6px 15px rgba(231, 76, 60, 0.8); }
    100% { transform: scale(1); text-shadow: 0 4px 10px rgba(231, 76, 60, 0.6); }
}

/* Media Query for smaller screens */
@media (max-width: 480px) {
    .timer-container { padding: 20px; }
    h1 { font-size: 1.8em; margin-bottom: 10px; }
    .date-display { font-size: 0.9em; margin-bottom: 20px; }
    .input-area { gap: 10px; margin-bottom: 20px; }
    .input-group input { width: 60px; }
    .time-display { margin-bottom: 25px; }
    .controls { gap: 10px; }
    .btn { padding: 10px 20px; font-size: 0.9em; }
    /* Shrink analog clock on small screens */
    .analog-clock { width: 250px; height: 250px; }
}