/* ═══ VIKING FITNESS — DARK THEME ═══ */

:root {
    --bg: #0f0f1a;
    --card: #1a1a2e;
    --card-border: #2a2a4a;
    --accent: #f59e0b;
    --accent-dim: rgba(245, 158, 11, 0.15);
    --red: #e94560;
    --green: #22c55e;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
}

/* ── Top Bar ────────────────────────────── */

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
    border-bottom: 1px solid var(--card-border);
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
}
.logo span { color: var(--text); }

.phase-badge {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* ── Content ────────────────────────────── */

.content {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
    overflow-y: auto;
}

/* ── Cards ────────────────────────────── */

.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.card-header h2 { font-size: 20px; }

.day-label {
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
}

/* ── Dashboard Session Card ────────────── */

.session-exercises {
    margin-bottom: 12px;
}

.mini-exercise {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    align-items: center;
}
.mini-exercise:last-child { border-bottom: none; }

.ex-name {
    flex: 1;
    font-size: 14px;
}
.ex-reps {
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
}
.ex-weight {
    color: var(--text-muted);
    font-size: 13px;
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* ── Buttons ────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--bg);
    flex: 1;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #d97706; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-accent {
    background: var(--accent);
    color: #000;
}
.btn-accent:hover { background: #d97706; }

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    margin-top: 16px;
}

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
}

/* ── Streak Card ────────────────────────── */

.streak-card {
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s;
}
.streak-card:hover { transform: scale(1.02); }

.streak-number {
    font-size: 48px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}
.streak-label {
    color: var(--text-muted);
    font-size: 14px;
    margin: 4px 0 12px;
}
.done-badge {
    color: var(--green);
    font-weight: 600;
    font-size: 14px;
}

/* ── Pull-Up GTG ────────────────────────── */

.pullup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.pullup-header h3 { font-size: 16px; }
.pullup-today {
    color: var(--accent);
    font-weight: 700;
    font-size: 18px;
}

.pullup-counter {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.btn-pullup {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    font-size: 22px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-pullup:active { transform: scale(0.9); }
.btn-pullup.btn-sm {
    width: 56px;
    height: 56px;
    font-size: 18px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.pullup-week {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    height: 50px;
}
.mini-bar {
    flex: 1;
    height: 50px;
    background: var(--card-border);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}
.bar-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: height 0.3s;
}
.bar-label {
    position: absolute;
    bottom: -18px;
    width: 100%;
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Quick Links ────────────────────────── */

.quick-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
}
.quick-link:last-child { border-bottom: none; }
.quick-link span:first-child { font-size: 20px; }

/* ── Session Page ────────────────────────── */

.session-header {
    margin-bottom: 16px;
}
.session-header h1 { font-size: 24px; margin-bottom: 4px; }
.phase-label {
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
}

.section-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 16px 0 8px;
    text-transform: uppercase;
}

.exercise-card {
    cursor: default;
}
.ex-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.ex-card-header h3 { font-size: 16px; flex: 1; }
.ex-card-reps {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
}
.ex-weight-badge {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}
.ex-notes {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 8px;
    font-style: italic;
}
.ex-cues {
    margin-bottom: 8px;
}
.cue {
    font-size: 13px;
    color: var(--text-muted);
    padding: 2px 0;
}

.video-link {
    display: inline-block;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 8px;
}
.video-link:hover { text-decoration: underline; }

.video-embed {
    margin-top: 10px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.video-embed iframe {
    display: block;
}

.warmup-card .warmup-item {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(42,42,74,0.5);
}
.warmup-card .warmup-item:last-child { border-bottom: none; }

.session-complete {
    margin-top: 20px;
}

.rest-text {
    color: var(--text-muted);
    padding: 8px 0;
}

/* ── Exercise Library ────────────────────── */

.exercises-page h1 { margin-bottom: 16px; }

.filter-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
}
.tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--card);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
}
.tab.active, .tab:hover {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
}

.exercise-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.exercise-thumb {
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s;
}
.exercise-thumb:hover { transform: translateY(-1px); }
.exercise-thumb h3 { font-size: 16px; margin-bottom: 4px; }

.cat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.cat-kb { background: rgba(59,130,246,0.15); color: #60a5fa; }
.cat-bodyweight { background: rgba(34,197,94,0.15); color: #4ade80; }
.cat-mobility { background: rgba(168,85,247,0.15); color: #c084fc; }

.ex-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.cue-preview {
    font-size: 12px;
    color: var(--text-dim);
}

/* ── Exercise Detail ────────────────────── */

.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 16px;
    font-size: 14px;
}

.detail-card h1 { margin: 8px 0; font-size: 24px; }
.ex-description { color: var(--text-muted); margin-bottom: 16px; }

.video-main {
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
}
.video-main iframe { display: block; }

.detail-section {
    margin-top: 16px;
}
.detail-section h3 {
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cue-item {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid rgba(42,42,74,0.3);
}
.cue-item:last-child { border-bottom: none; }

.mistake-item {
    padding: 6px 0;
    font-size: 13px;
    color: var(--red);
    border-bottom: 1px solid rgba(42,42,74,0.3);
}
.mistake-item:last-child { border-bottom: none; }

/* ── Log Page ────────────────────────────── */

.log-form { max-width: 100%; }

.form-row {
    margin-bottom: 12px;
}
.form-row label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.select-styled {
    width: 100%;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
}

.log-exercise h3 { font-size: 15px; margin-bottom: 4px; }
.log-target {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
.log-last {
    color: var(--text-dim);
    font-size: 12px;
    margin-bottom: 8px;
}

.log-inputs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.input-group {
    flex: 1;
}
.input-group label {
    font-size: 11px;
    color: var(--text-dim);
    display: block;
    margin-bottom: 2px;
}
.input-sm {
    width: 100%;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
}
.input-notes {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    margin-top: 4px;
}

.current-phase {
    margin: 8px 0;
    color: var(--text-muted);
    font-size: 14px;
}

textarea, .input-date, .input-weight {
    width: 100%;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
textarea { resize: vertical; }

/* ── Mobility Page ────────────────────────── */

.mobility-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.mobility-header h1 { font-size: 24px; }

.mobility-streak {
    display: flex;
    align-items: center;
    gap: 4px;
}
.streak-flame { font-size: 20px; }
.streak-num { font-size: 20px; font-weight: 800; color: var(--accent); }
.streak-text { font-size: 13px; color: var(--text-muted); }

.mobility-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.mobility-exercise {
    transition: all 0.2s;
    position: relative;
}
.mobility-exercise.done {
    opacity: 0.6;
    border-left: 3px solid var(--green);
}

.mob-ex-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mob-order {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.mob-ex-header h3 { flex: 1; font-size: 15px; }
.mob-reps {
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
}

.mob-cues { margin: 6px 0 6px 38px; }

.btn-check {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.btn-check.checked {
    background: var(--green);
    color: #000;
    border-color: var(--green);
}

.mobility-complete { margin-top: 16px; text-align: center; }
.done-today {
    color: var(--green);
    font-weight: 700;
    font-size: 16px;
    padding: 16px;
}

/* ── Progress Page ────────────────────────── */

.progress-page h1 { margin-bottom: 4px; }

.chart-card { padding: 16px; }
.chart-card h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }

.streak-calendar {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 3px;
}
.cal-cell {
    aspect-ratio: 1;
    background: var(--card-border);
    border-radius: 2px;
}
.cal-cell.active {
    background: var(--accent);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.summary-stat {
    text-align: center;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
}
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Settings Page ────────────────────────── */

.settings-page h1 { margin-bottom: 16px; }
.setting-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }

.version {
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 8px;
}

/* ── Bottom Nav ────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: flex;
    background: rgba(15,15,26,0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--card-border);
    padding: 6px 0;
    padding-bottom: env(safe-area-inset-bottom, 6px);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 11px;
    transition: color 0.2s;
}
.nav-item.active, .nav-item:hover {
    color: var(--accent);
}
.nav-item svg { width: 22px; height: 22px; }

/* ── Responsive ────────────────────────── */

@media (min-width: 481px) {
    .app { max-width: 480px; }
    body { background: #080810; }
}