* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    background: var(--paper);
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.45;
}

h1, h2, h3 {
    text-wrap: balance;
    letter-spacing: -0.02em;
    margin: 0;
}

.num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.eyebrow {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--orange);
}

a {
    color: inherit;
}

button {
    font-family: inherit;
}

::selection {
    background: var(--orange-soft);
}

:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

input[type="checkbox"]:checked {
    background-color: var(--orange);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 12 9 17 20 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 60%;
    border-color: var(--orange);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--sp-5) var(--sp-5) 96px;
}

.section-spaced {
    margin-bottom: var(--sp-5);
}

.intro-text {
    margin: 0 0 var(--sp-6);
}

.section-title {
    font-size: 15px;
    font-weight: 800;
    margin: var(--sp-6) 0 var(--sp-3);
}

.empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    color: var(--muted);
    font-size: 14px;
    text-align: center;
    padding: 40px 16px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--r-lg);
}

.empty-hint .empty-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--grad-soft);
    color: var(--orange);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-1);
}

@media (min-width: 960px) {
    .page {
        max-width: 1180px;
        padding: var(--sp-8) var(--sp-6) 64px;
    }
}

/* Mobile typography: deliberately smaller and denser than desktop.
   Form inputs/selects/textareas are excluded and stay >=16px to avoid iOS Safari auto-zoom on focus. */
@media (max-width: 959px) {
    body {
        font-size: 14px;
    }

    .hero-title {
        font-size: 21px;
    }

    .hero-sub {
        font-size: 12px;
    }

    .eyebrow,
    .hero-eyebrow {
        font-size: 10px;
    }

    .topbar-title {
        font-size: 15px;
    }

    .stat-value {
        font-size: 19px;
    }

    .stat-value-sm {
        font-size: 14px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-sub {
        font-size: 10.5px;
    }

    .exercise-name {
        font-size: 13.5px;
    }

    .exercise-meta,
    .exercise-desc {
        font-size: 11.5px;
    }

    .muscle-heading {
        font-size: 11px;
    }

    .form-card h2,
    .card h2,
    h2,
    .card-title-sm {
        font-size: 13.5px;
    }

    .form-card label,
    label.field-label {
        font-size: 12px;
    }

    .btn {
        font-size: 14px;
    }

    .btn-secondary {
        font-size: 13px;
    }

    .chip {
        font-size: 12.5px;
        padding: 8px 12px;
    }

    .badge {
        font-size: 9.5px;
    }

    .drawer-profile-name {
        font-size: 14px;
    }

    .drawer-profile-goal {
        font-size: 11px;
    }

    .drawer-nav a {
        font-size: 13px;
    }

    .qs-value {
        font-size: 13px;
    }

    .qs-label {
        font-size: 8.5px;
    }

    .auth-card h1 {
        font-size: 20px;
    }

    .auth-subtitle {
        font-size: 12px;
    }

    .last-session-title {
        font-size: 13px;
    }

    .history-exercise-name {
        font-size: 12.5px;
    }

    .profile-summary-name {
        font-size: 16px;
    }

    .section-title {
        font-size: 13px;
    }

    .calendar-month-label {
        font-size: 13.5px;
    }

    .stats-banner .stat-value {
        font-size: 17px;
    }
}
