/* ========================================
   GARMIN DASHBOARD — Dark Athletic Theme
   Accent: #F5A623 (warm yellow/orange)
   ======================================== */

:root {
    --bg-primary: #0d0f12;
    --bg-card: #161a21;
    --bg-card-hover: #1c2129;
    --border: #2a2f3a;
    --text-primary: #f0f0f0;
    --text-secondary: #8b919e;
    --text-muted: #5a6070;
    --accent: #F5A623;
    --accent-dim: rgba(245, 166, 35, 0.15);
    --accent-glow: rgba(245, 166, 35, 0.3);
    --green: #4ecb71;
    --red: #e74c5e;
    --blue: #5b9cf6;
    --purple: #a77bfa;
    --cyan: #38d9d9;
    --radius: 12px;
    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* === LAYOUT === */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.sidebar-logo svg {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-logo span {
    color: var(--accent);
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}

.sidebar-nav a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-nav a.active {
    color: var(--accent);
    background: var(--accent-dim);
}

.sidebar-nav a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 8px 0;
    border-top: 1px solid var(--border);
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.sync-dot.syncing {
    background: var(--accent);
    animation: pulse 1.2s infinite;
}

.sync-dot.error {
    background: var(--red);
}

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

.main {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    max-width: 1400px;
}

/* === HEADER === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

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

.btn-primary:hover {
    background: #ffb840;
    box-shadow: 0 0 20px var(--accent-glow);
}

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

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn svg {
    width: 16px;
    height: 16px;
}

/* === STAT CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--accent-glow);
    transform: translateY(-1px);
}

/* Hero stat cards — highlighted top stats */
.stat-card-hero {
    position: relative;
    overflow: hidden;
}

.stat-card-hero.orange {
    border-color: rgba(245, 166, 35, 0.3);
    background: linear-gradient(135deg, var(--bg-card) 60%, rgba(245,166,35,0.08) 100%);
}

.stat-card-hero.blue {
    border-color: rgba(91, 156, 246, 0.3);
    background: linear-gradient(135deg, var(--bg-card) 60%, rgba(91,156,246,0.08) 100%);
}

.stat-card-hero.green {
    border-color: rgba(78, 203, 113, 0.3);
    background: linear-gradient(135deg, var(--bg-card) 60%, rgba(78,203,113,0.08) 100%);
}

.stat-card-hero.cyan {
    border-color: rgba(56, 217, 217, 0.3);
    background: linear-gradient(135deg, var(--bg-card) 60%, rgba(56,217,217,0.08) 100%);
}

.stat-card-hero .stat-card-value {
    font-size: 34px;
}

.stat-card-glow {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.07;
    pointer-events: none;
}

.stat-card-hero.orange .stat-card-glow {
    background: var(--accent);
}

.stat-card-hero.blue .stat-card-glow {
    background: var(--blue);
}

.stat-card-hero.green .stat-card-glow {
    background: var(--green);
}

.stat-card-hero.cyan .stat-card-glow {
    background: #38d9d9;
}

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

.stat-card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.stat-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon svg {
    width: 18px;
    height: 18px;
}

.stat-card-icon.orange { background: var(--accent-dim); color: var(--accent); }
.stat-card-icon.green { background: rgba(78, 203, 113, 0.15); color: var(--green); }
.stat-card-icon.blue { background: rgba(91, 156, 246, 0.15); color: var(--blue); }
.stat-card-icon.purple { background: rgba(167, 123, 250, 0.15); color: var(--purple); }
.stat-card-icon.cyan { background: rgba(56, 217, 217, 0.15); color: var(--cyan); }

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.stat-card-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
}

.stat-card-trend.up { color: var(--green); }
.stat-card-trend.down { color: var(--red); }

/* === CHART CARDS === */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 4px;
}

.chart-card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.chart-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    width: 100%;
    order: 3;
}

.chart-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    padding: 3px;
}

.chart-tab {
    padding: 4px 12px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.chart-tab.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.chart-container {
    position: relative;
    height: 260px;
}

/* === CUSTOM BAR CHART (replaces broken Chart.js bars) === */
.custom-bar-chart {
    display: flex;
    height: 100%;
    gap: 4px;
}

.cbar-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 24px;
    min-width: 44px;
    text-align: right;
    padding-right: 8px;
}

.cbar-y-axis span {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1;
}

.cbar-area {
    flex: 1;
    position: relative;
    padding-bottom: 24px;
}

.cbar-grid {
    position: absolute;
    inset: 0;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.cbar-grid-line {
    height: 1px;
    background: rgba(255,255,255,0.04);
}

.cbar-bars {
    display: flex;
    align-items: flex-end;
    height: calc(100% - 24px);
    gap: 4px;
}

.cbar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    cursor: default;
}

.cbar-bar {
    width: 70%;
    max-width: 32px;
    min-height: 0;
    background: rgba(245,166,35,0.2);
    border-radius: 4px 4px 2px 2px;
    position: relative;
    transition: height 0.5s ease-out;
}

.cbar-bar.active {
    background: #F5A623;
    box-shadow: 0 0 10px rgba(245,166,35,0.3);
}

.cbar-val {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0;
}

.cbar-col:hover .cbar-val {
    opacity: 1;
}

.cbar-bar.active .cbar-val {
    color: #F5A623;
    font-weight: 600;
}

.cbar-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* === ACTIVITIES TABLE === */
.activities-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 32px;
}

.activities-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.activities-card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.activities-table {
    width: 100%;
    border-collapse: collapse;
}

.activities-table th {
    text-align: left;
    padding: 12px 24px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.activities-table td {
    padding: 14px 24px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.activities-table tbody tr {
    transition: background var(--transition);
}

.activities-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.activity-type {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.activity-type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.activity-type-dot.run { background: #F5A623; }
.activity-type-dot.ride { background: #4ecb71; }
.activity-type-dot.swim { background: #5b9cf6; }
.activity-type-dot.other { background: var(--purple); }

.pace-value {
    font-variant-numeric: tabular-nums;
}

.hr-value {
    color: var(--red);
    font-weight: 600;
}

/* === SLEEP SECTION === */
.sleep-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.sleep-score-ring {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 24px;
}

.ring-container {
    position: relative;
    width: 140px;
    height: 140px;
}

.ring-container svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}

.ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-value {
    font-size: 32px;
    font-weight: 700;
}

.ring-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sleep-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

.sleep-stage {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sleep-stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.sleep-stage-dot.deep { background: #5b5bdf; }
.sleep-stage-dot.light { background: #7b9cf6; }
.sleep-stage-dot.rem { background: var(--purple); }
.sleep-stage-dot.awake { background: var(--red); }

.sleep-stage-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.sleep-stage-name { color: var(--text-secondary); }
.sleep-stage-duration { font-weight: 600; }

/* === LOADING STATE === */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 15, 18, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 13px;
}

/* === FILTER BAR === */
.filter-bar {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 4px;
}

.filter-bar-years {
    flex-wrap: wrap;
}

.filter-bar-years .filter-btn {
    padding: 4px 10px;
    font-size: 12px;
}

.filter-btn {
    padding: 6px 14px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* === HIDDEN ACTIVITIES === */
.activity-hidden td {
    opacity: 0.35;
    text-decoration: line-through;
}

.activity-hidden td:last-child {
    opacity: 1;
    text-decoration: none;
}

.btn-hide {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
    transition: all var(--transition);
}

.btn-hide:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.hidden-notice {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.toggle-hidden-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}

.toggle-hidden-label input {
    accent-color: var(--accent);
}

/* === RECORDS LIST === */
.records-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0;
}

.record-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.record-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.record-info {
    flex: 1;
}

.record-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.record-value {
    font-size: 20px;
    font-weight: 700;
}

.record-value .unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.record-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* === OVERVIEW TOP ROW (rocket + goal) === */
/* === OVERVIEW WIDGET GRID === */
.overview-widgets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.overview-widget[data-size="full"] { grid-column: 1 / -1; }
.overview-widget > *:last-child { height: 100%; }

/* Edit bar (hidden by default, shown in edit mode) */
.widget-edit-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    font-size: 12px;
    color: var(--text-muted);
}
.overview-widgets.edit-mode .widget-edit-bar { display: flex; }
.overview-widgets.edit-mode .widget-edit-bar + * { border-radius: 0 0 var(--radius) var(--radius); }
.widget-drag-handle { cursor: grab; opacity: 0.4; display: flex; }
.widget-drag-handle:hover { opacity: 1; }
.widget-edit-label { flex: 1; }
.overview-widgets.edit-mode .overview-widget { outline: 1px dashed var(--border); outline-offset: -1px; border-radius: var(--radius); }
.overview-widget.widget-ghost { opacity: 0.3; outline: 2px dashed var(--accent) !important; }
.overview-widget.widget-chosen { outline: 2px solid var(--accent) !important; }
.overview-widget.sortable-drag { z-index: 100; }

.goal-card-compact {
    margin-bottom: 0;
}

.goal-card-compact .goal-scene {
    padding: 14px 16px;
    gap: 10px;
}

.goal-card-compact .goal-road {
    height: 56px;
}

.goal-card-compact .goal-event-name {
    font-size: 14px;
}

.goal-card-compact .countdown-number {
    font-size: 28px;
}

.goal-card-compact .goal-countdown {
    padding: 6px 12px;
}

/* overview-hero/overview-stats-col no longer used — flat widget grid replaces them */

.stats-grid-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    height: 100%;
}

.stats-grid-compact .stat-card,
.stats-grid-compact .stat-card-hero {
    min-height: 0;
    padding: 14px 16px;
}

.stats-grid-compact .stat-card-hero .stat-card-value {
    font-size: 24px;
}

.stats-grid-compact .stat-card-header {
    margin-bottom: 8px;
}

.stats-grid-compact .stat-card-label {
    font-size: 10px;
}

.stats-grid-compact .stat-card-sub {
    font-size: 11px;
}

.stats-grid-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

/* === GOAL / FINISH LINE CARD === */
.goal-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(245,166,35,0.04) 100%);
    border: 1px solid rgba(245, 166, 35, 0.15);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 20px;
}

.goal-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(245,166,35,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.goal-scene {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 14px;
}

/* Road animation */
.goal-road {
    position: relative;
    height: 80px;
    background: linear-gradient(0deg, #2a2d35 0%, #1e2129 100%);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
}

.goal-road::before,
.goal-road::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255,255,255,0.08);
}

.goal-road::before { top: 8px; }
.goal-road::after { bottom: 8px; }

.road-lines {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    transform: translateY(-50%);
}

.road-dash {
    position: absolute;
    width: 20px;
    height: 2px;
    background: rgba(255,255,255,0.15);
    border-radius: 1px;
    animation: roadScroll 3s linear infinite;
}

@keyframes roadScroll {
    0% { transform: translateX(0); opacity: 0.15; }
    50% { opacity: 0.25; }
    100% { transform: translateX(-30px); opacity: 0.15; }
}

.road-runner {
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 0 8px rgba(245, 166, 35, 0.4));
    animation: runnerBounce 0.35s ease-in-out infinite;
    transition: left 1s ease-out;
    z-index: 2;
}

.runner-svg { width: 100%; height: 100%; overflow: visible; }

.runner-arm-l { transform-origin: 33px 20px; animation: armSwingL 0.4s ease-in-out infinite; }
.runner-arm-r { transform-origin: 33px 20px; animation: armSwingR 0.4s ease-in-out infinite; }
.runner-leg-l { transform-origin: 30px 34px; animation: legSwingL 0.4s ease-in-out infinite; }
.runner-leg-r { transform-origin: 30px 34px; animation: legSwingR 0.4s ease-in-out infinite; }

@keyframes armSwingL { 0%, 100% { transform: rotate(30deg); } 50% { transform: rotate(-30deg); } }
@keyframes armSwingR { 0%, 100% { transform: rotate(-30deg); } 50% { transform: rotate(30deg); } }
@keyframes legSwingL { 0%, 100% { transform: rotate(28deg); } 50% { transform: rotate(-28deg); } }
@keyframes legSwingR { 0%, 100% { transform: rotate(-28deg); } 50% { transform: rotate(28deg); } }

@keyframes runnerBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.road-finish {
    position: absolute;
    right: 16px;
    top: 0;
    bottom: 0;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.finish-flag {
    width: 8px;
    height: 60px;
    position: relative;
}

.finish-flag::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0.4);
}

.flag-checkers {
    position: absolute;
    top: 0;
    left: 2px;
    width: 24px;
    height: 18px;
    background:
        repeating-conic-gradient(#fff 0% 25%, #222 0% 50%) 0 0 / 8px 9px;
    border-radius: 2px;
    opacity: 0.9;
    box-shadow: 0 0 12px rgba(255,255,255,0.15);
    animation: flagGlow 2s ease-in-out infinite;
}

@keyframes flagGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(255,255,255,0.1); }
    50% { box-shadow: 0 0 20px rgba(245,166,35,0.3), 0 0 40px rgba(245,166,35,0.1); }
}

/* Progress bar */
.goal-progress-track {
    position: relative;
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: visible;
}

.goal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38d9d9, #4ecb71, #F5A623);
    border-radius: 4px;
    transition: width 1s ease-out;
    box-shadow: 0 0 10px rgba(245, 166, 35, 0.3);
}

.goal-progress-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #F5A623;
    border: 3px solid var(--bg-card);
    border-radius: 50%;
    transition: left 1s ease-out;
    box-shadow: 0 0 8px rgba(245, 166, 35, 0.5);
    z-index: 1;
}

/* Goal info */
.goal-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-event-icons {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}

.tri-icon {
    font-size: 18px;
    filter: grayscale(0.2);
}

.goal-event-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.goal-event-date {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.goal-event-target {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
}

.goal-countdown {
    text-align: center;
    padding: 8px 16px;
    background: rgba(245, 166, 35, 0.08);
    border: 1px solid rgba(245, 166, 35, 0.15);
    border-radius: 12px;
}

.countdown-number {
    font-size: 36px;
    font-weight: 800;
    color: #F5A623;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.countdown-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

@media (max-width: 600px) {
    .overview-widgets {
        grid-template-columns: 1fr;
    }
    .overview-widget[data-size="half"],
    .overview-widget[data-size="full"] {
        grid-column: span 1;
    }
    .stats-grid-compact {
        grid-template-columns: 1fr;
    }
}

/* === TRAINING SCHEMA === */
.schema-progress-bar {
    margin-bottom: 20px;
}

.schema-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.schema-progress-pct {
    font-weight: 700;
    color: var(--accent);
}

.schema-progress-bar .schema-progress-track {
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
}

.schema-progress-bar .schema-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38d9d9, #4ecb71, #F5A623);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.schema-phase-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 24px 0 8px 0;
    border-radius: var(--radius);
    border-left: 4px solid;
}

.schema-phase-header.blue { border-color: #5b9cf6; background: rgba(91,156,246,0.06); }
.schema-phase-header.orange { border-color: #F5A623; background: rgba(245,166,35,0.06); }
.schema-phase-header.red { border-color: #e74c5e; background: rgba(231,76,94,0.06); }
.schema-phase-header.green { border-color: #4ecb71; background: rgba(78,203,113,0.06); }

.schema-phase-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.schema-phase-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.schema-phase-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.schema-week {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.schema-week.current {
    border-color: rgba(245, 166, 35, 0.3);
    box-shadow: 0 0 20px rgba(245, 166, 35, 0.05);
}

.schema-week-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.schema-week-label {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.schema-current-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #F5A623;
    background: rgba(245,166,35,0.12);
    padding: 2px 8px;
    border-radius: 10px;
}

.schema-week-progress {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

.schema-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.schema-day {
    padding: 10px 8px;
    border-right: 1px solid var(--border);
    position: relative;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    transition: background 0.2s;
}

.schema-day:last-child { border-right: none; }

.schema-day.rest { opacity: 0.5; }

.schema-day.completed { background: rgba(78, 203, 113, 0.06); }

.schema-day.today {
    background: rgba(245, 166, 35, 0.08);
    box-shadow: inset 0 2px 0 #F5A623;
}

.schema-day.missed { background: rgba(231, 76, 94, 0.06); }

.schema-day-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.schema-day-name {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.schema-day-date {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
}

.schema-day-body { flex: 1; }

.schema-day-icon { font-size: 14px; margin-right: 4px; }

.schema-day-desc {
    font-size: 11px;
    color: var(--text);
    line-height: 1.4;
}

.schema-day.rest .schema-day-desc { color: var(--text-muted); }

.schema-check-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}

.schema-check-btn:hover { opacity: 1; transform: scale(1.2); }
.schema-check-btn.checked { opacity: 1; }

.schema-synced-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #4ecb71;
    background: rgba(78,203,113,0.12);
    padding: 1px 5px;
    border-radius: 4px;
}

/* Compare badge */
.schema-compare-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 11px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.schema-day.has-comparison { cursor: pointer; }
.schema-day.has-comparison:hover .schema-compare-badge { opacity: 1; }
.schema-day.has-comparison:hover { border-color: var(--accent); }
.schema-day.comparison-open { border-color: var(--accent); z-index: 2; }

/* Floating comparison overlay */
.comparison-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    animation: overlayFadeIn 0.2s ease-out;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.comparison-panel {
    background: var(--card-bg, #1a1d28);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    min-width: 380px;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: panelScaleIn 0.2s ease-out;
}

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

.comparison-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}

.comparison-panel-left {
    flex: 1;
}

.comparison-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.comparison-panel-subtitle {
    font-size: 11px;
    color: var(--muted);
}

.comparison-panel-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.comparison-panel-close:hover { color: var(--text); }

.comparison-sport-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    margin-bottom: 14px;
}
.comparison-sport-badge.run { color: #F5A623; background: rgba(245,166,35,0.12); }
.comparison-sport-badge.swim { color: #5b9cf6; background: rgba(91,156,246,0.12); }
.comparison-sport-badge.bike { color: #4ecb71; background: rgba(78,203,113,0.12); }

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.comparison-table th {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.comparison-table td {
    padding: 8px 8px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.comparison-table tr:last-child td { border-bottom: none; }

.comparison-table tr td:first-child {
    font-weight: 600;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 80px;
}

.comparison-table td:nth-child(2) {
    color: var(--muted);
}

.comparison-table td:nth-child(3) {
    color: var(--text);
    font-weight: 600;
}

.comparison-table .diff {
    font-size: 11px;
    font-weight: 700;
    text-align: right;
}

.comparison-table .diff.positive { color: #4ecb71; }
.comparison-table .diff.negative { color: #e74c5e; }
.comparison-table .diff.neutral { color: var(--accent); }

@media (max-width: 768px) {
    .schema-week-grid { grid-template-columns: 1fr; }
    .schema-day {
        border-right: none;
        border-bottom: 1px solid var(--border);
        min-height: auto;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    .schema-day:last-child { border-bottom: none; }
    .schema-phase-desc { display: none; }
}

/* === WEEK TRAINING WIDGET (overview) === */
.week-training-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.week-training-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.week-training-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.week-training-progress {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(245, 166, 35, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.week-training-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.week-training-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.wt-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    transition: background 0.2s;
}

.wt-item:last-child { border-bottom: none; }

.wt-item.today {
    background: rgba(245, 166, 35, 0.08);
    border-left: 3px solid #F5A623;
    padding-left: 13px;
}

.wt-item.completed { background: rgba(78, 203, 113, 0.04); }

.wt-item.missed { background: rgba(231, 76, 94, 0.04); }

.wt-item.rest { opacity: 0.5; }

.wt-day {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 24px;
    text-transform: uppercase;
    font-size: 11px;
}

.wt-item.today .wt-day { color: #F5A623; }

.wt-icon { font-size: 14px; }

.wt-desc {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wt-item.completed .wt-desc {
    color: var(--text-muted);
    text-decoration: line-through;
}

.wt-check { font-size: 12px; }

.wt-synced {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #4ecb71;
    background: rgba(78,203,113,0.12);
    padding: 1px 5px;
    border-radius: 4px;
}

/* === BUILD SCENE (Rocket Construction Story) === */
.rocket-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    height: 100%;
    position: relative;
}

.build-scene {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 220px;
    overflow: hidden;
    background: linear-gradient(180deg, #0a1628 0%, #111d33 50%, #162210 85%, #1e3012 100%);
}

.build-phase-label {
    position: absolute;
    bottom: 8px;
    left: 12px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
}
.build-phase-label .phase-pct {
    color: var(--accent);
    font-weight: 700;
    font-size: 11px;
}

/* Ground */
.build-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15%;
    min-height: 32px;
    background: linear-gradient(180deg, #2a4a1a 0%, #1e3510 40%, #172a0d 100%);
    z-index: 1;
}
.build-ground::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(78,203,113,0.15), transparent);
}

/* Stars */
.build-star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    animation: buildStarTwinkle 3s ease-in-out infinite;
}
@keyframes buildStarTwinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.9; }
}

/* Clouds */
.build-cloud {
    position: absolute;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    animation: cloudDrift linear infinite;
}
@keyframes cloudDrift {
    from { transform: translateX(0); }
    to { transform: translateX(-150%); }
}

/* Sign */
.build-sign {
    position: absolute;
    z-index: 3;
    animation: signSway 4s ease-in-out infinite;
    transform-origin: bottom center;
}
.build-sign-post {
    width: 4px;
    height: 36px;
    background: #8B6914;
    margin: 0 auto;
}
.build-sign-board {
    width: 100px;
    padding: 5px 7px;
    background: #f5f0e0;
    border: 1.5px solid #c8b880;
    border-radius: 3px;
    font-size: 7.5px;
    color: #333;
    text-align: center;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: 0.3px;
}
@keyframes signSway {
    0%, 100% { transform: rotate(-1deg); }
    50% { transform: rotate(1deg); }
}

/* Fence */
.build-fence-post {
    position: absolute;
    z-index: 2;
}
.build-fence-post .post {
    width: 3px;
    height: 20px;
    background: #9e7c4a;
    margin: 0 auto;
}
.build-fence-post .beam-top,
.build-fence-post .beam-bot {
    position: absolute;
    width: 22px;
    height: 2px;
    background: #8B6914;
    left: -9px;
}
.build-fence-post .beam-top { top: 4px; }
.build-fence-post .beam-bot { top: 12px; }

/* Platform */
.build-platform {
    position: absolute;
    bottom: 38px;
    background: linear-gradient(180deg, #5a5a5a, #4a4a4a, #3e3e3e);
    border-top: 2px solid #777;
    z-index: 2;
    transition: width 0.5s ease, height 0.5s ease;
}

/* Workers */
.build-worker {
    position: absolute;
    z-index: 5;
    animation: workerBob 2s ease-in-out infinite;
}
.build-worker .w-head {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    margin: 0 auto 1px;
}
.build-worker .w-body {
    width: 5px;
    height: 7px;
    border-radius: 1px;
    margin: 0 auto;
}
.build-worker .w-legs {
    display: flex;
    justify-content: center;
    gap: 2px;
}
.build-worker .w-leg {
    width: 2px;
    height: 5px;
    background: #444;
    border-radius: 0 0 1px 1px;
}
/* Helmet colors */
.build-worker .w-head.yellow { background: #F5A623; }
.build-worker .w-head.white { background: #e8e8e8; }
.build-worker .w-head.orange { background: #e8742a; }
.build-worker .w-head.blue { background: #5b9cf6; }
.build-worker .w-head.red { background: #e74c5e; }
.build-worker .w-head.green { background: #4ecb71; }
.build-worker .w-body.vest { background: #F5A623; }
.build-worker .w-body.blue-vest { background: #3a6dc9; }
.build-worker .w-body.white-coat { background: #ddd; }
.build-worker .w-body.orange-vest { background: #cc6622; }
.build-worker .w-body.grey { background: #666; }

@keyframes workerBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1.5px); }
}

/* Sand pile */
.build-sandpile {
    position: absolute;
    z-index: 2;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 8px solid #c4a84a;
}

/* Crates */
.build-crate {
    position: absolute;
    z-index: 3;
    background: #8B6914;
    border: 1px solid #6d5210;
    border-radius: 1px;
}
.build-crate::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 2px;
    right: 2px;
    height: 1px;
    background: #6d5210;
}

/* Stakes (piketpaaltjes) */
.build-stake {
    position: absolute;
    width: 2px;
    height: 10px;
    background: var(--accent);
    z-index: 3;
}
.build-stake::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -1px;
    width: 4px;
    height: 3px;
    background: var(--accent);
    border-radius: 1px;
}

/* Blueprint table */
.build-table {
    position: absolute;
    z-index: 3;
}
.build-table .tabletop {
    width: 20px;
    height: 3px;
    background: #8B6914;
    border-radius: 1px;
}
.build-table .legs {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
}
.build-table .tleg {
    width: 2px;
    height: 8px;
    background: #6d5210;
}
.build-table .blueprint {
    position: absolute;
    top: -2px;
    left: 3px;
    width: 14px;
    height: 3px;
    background: #4a7ab5;
    border-radius: 0.5px;
    opacity: 0.9;
}

/* Truck */
.build-truck {
    position: absolute;
    z-index: 3;
}
.build-truck .truck-cab {
    width: 14px;
    height: 14px;
    background: #cc4444;
    border-radius: 2px 2px 0 0;
    position: relative;
}
.build-truck .truck-cab::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 2px;
    width: 6px;
    height: 5px;
    background: rgba(150,200,255,0.4);
    border-radius: 1px;
}
.build-truck .truck-bed {
    width: 28px;
    height: 12px;
    background: #555;
    border-radius: 0 2px 2px 2px;
    margin-top: -1px;
    margin-left: -14px;
}
.build-truck .truck-wheels {
    display: flex;
    gap: 16px;
    margin-top: 0;
    margin-left: -10px;
}
.build-truck .tw {
    width: 6px;
    height: 6px;
    background: #222;
    border-radius: 50%;
    border: 1px solid #444;
}

/* Forklift */
.build-forklift {
    position: absolute;
    z-index: 4;
}
.build-forklift .fl-body {
    width: 12px;
    height: 10px;
    background: #d4a017;
    border-radius: 2px;
}
.build-forklift .fl-fork {
    width: 2px;
    height: 12px;
    background: #888;
    margin-left: 10px;
    margin-top: -12px;
}
.build-forklift .fl-wheels {
    display: flex;
    gap: 4px;
    margin-top: 0;
}
.build-forklift .fl-w {
    width: 5px;
    height: 5px;
    background: #222;
    border-radius: 50%;
}

/* Scaffolding */
.build-scaffold {
    position: absolute;
    z-index: 3;
}
.build-scaffold .sc-v {
    position: absolute;
    width: 2px;
    background: #777;
}
.build-scaffold .sc-h {
    position: absolute;
    height: 2px;
    background: #666;
}
.build-scaffold .sc-x {
    position: absolute;
    width: 1px;
    background: rgba(150,150,150,0.4);
    transform-origin: top left;
}

/* Welding sparks */
.build-spark {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ffdd44;
    border-radius: 50%;
    z-index: 6;
    animation: sparkFlash 0.3s ease-in-out infinite;
    box-shadow: 0 0 3px 1px rgba(255,221,68,0.6);
}
@keyframes sparkFlash {
    0% { opacity: 1; transform: translate(0,0); }
    50% { opacity: 0; transform: translate(var(--sx), var(--sy)); }
    100% { opacity: 0.8; transform: translate(0,0); }
}

/* Crane */
.build-crane {
    position: absolute;
    z-index: 2;
}
.build-crane .cr-mast {
    width: 3px;
    background: #888;
    position: absolute;
    bottom: 0;
}
.build-crane .cr-jib {
    position: absolute;
    height: 3px;
    background: #777;
}
.build-crane .cr-cable {
    position: absolute;
    width: 1px;
    background: #999;
}
.build-crane .cr-hook {
    position: absolute;
    width: 4px;
    height: 4px;
    border: 1px solid #aaa;
    border-top: none;
    border-radius: 0 0 2px 2px;
}

/* Rocket (built incrementally) */
.build-rocket {
    position: absolute;
    z-index: 4;
    transition: transform 0.3s ease;
}
.build-rocket-base {
    width: 18px;
    height: 14px;
    background: linear-gradient(135deg, #777 0%, #555 100%);
    border-radius: 2px;
    margin: 0 auto;
    position: relative;
}
.build-rocket-base .nozzle {
    width: 8px;
    height: 6px;
    background: #444;
    border-radius: 0 0 3px 3px;
    margin: 0 auto;
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
}
.build-rocket-body-section {
    width: 20px;
    height: 0;
    background: linear-gradient(135deg, #e0e0e0 0%, #b0b0b0 50%, #ccc 100%);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
    transition: height 0.5s ease;
}
.build-rocket-nose {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 18px solid var(--accent);
    margin: 0 auto;
}
.build-rocket-window {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--blue);
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.3);
    box-shadow: 0 0 4px rgba(91,156,246,0.4);
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}
.build-rocket-fin {
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    z-index: 3;
}
.build-rocket-fin.left {
    border-left: 8px solid transparent;
    border-right: 0 solid transparent;
    border-bottom: 14px solid var(--accent);
    transform: skewY(10deg);
}
.build-rocket-fin.right {
    border-left: 0 solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 14px solid var(--accent);
    transform: skewY(-10deg);
}
.build-rocket-stripe {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent);
    opacity: 0.8;
}

/* Fuel truck */
.build-fuel-truck {
    position: absolute;
    z-index: 3;
}
.build-fuel-truck .ft-tank {
    width: 22px;
    height: 10px;
    background: linear-gradient(180deg, #3a7a3a, #2a5a2a);
    border-radius: 5px;
}
.build-fuel-truck .ft-cab {
    width: 10px;
    height: 10px;
    background: #2a5a2a;
    border-radius: 2px 2px 0 0;
    margin-left: 22px;
    margin-top: -10px;
}
.build-fuel-truck .ft-wheels {
    display: flex;
    gap: 14px;
    margin-top: 0;
}
.build-fuel-truck .ft-w {
    width: 5px;
    height: 5px;
    background: #222;
    border-radius: 50%;
}

/* Fuel hose */
.build-hose {
    position: absolute;
    height: 2px;
    background: #555;
    z-index: 3;
    border-radius: 1px;
}

/* Control panel */
.build-panel {
    position: absolute;
    z-index: 4;
}
.build-panel .panel-body {
    width: 14px;
    height: 16px;
    background: #333;
    border: 1px solid #555;
    border-radius: 2px;
}
.build-panel .panel-screen {
    width: 10px;
    height: 6px;
    background: #1a3a2a;
    margin: 2px auto;
    border-radius: 1px;
    box-shadow: 0 0 3px rgba(78,203,113,0.3);
}
.build-panel .panel-lights {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin-top: 2px;
}
.build-panel .pl {
    width: 2px;
    height: 2px;
    border-radius: 50%;
    animation: panelBlink 1.5s ease-in-out infinite;
}
.build-panel .pl.g { background: var(--green); }
.build-panel .pl.r { background: var(--red); animation-delay: 0.5s; }
.build-panel .pl.y { background: var(--accent); animation-delay: 1s; }
@keyframes panelBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Cables */
.build-cable {
    position: absolute;
    width: 1px;
    background: #666;
    z-index: 3;
}

/* Countdown board */
.build-countdown {
    position: absolute;
    z-index: 5;
    text-align: center;
}
.build-countdown .cd-board {
    background: #111;
    border: 1px solid #444;
    border-radius: 2px;
    padding: 3px 5px;
}
.build-countdown .cd-text {
    font-family: monospace;
    font-size: 7px;
    font-weight: 700;
    color: var(--green);
    text-shadow: 0 0 4px rgba(78,203,113,0.5);
    letter-spacing: 1px;
}

/* Steam / mist */
.build-steam {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    z-index: 6;
    animation: steamRise 2.5s ease-out infinite;
}
@keyframes steamRise {
    0% { opacity: 0.4; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-40px) scale(2); }
}

/* Launch flame */
.build-launch-flame {
    position: absolute;
    z-index: 3;
}
.build-launch-flame .lf-core {
    width: 12px;
    height: 20px;
    background: #fff;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    margin: 0 auto;
    box-shadow: 0 0 8px 3px rgba(255,255,255,0.7);
    animation: flameFlicker 0.1s ease-in-out infinite alternate;
}
.build-launch-flame .lf-outer {
    width: 22px;
    height: 40px;
    background: var(--accent);
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    margin: -12px auto 0;
    box-shadow: 0 0 16px 6px rgba(245,166,35,0.5);
    animation: flameFlicker 0.12s ease-in-out infinite alternate;
}
.build-launch-flame .lf-tip {
    width: 16px;
    height: 30px;
    background: var(--red);
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    margin: -8px auto 0;
    opacity: 0.8;
    animation: flameFlicker 0.15s ease-in-out infinite alternate;
}
@keyframes flameFlicker {
    from { transform: scaleX(1) scaleY(1); }
    to { transform: scaleX(0.85) scaleY(1.08); }
}

/* Launch smoke */
.build-smoke {
    position: absolute;
    border-radius: 50%;
    background: rgba(200,200,200,0.2);
    z-index: 2;
    animation: smokeExpand 3s ease-out forwards;
}
@keyframes smokeExpand {
    0% { opacity: 0.5; transform: scale(0.5); }
    100% { opacity: 0; transform: scale(4); }
}

/* Launch animation */
.build-rocket.launching {
    animation: rocketLaunch 3s cubic-bezier(0.15, 0, 0.7, 1) forwards;
}
@keyframes rocketLaunch {
    0% { transform: translateY(0); }
    8% { transform: translateY(3px); }
    15% { transform: translateY(0); }
    100% { transform: translateY(var(--launch-y, -160px)); }
}

/* Screen shake */
.build-scene.shaking {
    animation: screenShake 0.5s ease-in-out;
}
@keyframes screenShake {
    0%, 100% { transform: translate(0,0); }
    10% { transform: translate(-2px, 1px); }
    20% { transform: translate(2px, -1px); }
    30% { transform: translate(-1px, 2px); }
    40% { transform: translate(1px, -1px); }
    50% { transform: translate(-2px, 0); }
    60% { transform: translate(1px, 1px); }
    70% { transform: translate(-1px, -2px); }
    80% { transform: translate(2px, 1px); }
    90% { transform: translate(-1px, -1px); }
}


/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === MOBILE HEADER === */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    z-index: 1001;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    /* Safe area for iPhone notch */
    padding-top: env(safe-area-inset-top);
}
.mobile-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}
.mobile-menu-btn:hover {
    background: var(--border);
}
.mobile-menu-btn svg {
    width: 22px;
    height: 22px;
}
.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1002;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-nav-overlay.open {
    display: block;
    opacity: 1;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .sleep-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }
    .mobile-header {
        display: flex;
    }
    .sidebar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        z-index: 1003;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main {
        margin-left: 0;
        padding: 20px;
        padding-top: calc(56px + env(safe-area-inset-top) + 16px);
        max-width: 100vw;
        overflow-x: hidden;
    }
    .section {
        max-width: 100%;
        overflow-x: hidden;
    }
    .card, .stat-card, .training-progress-card, .chart-card {
        max-width: 100%;
        overflow-x: hidden;
    }
    canvas {
        max-width: 100% !important;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    /* Smaller font sizes on mobile */
    .page-header h2 {
        font-size: 20px;
    }
    .stat-card .stat-value {
        font-size: 22px;
    }
    /* Activities table scroll */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Widget grid single column on mobile */
    .overview-widgets {
        grid-template-columns: 1fr;
    }
    .overview-widget[data-size="half"],
    .overview-widget[data-size="full"] {
        grid-column: span 1;
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .main {
        padding: 12px;
        padding-top: calc(56px + env(safe-area-inset-top) + 12px);
    }
    /* Safe area bottom padding for iPhone home indicator */
    .section {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* === SETTINGS PANEL === */
.settings-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
}
.settings-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
    border-color: var(--text-muted);
}
.settings-btn svg { flex-shrink: 0; }

.settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.settings-panel.open { transform: translateX(0); }

.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1099;
}
.settings-overlay.open { display: block; }

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.settings-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.settings-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.settings-close:hover { color: var(--text-primary); }

.settings-section {
    margin-bottom: 28px;
}
.settings-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Color Swatches */
.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: rgba(0,0,0,0.6);
    transition: all 0.2s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-primary); }
.custom-swatch {
    background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red) !important;
    position: relative;
    overflow: hidden;
    font-size: 18px;
    color: #fff;
}
.custom-swatch input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Widget Toggles */
.widget-toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}
.widget-toggle-item:last-child { border-bottom: none; }
.widget-toggle-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Edit Dashboard button active state */
#editDashboardBtn.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

@media (max-width: 768px) {
    .settings-panel { width: 100%; }
}

/* === TAB NAVIGATION (sections) === */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* === TOAST NOTIFICATIONS === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1001;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    border-color: var(--red);
}

.toast.success {
    border-color: var(--green);
}

/* === PERSONAL RECORDS === */
.pr-section { margin-bottom: 32px; }
.pr-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.pr-header h3 { font-size: 15px; font-weight: 600; }
.pr-trophy { font-size: 18px; }

.pr-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.pr-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
}

.pr-card:hover { border-color: var(--accent-glow); transform: translateY(-1px); }
.pr-card-orange { border-left: 3px solid var(--accent); }
.pr-card-blue { border-left: 3px solid var(--blue); }
.pr-card-green { border-left: 3px solid var(--green); }

.pr-card-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.pr-card-body { flex: 1; min-width: 0; }
.pr-card-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.pr-card-value { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.pr-card-unit { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.pr-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* PR New Record Glow */
.pr-card.pr-new {
    border-color: var(--accent) !important;
    box-shadow: 0 0 12px rgba(245, 166, 35, 0.35), 0 0 30px rgba(245, 166, 35, 0.12);
    animation: prGlow 2s ease-in-out 3;
}
.pr-card.pr-new .pr-card-value { color: var(--accent); }
@keyframes prGlow {
    0%, 100% { box-shadow: 0 0 12px rgba(245, 166, 35, 0.35), 0 0 30px rgba(245, 166, 35, 0.12); }
    50% { box-shadow: 0 0 20px rgba(245, 166, 35, 0.55), 0 0 45px rgba(245, 166, 35, 0.2); }
}

/* === COACH JERRY (Blue Mountain State vibes) === */
.coach-jerry-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 16px;
    border-left: 3px solid var(--accent);
    transition: all 0.2s ease;
}
.coach-jerry-card:hover { border-color: var(--accent-glow); }

/* ── Avatar container — lean athletic coach ── */
.coach-jerry-avatar {
    flex-shrink: 0;
    width: 72px;
    height: 120px;
    position: relative;
    animation: jerryIdle 4s ease-in-out infinite;
    transform: rotate(-2deg);
}
@keyframes jerryIdle {
    0%, 100% { transform: rotate(-2deg) translateY(0); }
    50% { transform: rotate(-2deg) translateY(-2px); }
}

/* ── Sneakers — fresh kicks with color accent ── */
.jerry-shoe {
    position: absolute;
    bottom: 0;
    width: 15px;
    height: 7px;
    background: #f0f0f0;
    border-radius: 3px 7px 3px 3px;
    z-index: 1;
}
.jerry-shoe.l { left: 12px; }
.jerry-shoe.r { right: 10px; }
/* Sole */
.jerry-shoe::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2.5px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
}
/* Nike-style swoosh */
.jerry-shoe::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 3px;
    width: 7px;
    height: 3px;
    border-bottom: 1.5px solid var(--accent);
    border-radius: 0 0 0 5px;
}

/* ── Legs — longer & leaner, khaki shorts ── */
.jerry-leg {
    position: absolute;
    bottom: 5px;
    width: 9px;
    height: 26px;
    background: #8B7355;
    border-radius: 3px 3px 4px 4px;
}
.jerry-leg.l { left: 16px; }
.jerry-leg.r { right: 14px; }
/* Skin below shorts (calves) */
.jerry-leg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1px;
    width: 7px;
    height: 10px;
    background: #d4a574;
    border-radius: 0 0 3px 3px;
}

/* ── Torso — navy track jacket (closed, zip) over orange tee ── */
.jerry-torso {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 30px;
    background: #1a2744;
    border-radius: 5px 5px 3px 3px;
    z-index: 2;
    overflow: hidden;
}
/* Orange tee visible at collar */
.jerry-collar {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 5px;
    background: #e8532e;
    border-radius: 0 0 4px 4px;
    z-index: 1;
}
/* Zipper line */
.jerry-stripe {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 1.5px;
    height: 22px;
    background: #888;
}
/* "J" logo on chest (like BMS logo) */
.jerry-logo {
    position: absolute;
    top: 7px;
    left: 5px;
    width: 10px;
    height: 8px;
    border: 1px solid #F5A623;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.jerry-logo::after {
    content: 'J';
    font-size: 6px;
    font-weight: 900;
    color: #F5A623;
    font-family: 'Georgia', serif;
}
/* White + orange side stripes on torso */
.jerry-torso::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to right, #F5A623 40%, #fff 40%);
}
.jerry-torso::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to left, #F5A623 40%, #fff 40%);
}

/* Jacket unused classes (kept for compat) */
.jerry-jacket { display: none; }
.jerry-jacket-l, .jerry-jacket-r, .jerry-jacket-collar { display: none; }

/* ── Arms — navy jacket sleeves with stripes ── */
.jerry-arm {
    position: absolute;
    width: 9px;
    border-radius: 4px;
    z-index: 3;
    background: #1a2744;
}
/* Left arm — relaxed at side */
.jerry-arm.l {
    bottom: 22px;
    left: 5px;
    height: 26px;
    transform: rotate(6deg);
}
/* Left hand below sleeve */
.jerry-arm.l::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 1px;
    width: 7px;
    height: 5px;
    background: #d4a574;
    border-radius: 3px;
}
/* Orange+white stripe on left sleeve */
.jerry-arm.l::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to left, #F5A623 40%, #fff 40%);
    border-radius: 0 4px 4px 0;
}
/* Right arm — slightly bent, coach stance */
.jerry-arm.r {
    bottom: 28px;
    right: 3px;
    height: 20px;
    transform: rotate(-15deg);
    transform-origin: top center;
}
/* Right hand */
.jerry-arm.r::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 1px;
    width: 7px;
    height: 5px;
    background: #d4a574;
    border-radius: 3px;
}
/* Orange+white stripe on right sleeve */
.jerry-arm.r::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to right, #F5A623 40%, #fff 40%);
    border-radius: 4px 0 0 4px;
}
/* Forearm hidden */
.jerry-forearm { display: none; }

/* ── Neck ── */
.jerry-neck {
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 5px;
    background: #d4a574;
    z-index: 2;
}

/* ── Head — mature coach face ── */
.jerry-head {
    position: absolute;
    bottom: 59px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    background: #d4a574;
    border-radius: 9px 9px 5px 5px;
    z-index: 5;
}
/* Strong jawline */
.jerry-jaw {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 5px;
    background: #c99a64;
    border-radius: 0 0 5px 5px;
}
/* Stubble hidden */
.jerry-stubble { display: none; }
/* Slight frown / serious mouth */
.jerry-mouth {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 2px;
    border-bottom: 1.5px solid #a07050;
    border-radius: 0 0 2px 2px;
}

/* ── Glasses — thin rectangular wire frames ── */
.jerry-eyes {
    position: absolute;
    bottom: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    width: 22px;
    height: 7px;
}
.jerry-eye {
    position: absolute;
    top: 0;
    width: 9px;
    height: 6px;
    border: 1px solid #aaa;
    border-radius: 1.5px;
    background: rgba(200, 220, 255, 0.08);
}
.jerry-eye.l { left: 0; }
.jerry-eye.r { right: 0; }
/* Pupils behind glasses */
.jerry-eye::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3px;
    background: #2c2c2c;
    border-radius: 50%;
}
/* Glasses bridge */
.jerry-eye.l::before {
    content: '';
    position: absolute;
    top: 2px;
    right: -3px;
    width: 3px;
    height: 1px;
    background: #aaa;
}
/* Glasses temple arm hint */
.jerry-eye.r::before {
    display: none;
}

/* ── Eyebrows — thick, expressive ── */
.jerry-brow {
    position: absolute;
    width: 7px;
    height: 0;
    border-top: 2px solid #3d2b1f;
    border-radius: 1px;
    z-index: 7;
}
.jerry-brow.l {
    bottom: 76px;
    left: 50%;
    margin-left: -10px;
    transform: rotate(-5deg);
}
.jerry-brow.r {
    bottom: 76px;
    left: 50%;
    margin-left: 4px;
    transform: rotate(5deg);
}

/* ── Hair — dark, messy, sticking out above visor ── */
.jerry-hair {
    position: absolute;
    bottom: 78px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 8px;
    z-index: 6;
}
/* Hair tufts */
.jerry-hair-tuft {
    position: absolute;
    bottom: 0;
    background: #2c1810;
    border-radius: 2px 2px 0 0;
}
.jerry-hair-tuft:nth-child(1) { left: 1px; width: 4px; height: 7px; transform: rotate(-8deg); }
.jerry-hair-tuft:nth-child(2) { left: 6px; width: 4px; height: 9px; transform: rotate(-3deg); }
.jerry-hair-tuft:nth-child(3) { left: 11px; width: 4px; height: 8px; transform: rotate(2deg); }
.jerry-hair-tuft:nth-child(4) { left: 16px; width: 4px; height: 7px; transform: rotate(5deg); }
.jerry-hair-tuft:nth-child(5) { left: 20px; width: 4px; height: 5px; transform: rotate(10deg); }

/* ── Visor — khaki/tan, pushed up on forehead ── */
.jerry-cap {
    position: absolute;
    bottom: 76px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8;
}
/* Visor band (sweatband) */
.jerry-cap-crown {
    width: 24px;
    height: 5px;
    background: #c4a96a;
    border-radius: 2px 2px 0 0;
    position: relative;
    border: 1px solid #b09858;
    border-bottom: none;
}
/* Logo on visor band */
.jerry-cap-logo {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 4px;
    color: #e8532e;
    font-weight: 900;
    line-height: 5px;
    font-family: 'Georgia', serif;
    letter-spacing: -0.3px;
}
/* Visor brim — facing forward, curved */
.jerry-cap-brim {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 5px;
    background: #c4a96a;
    border-radius: 0 0 12px 12px;
    border: 1px solid #b09858;
    border-top: none;
    box-shadow: 0 2px 3px rgba(0,0,0,0.2);
}

/* ── Whistle on cord around neck ── */
.jerry-whistle {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8;
}
.jerry-whistle-cord {
    width: 20px;
    height: 12px;
    border: 1.5px solid #555;
    border-top: none;
    border-radius: 0 0 10px 10px;
    position: relative;
}
.jerry-whistle-body {
    position: absolute;
    bottom: -3px;
    left: -4px;
    width: 9px;
    height: 5px;
    background: linear-gradient(to bottom, #e0e0e0, #bbb);
    border-radius: 2px 5px 5px 2px;
    border: 1px solid #999;
}
/* Whistle mouthpiece */
.jerry-whistle-body::after {
    content: '';
    position: absolute;
    top: 1px;
    left: -3px;
    width: 4px;
    height: 3px;
    background: #ccc;
    border-radius: 2px 0 0 2px;
    border: 1px solid #999;
    border-right: none;
}

/* Stopwatch hidden — whistle is the main accessory */
.jerry-stopwatch { display: none; }

/* ── Content area ── */
.coach-jerry-content {
    flex: 1;
    min-width: 0;
}
.coach-jerry-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.coach-jerry-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.coach-jerry-badge {
    font-size: 11px;
    color: var(--accent);
    background: rgba(245, 166, 35, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.coach-jerry-tip {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    animation: tipFadeIn 0.8s ease-out;
}
@keyframes tipFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mood indicators */
.coach-jerry-card[data-mood="warning"] { border-left-color: #e74c5e; }
.coach-jerry-card[data-mood="positive"] { border-left-color: var(--green); }
.coach-jerry-card[data-mood="nudge"] { border-left-color: var(--blue); }
.coach-jerry-card[data-mood="focus"] { border-left-color: var(--purple); }

/* Mobile */
@media (max-width: 600px) {
    .coach-jerry-card { padding: 16px; gap: 16px; }
    .coach-jerry-avatar { width: 58px; height: 96px; transform: scale(0.8) rotate(-2deg); }
}

/* === RACE SIMULATION === */
.race-sim-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 0;
}

.race-sim-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.race-sim-header h3 { font-size: 15px; font-weight: 600; }
.race-sim-subtitle { font-size: 12px; color: var(--text-muted); }
.race-sim-empty { text-align: center; color: var(--text-muted); padding: 24px; font-size: 13px; }

.race-sim-total { text-align: center; margin-bottom: 20px; }
.race-sim-total-time { font-size: 42px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.race-sim-total-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.race-sim-vs-goal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.race-sim-vs-goal.under { color: var(--green); background: rgba(78, 203, 113, 0.1); }
.race-sim-vs-goal.over { color: var(--accent); background: rgba(245, 166, 35, 0.1); }
.race-sim-goal-label { font-weight: 400; color: var(--text-muted); font-size: 12px; }

.race-sim-progress {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    gap: 2px;
    margin-bottom: 20px;
}

.race-sim-segment { border-radius: 3px; min-width: 4px; }

.race-sim-legs { display: flex; flex-direction: column; gap: 2px; }

.race-sim-leg {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.race-sim-leg:hover { background: rgba(255, 255, 255, 0.04); }
.race-sim-leg-transition { opacity: 0.5; }
.race-sim-leg-icon { font-size: 20px; width: 32px; text-align: center; flex-shrink: 0; }
.race-sim-leg-info { flex: 1; }
.race-sim-leg-name { font-size: 14px; font-weight: 600; }
.race-sim-leg-detail { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.race-sim-leg-time { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
.race-sim-leg-time.estimated { color: var(--text-muted); font-style: italic; }

@media (max-width: 600px) {
    .pr-cards { grid-template-columns: repeat(2, 1fr); }
    .race-sim-total-time { font-size: 32px; }
}

/* overview-duo-row no longer used — flat widget grid replaces it */

/* === TRAINING PROGRESS === */
.training-progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 0;
}
.tp-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }
.tp-header h3 { font-size: 16px; font-weight: 700; margin: 0; }
.tp-subtitle { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.tp-total-bar { margin-bottom: 24px; }
.tp-total-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.tp-total-pct { color: var(--accent); font-weight: 700; }
.tp-bar-track { width: 100%; height: 12px; background: rgba(255,255,255,0.06); border-radius: 6px; overflow: hidden; }
.tp-bar-fill { height: 100%; border-radius: 6px; min-width: 2px; }
.tp-total-km { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-align: right; }
.tp-sports { display: flex; flex-direction: column; gap: 16px; }
.tp-sport-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.tp-sport-icon { font-size: 16px; }
.tp-sport-label { font-weight: 600; }
.tp-sport-km { margin-left: auto; color: var(--text-muted); font-size: 12px; }

/* === CONFETTI === */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    left: var(--x);
    opacity: 0;
    animation: confettiFall var(--fall-duration) ease-in var(--fall-delay) forwards;
}

.confetti-square { width: 10px; height: 10px; border-radius: 2px; }
.confetti-circle { width: 8px; height: 8px; border-radius: 50%; }
.confetti-strip { width: 4px; height: 14px; border-radius: 2px; }

@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(0) translateX(0) rotate(var(--rotation)) scale(1); }
    75% { opacity: 1; }
    100% { opacity: 0; transform: translateY(100vh) translateX(var(--drift)) rotate(var(--rotation-end)) scale(0.5); }
}

.wt-check-btn {
    font-size: 14px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.wt-check-btn:hover {
    transform: scale(1.2);
}

/* === SPORT COLOR CODING === */
.schema-day.sport-swim {
    border-left: 3px solid #5b9cf6;
    background: rgba(91, 156, 246, 0.06);
}
.schema-day.sport-run {
    border-left: 3px solid #F5A623;
    background: rgba(245, 166, 35, 0.06);
}
.schema-day.sport-bike {
    border-left: 3px solid #4ecb71;
    background: rgba(78, 203, 113, 0.06);
}
.schema-day.sport-brick {
    border-left: 3px solid #a77bfa;
    background: rgba(167, 123, 250, 0.06);
}
.schema-day.sport-race {
    border-left: 3px solid #e74c5e;
    background: rgba(231, 76, 94, 0.06);
}

/* === SCHEMA DRAG & DROP === */
.schema-drag-handle {
    cursor: grab;
    opacity: 0.3;
    font-size: 12px;
    letter-spacing: -1px;
    user-select: none;
    transition: opacity 0.2s;
    margin-right: 4px;
}
.schema-day:hover .schema-drag-handle {
    opacity: 0.7;
}
.schema-day[draggable="true"] {
    cursor: grab;
    transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.schema-day[draggable="true"]:active {
    cursor: grabbing;
}
.schema-day.dragging {
    opacity: 0.4;
    transform: scale(0.97);
}
.schema-day.drag-over {
    box-shadow: inset 0 0 0 2px var(--accent);
    border-radius: 8px;
    background: rgba(245, 166, 35, 0.08) !important;
}

/* ========================================
   AUTH PAGES (Login, Register, Onboarding, Settings)
   ======================================== */

.auth-page {
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-top: 0.75rem;
}

.auth-logo h1 span {
    color: var(--accent);
}

.auth-card h2 {
    color: var(--text-primary);
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.auth-btn {
    background: var(--bg-primary);
    color: var(--accent);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
    width: 100%;
    margin-top: 0.5rem;
    background-image: linear-gradient(var(--bg-primary), var(--bg-primary)), linear-gradient(135deg, #F5A623, #4ecb71, #5b9cf6);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.auth-btn:hover { opacity: 0.9; }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-btn-google {
    background: var(--bg-primary);
    background-image: none;
    color: var(--text-primary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
}

.auth-btn-google:hover {
    background: var(--bg-card-hover);
    opacity: 1;
}

.auth-btn-secondary {
    background: transparent;
    background-image: none;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.auth-btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    opacity: 1;
}

.auth-btn-danger {
    background: var(--red);
    background-image: none;
    color: #fff;
    border-color: var(--red);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 1rem;
}

.auth-link {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-link a {
    color: var(--accent);
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

.auth-error {
    background: rgba(231, 76, 94, 0.1);
    border: 1px solid rgba(231, 76, 94, 0.3);
    color: var(--red);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.auth-success {
    background: rgba(78, 203, 113, 0.1);
    border: 1px solid rgba(78, 203, 113, 0.3);
    color: var(--green);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Onboarding */
.onboarding-container {
    width: 100%;
    max-width: 520px;
    padding: 1.5rem;
}

.onboarding-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.onboarding-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #F5A623, #4ecb71, #5b9cf6);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 14.3%;
}

.progress-text {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.onboarding-step h2 {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    text-align: left;
}

.onboarding-step > p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.choice-grid-narrow {
    grid-template-columns: repeat(4, 1fr);
}

.choice-btn {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition);
}

.choice-btn:hover {
    border-color: #4ecb71;
    background: var(--bg-card-hover);
}

.choice-btn.active {
    border-color: #4ecb71;
    background: linear-gradient(135deg, rgba(245,166,35,0.12), rgba(78,203,113,0.12), rgba(91,156,246,0.12));
}

.choice-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.choice-icon {
    font-size: 1.5rem;
}

.time-input-group {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.time-sep {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.time-input {
    width: 80px !important;
    text-align: center;
}

.disclaimer-box {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.disclaimer-box p + p {
    margin-top: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 1rem;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    accent-color: #4ecb71;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.onboarding-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
}

.onboarding-btn-back {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition);
}

.onboarding-btn-back:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.onboarding-btn-next {
    flex: 1;
    max-width: 200px;
    margin-left: auto;
    margin-top: 0;
}

/* Settings page */
.settings-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.settings-header {
    margin-bottom: 2rem;
}

.settings-header h1 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-top: 0.5rem;
}

.settings-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color var(--transition);
}

.settings-back:hover {
    color: var(--accent);
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h2 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.settings-section .form-group {
    margin-bottom: 1rem;
}

.settings-section .auth-btn {
    margin-top: 0.5rem;
}

.garmin-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.garmin-status-ok {
    color: var(--green);
}

/* Sidebar user */
.sidebar-user {
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.user-name {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

/* Welcome modal */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.welcome-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    animation: slideUp 0.4s ease;
}

.welcome-avatar {
    margin-bottom: 1.25rem;
}

.welcome-coach-avatar {
    position: relative;
    width: 72px;
    height: 120px;
    margin: 0 auto 1.5rem;
    transform: scale(1.15);
    animation: jerryIdle 4s ease-in-out infinite;
}

.welcome-rocket {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.welcome-modal h2 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.welcome-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

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

.welcome-signature {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.95rem;
    margin: 1rem 0 1.5rem;
}

.welcome-btn {
    max-width: 280px;
    margin: 0 auto;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ── Coach Helper (schema explainer) ──────────────── */
.coach-helper {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: none; /* shown via JS when on schema */
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    cursor: pointer;
    z-index: 100;
    animation: fadeIn 0.5s ease;
}

.coach-helper * {
    pointer-events: none;
}

.coach-helper-avatar {
    position: relative;
    width: 52px;
    height: 86px;
    flex-shrink: 0;
    transform: scale(0.7);
    animation: jerryIdle 4s ease-in-out infinite;
}

.coach-helper-avatar-small {
    width: 40px;
    height: 66px;
    transform: scale(0.6);
    transform-origin: bottom center;
}

.coach-helper-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px 12px 12px 0;
    padding: 0.6rem 0.9rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 200px;
    line-height: 1.4;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    position: relative;
}

.coach-helper-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 12px;
    width: 0;
    height: 0;
    border-right: 8px solid transparent;
    border-top: 6px solid var(--bg-card);
}

.coach-helper:hover .coach-helper-bubble {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Explainer overlay */
.coach-explainer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.coach-explainer-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease;
    margin-right: 1rem;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.coach-explainer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.coach-explainer-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.coach-explainer-title h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0;
}

.coach-explainer-title p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0.15rem 0 0;
}

.coach-explainer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.coach-explainer-close:hover {
    color: var(--text-primary);
}

.coach-explainer-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.explainer-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.explainer-item:last-child {
    border-bottom: none;
}

.explainer-term {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.explainer-term-icon {
    font-size: 1rem;
}

.explainer-term-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.explainer-term-desc {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.55;
    padding-left: 1.5rem;
}

.explainer-section-title {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1rem 0 0.5rem;
    padding-top: 0.5rem;
}

.explainer-section-title:first-child {
    margin-top: 0;
    padding-top: 0;
}

@media (max-width: 768px) {
    .coach-helper {
        bottom: 1rem;
        right: 1rem;
    }
    .coach-helper-bubble {
        display: none;
    }
    .coach-helper-avatar {
        transform: scale(0.8);
    }
    .coach-explainer-panel {
        max-width: 100%;
        margin-right: 0;
        max-height: 80vh;
    }
}

/* Mobile auth */
@media (max-width: 480px) {
    .auth-card, .onboarding-card {
        padding: 1.5rem 1.25rem;
    }
    .choice-grid-narrow {
        grid-template-columns: repeat(2, 1fr);
    }
}
