* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-hover: #252525;
    --text: #f0f0f0;
    --text-muted: #999;
    --push-color: #e74c3c;
    --pull-color: #2ecc71;
    --legs-color: #3498db;
    --upper-color: #9b59b6;
    --accent: #f39c12;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* NAVIGATION TABS */
.tabs {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid #333;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    flex: 1;
    padding: 1rem 0.5rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: fit-content;
}

.tab:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.tab.active {
    color: var(--accent);
    border-bottom: 3px solid var(--accent);
}

/* PAGES */
.page {
    display: none;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

/* ACCUEIL */
#accueil h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* WAKE LOCK BADGE */
.wakelock-badge {
    text-align: center;
    margin-bottom: 1.5rem;
}

#wakelock-status {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: 1px solid #333;
}

#wakelock-status.active {
    background: rgba(46, 204, 113, 0.15);
    color: var(--pull-color);
    border-color: rgba(46, 204, 113, 0.4);
}

/* TIMERS */
.timers-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.timer-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.3s;
}

.timer-card h2 {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
}

.timer-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.timer-30 { border-color: var(--accent); }
.timer-30 h2 { color: var(--accent); }

.timer-2m30 { border-color: var(--push-color); }
.timer-2m30 h2 { color: var(--push-color); }

.timer-2m { border-color: var(--pull-color); }
.timer-2m h2 { color: var(--pull-color); }

.timer-display {
    font-size: 4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin: 1rem 0;
    letter-spacing: 2px;
}

.timer-display.warning {
    color: var(--accent);
    animation: pulse 1s infinite;
}

.timer-display.done {
    color: var(--push-color);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.timer-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.timer-buttons button {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.timer-buttons button:active {
    transform: scale(0.95);
}

.timer-buttons button:first-child {
    background: var(--accent);
    color: #000;
}

.timer-buttons button:nth-child(2) {
    background: #444;
    color: var(--text);
}

.timer-buttons button:last-child {
    background: #333;
    color: var(--text-muted);
}

/* SESSION HEADERS */
.session-header {
    text-align: center;
    padding: 2rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.session-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.session-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.push-header { background: linear-gradient(135deg, rgba(231,76,60,0.15), rgba(231,76,60,0.05)); border: 1px solid rgba(231,76,60,0.3); }
.push-header h1 { color: var(--push-color); }

.pull-header { background: linear-gradient(135deg, rgba(46,204,113,0.15), rgba(46,204,113,0.05)); border: 1px solid rgba(46,204,113,0.3); }
.pull-header h1 { color: var(--pull-color); }

.legs-header { background: linear-gradient(135deg, rgba(52,152,219,0.15), rgba(52,152,219,0.05)); border: 1px solid rgba(52,152,219,0.3); }
.legs-header h1 { color: var(--legs-color); }

.upper-header { background: linear-gradient(135deg, rgba(155,89,182,0.15), rgba(155,89,182,0.05)); border: 1px solid rgba(155,89,182,0.3); }
.upper-header h1 { color: var(--upper-color); }

/* WARMUP */
.warmup {
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid rgba(243, 156, 18, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.warmup strong {
    color: var(--accent);
}

/* EXERCISES GRID */
.exercises-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.exercise-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.exercise-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.exercise-img {
    position: relative;
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    overflow: hidden;
}

.exercise-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
}

.exercise-img img[src]:not([src=""]) + .img-placeholder {
    display: none;
}

.exercise-img img:error + .img-placeholder,
.exercise-img img[src=""] + .img-placeholder {
    display: flex;
}

.exercise-info {
    padding: 1rem 1.2rem 1.2rem;
}

.exercise-info h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.muscle-tag {
    display: inline-block;
    background: rgba(243, 156, 18, 0.15);
    color: var(--accent);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.exercise-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0.4rem 0;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}

.exercise-details span:first-child {
    font-weight: 700;
    color: var(--text);
}

.exercise-notes {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 0.4rem;
}

/* CARDIO SECTION */
.cardio-section {
    margin-top: 1.5rem;
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.cardio-section strong {
    color: var(--pull-color);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .tabs {
        justify-content: flex-start;
    }

    .tab {
        padding: 0.8rem 0.6rem;
        font-size: 0.75rem;
    }

    .page {
        padding: 1rem;
    }

    #accueil h1 {
        font-size: 1.5rem;
    }

    .timer-display {
        font-size: 3rem;
    }

    .exercises-grid {
        grid-template-columns: 1fr;
    }

    .exercise-img {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .timers-container {
        grid-template-columns: 1fr;
    }

    .timer-buttons button {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}
