:root {
    /* Colors */
    --bg-base: #000000;
    --bg-surface: #0a0a0a;
    --bg-surface-elevated: #141414;
    --accent-primary: #a3e635; /* Lime Green */
    --accent-secondary: #71717a; /* Cool Gray */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #52525b;
    --border-subtle: #27272a;
    --border-emphasis: #3f3f46;

    /* Spacing */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;

    /* Border Radius */
    --br-input: 8px;
    --br-btn: 12px;
    --br-card: 16px;
    --br-full: 24px;

    /* Shadows */
    --shadow-subtle: 0 4px 12px rgba(0, 0, 0, 0.3);

    /* Easing */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    
    /* Safe Area */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
    min-height: 100vh;
    padding-top: var(--safe-top);
    padding-bottom: calc(var(--safe-bottom) + 72px); /* Space for bottom nav */
    overflow-x: hidden;
    user-select: none;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--sp-4);
}
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 24px; letter-spacing: -0.01em; }
h3 { font-size: 20px; }
.text-muted { color: var(--text-secondary); font-size: 14px; }
.text-small { color: var(--text-tertiary); font-size: 12px; }

/* Utilities */
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.hidden { display: none !important; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--br-btn);
    font-weight: 600;
    font-size: 16px;
    border: none;
    outline: none;
    cursor: pointer;
    transition: transform 160ms var(--ease-out), background-color 200ms ease;
    width: 100%;
    min-height: 48px; /* Touch target size */
}
.btn:active {
    transform: scale(0.97);
}
.btn-primary {
    background-color: var(--accent-primary);
    color: #000;
}
.btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}
.btn-icon {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: var(--br-btn);
    background-color: var(--bg-surface-elevated);
    color: var(--accent-primary);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:active {
    transform: scale(0.92);
}

/* Inputs */
input[type="number"], input[type="text"] {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: var(--sp-3);
    border-radius: var(--br-input);
    font-size: 16px;
    font-family: inherit;
    width: 100%;
    min-height: 44px;
    transition: border-color 200ms ease;
    appearance: none;
}
input[type="number"]:focus, input[type="text"]:focus {
    border-color: var(--accent-primary);
    outline: none;
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: var(--sp-2) 0;
}
.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.checkmark {
    height: 24px;
    width: 24px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--sp-3);
    transition: all 200ms ease;
}
.checkbox-container:active .checkmark {
    transform: scale(0.92);
}
.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}
.checkmark:after {
    content: "";
    display: none;
    width: 5px;
    height: 10px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* Cards */
.card {
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--br-card);
    padding: var(--sp-4);
    margin-bottom: var(--sp-4);
    box-shadow: var(--shadow-subtle);
}

/* Layout */
.container {
    padding: var(--sp-4);
    max-width: 428px;
    margin: 0 auto;
}

/* Animations */
@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.animate-item {
    animation: slideUpFade 400ms var(--ease-out) both;
}
/* Staggering */
.stagger-1 { animation-delay: 40ms; }
.stagger-2 { animation-delay: 80ms; }
.stagger-3 { animation-delay: 120ms; }
.stagger-4 { animation-delay: 160ms; }
.stagger-5 { animation-delay: 200ms; }
.stagger-6 { animation-delay: 240ms; }

/* Video */
.video-container {
    width: 100%;
    border-radius: var(--br-btn);
    overflow: hidden;
    margin-bottom: var(--sp-4);
    background-color: #000;
}
.video-container video {
    width: 100%;
    display: block;
}

/* Sets Table */
.sets-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--sp-4);
}
.sets-table th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding-bottom: var(--sp-2);
}
.sets-table td {
    padding: var(--sp-2) 0;
    vertical-align: middle;
}
.sets-table tr.warmup-row {
    opacity: 0.6;
}
.set-input-group {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.set-input-group input {
    width: 70px;
    text-align: center;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-around;
    padding: var(--sp-2) 0 calc(var(--safe-bottom) + var(--sp-2));
    z-index: 100;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    padding: var(--sp-2) var(--sp-4);
    transition: color 200ms ease;
    cursor: pointer;
}
.nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: var(--sp-1);
    fill: currentColor;
    transition: transform 200ms var(--ease-out);
}
.nav-item:active svg {
    transform: scale(0.85);
}
.nav-item.active {
    color: var(--accent-primary);
}

/* Rest Timer Overlay */
#timer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 300ms var(--ease-out);
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.timer-container {
    text-align: center;
    width: 100%;
    padding: 0 var(--sp-6);
}
.timer-ring {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    margin: 0 auto var(--sp-4);
    position: relative;
    background: var(--bg-surface-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
}
.timer-ring-progress {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: conic-gradient(var(--accent-primary) 0%, transparent 0%);
    transition: background 1s linear;
}
.timer-ring-inner {
    position: absolute;
    top: 8px; left: 8px; right: 8px; bottom: 8px;
    background: var(--bg-base);
    border-radius: 50%;
}
.timer-text {
    position: relative;
    font-size: 64px;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
    z-index: 2;
}
.timer-label {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: var(--sp-8);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--border-emphasis);
    color: var(--text-primary);
    margin-bottom: var(--sp-2);
}

/* Progress bar */
.progress-bar-bg {
    background: var(--bg-surface-elevated);
    height: 6px;
    border-radius: 3px;
    width: 100%;
    overflow: hidden;
    margin-bottom: var(--sp-4);
}
.progress-bar-fill {
    background: var(--accent-primary);
    height: 100%;
    width: 0%;
    transition: width 300ms var(--ease-out);
}

/* Toast */
#toast-container {
    position: fixed;
    top: var(--safe-top);
    left: 0;
    right: 0;
    padding: var(--sp-4);
    pointer-events: none;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.toast {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--br-input);
    box-shadow: var(--shadow-subtle);
    animation: slideDownFade 300ms var(--ease-out) forwards;
    pointer-events: auto;
}
@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* New Component Styles */
.technique-text {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms var(--ease-out), margin-top 300ms var(--ease-out);
    color: var(--text-secondary);
    font-size: 14px;
}
.technique-text.expanded {
    max-height: 500px;
    margin-top: var(--sp-2);
}
.technique-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: var(--sp-2) 0;
    font-weight: 500;
    color: var(--accent-primary);
}
.technique-toggle svg {
    transition: transform 300ms var(--ease-out);
}
.technique-toggle.expanded svg {
    transform: rotate(180deg);
}

.exercise-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--br-card);
    padding: var(--sp-4);
    margin-bottom: var(--sp-4);
}
.set-row {
    transition: opacity 200ms ease;
}
.set-row.completed {
    opacity: 0.5;
}
.set-row.completed input {
    color: var(--accent-primary);
    border-color: var(--border-subtle);
}
.warmup-section {
    background: var(--bg-surface);
    border-radius: var(--br-card);
    padding: var(--sp-4);
    margin-bottom: var(--sp-6);
    border: 1px solid var(--border-subtle);
}

.plan-toggle {
    display: flex;
    background: var(--bg-surface-elevated);
    padding: var(--sp-1);
    border-radius: var(--br-btn);
    margin-bottom: var(--sp-6);
}
.plan-toggle-btn {
    flex: 1;
    padding: var(--sp-2);
    text-align: center;
    border-radius: calc(var(--br-btn) - 2px);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 200ms ease;
    cursor: pointer;
}
.plan-toggle-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-subtle);
}

.day-card {
    background: var(--bg-surface-elevated);
    border-radius: var(--br-card);
    padding: var(--sp-4);
    margin-bottom: var(--sp-4);
    cursor: pointer;
    transition: background 200ms ease;
}
.day-card:active {
    background: var(--border-emphasis);
}
.day-card-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms var(--ease-out);
}
.day-card.expanded .day-card-content {
    max-height: 2000px;
    margin-top: var(--sp-4);
}
.history-card {
    background: var(--bg-surface-elevated);
    border-radius: var(--br-card);
    padding: var(--sp-4);
    margin-bottom: var(--sp-4);
}
.history-card-content {
    display: none;
}
.history-card.expanded .history-card-content {
    display: block;
    margin-top: var(--sp-4);
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--sp-4);
}
.rules-list {
    list-style: none;
    padding: 0;
}
.rules-list li {
    position: relative;
    padding-left: var(--sp-4);
    margin-bottom: var(--sp-3);
    color: var(--text-secondary);
}
.rules-list li::before {
    content: "•";
    color: var(--accent-primary);
    position: absolute;
    left: 0;
    font-size: 20px;
    line-height: 1;
    top: -2px;
}
.empty-state {
    text-align: center;
    padding: var(--sp-8) 0;
    color: var(--text-tertiary);
}
.muscle-badge {
    background: var(--border-subtle);
    color: var(--accent-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    display: inline-block;
    margin-right: var(--sp-1);
    margin-bottom: var(--sp-2);
}
.hint-box {
    background: var(--bg-surface);
    border-left: 3px solid var(--text-tertiary);
    padding: var(--sp-2) var(--sp-3);
    border-radius: 0 var(--br-input) var(--br-input) 0;
    font-size: 13px;
    color: var(--text-secondary);
    margin: var(--sp-2) 0;
}
.hint-box.suggest-increase {
    border-left-color: var(--accent-primary);
    color: var(--text-primary);
}
.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--sp-3);
}
.workout-progress-header {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10;
    padding: var(--sp-3) 0;
    margin-bottom: var(--sp-3);
    border-bottom: 1px solid var(--border-subtle);
}

/* Step Chips Navigation */
.step-chips-scroll {
    display: flex;
    gap: var(--sp-2);
    overflow-x: auto;
    padding: var(--sp-2) 0;
    margin-bottom: var(--sp-2);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.step-chips-scroll::-webkit-scrollbar {
    display: none;
}
.step-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 200ms var(--ease-out);
    flex-shrink: 0;
}
.step-chip:active {
    transform: scale(0.95);
}
.step-chip.active {
    background: rgba(163, 230, 53, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    font-weight: 600;
}
.step-chip.completed {
    border-color: rgba(163, 230, 53, 0.4);
    color: var(--text-primary);
}
.step-chip.completed .chip-check {
    color: var(--accent-primary);
}

/* Recommendation Info Box */
.recommendation-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--br-card);
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}
.recommendation-title {
    color: var(--accent-primary);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.recommendation-details {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

/* Step Navigation Footer */
.step-nav-footer {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-6);
}
.btn-step-prev {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}
.btn-step-next {
    flex: 2;
    background: var(--accent-primary);
    color: #000;
    font-weight: 600;
}
.btn-add-set {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    width: 100%;
    margin-top: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    background: transparent;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--br-button);
    color: var(--accent-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 160ms var(--ease-out);
}
.btn-add-set:active {
    transform: scale(0.98);
    background: rgba(163, 230, 53, 0.05);
    border-color: var(--accent-primary);
}

/* Timer Launch Box */
.timer-trigger-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--br-card);
    padding: var(--sp-3) var(--sp-4);
    margin-top: var(--sp-4);
}
.timer-trigger-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-2);
}
.timer-presets-list {
    display: flex;
    gap: var(--sp-2);
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}
.timer-presets-list::-webkit-scrollbar {
    display: none;
}
.timer-preset-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 160ms var(--ease-out);
    flex-shrink: 0;
}
.timer-preset-btn:active {
    transform: scale(0.95);
    background: rgba(163, 230, 53, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
.timer-preset-btn.recommended {
    border-color: rgba(163, 230, 53, 0.5);
    color: var(--accent-primary);
    background: rgba(163, 230, 53, 0.08);
    font-weight: 600;
}


