/* ===== Variables y Reset ===== */
:root {
    --color-bg: #1a1a2e;
    --color-q1: #ffffff;  /* Blanco */
    --color-q2: #ffffff;  /* Blanco */
    --color-q3: #ffffff;  /* Blanco */
    --color-q4: #ffffff;  /* Blanco */
    --color-needle: #ffffff;
    --color-text: #000000;
    --color-accent: #e63946;
    --color-btn-start: #4ade80;
    --color-btn-pause: #fbbf24;
    --color-btn-reset: #f87171;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ===== Container Principal ===== */
.container {
    width: 100%;
    height: 100%;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* ===== Reloj ===== */
.clock-wrapper {
    width: 100%;
    max-width: min(92vw, 75vh);
    aspect-ratio: 1;
    padding: 5px;
}

.clock {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 
        0 0 0 8px #e0e0e0,
        0 8px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ===== Cuartos ===== */
.quarters {
    display: none;
}

.quarter {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: 100% 100%;
}

.q1 {
    top: 0;
    right: 0;
    background: var(--color-q1);
    transform-origin: 0% 100%;
    border-radius: 0 100% 0 0;
}

.q2 {
    bottom: 0;
    right: 0;
    background: var(--color-q2);
    transform-origin: 0% 0%;
    border-radius: 0 0 100% 0;
}

.q3 {
    bottom: 0;
    left: 0;
    background: var(--color-q3);
    transform-origin: 100% 0%;
    border-radius: 0 0 0 100%;
}

.q4 {
    top: 0;
    left: 0;
    background: var(--color-q4);
    transform-origin: 100% 100%;
    border-radius: 100% 0 0 0;
}

/* ===== Rayas cada 2 segundos ===== */
.tick-marks {
    position: absolute;
    width: 100%;
    height: 100%;
}

.tick {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 50%;
    background: transparent;
    transform-origin: center top;
    transform: translateX(-50%) rotate(var(--angle));
}

.tick::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 3px;
    height: 8%;
    background: #1a3a6e;
}

/* ===== Marcas de Tiempo ===== */
.time-marks {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.mark {
    position: absolute;
    font-size: clamp(1.8rem, 7vw, 3rem);
    font-weight: bold;
    color: #1a3a6e;
    text-shadow: none;
}

.mark-0 {
    top: 1%;
    left: 50%;
    transform: translateX(-50%);
}

.mark-10 {
    top: 22%;
    right: 6%;
}

.mark-20 {
    bottom: 22%;
    right: 6%;
}

.mark-30 {
    bottom: 1%;
    left: 50%;
    transform: translateX(-50%);
}

.mark-40 {
    bottom: 22%;
    left: 6%;
}

.mark-50 {
    top: 22%;
    left: 6%;
}

/* ===== 4 Agujas de colores ===== */
.needle-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.needle {
    position: absolute;
    top: 16%;
    left: 50%;
    width: 35px;
    height: 34%;
    transform: translateX(-50%);
    border-radius: 8px;
}

/* Punta de las agujas */
.needle::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
}

/* Aguja AZUL */
.needle-blue {
    background: #2563eb;
    box-shadow: 
        0 0 10px rgba(37, 99, 235, 0.5),
        3px 5px 15px rgba(0, 0, 0, 0.4);
}
.needle-blue::before {
    border-bottom: 28px solid #2563eb;
    filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.3));
}

/* Aguja VERDE */
.needle-green {
    background: #22c55e;
    box-shadow: 
        0 0 10px rgba(34, 197, 94, 0.5),
        3px 5px 15px rgba(0, 0, 0, 0.4);
}
.needle-green::before {
    border-bottom: 28px solid #22c55e;
    filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.3));
}

/* Aguja ROJA */
.needle-red {
    background: #dc2626;
    box-shadow: 
        0 0 10px rgba(220, 38, 38, 0.5),
        3px 5px 15px rgba(0, 0, 0, 0.4);
}
.needle-red::before {
    border-bottom: 28px solid #dc2626;
    filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.3));
}

/* Aguja AMARILLA */
.needle-yellow {
    background: #eab308;
    box-shadow: 
        0 0 10px rgba(234, 179, 8, 0.5),
        3px 5px 15px rgba(0, 0, 0, 0.4);
}
.needle-yellow::before {
    border-bottom: 28px solid #eab308;
    filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.3));
}

/* ===== Centro ===== */
.center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #fff 0%, #ddd 50%, #aaa 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 
        0 0 15px rgba(255, 255, 255, 0.8),
        inset 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 10;
}



/* ===== Reloj Digital ===== */
.digital-clock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 300;
    color: #ffffff;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 15px 35px;
    border-radius: 15px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
}

.digital-clock span {
    text-shadow: 0 0 20px rgba(77, 171, 247, 0.8);
}

.digital-clock .separator {
    animation: blink 1s ease-in-out infinite;
    opacity: 1;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .container {
        padding: 8px;
        gap: 8px;
    }
    
    .clock-wrapper {
        max-width: min(95vw, 75vh);
    }
    
    .digital-clock {
        font-size: clamp(2rem, 7vw, 3rem);
        padding: 10px 25px;
    }
}

@media (max-height: 700px) {
    .container {
        gap: 5px;
    }
    
    .clock-wrapper {
        max-width: min(92vw, 70vh);
    }
    
    .digital-clock {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
        padding: 8px 20px;
    }
}

/* ===== Landscape en móvil ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-content: center;
        gap: 15px;
    }
    
    .clock-wrapper {
        max-width: min(80vh, 50vw);
    }
    
    .digital-clock {
        font-size: 2.5rem;
        padding: 10px 25px;
    }
}
    
    .btn {
        padding: 6px 12px;
    }
}

/* ===== Animación de pulso cuando está activo ===== */
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.1), 0 0 40px rgba(233, 69, 96, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.2), 0 0 60px rgba(233, 69, 96, 0.5); }
}

.clock.running {
    animation: pulse 2s ease-in-out infinite;
}
