/* FitNotes v2 — Design tokens + component styles */

/* === DESIGN TOKENS === */
:root {
    /* Surfaces */
    --bg: #0a0a0c;
    --surface-1: #121214;
    --surface-2: #1c1c1e;
    --surface-3: #2c2c2e;
    --surface-4: #3a3a3c;

    /* Text */
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a8;
    --text-tertiary: #636366;

    /* Semantic */
    --positive: #30d158;
    --negative: #ff453a;
    --warning: #ff9f0a;
    --record: #ffd60a;

    /* Borders */
    --divider: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.12);

    /* Accent — overridden per profile */
    --accent: #E5A54B;
    --accent-dim: rgba(229,165,75,0.15);

    /* Display font */
    --font-family-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    /* Spacing (4px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 80px;

    /* Typography */
    --font-display: 2.25rem;
    --font-title: 1.25rem;
    --font-body: 0.9375rem;
    --font-caption: 0.8125rem;
    --font-label: 0.6875rem;

    --weight-display: 800;
    --weight-title: 700;
    --weight-body: 400;
    --weight-caption: 500;
    --weight-label: 600;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

/* Profile accent overrides */
[data-profile="karl"] {
    --accent: #E5A54B;
    --accent-dim: rgba(229,165,75,0.15);
}
[data-profile="nah"] {
    --accent: #F4729E;
    --accent-dim: rgba(244,114,158,0.15);
}

/* === RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    height: 100dvh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    font-size: var(--font-body);
    line-height: 1.5;
}

/* === APP SHELL === */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
}

/* === HEADER === */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(56px + env(safe-area-inset-top, 0px));
    background: rgba(10,10,12,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 1px solid var(--divider);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}
.hamburger-btn .material-symbols-rounded { font-size: 24px; }
.hamburger-btn:active { background: rgba(255,255,255,0.08); transform: scale(0.95); }

/* Center toggle (workout <-> calendar) */
.header-center-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    transition: opacity 0.15s ease;
    width: 80px;
    height: 44px;
    border-radius: 22px;
    background: var(--surface-3);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-center-btn .material-symbols-rounded { font-size: 26px; }
.header-center-btn:active { transform: translate(-50%, -50%) scale(0.95); }
.header-center-btn.hidden { opacity: 0; pointer-events: none; }

.header-title {
    font-size: var(--font-title);
    font-weight: var(--weight-title);
    color: var(--text-primary);
}

.header-subtitle {
    font-size: var(--font-label);
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-sync-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--positive);
    transition: background 0.3s;
}
.header-sync-dot.dirty { background: var(--warning); width: 10px; height: 10px; animation: pulse 1.5s infinite; }
.header-sync-dot.syncing { background: var(--accent); animation: pulse 1s infinite; }

/* === CONTENT AREA === */
.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-4);
}

/* === BENTO MENU === */
.bento-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 220;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.bento-overlay.open {
    opacity: 1;
    visibility: visible;
}

.bento-panel {
    background: var(--surface-2);
    border-radius: 28px;
    width: 100%;
    max-width: 460px;
    max-height: calc(100dvh - max(56px, 44px + env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 20px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: max(56px, 44px + env(safe-area-inset-top));
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    transform: scale(0.95) translateY(-8px);
    transition: transform 0.25s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.bento-overlay.open .bento-panel {
    transform: scale(1) translateY(0);
}

.bento-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    flex-shrink: 0;
}
.bento-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.bento-profile-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    flex-shrink: 0;
}
.bento-profile-name {
    font-weight: 700;
    font-size: 0.95rem;
}

/* Primary nav — full-width prominent button for Today's Workout */
.bento-primary-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px 20px;
    border-radius: 16px;
    background: var(--surface-1);
    border: 2px solid var(--border);
    color: var(--text-primary);
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s ease;
    -webkit-appearance: none;
}
.bento-primary-nav:active { transform: scale(0.97); }
.bento-primary-nav.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.bento-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 0 4px;
    margin-top: 4px;
}

.bento-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
.bento-nav.bento-nav-2x2 {
    grid-template-columns: 1fr 1fr;
}
.bento-nav-tile {
    background: var(--surface-1);
    border: none;
    border-radius: 16px;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-family: inherit;
    min-height: 72px;
    transition: transform 0.1s ease;
}
.bento-nav-tile:active { transform: scale(0.95); }
.bento-nav-tile.active {
    background: var(--accent-dim);
    color: var(--accent);
}
.bento-nav-icon { line-height: 1; }
.bento-nav-label {
    font-size: 0.7rem;
    font-weight: 600;
}

.bento-overlay.open .bento-nav-tile {
    animation: bentoIn 0.3s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
@keyframes bentoIn {
    from { opacity: 0; transform: scale(0.92) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.bento-nav-tile:nth-child(1) { animation-delay: 0.08s; }
.bento-nav-tile:nth-child(2) { animation-delay: 0.10s; }
.bento-nav-tile:nth-child(3) { animation-delay: 0.12s; }
.bento-nav-tile:nth-child(4) { animation-delay: 0.14s; }
.bento-nav-tile:nth-child(5) { animation-delay: 0.16s; }

.bento-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface-3);
    border-radius: 16px;
}
.bento-settings-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-primary);
}
.bento-settings-label .material-symbols-rounded {
    font-size: 20px;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 32px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--surface-4);
    border-radius: 9999px;
    border: 2px solid var(--border);
    transition: all 0.25s cubic-bezier(0.22, 1.2, 0.36, 1);
    cursor: pointer;
}
.toggle-track::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 9999px;
    background: var(--border);
    top: 50%;
    left: 6px;
    transform: translateY(-50%);
    transition: all 0.25s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.toggle-switch input:checked + .toggle-track {
    background: var(--accent);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-track::after {
    background: #ffffff;
    left: 28px;
    width: 20px;
    height: 20px;
}

/* === PROFILE PICKER === */
.profile-picker {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
}

.profile-picker-title {
    font-size: var(--font-display);
    font-weight: var(--weight-display);
    color: var(--text-primary);
    font-family: var(--font-family-display);
}

.profile-picker-options {
    display: flex;
    gap: var(--space-5);
}

.profile-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    background: var(--surface-2);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}
.profile-btn:active {
    transform: scale(0.95);
    border-color: var(--accent);
}

.profile-btn-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-title);
    font-weight: var(--weight-display);
    color: #fff;
}

.profile-btn-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    color: var(--text-primary);
}

.profile-btn-stat {
    font-size: var(--font-label);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

.profile-btn-stat-dim {
    font-size: var(--font-label);
    color: var(--text-tertiary);
}

/* === CARDS === */
.card {
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    border: 1px solid var(--divider);
    margin: var(--space-2) var(--space-3);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
}

.card-body {
    padding: 0 var(--space-4) var(--space-3);
}

/* === EXERCISE CARD === */
.exercise-card {
    margin: var(--space-2) var(--space-3);
}

.exercise-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    gap: var(--space-2);
}

.exercise-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    color: var(--text-primary);
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.exercise-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.exercise-note {
    padding: var(--space-1) var(--space-4) var(--space-2);
    font-size: var(--font-caption);
    color: var(--text-secondary);
    font-style: italic;
    cursor: pointer;
}

/* === SET ROW === */
.set-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 8px 12px 8px 22px;
    transition: background 0.2s, opacity 0.2s;
    position: relative;
}

.set-row.done,
.set-row.set-done {
    background: rgba(48,209,88,0.06);
}
.set-row.done .set-check,
.set-row.set-done .set-check { background: var(--positive); color: #fff; }

.set-row.deload {
    opacity: 0.5;
}


/* === STEPPER === */
.input-stepper {
    display: flex;
    align-items: center;
    flex: 1;
    background: var(--surface-2);
    border-radius: 12px;
    overflow: hidden;
    height: 48px;
}

.stepper-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 48px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none;
}
.stepper-btn.minus { border-radius: 12px 0 0 12px; }
.stepper-btn.plus { border-radius: 0 12px 12px 0; }
.stepper-btn:active { background: var(--accent); color: #fff; transform: scale(0.92); }

.set-input {
    flex: 1;
    height: 100%;
    background: var(--surface-3);
    border: none;
    color: var(--text-primary);
    text-align: center;
    padding: 12px 2px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    min-width: 0;
    -moz-appearance: textfield;
}
.set-input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.set-input::-webkit-inner-spin-button,
.set-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* === CHECK BUTTON === */
.set-check {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--surface-4);
    background: var(--surface-2);
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.15s;
    flex-shrink: 0;
    -webkit-appearance: none;
}
.set-check.checked {
    background: var(--positive);
    border-color: var(--positive);
    color: #fff;
    animation: checkPop 0.25s cubic-bezier(0.22, 1.2, 0.36, 1);
}
@keyframes checkPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* === TAG === */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-label);
    font-weight: var(--weight-label);
    background: var(--surface-3);
    color: var(--text-secondary);
    white-space: nowrap;
}

.tag-accent {
    background: var(--accent-dim);
    color: var(--accent);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    -webkit-appearance: none;
    gap: var(--space-1);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-secondary {
    background: var(--surface-3);
    color: var(--text-primary);
}

.btn-tonal {
    background: var(--accent-dim);
    color: var(--accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-block { width: 100%; }

.btn-danger {
    background: rgba(255,69,58,0.15);
    color: var(--negative);
}

/* === ICON BUTTON === */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    -webkit-appearance: none;
}
.icon-btn:active { background: var(--surface-3); }

/* === MODAL === */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--surface-2);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 360px;
    max-height: 80dvh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.2s;
}
.modal-backdrop.open .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--divider);
}

.modal-title {
    font-size: var(--font-title);
    font-weight: var(--weight-title);
}

.modal-body {
    padding: var(--space-4);
}

/* === ACTION SHEET === */
.action-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.action-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.action-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 501;
    background: var(--surface-2);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    max-height: 70dvh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.action-sheet-backdrop.open .action-sheet {
    transform: translateY(0);
}

.action-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--surface-4);
    margin: 0 auto var(--space-4);
}

.action-sheet-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    font-size: var(--font-body);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    -webkit-appearance: none;
}
.action-sheet-item:active { background: var(--surface-3); }
.action-sheet-item.danger { color: var(--negative); }

.action-sheet-icon {
    font-size: 20px;
    color: var(--text-secondary);
}
.action-sheet-item.danger .action-sheet-icon { color: var(--negative); }

/* === DIALOG === */
.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 25dvh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.dialog-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.dialog {
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    width: 280px;
    transform: scale(0.9);
    transition: transform 0.2s;
}
.dialog-backdrop.open .dialog {
    transform: scale(1);
}

.dialog-msg {
    font-size: var(--font-body);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--space-4);
}

.dialog-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: var(--font-body);
    font-family: inherit;
    outline: none;
    margin-bottom: var(--space-4);
}
.dialog-input:focus { border-color: var(--accent); }

.dialog-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface-3);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    z-index: 700;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === GAME TOAST === */
.game-toast {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    white-space: nowrap;
    font-size: var(--font-caption);
}
.game-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.game-toast-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

/* === TIMER OVERLAY === */
.timer-overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.timer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.timer-display {
    font-size: 5rem;
    font-weight: var(--weight-display);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-family-display);
}

.timer-presets {
    display: flex;
    gap: var(--space-2);
}

.timer-preset {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.timer-preset.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

.timer-start-btn {
    padding: var(--space-4) var(--space-10);
    border-radius: var(--radius-full);
    background: var(--accent);
    color: #fff;
    font-size: var(--font-title);
    font-weight: var(--weight-title);
    border: none;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.timer-start-btn:active { transform: scale(0.95); }

.timer-overlay.alarming { background: var(--negative); }
.timer-overlay.alarming .timer-display { color: #fff; }
.timer-overlay.alarming .timer-start-btn {
    background: #fff;
    color: var(--negative);
}

/* === TIMER PILL (header) === */
.header-timer-pill {
    display: none;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    background: var(--accent-dim);
    border-radius: var(--radius-full);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    color: var(--accent);
    cursor: pointer;
}
.header-timer-pill.visible { display: flex; }
.header-timer-pill.pulse { animation: pulse 1s infinite; }

/* === CALENDAR === */
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
}

.cal-month-label {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
}

.cal-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    -webkit-appearance: none;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    padding: 0 var(--space-3);
}

.cal-day-label {
    text-align: center;
    font-size: var(--font-label);
    font-weight: var(--weight-label);
    color: var(--text-tertiary);
    padding: var(--space-1) 0;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: var(--font-caption);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    position: relative;
    gap: 1px;
}

.cal-day.today {
    font-weight: var(--weight-title);
    color: var(--accent);
}

.cal-day.selected {
    background: var(--accent-dim);
}

.cal-day.has-workout {
    color: var(--text-primary);
    font-weight: var(--weight-caption);
}

.cal-day.record-day {
    outline: 1px solid var(--record);
    outline-offset: -1px;
}

.cal-tag {
    font-size: 8px;
    font-weight: var(--weight-label);
    line-height: 1;
    white-space: nowrap;
}

.cal-rest-badge {
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 3px;
    background: rgba(255,69,58,0.15);
    line-height: 1;
}

/* === CALENDAR DAY DETAIL === */
.cal-detail {
    margin: var(--space-3);
    padding: var(--space-4);
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    border: 1px solid var(--divider);
}

.cal-detail-date {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    margin-bottom: var(--space-3);
}

.cal-type-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--font-label);
    font-weight: var(--weight-label);
}

.cal-detail-exercise {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--divider);
}
.cal-detail-exercise:last-child { border-bottom: none; }

.cal-detail-name {
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    color: var(--text-primary);
}

.cal-detail-sets {
    font-size: var(--font-label);
    color: var(--text-secondary);
    margin-top: 2px;
}

/* === ROUTINE BUTTON === */
.routine-btn {
    width: 100%;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-1);
    cursor: pointer;
    display: flex;
    align-items: center;
    text-align: left;
    color: var(--text-primary);
    font-family: inherit;
    -webkit-appearance: none;
}
.routine-btn:active { background: var(--surface-2); }

.routine-btn-color {
    width: 4px;
    align-self: stretch;
    border-radius: 2px;
    margin-right: var(--space-3);
    flex-shrink: 0;
}

.routine-btn-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
}

.routine-btn-volume {
    font-size: var(--font-label);
    color: var(--text-secondary);
    margin-top: 1px;
}

.routine-btn-sets {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
    max-height: 4.2em;
    overflow: hidden;
}

/* === STATS === */
.stat-summary {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    padding: var(--space-4);
    flex-wrap: wrap;
}

.stat-inline {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.stat-sep {
    color: var(--text-tertiary);
    font-size: var(--font-caption);
}

.stat-value {
    font-size: var(--font-title);
    font-weight: var(--weight-display);
    color: var(--text-primary);
    font-family: var(--font-family-display);
}

.stat-label {
    font-size: var(--font-label);
    color: var(--text-secondary);
}

/* === PR LIST === */
.pr-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--divider);
}

.pr-name {
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    color: var(--text-primary);
    flex: 1;
}

.pr-value {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    text-align: right;
}

.pr-date {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    margin-left: var(--space-2);
}

/* === MEASUREMENTS === */
.measure-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
}

.measure-label {
    font-size: var(--font-caption);
    color: var(--text-secondary);
}

.measure-value {
    font-size: var(--font-caption);
    color: var(--text-primary);
    font-weight: var(--weight-caption);
}

.measure-trend {
    font-size: var(--font-label);
    margin-left: var(--space-1);
}
.measure-trend.up { color: var(--positive); }
.measure-trend.down { color: var(--negative); }
.measure-trend.same { color: var(--text-tertiary); }

/* === GAME SCOREBOARD === */
.scoreboard {
    display: flex;
    justify-content: space-around;
    padding: var(--space-5) 0;
}

.score-column {
    text-align: center;
    flex: 1;
}

.score-number {
    font-size: var(--font-display);
    font-weight: var(--weight-display);
    font-family: var(--font-family-display);
}

.score-name {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

.score-divider {
    width: 1px;
    background: var(--border);
    margin: 0 var(--space-2);
}

.session-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--divider);
}

.session-type {
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
}

.session-date {
    font-size: var(--font-label);
    color: var(--text-secondary);
}

.session-volume {
    font-size: var(--font-caption);
    text-align: right;
}

.session-pct {
    font-size: var(--font-label);
    color: var(--text-tertiary);
}

.session-points {
    font-size: var(--font-caption);
    font-weight: var(--weight-title);
}

/* === SCORE MODAL === */
.score-modal {
    text-align: center;
    padding: var(--space-8) var(--space-4);
}

.score-modal-number {
    font-size: 4rem;
    font-weight: var(--weight-display);
    line-height: 1;
    font-family: var(--font-family-display);
}

.score-modal-label {
    font-size: var(--font-body);
    color: var(--text-secondary);
    margin-top: var(--space-3);
}

.score-modal-quote {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    font-style: italic;
    margin-top: var(--space-4);
}

.score-modal-btn {
    margin-top: var(--space-6);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    background: var(--surface-3);
    border: none;
    color: var(--text-primary);
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.score-modal-btn.accent { background: var(--accent); color: #fff; }

/* === SCORE TOGGLE === */
.score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    margin: var(--space-2) var(--space-3);
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    border: 1px solid var(--divider);
}

.score-row-label {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
}

.score-row-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.score-result {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
}

/* === EXERCISE PICKER === */
.picker-tabs {
    display: flex;
    border-bottom: 1px solid var(--divider);
}

.picker-tab {
    flex: 1;
    padding: var(--space-3);
    text-align: center;
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    -webkit-appearance: none;
}
.picker-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.picker-group-label {
    padding: var(--space-3) var(--space-4) var(--space-1);
    font-size: var(--font-label);
    font-weight: var(--weight-label);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    border-bottom: 1px solid var(--divider);
}
.picker-item:active { background: var(--surface-2); }

.picker-item-name {
    font-size: var(--font-body);
    color: var(--text-primary);
}

/* === ROUTINE CARD (picker) === */
.routine-card {
    margin: var(--space-2) var(--space-3);
    background: var(--surface-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--divider);
    overflow: hidden;
}

.routine-card-header {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    gap: var(--space-2);
}

.routine-card-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    flex: 1;
}

.routine-card-count {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    background: var(--surface-3);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.routine-card-chevron {
    font-size: 20px;
    color: var(--text-tertiary);
    transition: transform 0.2s;
}
.routine-card.expanded .routine-card-chevron { transform: rotate(180deg); }

.routine-card-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s;
}
.routine-card.expanded .routine-card-body {
    max-height: 500px;
}

.routine-exercise-row {
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    gap: var(--space-2);
    border-top: 1px solid var(--divider);
}

.routine-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
}
.routine-checkbox.checked {
    background: var(--accent);
    border-color: var(--accent);
}

/* === SUPERSET GROUP === */
.superset-group {
    position: relative;
}
.superset-group::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 0 0 var(--radius-sm);
}

.superset-between {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 32px;
    margin: 2px 0;
    gap: var(--space-2);
}

.superset-label {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    font-weight: var(--weight-label);
    letter-spacing: 0.05em;
}

.superset-link-btn {
    font-size: var(--font-label);
    color: var(--text-secondary);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: inherit;
    font-weight: var(--weight-label);
    -webkit-appearance: none;
}
.superset-link-btn.linked {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* === WORKOUT VIEW === */
.workout-view {
    display: flex;
    flex-direction: column;
}

.workout-sets {
    padding: 0;
}

.set-row.set-header {
    padding: var(--space-1) 12px var(--space-1) 22px;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 6px;
}

.header-cell {
    font-size: var(--font-label);
    font-weight: var(--weight-label);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-spacer {
    width: 36px;
}

.set-tf-bar {
    position: absolute;
    right: 4px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--positive);
    border-radius: 2px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.15s;
}
.set-tf-bar:active { opacity: 1; }
.set-row.to-failure .set-tf-bar { opacity: 1; }
.set-row.set-done .set-delete-bar,
.set-row.set-done .set-tf-bar { display: none; }

/* === MOVE BAR === */
.ex-move-bar {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-4) var(--space-2);
    background: var(--surface-2);
}

.ex-move-btn {
    flex: 1;
    padding: 10px 24px;
    border-radius: 14px;
    border: none;
    background: var(--surface-3);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.ex-move-btn:not(:disabled):active { background: var(--accent); color: #fff; transform: scale(0.95); }
.ex-move-btn:disabled { opacity: 0.3; }
.ex-move-btn.rest-timer-btn { color: var(--accent); }

.superset-between-label {
    font-size: var(--font-label);
    color: var(--text-tertiary);
    font-weight: var(--weight-label);
    letter-spacing: 0.05em;
}

.workout-footer {
    padding: var(--space-2) 0;
}

/* === SET ROW EXTRAS === */
.set-stepper-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.set-row > .input-stepper {
    flex: 1;
    min-width: 0;
}

.set-delete-bar {
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--negative);
    opacity: 0.3;
    border-radius: 2px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.set-delete-bar:active { opacity: 1; }

.set-confirm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,10,12,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    z-index: 10;
    border-radius: var(--radius-sm);
}

.set-confirm-yes {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: rgba(255,69,58,0.15);
    color: var(--negative);
    border: none;
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}

.set-confirm-no {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    background: var(--positive);
    color: #fff;
    border: none;
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}

.tf-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.55rem;
    font-weight: var(--weight-title);
    color: var(--warning);
    background: rgba(255,159,10,0.15);
    padding: 1px 5px;
    border-radius: 4px;
    pointer-events: none;
}

.set-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 16px;
    -webkit-appearance: none;
}
.set-delete:active { color: var(--text-secondary); }

/* === ADD SET BUTTON === */
.add-set-btn {
    padding: 14px;
    margin: 0 16px 14px;
    background: none;
    border: 1px dashed var(--border);
    border-radius: 14px;
    color: var(--accent);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.add-set-btn:active { background: var(--accent-dim); }

/* === DELOAD === */
.deload-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
}
.deload-btn.active {
    background: var(--warning);
    border-radius: var(--radius-sm);
}

.deload-warning {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-label);
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* === REST PICKER === */
.rest-picker {
    display: none;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-4) var(--space-2);
}
.rest-picker.open { display: flex; }

.rest-pill {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.rest-pill.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

/* === MOVE BAR === */
.move-bar {
    display: none;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-4) var(--space-2);
}
.move-bar.open { display: flex; }

.move-btn {
    flex: 1;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.move-btn:active { background: var(--surface-3); }
.move-btn:disabled { opacity: 0.3; }

/* === COMPACT MODE === */
.compact-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-1);
    border-radius: var(--radius-md);
    border: 1px solid var(--divider);
    margin: var(--space-1) var(--space-3);
    cursor: grab;
}
.compact-card:active { cursor: grabbing; }

.compact-drag {
    color: var(--text-tertiary);
    font-size: 18px;
    flex-shrink: 0;
}

.compact-info { flex: 1; min-width: 0; }

.compact-name {
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-summary {
    font-size: var(--font-label);
    color: var(--text-secondary);
}

.compact-muscle-tag {
    display: inline-block;
    margin-left: var(--space-2);
}

/* === FORM TIPS === */
.tip-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    cursor: pointer;
    border-bottom: 1px solid var(--divider);
}
.tip-row:active { background: var(--surface-3); }

.tip-badge {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-label);
    font-weight: var(--weight-title);
    flex-shrink: 0;
}

.tip-text {
    font-size: var(--font-caption);
    color: var(--text-primary);
    flex: 1;
}

.tip-play {
    color: var(--accent);
    font-size: 14px;
}

/* === EMPTY STATE === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-4);
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
}

.empty-text {
    font-size: var(--font-body);
    color: var(--text-secondary);
}

/* === SECTION HEADER === */
.section-header {
    padding: var(--space-4) var(--space-4) var(--space-2);
    font-size: var(--font-caption);
    font-weight: var(--weight-title);
    color: var(--text-primary);
    font-family: var(--font-family-display);
}

/* === MULTIPLIER BADGE === */
.multiplier-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
}

/* === EXERCISE LIST (library view) === */
.exercise-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--surface-1);
    border-radius: var(--radius-md);
    margin: 0 var(--space-3) var(--space-2);
    cursor: pointer;
    transition: transform 0.1s ease;
}
.exercise-list-item:active { transform: scale(0.98); }

.exercise-list-name {
    font-size: var(--font-body);
    font-weight: var(--weight-caption);
}

.exercise-list-muscle {
    font-size: var(--font-label);
    color: var(--text-tertiary);
}

.exercise-list-pr {
    font-size: var(--font-label);
    color: var(--warning);
    font-weight: 600;
    text-align: right;
}

/* === TAB SWITCHER (game view) === */
.tab-switcher {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
}

.tab-switch-btn {
    flex: 1;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
}
.tab-switch-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

/* === SWAP OVERLAY === */
.swap-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(env(safe-area-inset-top, 0px) + 60px) 16px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.swap-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.swap-panel {
    background: var(--surface-2);
    border-radius: 28px;
    width: 100%;
    max-width: 460px;
    max-height: 80dvh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    transform: scale(0.95);
    transition: transform 0.35s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.swap-overlay.open .swap-panel {
    transform: scale(1);
}

.swap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
}

.swap-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.swap-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-3);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    -webkit-appearance: none;
}
.swap-close:active { background: var(--surface-4); }

.swap-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px 20px;
}

.swap-section-label {
    font-size: var(--font-label);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    padding: 12px 0 4px;
}

.swap-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    cursor: pointer;
    border-bottom: 1px solid var(--divider);
    transition: transform 0.1s;
}
.swap-item:active { transform: scale(0.98); }

.swap-item-name {
    font-size: var(--font-body);
    color: var(--text-primary);
}

.swap-item-tag {
    font-size: var(--font-label);
    color: var(--text-secondary);
    background: var(--surface-3);
    padding: 4px 10px;
    border-radius: 10px;
}

/* === VIDEO MODAL === */
.video-backdrop {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0,0,0,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.video-backdrop.open { display: flex; }

.video-container {
    width: 100%;
    max-width: 480px;
    position: relative;
}

.video-close {
    position: absolute;
    top: -48px;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(40,40,40,0.85);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
}

.video-player {
    border-radius: 16px;
    overflow: hidden;
}

.video-player iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    display: block;
    background: #000;
}

/* === FORM TIPS FIXES === */
.tip-row:last-child { border-bottom: none; }

/* === WORKOUT EXERCISE CARDS === */
.workout-exercise {
    background: var(--surface-1);
    border-radius: var(--radius-xl);
    border: 1px solid var(--divider);
    margin: var(--space-2) var(--space-3);
    overflow: hidden;
}

/* Completed exercise — dims to show it's done */
.workout-exercise.exercise-complete {
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

/* Current exercise — subtle "you are here" indicator */
.workout-exercise.exercise-current {
    border: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Celebration pulse when exercise completes */
@keyframes exerciseDone {
    0% { transform: scale(1); }
    50% { transform: scale(1.015); }
    100% { transform: scale(1); }
}
.workout-exercise.exercise-just-done {
    animation: exerciseDone 0.4s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.workout-exercise-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
}

.workout-exercise-name {
    font-size: var(--font-body);
    font-weight: var(--weight-title);
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ex-grip {
    color: var(--text-tertiary);
    cursor: grab;
    display: flex;
    align-items: center;
    padding: var(--space-1);
}
.ex-grip:active { cursor: grabbing; }

.ex-note {
    padding: var(--space-1) var(--space-4) var(--space-2);
    font-size: var(--font-caption);
    color: var(--text-secondary);
    font-style: italic;
    cursor: pointer;
}

.add-exercise-btn {
    width: calc(100% - var(--space-6));
    margin: var(--space-2) var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-weight: var(--weight-label);
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    -webkit-appearance: none;
}
.add-exercise-btn:active { background: var(--surface-1); }

.score-toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-label);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-2) var(--space-4);
}

.score-toggle-input {
    display: none;
}

.score-toggle-slider {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: var(--surface-4);
    position: relative;
    transition: background 0.2s;
}
.score-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-tertiary);
    transition: all 0.2s;
}
.score-toggle-input:checked + .score-toggle-slider {
    background: var(--accent);
}
.score-toggle-input:checked + .score-toggle-slider::after {
    background: #fff;
    transform: translateX(16px);
}

/* === SECONDARY HEADER (volume meter) === */
.secondary-header {
    padding: var(--space-2) var(--space-4);
    background: var(--surface-1);
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
}

.sec-header-text {
    font-size: var(--font-label);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.vol-bar-track {
    height: 3px;
    background: var(--surface-3);
    border-radius: 2px;
    overflow: hidden;
}

.vol-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.workout-exercises {
    padding-bottom: var(--space-2);
}

/* === WORKOUT SCORED — full lockdown === */
.workout-scored .set-check { pointer-events: none; cursor: default; }
.workout-scored .set-check:active { transform: none; }
.workout-scored .set-row { opacity: 0.7; }
.workout-scored .set-delete-bar,
.workout-scored .set-tf-bar,
.workout-scored .add-set-btn,
.workout-scored .deload-btn,
.workout-scored .ex-grip,
.workout-scored .superset-link-btn {
    pointer-events: none;
    opacity: 0.3;
}

/* === DONE STATE EXTRAS === */
.set-row.set-done .set-input { color: var(--text-secondary); }
.set-row.deload .set-delete-bar { background: var(--warning); }

/* === ANIMATIONS === */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes staggerIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.stagger-in {
    animation: staggerIn 0.2s ease both;
    animation-delay: var(--d, 0s);
}

/* === RESPONSIVE — narrow screens (iPhone 13 = 390px) === */
@media (max-width: 400px) {
    .header-title { font-size: 1.1rem; }
    .header-avatar { width: 28px; height: 28px; font-size: 12px; }
}

/* === EXERCISE FOCUS OVERLAY === */
.focus-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 12px 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.focus-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.focus-panel {
    background: var(--surface-1);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
    transform: scale(0.95);
    transition: transform 0.35s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.focus-overlay.open .focus-panel {
    transform: scale(1);
}

.focus-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: var(--space-5) var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--divider);
}

.focus-title {
    font-size: var(--font-title);
    font-weight: var(--weight-title);
    color: var(--text-primary);
}

.focus-subtitle {
    font-size: var(--font-caption);
    color: var(--text-tertiary);
    margin-top: 2px;
}

.focus-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--surface-3);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.focus-close:active { background: var(--surface-4); }

.focus-body {
    padding: var(--space-3) var(--space-5) var(--space-5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.focus-section {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--divider);
}
.focus-section:last-child { border-bottom: none; }

.focus-section-header {
    font-size: var(--font-caption);
    font-weight: var(--weight-caption);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.focus-section-icon {
    font-size: 18px;
    color: var(--text-tertiary);
}

.focus-section-primary .focus-last-sets,
.focus-section-primary .focus-setup-fields {
    font-size: var(--font-body);
}

/* PR badge */
.focus-pr {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-body);
    font-weight: 600;
    color: var(--record);
}

.focus-pr-icon {
    background: var(--record);
    color: #000;
    font-size: var(--font-label);
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.focus-pr-date {
    font-size: var(--font-label);
    font-weight: 400;
    color: var(--text-tertiary);
    margin-left: auto;
}

/* Photo */
.focus-photo-wrap {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: var(--space-1);
}

.focus-photo {
    width: 100%;
    display: block;
    border-radius: var(--radius-md);
}

.focus-photo-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.6);
    border: none;
    color: var(--negative);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.focus-photo-add {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-caption);
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    justify-content: center;
}
.focus-photo-add:active { background: var(--surface-2); }

.focus-photo-compact {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: var(--font-caption);
    font-family: inherit;
    cursor: pointer;
}
.focus-photo-compact:active { color: var(--text-secondary); }

/* Machine setup */
.focus-setup-fields {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.focus-setup-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.focus-setup-label {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    min-width: 48px;
}

.focus-setup-input {
    width: 56px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: var(--font-body);
    font-family: inherit;
    text-align: center;
}
.focus-setup-input:focus {
    outline: none;
    border-color: var(--accent);
}

.focus-setup-remove {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: none;
    border: none;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.focus-setup-remove:active { color: var(--negative); }

.focus-add-btn {
    margin-top: var(--space-2);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: none;
    color: var(--text-secondary);
    font-size: var(--font-label);
    font-family: inherit;
    cursor: pointer;
}
.focus-add-btn:active { background: var(--surface-2); }

.focus-add-setup-link {
    display: block;
    width: 100%;
    padding: var(--space-3) 0;
    background: none;
    border: none;
    border-top: 1px solid var(--divider);
    color: var(--text-tertiary);
    font-size: var(--font-caption);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
}
.focus-add-setup-link:active { color: var(--text-secondary); }

.focus-empty {
    font-size: var(--font-caption);
    color: var(--text-tertiary);
    font-style: italic;
}

/* Notes */
.focus-note-text {
    font-size: var(--font-body);
    color: var(--text-primary);
    line-height: 1.5;
}
.focus-note-text.empty {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Last session */
.focus-last-sets {
    font-size: var(--font-body);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Form tips inline */
.focus-tip {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    cursor: pointer;
}
.focus-tip:active { opacity: 0.6; }

.focus-tip-thumb-wrap {
    position: relative;
    width: 80px;
    height: 45px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.focus-tip-thumb-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    /* CSS triangle play icon */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
}

.focus-tip-thumb {
    width: 80px;
    height: 45px;
    object-fit: cover;
    display: block;
}

.focus-tip-content {
    flex: 1;
    min-width: 0;
}

.focus-tip-text {
    font-size: var(--font-caption);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Rest timer pills */
.focus-rest-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

/* === SCROLLBAR STYLING === */
.app-content::-webkit-scrollbar { display: none; }
.app-content { -ms-overflow-style: none; scrollbar-width: none; }
