/* Reset and base styles */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--system-background);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    color: var(--system-text);
}

/* iOS Design System Variables */
.ios {
    --system-background: #f2f2f7;
    --system-secondary-background: #ffffff;
    --system-tertiary-background: #f2f2f7;
    --system-text: #000000;
    --system-secondary-text: #8e8e93;
    --system-blue: #007aff;
    --system-green: #34c759;
    --system-red: #ff3b30;
    --system-orange: #ff9500;
    --system-purple: #af52de;
    --system-pink: #ff2d92;
    --system-teal: #5ac8fa;
    --system-indigo: #5856d6;
    --system-gray: #8e8e93;
    --system-gray2: #aeaeb2;
    --system-gray3: #c7c7cc;
    --system-gray4: #d1d1d6;
    --system-gray5: #e5e5ea;
    --system-gray6: #f2f2f7;
    --system-separator: #c6c6c8;
    --system-opaque-separator: #38383a;
    --system-grouped-background: #f2f2f7;
    --system-secondary-grouped-background: #ffffff;
    --system-tertiary-grouped-background: #f2f2f7;
    --system-label: #000000;
    --system-secondary-label: #3c3c43;
    --system-tertiary-label: #3c3c43;
    --system-quaternary-label: #3c3c43;
    --system-fill: #787880;
    --system-secondary-fill: #787880;
    --system-tertiary-fill: #787880;
    --system-quaternary-fill: #787880;
    --system-placeholder-text: #3c3c43;
    --system-link: #007aff;
    --system-border: #c6c6c8;
    --system-shadow: rgba(0, 0, 0, 0.1);
    --system-blur: blur(20px);
    --system-border-radius: 10px;
    --system-button-radius: 8px;
    --system-input-radius: 8px;
}

/* Android Material Design 3 Variables */
.android {
    --system-background: #fafafa;
    --system-secondary-background: #ffffff;
    --system-tertiary-background: #f5f5f5;
    --system-text: #1c1b1f;
    --system-secondary-text: #49454f;
    --system-blue: #6750a4;
    --system-green: #4caf50;
    --system-red: #f44336;
    --system-orange: #ff9800;
    --system-purple: #9c27b0;
    --system-pink: #e91e63;
    --system-teal: #009688;
    --system-indigo: #3f51b5;
    --system-gray: #9e9e9e;
    --system-gray2: #757575;
    --system-gray3: #616161;
    --system-gray4: #424242;
    --system-gray5: #212121;
    --system-gray6: #fafafa;
    --system-separator: #e0e0e0;
    --system-opaque-separator: #1c1b1f;
    --system-grouped-background: #fafafa;
    --system-secondary-grouped-background: #ffffff;
    --system-tertiary-grouped-background: #f5f5f5;
    --system-label: #1c1b1f;
    --system-secondary-label: #49454f;
    --system-tertiary-label: #79747e;
    --system-quaternary-label: #cac4d0;
    --system-fill: #6750a4;
    --system-secondary-fill: #49454f;
    --system-tertiary-fill: #79747e;
    --system-quaternary-fill: #cac4d0;
    --system-placeholder-text: #79747e;
    --system-link: #6750a4;
    --system-border: #e0e0e0;
    --system-shadow: rgba(0, 0, 0, 0.12);
    --system-blur: blur(10px);
    --system-border-radius: 16px;
    --system-button-radius: 20px;
    --system-input-radius: 4px;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--system-background);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.1);
}

.splash-content {
    text-align: center;
    color: var(--system-text);
}

.splash-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.splash-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 2rem 0;
    letter-spacing: -0.5px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--system-gray3);
    border-top: 3px solid var(--system-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.timer-container {
    background: var(--system-secondary-background);
    backdrop-filter: var(--system-blur);
    -webkit-backdrop-filter: var(--system-blur);
    border-radius: var(--system-border-radius);
    box-shadow: 0 4px 20px var(--system-shadow);
    padding: 40px;
    text-align: center;
    min-width: 320px;
    max-width: 90vw;
    border: 1px solid var(--system-border);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.activity-input-container {
    margin-bottom: 20px;
}

.activity-input-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--system-label);
    font-size: 17px;
}

.activity-input-container input {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--system-input-radius);
    font-size: 17px;
    background: var(--system-tertiary-background);
    transition: all 0.3s ease;
    font-family: inherit;
    color: var(--system-text);
}

.activity-input-container input:focus {
    outline: none;
    background: var(--system-secondary-background);
    box-shadow: 0 0 0 3px var(--system-blue);
    border: 1px solid var(--system-blue);
}

.activity-input-container input::placeholder {
    color: var(--system-placeholder-text);
}

.completion-message {
    background-color: var(--system-green);
    color: var(--system-secondary-background);
    border: 1px solid var(--system-green);
    border-radius: var(--system-border-radius);
    padding: 15px;
    margin-bottom: 20px;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
}

.activity-display {
    background-color: var(--system-blue);
    color: var(--system-secondary-background);
    border: 1px solid var(--system-blue);
    border-radius: var(--system-border-radius);
    padding: 12px 16px;
    margin-bottom: 15px;
    font-size: 16px;
    text-align: center;
    font-weight: 500;
}

.timer-display {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--system-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
    background: var(--system-tertiary-background);
    padding: 25px;
    border-radius: var(--system-border-radius);
    border: 1px solid var(--system-border);
    box-shadow: inset 0 1px 3px var(--system-shadow);
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

.timer-display.running {
    background: var(--system-green);
    color: var(--system-secondary-background);
    transform: scale(1.02);
    border-color: var(--system-green);
}

.timer-display.finished {
    background: var(--system-red);
    color: var(--system-secondary-background);
    animation: pulse 0.5s ease-in-out;
    border-color: var(--system-red);
}

.button-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 16px 32px;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: var(--system-button-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn.primary {
    background: var(--system-blue);
    color: var(--system-secondary-background);
    box-shadow: 0 2px 8px var(--system-shadow);
}

.btn.primary:hover {
    background: var(--system-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--system-shadow);
}

.btn.secondary {
    background: var(--system-gray);
    color: var(--system-secondary-background);
    box-shadow: 0 2px 8px var(--system-shadow);
}

.btn.secondary:hover {
    background: var(--system-gray2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--system-shadow);
}

.btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .timer-container {
        padding: 30px 20px;
        min-width: 280px;
        margin: 20px;
    }
    
    .timer-display {
        font-size: 2.8rem;
        padding: 20px;
        letter-spacing: 1px;
    }
    
    .button-container {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .btn {
        width: 100%;
        max-width: 220px;
        padding: 18px 24px;
    }
    
    .splash-content h1 {
        font-size: 2rem;
    }
    
    .splash-icon {
        font-size: 3rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ios {
        --system-background: #000000;
        --system-secondary-background: #1c1c1e;
        --system-tertiary-background: #2c2c2e;
        --system-text: #ffffff;
        --system-secondary-text: #8e8e93;
        --system-border: #38383a;
        --system-shadow: rgba(0, 0, 0, 0.3);
    }
    
    .android {
        --system-background: #121212;
        --system-secondary-background: #1e1e1e;
        --system-tertiary-background: #2d2d2d;
        --system-text: #ffffff;
        --system-secondary-text: #b3b3b3;
        --system-border: #2d2d2d;
        --system-shadow: rgba(0, 0, 0, 0.3);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}