:root {
    --work-color: #4CAF50;
    --rest-color: #FF9800;
    --finished-color: #9E9E9E;
    --ready-color: #2196F3;
    --white: #ffffff;
    --shadow: 0 4px 15px rgba(0,0,0,0.2);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--ready-color) 0%, #1976D2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    padding: 20px;
}

body.work-mode {
    background: linear-gradient(135deg, var(--work-color) 0%, #388E3C 100%);
}

body.rest-mode {
    background: linear-gradient(135deg, var(--rest-color) 0%, #F57C00 100%);
}

body.finished-mode {
    background: linear-gradient(135deg, var(--finished-color) 0%, #757575 100%);
}

.container {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 30px;
    text-align: center;
    position: relative;
}

.header {
    margin-bottom: 30px;
    position: relative;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

.back-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.back-link:hover {
    color: var(--white);
    transform: translateX(-3px);
}

.timer-display {
    margin: 50px 0;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.status-text {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    letter-spacing: 2px;
}

.timer-text {
    font-size: 4.5rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 0 4px 20px rgba(0,0,0,0.4);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-bottom: 15px;
}

.round-text {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}

.audio-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.audio-controls > div:first-child {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.test-sound-button, .voice-toggle-button {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    font-size: 0.9rem;
    min-width: 120px;
}

.test-sound-button:hover, .voice-toggle-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.voice-toggle-button.disabled {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    opacity: 0.7;
}

.audio-status {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.button {
    padding: 15px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.start-button {
    background: rgba(255, 255, 255, 0.25);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.start-button:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.start-button:active {
    transform: translateY(-1px);
}

.reset-button {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.reset-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.settings-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.setting:last-child {
    margin-bottom: 0;
}

.setting-label {
    font-size: 1rem;
    color: var(--white);
    font-weight: 500;
    text-align: left;
}

.setting-input {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    width: 80px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    transition: var(--transition);
}

.setting-input:focus {
    outline: none;
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.setting-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Pulse animation for timer */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.timer-text.pulse {
    animation: pulse 1s ease-in-out infinite;
}

/* Celebration animation */
@keyframes celebration {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(-5deg);
    }
    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

.timer-display.celebration {
    animation: celebration 0.6s ease-in-out;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .timer-text {
        font-size: 3.5rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .button {
        width: 100%;
        padding: 18px;
    }
    
    .setting {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .setting-input {
        width: 100px;
    }
}

/* Low battery warning */
.low-time {
    color: #ffeb3b !important;
    text-shadow: 0 0 20px #ffeb3b;
}

.critical-time {
    color: #f44336 !important;
    text-shadow: 0 0 20px #f44336;
}

/* Progress indicator */
.progress-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    opacity: 0.3;
    pointer-events: none;
}

.progress-ring circle {
    fill: none;
    stroke: var(--white);
    stroke-width: 4;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dasharray 0.3s ease;
}