:root {
    --primary-color: #1a237e;
    --background-color: #4281ff;
    --text-color: #ffffff;
    --button-hover: rgba(255, 255, 255, 0.1);
    --border-radius: 8px;
    --spacing: 1rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
    -webkit-overflow-scrolling: touch;
}

.container {
    width: 100%;
    max-width: 350px;
    padding: 0px;
    padding-top: env(safe-area-inset-top, 0px);
    height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    box-sizing: border-box;
    position: relative;
    border-color: var(--text-color);
    border-width: 1px;
    border-style: solid;
    background-color: var(--background-color);
}

.stopwatch {
    background-color: transparent;
    padding: calc(var(--spacing) * 2);
    border-radius: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    margin-top: 0;
}

.display {
    font-size: 4rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: var(--spacing);
    margin-right: 25px;
    width: 100%;
}

#startStop {
    height: 165px;

}

.time-adjustment {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: var(--spacing);
    height: 45px;
}

.presets {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing);
}

.preset-select {
    width: 100%;
    max-width: 300px;
    padding: 0.75rem;
    font-size: 1.1rem;
    border: 1px solid var(--text-color);
    border-radius: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
}

.preset-select option {
    background-color: var(--background-color);
    color: var(--text-color);
}

.preset-select:hover {
    border-color: var(--primary-color);
}

.preset-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    margin-bottom: 0;
    padding-top: 2rem;
}

.controls .btn.primary {
    font-size: 2rem;
    padding: 1rem 3rem;
    min-width: 200px;
    width: 100%;
    margin-bottom: 0.5rem;
}

.controls .btn:not(.primary) {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    width: 60%;
    min-width: 100px;
    margin: 0 auto;
    display: block;
}

.settings {
    display: grid;
    gap: 1rem;
    padding-top: var(--spacing);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--button-hover);
}

.btn.primary {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--text-color);
}

.btn.primary:hover {
    background-color: var(--button-hover);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--background-color);
    color: var(--text-color);
    padding: calc(var(--spacing) * 2);
    border-radius: 0;
    width: 90%;
    max-width: 400px;
}

.modal-content h2 {
    margin-bottom: var(--spacing);
    text-align: center;
}

.modal-content input {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--text-color);
    border-radius: 0;
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: var(--spacing);
}

select, input[type="color"] {
    padding: 0.25rem;
    border: 1px solid var(--text-color);
    border-radius: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

select option {
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Mobile-specific styles */
@media screen and (max-width: 480px) {
    .display {
        font-size: 7rem !important; /* Force override */
    }
    
    .time-adjustment {
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    /* Prevent zoom on input focus for iOS */
    input[type="number"],
    input[type="text"],
    select {
        font-size: 16px;
    }

    /* Prevent pull-to-refresh */
    .stopwatch {
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: manipulation;
    }

    .container {
        padding-top: env(safe-area-inset-top, 0px);
        min-height: unset;
    }
}

/* Menu Button */
.menu-button {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 40px;
    height: 40px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease;
}

.menu-button span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--text-color);
    transition: all 0.3s ease;
    border-radius: 3px;
}

.menu-button.active span:nth-child(1) {
    transform: translateY(3px) rotate(45deg);
}

.menu-button.active span:nth-child(2) {
    opacity: 0;
}

.menu-button.active span:nth-child(3) {
    transform: translateY(-3px) rotate(-45deg);
}

/* Menu Panel */
.menu-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background-color: var(--background-color);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 999;
}

.menu-panel.active {
    right: 0;
}

.menu-content {
    padding: 4rem 1rem 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.menu-section {
    margin-bottom: 1rem;
}

.menu-section h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.menu-divider {
    height: 1px;
    background-color: var(--text-color);
    opacity: 0.1;
    margin: 1rem 0;
}

.menu-item {
    width: 100%;
    padding: 0.5rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: var(--button-hover);
}

/* About Panel */
.about-content {
    margin: 1rem 0;
    line-height: 1.5;
}

.about-content h3 {
    margin: 1rem 0 0.5rem;
    color: var(--text-color);
}

.about-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.about-content li {
    margin: 0.25rem 0;
}

/* Remove old preset button styles */
.preset-btn {
    display: none;
}

.custom-time-inputs {
    display: flex;
    gap: 1rem;
    margin-bottom: var(--spacing);
    justify-content: center;
}

.time-select-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 120px;
}

.time-select-group label {
    font-size: 0.9rem;
    color: var(--text-color);
}

.time-select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1.1rem;
    border: 1px solid var(--text-color);
    border-radius: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
}

.time-select:hover {
    border-color: var(--primary-color);
}

.time-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.time-select option {
    background-color: var(--background-color);
    color: var(--text-color);
}

@media (max-width: 480px) {
    .custom-time-inputs {
        flex-direction: column;
        align-items: center;
    }
    
    .time-select-group {
        width: 100%;
        max-width: 200px;
    }
}

/* Landscape mode styles */
@media screen and (orientation: landscape) and (max-height: 480px) {
    body {
        padding-top: 0;
        align-items: center;
    }

    .container {
        height: 100vh;
        max-width: none;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
    }

    .stopwatch {
        background: none;
        box-shadow: none;
        padding: 0;
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .display {
        font-size: 12rem !important;
        margin: 0;
        line-height: 1;
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        transition: opacity 0.2s ease;
        position: relative;
    }

    .display:active {
        opacity: 0.7;
    }

    .display:active + #landscapeMessage {
        opacity: 0.4;
    }

    /* Add a subtle pulse animation when paused */
    .display.paused {
        animation: pulse 2s infinite;
    }

    @keyframes pulse {
        0% {
            opacity: 1;
        }
        50% {
            opacity: 0.2;
        }
        100% {
            opacity: 1;
        }
    }

    /* Hide all other elements in landscape mode */
    .time-adjustment,
    .presets,
    .controls,
    .menu-button {
        display: none !important;
    }

    /* Show menu button when menu is active */
    .menu-button.active {
        display: flex !important;
    }

    /* Ensure modals are still visible */
    .modal {
        display: none;
    }

    .modal.active {
        display: flex;
    }

    .menu-button {
        position: absolute;
        top: 5px;
        right: 5px;
        width: 40px;
        height: 40px;
        padding: 10px;
    }

    .menu-button.active span:nth-child(1) {
        transform: translateY(10px) rotate(45deg);
    }

    .menu-button.active span:nth-child(3) {
        transform: translateY(-10px) rotate(-45deg);
    }
}

.time-adjustment .btn i {
    font-size: 1rem;
    line-height: 1;
    vertical-align: middle;
}

.time-adjustment .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.4rem;
}

.time-adjustment .btn#customTime {
    min-width: 80px;
    font-size: 0.9rem;
}

#landscapeMessage {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 1.2rem;
    opacity: 0.7;
    user-select: none;
    pointer-events: none;
    transition: opacity 0.3s ease;
} 