* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: black;
    color: white;
    font-family: Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 100vh;
    padding: 1rem;
}

.timer {
    text-align: center;
    margin-top: 30vh;
}

.time {
    font-size: clamp(4rem, 15vw, 8rem);
    font-weight: bold;
    margin-bottom: 2rem;
}

.controls button {
    background: none;
    border: 2px solid white;
    color: white;
    width: clamp(2.5rem, 8vw, 3.5rem);
    height: clamp(2.5rem, 8vw, 3.5rem);
    border-radius: 50%;
    margin: 0 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.controls button:hover {
    background-color: white;
    color: black;
}

.settings-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 1rem;
    transition: transform 0.3s ease;
    margin-bottom: 20px;
}

.settings-btn:hover {
    transform: rotate(90deg);
}

.settings-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    display: none;
    padding: 2rem;
    overflow-y: auto;
}

.settings-menu.active {
    display: block;
}

.close-btn {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 1rem;
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.settings-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: clamp(1rem, 3vw, 2rem);
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 3vw, 3rem);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid white;
}

.settings-content > div {
    padding: clamp(1rem, 3vw, 2rem);
    background: black;
    border-radius: 12px;
    border: 1px solid white;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-content h2 {
    text-align: left;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 500;
    color: white;
    border-bottom: 1px solid white;
    padding-bottom: 1rem;
    margin-bottom: 0;
}

.settings-description {
    color: white;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    opacity: 0.8;
    line-height: 1.4;
    margin: 0;
    padding: 0 0 1rem 0;
}

.audio-settings {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 400px;
}

.difficulty-select {
    background: black;
    border: 1px solid white;
    color: white;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    flex: 1;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.difficulty-select:hover {
    border-color: white;
}

.difficulty-select option {
    background: black;
    color: white;
}

.difficulty-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px white;
}

.checkbox-container {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
    color: white;
    font-size: 1rem;
    padding: 1rem;
    background: black;
    border-radius: 8px;
    border: 1px solid white;
    transition: all 0.3s ease;
}

.checkbox-container:hover {
    background: white;
    color: black;
}

.checkbox-container input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid white;
    background: black;
    cursor: pointer;
    position: relative;
    margin: 0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.checkbox-container input[type="checkbox"]:checked {
    background-color: white;
    border-color: white;
}

.checkbox-container input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: black;
    font-size: 16px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checkmark {
    grid-column: 2;
}

.checkbox-container span:not(.checkmark) {
    grid-column: 3;
    text-align: left;
    white-space: nowrap;
}

/* Remove default focus outlines and add custom ones */
button:focus,
input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px white;
}

.weight-input {
    grid-column: 4;
    width: 60px;
    background: black;
    border: 1px solid white;
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
    margin-left: 10px;
    -moz-appearance: textfield;
    transition: all 0.3s ease;
}

.weight-input:hover {
    border-color: white;
}

.weight-input::-webkit-outer-spin-button,
.weight-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.weight-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px white;
}

.graph-container {
    width: 100%;
    max-width: none;  /* Remove max-width to fill space */
    margin: 0;        /* Remove margin */
    padding: clamp(1rem, 2vw, 1.5rem);
    background: black;
    border-radius: 12px;
    border: 1px solid white;
    touch-action: none; /* Prevent scrolling on touch devices */
}

canvas#intensityGraph {
    width: 100%;
    height: clamp(150px, 30vh, 200px);
    background: black;
    border-radius: 8px;
    border: 1px solid white;
    cursor: crosshair;
    margin-bottom: 1rem;
    touch-action: none; /* Prevent scrolling on touch devices */
}

.graph-controls {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

.graph-btn {
    background: black;
    border: 1px solid white;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.graph-btn:hover {
    background: white;
    color: black;
}

/* Make graph container responsive */
@media (max-width: 1024px) {
    .settings-content {
        grid-template-columns: 1fr;
        max-width: 600px;
        gap: 2rem;
        margin: 2rem auto;
        flex-direction: column;
    }

    .settings-content > div {
        padding: 1.5rem;
    }

    .graph-container {
        margin-top: 2rem;
    }

    .close-btn {
        top: 1rem;
        right: 1rem;
    }
}

.time-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.duration-input {
    background: none;
    border: 2px solid white;
    border-radius: 4px;
    color: white;
    font-size: 1.5rem;
    width: 80px;
    padding: 0.25rem;
    text-align: center;
    display: none; /* Hidden when timer is running */
}

.duration-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.duration-input.visible {
    display: block;
}

.time-input-container {
    display: flex;
    align-items: center;
    gap: clamp(0.25rem, 1vw, 0.5rem);
    background: rgba(0, 0, 0, 0.2);
    padding: clamp(0.5rem, 2vw, 1rem);
    border-radius: 8px;
}

.digit-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.time-digit {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: bold;
    color: white;
    width: 1.5em;
    text-align: center;
}

.time-separator {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: bold;
    color: white;
    margin: 0 0.25rem;
}

.digit-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.digit-btn:hover {
    opacity: 1;
}

.digit-btn.hidden {
    visibility: hidden;
}

/* Add/modify these responsive styles */

/* Media queries for different screen sizes */
@media (max-width: 768px) {
    .timer {
        margin-top: 20vh;
    }

    .difficulty-selector {
        max-width: 100%;
    }

    .checkbox-container {
        padding: 0.75rem;
        gap: 1rem;
    }

    .weight-input {
        width: 50px;
        padding: 0.25rem;
    }

    .graph-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .timer {
        margin-top: 15vh;
    }

    .settings-menu {
        padding: 1rem;
    }

    .close-btn {
        top: 0.5rem;
        right: 0.5rem;
        font-size: 1.25rem;
    }

    .checkbox-container input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    .checkbox-container span:not(.checkmark) {
        font-size: 0.9rem;
    }
}

/* Fix for very small screens */
@media (max-width: 360px) {
    .time-input-container {
        flex-wrap: wrap;
        justify-content: center;
    }

    .controls {
        margin-top: 1rem;
    }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .timer {
        margin-top: 10vh;
    }

    .settings-content {
        margin: 1rem auto;
    }

    .graph-container {
        height: auto;
    }

    canvas#intensityGraph {
        height: clamp(100px, 40vh, 150px);
    }
}

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: white;
    background: black;
    z-index: 10;
}

.site-footer a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.site-footer a:hover {
    opacity: 0.7;
}