/* --- 1. GLOBAL RESETS & FONTS --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0b2512 0%, #020c04 100%);
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

/* --- 2. GLOBAL CONTAINER CARD --- */
.card {
    text-align: center;
    padding: 2rem 1.5rem;
    border: 1px solid #10b981;
    border-radius: 12px;
    background-color: rgba(10, 25, 14, 0.85);
    box-shadow: 0 8px 32px 0 rgba(16, 185, 129, 0.15);
    backdrop-filter: blur(6px);
    width: 100%;
    max-width: 440px; /* Perfectly optimized viewport width boundary */
    transition: all 0.5s ease;
}

/* Alert state border when countdown triggers */
.card.alert-active {
    border-color: #ef4444;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.5);
    animation: alertBlink 1.5s infinite alternate;
}

@keyframes alertBlink {
    0% { border-color: rgba(239, 68, 68, 0.4); box-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }
    100% { border-color: rgba(239, 68, 68, 1); box-shadow: 0 0 25px rgba(239, 68, 68, 0.6); }
}

/* --- 3. HEADINGS & TEXT --- */
h2 {
    color: #39ff14;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
    font-size: 2rem;
    text-transform: uppercase;
}

p {
    color: #cbd5e1;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* --- 4. TYPING INPUT GRID (Width Fix Implemented) --- */
.input-grid {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 1.5rem;
    width: 100%;
}

.input-box {
    flex: 1 1 0; /* Forces all 4 cards to share equal space without breaking overflow bounds */
    min-width: 0; 
    text-align: center;
}

.input-box label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #cbd5e1;
    margin-bottom: 0.4rem;
}

/* Number fields layout optimization */
input[type="number"] {
    width: 100%;
    background: rgba(2, 12, 4, 0.6);
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 0.65rem 0.2rem;
    color: #e2e8f0;
    font-size: 1.1rem;
    font-family: monospace;
    border-radius: 6px;
    outline: none;
    text-align: center;
    transition: all 0.3s ease;
}

input[type="number"]:focus {
    border-color: #39ff14;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

/* Hide default input arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- 5. TIMER CHRONO READOUT --- */
.timer-display {
    font-family: monospace;
    font-size: 2.6rem; /* Scaled perfectly so text does not clip on small display interfaces */
    font-weight: bold;
    color: #39ff14;
    text-shadow: 0 0 20px rgba(57, 255, 20, 0.6);
    margin: 1.5rem 0;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.timer-display.alert-text {
    color: #ef4444;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
}

/* --- 6. ACTION CONTROLS --- */
.controls-container {
    display: flex;
    gap: 12px;
    justify-content: center;
}

button.btn {
    background: rgba(16, 185, 129, 0.1);
    color: #39ff14;
    border: 1px solid #10b981;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
    flex: 1;
}

button.btn:hover:not(:disabled) {
    background: #10b981;
    color: #020c04;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
    transform: translateY(-2px);
}

button.btn:active:not(:disabled) {
    transform: translateY(0);
}

button.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(16, 185, 129, 0.2);
    color: #cbd5e1;
}

button.btn-reset {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

button.btn-reset:hover {
    background: #ef4444;
    color: #020c04;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
}
