/* Apple-inspired Timer & Stopwatch Styles */

:root {
    --primary-blue: #007AFF;
    --secondary-red: #FF3B30;
    --background-grey: #F2F2F7;
    --text-black: #000000;
    --accent-green: #34C759;
    --light-grey: #F8F9FA;
    --medium-grey: #8E8E93;
    --border-grey: #C7C7CC;
}

/* Theme Variables */
body {
    --theme-bg-primary: var(--background-grey);
    --theme-bg-secondary: #FFFFFF;
    --theme-text-primary: var(--text-black);
    --theme-text-secondary: var(--medium-grey);
    --theme-accent: var(--primary-blue);
    --theme-overlay: rgba(255, 255, 255, 0.9);
}

/* Default Theme */
body.theme-default {
    background: var(--background-grey);
}

/* Ocean Theme */
body.theme-ocean {
    --theme-bg-primary: #0F4C75;
    --theme-bg-secondary: rgba(255, 255, 255, 0.95);
    --theme-text-primary: #FFFFFF;
    --theme-text-secondary: #B8D4E3;
    --theme-accent: #00BCD4;
    --theme-overlay: rgba(15, 76, 117, 0.9);
    background: linear-gradient(135deg, #667db6 0%, #0082c8 25%, #0082c8 75%, #667db6 100%);
    background-attachment: fixed;
}

body.theme-ocean .time-text {
    color: #FFFFFF;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Forest Theme */
body.theme-forest {
    --theme-bg-primary: #2E7D32;
    --theme-bg-secondary: rgba(255, 255, 255, 0.95);
    --theme-text-primary: #FFFFFF;
    --theme-text-secondary: #C8E6C9;
    --theme-accent: #4CAF50;
    --theme-overlay: rgba(46, 125, 50, 0.9);
    background: linear-gradient(135deg, #2E7D32 0%, #388E3C 25%, #43A047 75%, #4CAF50 100%);
    background-attachment: fixed;
}

body.theme-forest .time-text {
    color: #FFFFFF;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Sunset Theme */
body.theme-sunset {
    --theme-bg-primary: #E65100;
    --theme-bg-secondary: rgba(255, 255, 255, 0.95);
    --theme-text-primary: #FFFFFF;
    --theme-text-secondary: #FFE0B2;
    --theme-accent: #FF9800;
    --theme-overlay: rgba(230, 81, 0, 0.9);
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 25%, #fecfef 75%, #ff9a9e 100%);
    background-attachment: fixed;
}

body.theme-sunset .time-text {
    color: #FFFFFF;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Night Theme */
body.theme-night {
    --theme-bg-primary: #1A1A1A;
    --theme-bg-secondary: rgba(40, 40, 40, 0.95);
    --theme-text-primary: #FFFFFF;
    --theme-text-secondary: #B0B0B0;
    --theme-accent: #BB86FC;
    --theme-overlay: rgba(26, 26, 26, 0.9);
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 25%, #2c3e50 75%, #34495e 100%);
    background-attachment: fixed;
}

body.theme-night .time-text {
    color: #FFFFFF;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

/* Space Theme */
body.theme-space {
    --theme-bg-primary: #0D1421;
    --theme-bg-secondary: rgba(30, 30, 60, 0.95);
    --theme-text-primary: #FFFFFF;
    --theme-text-secondary: #9C27B0;
    --theme-accent: #E91E63;
    --theme-overlay: rgba(13, 20, 33, 0.9);
    background: linear-gradient(135deg, #667db6 0%, #0082c8 25%, #667db6 50%, #0082c8 75%, #667db6 100%);
    background-attachment: fixed;
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

body.theme-space .time-text {
    color: #FFFFFF;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Enhanced contrast for all themed elements */
body.theme-ocean .time-input,
body.theme-forest .time-input,
body.theme-sunset .time-input,
body.theme-night .time-input,
body.theme-space .time-input {
    background-color: rgba(255, 255, 255, 0.95);
    color: #000000;
    border-color: rgba(255, 255, 255, 0.3);
}

body.theme-ocean .input-group-text,
body.theme-forest .input-group-text,
body.theme-sunset .input-group-text,
body.theme-night .input-group-text,
body.theme-space .input-group-text {
    background-color: rgba(255, 255, 255, 0.95);
    color: #666666;
    border-color: rgba(255, 255, 255, 0.3);
}

body.theme-ocean .mode-btn,
body.theme-forest .mode-btn,
body.theme-sunset .mode-btn,
body.theme-night .mode-btn,
body.theme-space .mode-btn {
    background-color: rgba(255, 255, 255, 0.95);
    color: #333333;
    border-color: rgba(255, 255, 255, 0.3);
}

body.theme-ocean .theme-toggle-btn,
body.theme-forest .theme-toggle-btn,
body.theme-sunset .theme-toggle-btn,
body.theme-night .theme-toggle-btn,
body.theme-space .theme-toggle-btn {
    background-color: rgba(255, 255, 255, 0.95);
    color: #333333;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Timer warning states for themes */
body.theme-ocean .time-text.timer-warning,
body.theme-forest .time-text.timer-warning,
body.theme-sunset .time-text.timer-warning,
body.theme-night .time-text.timer-warning,
body.theme-space .time-text.timer-warning {
    color: #FFD700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

body.theme-ocean .time-text.timer-finished,
body.theme-forest .time-text.timer-finished,
body.theme-sunset .time-text.timer-finished,
body.theme-night .time-text.timer-finished,
body.theme-space .time-text.timer-finished {
    color: #FF6B6B;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

* {
    box-sizing: border-box;
}

html {
    /* Use CSS custom property for viewport height on mobile */
    height: 100%;
    height: calc(var(--vh, 1vh) * 100);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Roboto', 'Segoe UI', sans-serif;
    background-color: var(--theme-bg-primary, var(--background-grey));
    color: var(--theme-text-primary, var(--text-black));
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    height: 100%;
    height: calc(var(--vh, 1vh) * 100);
    -webkit-overflow-scrolling: touch;
    /* Prevent rubber band scrolling on iOS */
    overscroll-behavior: none;
    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior-y: contain;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Top Controls Layout */
.top-controls {
    margin-bottom: 2rem;
}

.top-controls .mode-switcher {
    margin-bottom: 0;
}

/* Theme Selector */
.theme-selector {
    position: relative;
}

.theme-toggle-btn {
    background-color: var(--theme-bg-secondary, white);
    border: 2px solid var(--border-grey);
    color: var(--theme-text-secondary, var(--medium-grey));
    padding: 12px;
    font-weight: 500;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn:hover {
    background-color: var(--theme-overlay, var(--light-grey));
    border-color: var(--theme-accent, var(--primary-blue));
    color: var(--theme-accent, var(--primary-blue));
}

.theme-toggle-btn i {
    width: 20px;
    height: 20px;
}

/* Theme Dropdown */
.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--theme-bg-secondary, white);
    border: 2px solid var(--border-grey);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 8px;
}

.theme-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border-grey);
}

.theme-option:last-child {
    border-bottom: none;
}

.theme-option:hover {
    background-color: var(--theme-overlay, var(--light-grey));
}

.theme-option.active {
    background-color: var(--theme-accent, var(--primary-blue));
    color: white;
}

.theme-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

/* Theme Preview Colors */
.theme-preview-default {
    background: var(--background-grey);
}

.theme-preview-ocean {
    background: linear-gradient(135deg, #667db6 0%, #0082c8 100%);
}

.theme-preview-forest {
    background: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%);
}

.theme-preview-sunset {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.theme-preview-night {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.theme-preview-space {
    background: linear-gradient(135deg, #667db6 0%, #0082c8 50%, #667db6 100%);
}

.theme-option span {
    font-weight: 500;
    color: var(--theme-text-primary, var(--text-black));
}

.theme-option.active span {
    color: white;
}

.mode-btn {
    background-color: var(--theme-bg-secondary, white);
    border: 2px solid var(--border-grey);
    color: var(--theme-text-secondary, var(--medium-grey));
    padding: 12px 24px;
    font-weight: 500;
    border-radius: 25px;
    margin: 0 5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-btn:hover {
    background-color: var(--theme-overlay, var(--light-grey));
    border-color: var(--theme-accent, var(--primary-blue));
    color: var(--theme-accent, var(--primary-blue));
}

.mode-btn.active {
    background-color: var(--theme-accent, var(--primary-blue));
    border-color: var(--theme-accent, var(--primary-blue));
    color: white;
}

.mode-btn i {
    width: 18px;
    height: 18px;
}

/* Time Display */
.time-display {
    margin: 3rem 0;
    user-select: none;
}

.time-text {
    font-family: 'Roboto Mono', 'SF Pro Display', monospace;
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--theme-text-primary, var(--text-black));
    text-align: center;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.time-text.timer-warning {
    color: var(--secondary-red);
    animation: pulse-warning 1s ease-in-out infinite;
}

.time-text.timer-finished {
    color: var(--secondary-red);
    animation: pulse-finished 0.5s ease-in-out infinite;
}

/* Timer Input Styles */
.timer-inputs {
    margin-bottom: 2rem;
}

.time-input {
    width: 80px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 500;
    border: 2px solid var(--border-grey);
    border-radius: 12px;
    background-color: var(--theme-bg-secondary, white);
    color: var(--theme-text-primary, var(--text-black));
    transition: all 0.3s ease;
}

.time-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
    outline: none;
}

.input-group-text {
    background-color: var(--theme-bg-secondary, white);
    border: 2px solid var(--border-grey);
    border-left: none;
    color: var(--theme-text-secondary, var(--medium-grey));
    font-weight: 500;
}

/* Control Buttons */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 2rem 0;
}

.control-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.start-btn {
    background-color: var(--accent-green);
    color: white;
}

.start-btn:hover {
    background-color: #28a745;
}

.pause-btn {
    background-color: var(--secondary-red);
    color: white;
}

.pause-btn:hover {
    background-color: #dc3545;
}

.reset-btn {
    background-color: white;
    color: var(--medium-grey);
    border: 2px solid var(--border-grey);
}

.reset-btn:hover {
    background-color: var(--light-grey);
    color: var(--text-black);
}

.control-btn i {
    width: 24px;
    height: 24px;
}

/* Lap Times */
.lap-times {
    max-width: 400px;
    margin: 0 auto;
}

#lap-btn {
    border-radius: 20px;
    padding: 8px 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 1rem auto;
}

#lap-btn:disabled {
    opacity: 0.5;
}

.lap-list {
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--theme-bg-secondary, white);
    border-radius: 12px;
    border: 1px solid var(--border-grey);
}

.lap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-grey);
    font-family: 'Roboto Mono', monospace;
}

.lap-item:last-child {
    border-bottom: none;
}

.lap-number {
    font-weight: 500;
    color: var(--theme-text-secondary, var(--medium-grey));
}

.lap-time {
    font-weight: 500;
    color: var(--theme-text-primary, var(--text-black));
}

/* Animations */
@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes pulse-finished {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.02); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Mobile-First Responsive Design */

/* Touch-friendly controls for all devices */
.control-btn,
.mode-btn,
.time-input,
#lap-btn {
    -webkit-tap-highlight-color: rgba(0, 122, 255, 0.3);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Enhanced touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    .control-btn {
        min-width: 60px;
        min-height: 60px;
        margin: 5px;
    }
    
    .mode-btn {
        min-height: 48px;
        padding: 12px 20px;
    }
    
    .time-input {
        min-height: 48px;
        font-size: 1.2rem;
    }
    
    #lap-btn {
        min-height: 44px;
        padding: 10px 16px;
    }
}

/* Tablet Portrait (768px and below) */
@media (max-width: 768px) {
    body {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .container-fluid {
        padding: 0 20px;
    }
    
    .time-display {
        margin: 2rem 0;
    }
    
    .time-text {
        font-size: clamp(3rem, 10vw, 5rem);
        line-height: 1.1;
    }
    
    .control-btn {
        width: 75px;
        height: 75px;
        margin: 0 8px;
    }
    
    .controls {
        gap: 16px;
        margin: 1.5rem 0;
    }
    
    .time-input {
        width: 80px;
        font-size: 1.3rem;
        padding: 12px 8px;
    }
    
    .input-group-text {
        padding: 12px 12px;
        font-size: 1rem;
    }
    
    .mode-btn {
        padding: 12px 24px;
        font-size: 1rem;
        margin: 0 3px;
    }
    
    .lap-times {
        margin-top: 2rem;
    }
    
    .lap-item {
        padding: 14px 16px;
        font-size: 1rem;
    }
    
    /* Improve text readability on tablets */
    .timer-inputs .input-group {
        margin-bottom: 10px;
    }
}

/* Mobile Landscape (max-height: 500px) */
@media (max-height: 500px) and (orientation: landscape) {
    .time-display {
        margin: 1rem 0;
    }
    
    .time-text {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }
    
    .controls {
        margin: 1rem 0;
    }
    
    .timer-inputs {
        margin-bottom: 1rem;
    }
    
    .mode-switcher {
        margin-bottom: 1rem;
    }
    
    .lap-times {
        margin-top: 1rem;
    }
    
    .lap-list {
        max-height: 120px;
    }
}

/* Large Mobile (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .time-text {
        font-size: clamp(3.5rem, 9vw, 4.5rem);
    }
    
    .control-btn {
        width: 80px;
        height: 80px;
    }
    
    .time-input {
        width: 85px;
        font-size: 1.4rem;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    .container-fluid {
        padding: 0 16px;
    }
    
    .top-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .top-controls .mode-switcher {
        order: 1;
    }
    
    .top-controls .theme-selector {
        order: 2;
    }
    
    .time-display {
        margin: 1.5rem 0;
    }
    
    .time-text {
        font-size: clamp(2.5rem, 12vw, 3.5rem);
        line-height: 1.2;
    }
    
    .control-btn {
        width: 70px;
        height: 70px;
        margin: 0 6px;
    }
    
    .control-btn i {
        width: 22px;
        height: 22px;
    }
    
    .controls {
        gap: 12px;
        margin: 1.2rem 0;
    }
    
    .time-input {
        width: 75px;
        font-size: 1.2rem;
        padding: 10px 6px;
    }
    
    .input-group-text {
        padding: 10px 10px;
        font-size: 0.9rem;
    }
    
    .mode-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
        margin: 0 2px;
    }
    
    .mode-btn i {
        width: 16px;
        height: 16px;
    }
    
    .timer-inputs .row {
        gap: 8px;
        justify-content: center;
    }
    
    .timer-inputs .col-auto {
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
    }
    
    #lap-btn {
        font-size: 0.9rem;
        padding: 8px 14px;
    }
    
    .lap-item {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
    
    .lap-list {
        max-height: 180px;
    }
    
    /* Theme selector mobile adjustments */
    .theme-toggle-btn {
        width: 44px;
        height: 44px;
    }
    
    .theme-dropdown {
        min-width: 180px;
        right: 50%;
        transform: translateX(50%) translateY(-10px);
    }
    
    .theme-dropdown.show {
        transform: translateX(50%) translateY(0);
    }
}

/* Extra Small Mobile (360px and below) */
@media (max-width: 360px) {
    .container-fluid {
        padding: 0 12px;
    }
    
    .time-text {
        font-size: clamp(2rem, 14vw, 3rem);
    }
    
    .control-btn {
        width: 65px;
        height: 65px;
        margin: 0 4px;
    }
    
    .control-btn i {
        width: 20px;
        height: 20px;
    }
    
    .controls {
        gap: 8px;
    }
    
    .time-input {
        width: 70px;
        font-size: 1.1rem;
    }
    
    .mode-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .mode-btn span {
        display: none; /* Hide text, show only icons on very small screens */
    }
    
    .mode-btn i {
        margin-right: 0 !important;
    }
}

/* Orientation-specific styles */
body.landscape {
    /* Adjustments for landscape mode */
}

body.portrait {
    /* Adjustments for portrait mode */
}

/* Touch-specific enhancements */
@media (hover: none) and (pointer: coarse) {
    /* Increase button sizes for touch devices */
    .control-btn {
        min-width: 64px;
        min-height: 64px;
    }
    
    .mode-btn {
        min-height: 48px;
    }
    
    /* Improve tap targets */
    .time-input {
        min-height: 48px;
        padding: 12px;
        border-radius: 8px;
    }
    
    /* Better touch feedback */
    .control-btn:active,
    .mode-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Disable hover effects on touch devices */
    .control-btn:hover,
    .mode-btn:hover {
        transform: none;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix viewport height issues on iOS */
    .container-fluid {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Prevent selection highlighting on iOS */
    .time-text,
    .control-btn,
    .mode-btn {
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    /* Fix input zoom on iOS */
    .time-input {
        font-size: 16px; /* Prevent zoom */
        transform: translateZ(0); /* Force hardware acceleration */
    }
}

/* Android specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 1) and (max-device-width: 480px) {
    /* Android Chrome address bar compensation */
    .container-fluid {
        min-height: calc(100vh - 56px);
    }
}

/* PWA-style mobile optimizations */
@media (display-mode: standalone) {
    /* When app is installed as PWA */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .container-fluid {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Improve scrolling performance on mobile */
.lap-list {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Better focus indicators for mobile */
@media (hover: none) and (pointer: coarse) {
    .control-btn:focus,
    .mode-btn:focus,
    .time-input:focus {
        outline: 3px solid var(--primary-blue);
        outline-offset: 2px;
    }
}

/* Mobile keyboard adjustments */
@media (max-height: 500px) {
    /* When mobile keyboard is open */
    .time-display {
        margin: 1rem 0;
    }
    
    .controls {
        margin: 0.5rem 0;
    }
    
    .timer-inputs {
        margin-bottom: 0.5rem;
    }
    
    .lap-times {
        margin-top: 0.5rem;
    }
    
    .lap-list {
        max-height: 100px;
    }
}

/* Improve input experience on mobile */
.time-input {
    /* Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.time-input:focus {
    /* Re-enable selection when focused */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Better visual feedback for active states */
.control-btn.active,
.mode-btn.active {
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

/* Improve performance with hardware acceleration */
.control-btn,
.mode-btn,
.time-text {
    transform: translateZ(0);
    will-change: transform;
}

/* Focus and Accessibility */
.control-btn:focus,
.mode-btn:focus,
.time-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-blue: #0056CC;
        --background-grey: #FFFFFF;
        --border-grey: #000000;
        --medium-grey: #666666;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Enhanced mobile touch feedback */
@media (hover: none) and (pointer: coarse) {
    .control-btn.active {
        transform: scale(0.9);
        background-color: var(--primary-blue);
        border-color: var(--primary-blue);
        color: white;
        box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
    }
    
    .mode-btn.active {
        transform: scale(0.95);
    }
    
    .theme-toggle-btn.active {
        transform: scale(0.95);
        background-color: var(--light-grey);
    }
    
    /* Ensure buttons are large enough for touch */
    .control-btn {
        min-width: 80px;
        min-height: 80px;
        touch-action: manipulation;
    }
    
    .mode-btn {
        min-height: 48px;
        touch-action: manipulation;
    }
    
    .theme-toggle-btn {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
}
