/* CSS Reset & Variables */
:root {
    --card-bg: #FFFFFF;
    --text-neon: #FFFFFF;
    --text-main: #111827;
    --text-muted: #CCCCCC;
    --btn-gray: #F3F4F6;
    --primary: #2563EB;
    --primary-shadow: rgba(37, 99, 235, 0.3);
    --danger: #444444;
    --danger-shadow: rgba(68, 68, 68, 0.3);
    --state-stopped: #FF0000;
    --state-working: #009900;
    --state-resting: #0000FF;
    --state-settings: #F9FAFB;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--state-settings);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Prevents pull-to-refresh on mobile */
    overscroll-behavior-y: none;

    /* Prevent select button text on long press */
    -webkit-user-select: none; /* Safari and Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* Internet Explorer/Edge */
    user-select: none;         /* Standard syntax */

    /* Prevents mobile context menu (iOS Safari) */
    -webkit-touch-callout: none;
}

.container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 24px;
    /* Max width keeps it looking like a phone even on desktop */
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* --- SETTINGS MODE --- */
.header {
    margin-bottom: 32px;
    text-align: center;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.stepper-btn {
    background: var(--btn-gray);
    border: none;
    border-radius: 14px;
    width: 56px;
    height: 56px;
    font-size: 24px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.2s;
    touch-action: manipulation;

    /* Prevent select button text on long press */
    -webkit-user-select: none; /* Safari and Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* Internet Explorer/Edge */
    user-select: none;         /* Standard syntax */

    /* Prevents mobile context menu (iOS Safari) */
    -webkit-touch-callout: none;
}

.stepper-btn:active {
    transform: scale(0.92);
    background: #E5E7EB;
}

.card-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

.card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.card-value {
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.footer {
    font-size: 12px;
    text-align: center;
}

.footer a {
    font-size: 14px;
    text-decoration: none;
}

/* --- ACTIVE MODE --- */
#active-mode {
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: 40px;
}

.reps-display {
    font-size: 30px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.timer-display {
    font-size: 24vw; /* Scales with screen width */
    line-height: 1;
    font-weight: 800;
    letter-spacing: -2px;
    font-variant-numeric: tabular-nums;
    margin-bottom: 16px;
    color: var(--text-neon);
}

/* Cap the max size of the timer for larger screens */
@media (min-width: 480px) {
    .timer-display { font-size: 110px; }
}

.state-display {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-neon);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- BOTTOM BUTTONS --- */
.bottom-action {
    margin-top: auto; /* Pushes button to bottom */
    padding-top: 24px;
    padding-bottom: 24px;
    width: 100%;
}

.main-btn {
    width: 100%;
    height: 64px;
    border-radius: 20px;
    border: none;
    font-size: 20px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: transform 0.1s ease;
    touch-action: manipulation;

    /* Prevent select button text on long press */
    -webkit-user-select: none; /* Safari and Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* Internet Explorer/Edge */
    user-select: none;         /* Standard syntax */

    /* Prevents mobile context menu (iOS Safari) */
    -webkit-touch-callout: none;
}

.main-btn:active {
    transform: scale(0.96);
}

.btn-start {
    background-color: var(--primary);
    box-shadow: 0 8px 24px var(--primary-shadow);
}

.btn-cancel {
    background-color: var(--danger);
    box-shadow: 0 8px 24px var(--danger-shadow);
}

/* Popup help */
/* The semi-transparent background */
.overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    visibility: hidden;
    opacity: 0;
    transition: opacity 500ms;
}

/* Show the popup when it's the 'target' */
.overlay:target {
    visibility: visible;
    opacity: 1;
}

/* The white box in the center */
.popup {
    margin: 10px auto;
    padding: 10px;
    background: #fff;
    border-radius: 5px;
    width: 90%;
    position: relative;
    font-size: 12px;
}

/* The close button */
.popup .close {
    position: absolute;
    top: 0px;
    right: 10px;
    text-decoration: none;
    font-size: 30px;
}

ul, ol {
    padding-left: 20px; /* Standard browser default */
    margin-left: 0;
}
