/* CSS Variables */
:root {
    --color-primary: #4d96ff;
    --color-bg: #1a1a2e;
    --color-bg-light: #252542;
    --color-text: #ffffff;
    --color-text-muted: #a0a0a0;
    --color-input-bg: #2d2d4a;
    --color-input-border: #3d3d5c;
    --transition-speed: 0.3s;
    --border-radius: 12px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Container */
.container {
    width: 100%;
    max-width: 400px;
}

/* Typography */
.title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 32px;
}

/* Form */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="time"] {
    background-color: var(--color-input-bg);
    border: 1px solid var(--color-input-border);
    border-radius: var(--border-radius);
    color: var(--color-text);
    font-size: 1rem;
    padding: 14px 16px;
    min-height: 48px;
    width: 100%;
    transition: border-color var(--transition-speed);
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group input::placeholder {
    color: var(--color-text-muted);
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.color-option {
    position: relative;
    cursor: pointer;
}

.color-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.color-swatch {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.color-option input:checked + .color-swatch {
    border-color: var(--color-text);
    transform: scale(1.1);
}

.color-option:active .color-swatch {
    transform: scale(0.95);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    padding: 16px 24px;
    min-height: 56px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform var(--transition-speed), opacity var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text);
    width: 100%;
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-input-border);
    width: 100%;
}

.btn-secondary:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

/* Countdown Display */
.countdown-container {
    text-align: center;
}

.countdown-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.countdown-display {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 48px;
}

.time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.time-value {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    background: var(--color-bg-light);
    padding: 16px 12px;
    border-radius: var(--border-radius);
    min-width: 80px;
    font-variant-numeric: tabular-nums;
}

.time-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
}

.time-block-seconds .time-value {
    color: var(--color-primary);
}

/* Countdown Actions */
.countdown-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Completed Screen */
.completed-container {
    text-align: center;
}

.celebration-emoji {
    font-size: 5rem;
    margin-bottom: 24px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.completed-message {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin-bottom: 40px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--color-bg-light);
    color: var(--color-text);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    max-width: calc(100% - 32px);
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (min-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .countdown-title {
        font-size: 2rem;
    }

    .time-value {
        font-size: 4rem;
        padding: 20px 16px;
        min-width: 100px;
    }

    .countdown-display {
        gap: 20px;
    }

    .countdown-actions {
        flex-direction: row;
        justify-content: center;
    }

    .countdown-actions .btn {
        width: auto;
        min-width: 180px;
    }
}

/* Animation for numbers changing */
.time-value {
    transition: transform 0.1s ease;
}

.time-value.pulse {
    transform: scale(1.05);
}
