/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0a0a0a;
    --bg-card: #1a1a1a;
    --bg-elevated: #242424;
    --text: #f5f5f5;
    --text-dim: #999;
    --accent: #ff7a00;
    --accent-dim: #cc6200;
    --accent-soft: rgba(255,122,0,0.15);
    --border: #333;
    --success: #4caf50;
    --danger: #f44336;
    --shadow: rgba(0,0,0,0.4);
    --chart-1: #ff7a00;
    --chart-2: #4fc3f7;
    --chart-3: #81c784;
    --chart-4: #ba68c8;
    --chart-5: #ffd54f;
    --chart-6: #ff8a65;
    --chart-7: #4db6ac;
    --chart-8: #f06292;
    --chart-9: #90a4ae;
    --chart-10: #aed581;
    --chart-11: #9575cd;
}

/* Theme: Dark (black + orange) */
.theme-dark {
    --bg: #0a0a0a; --bg-card: #1a1a1a; --bg-elevated: #2a2a2a;
    --text: #f5f5f5; --text-dim: #888;
    --accent: #ff7a00; --accent-dim: #cc6200; --accent-soft: rgba(255,122,0,0.12);
    --border: #333; --shadow: rgba(0,0,0,0.5);
}

/* Theme: Light (white + black-gray) */
.theme-light {
    --bg: #f5f5f5; --bg-card: #ffffff; --bg-elevated: #ececec;
    --text: #1a1a1a; --text-dim: #666;
    --accent: #333333; --accent-dim: #555; --accent-soft: rgba(50,50,50,0.08);
    --border: #ddd; --shadow: rgba(0,0,0,0.12);
}

/* Theme: Lilac (purple + gold) */
.theme-lilac {
    --bg: #2d1b4e; --bg-card: #3d2b5e; --bg-elevated: #4d3b6e;
    --text: #f0e6ff; --text-dim: #b8a0d0;
    --accent: #ffd700; --accent-dim: #b8860b; --accent-soft: rgba(255,215,0,0.12);
    --border: #5d4b7e; --shadow: rgba(0,0,0,0.35);
}

/* Theme: Pink (pink + blue-cyan) */
.theme-pink {
    --bg: #ff4f8b; --bg-card: #ff6b9d; --bg-elevated: #ff8ab0;
    --text: #ffffff; --text-dim: #ffe0ec;
    --accent: #00d4ff; --accent-dim: #0099cc; --accent-soft: rgba(0,212,255,0.15);
    --border: #ffa0c0; --shadow: rgba(255,80,140,0.3);
}

/* Theme: Red (red + black-gray) */
.theme-red {
    --bg: #c41e3a; --bg-card: #d63046; --bg-elevated: #e0405a;
    --text: #ffffff; --text-dim: #f5c0cc;
    --accent: #1a1a1a; --accent-dim: #333; --accent-soft: rgba(26,26,26,0.15);
    --border: #d05060; --shadow: rgba(120,0,20,0.3);
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.3s, color 0.3s;
}

input, select { -webkit-user-select: text; user-select: text; }

#app {
    max-width: 480px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* ===== Screens ===== */
.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
}
.screen.active { display: flex; }

/* ===== PIN Screen ===== */
#pin-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.pin-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 300px;
}
.pin-logo {
    color: var(--accent);
    margin-bottom: 8px;
}
.pin-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 1px;
}
.pin-subtitle {
    font-size: 14px;
    color: var(--text-dim);
}
.pin-dots {
    display: flex;
    gap: 12px;
    margin: 8px 0 16px;
}
.pin-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid var(--text-dim);
    transition: all 0.2s;
}
.pin-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.15);
}
.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}
.pin-key {
    aspect-ratio: 1.4;
    border: none;
    border-radius: 16px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.pin-key:active {
    transform: scale(0.92);
    background: var(--accent-soft);
}
.pin-key.pin-empty { visibility: hidden; }
.pin-key.pin-back { font-size: 20px; }
.pin-error {
    color: var(--danger);
    font-size: 13px;
    min-height: 18px;
    text-align: center;
}

/* ===== Top Bar ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.top-bar-title {
    font-size: 18px;
    font-weight: 700;
}
.top-bar-actions {
    display: flex;
    gap: 8px;
}
.icon-btn {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.icon-btn:active { transform: scale(0.94); }

/* ===== Tab Bar ===== */
.tab-bar {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    padding: 10px 4px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    font-size: 11px;
}
.tab-btn .tab-icon { font-size: 20px; }
.tab-btn .tab-label { font-weight: 600; }
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ===== Content Area ===== */
.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
.tab-content { display: none; padding: 12px; }
.tab-content.active { display: block; }

/* ===== Carousel ===== */
.carousel-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}
.carousel-viewport {
    overflow: hidden;
    flex: 1;
    height: 140px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.carousel-track {
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.carousel-card {
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    text-align: center;
    flex-shrink: 0;
}
.carousel-card .ex-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
    /* PNG icons are applied via mask-image so they inherit the theme color */
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    background-color: currentColor;
}
/* Fallback for inline SVG icons (kept for compatibility) */
.carousel-card .ex-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}
.carousel-card .ex-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.carousel-card .ex-type {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}
.carousel-card.active-card .ex-icon {
    transform: scale(1.1);
}
.carousel-nav {
    width: 36px;
    height: 56px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--accent);
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.carousel-nav:active { transform: scale(0.9); }
.carousel-nav:disabled { opacity: 0.3; }
.carousel-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}
.carousel-pos {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 13px;
    max-width: 100%;
}
.cp-num { font-weight: 800; color: var(--accent); }
.cp-tot { font-weight: 500; opacity: .6; font-size: 11px; }
.cp-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }

/* ===== Input Panel ===== */
.input-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
}
.info-badge {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    text-align: center;
    margin-bottom: 12px;
    font-weight: 600;
}
.input-group {
    margin-bottom: 14px;
}
.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 600;
}
.input-with-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-elevated);
}
.input-with-stepper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    padding: 12px 8px;
    outline: none;
    min-width: 0;
}
.input-with-stepper input::placeholder { color: var(--text-dim); opacity: 0.5; }
.stepper-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: var(--bg-card);
    color: var(--accent);
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.stepper-btn:active { background: var(--accent-soft); }

.calc-btn, .save-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 4px;
}
.calc-btn {
    background: var(--accent);
    color: var(--bg);
}
.calc-btn:active { transform: scale(0.97); opacity: 0.9; }
.save-btn {
    background: var(--bg-elevated);
    color: var(--accent);
    border: 2px solid var(--accent);
    margin-top: 12px;
}
.save-btn:active { transform: scale(0.97); }

/* ===== Results ===== */
.results {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.result-card {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
}
.result-card .result-formula {
    font-size: 10px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
}
.result-card .result-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    margin: 4px 0;
}
.result-card .result-unit {
    font-size: 11px;
    color: var(--text-dim);
}

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.filter-select {
    flex: 1;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

/* ===== Table ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: var(--bg-card);
    color: var(--text-dim);
    padding: 10px 8px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    white-space: nowrap;
}
.data-table td {
    padding: 10px 8px;
    border-top: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr {
    background: var(--bg-card);
}
.data-table tbody tr:nth-child(even) {
    background: var(--bg-elevated);
}
.data-table .col-rm {
    color: var(--accent);
    font-weight: 700;
}
.del-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}
.empty-icon { font-size: 40px; display: block; margin-bottom: 8px; }

/* ===== Chart ===== */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}
.chart-container canvas {
    width: 100% !important;
    height: auto !important;
}
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
}
.legend-color {
    width: 12px; height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}
.report-summary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .sum-val { font-weight: 700; color: var(--accent); }

/* ===== Awards ===== */
.awards-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.stat-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
}
.stat-card .stat-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
}
.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
}
.awards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.award-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
    opacity: 0.4;
    transition: all 0.2s;
}
.award-card.unlocked {
    opacity: 1;
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-soft);
}
.award-card .award-icon {
    font-size: 28px;
    margin-bottom: 4px;
}
.award-card .award-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.award-card .award-desc {
    font-size: 9px;
    color: var(--text-dim);
    margin-top: 2px;
    line-height: 1.1;
}
.award-card.unlocked .award-icon {
    filter: drop-shadow(0 0 4px var(--accent));
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: flex-end;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--bg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
}
.modal-header h2 { font-size: 18px; }
.modal-close {
    background: var(--bg-elevated);
    border: none;
    color: var(--text);
    width: 32px; height: 32px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}
.modal-body { padding: 16px; }
.settings-section {
    margin-bottom: 24px;
}
.settings-section h3 {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.setting-row label {
    font-size: 14px;
    font-weight: 600;
}
.setting-row input, .setting-row select {
    width: 140px;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
    outline: none;
    text-align: center;
}
/* ===== Theme Grid ===== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.theme-card {
    text-align: center;
    cursor: pointer;
    padding: 8px 4px;
    border: 2px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s;
}
.theme-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.theme-preview {
    width: 100%;
    height: 50px;
    border-radius: 8px;
    margin-bottom: 4px;
}
.dark-preview { background: linear-gradient(135deg, #0a0a0a 50%, #ff7a00 50%); }
.light-preview { background: linear-gradient(135deg, #ffffff 50%, #333 50%); }
.lilac-preview { background: linear-gradient(135deg, #2d1b4e 50%, #ffd700 50%); }
.pink-preview { background: linear-gradient(135deg, #ff4f8b 50%, #00d4ff 50%); }
.red-preview { background: linear-gradient(135deg, #c41e3a 50%, #1a1a1a 50%); }
.theme-card span { font-size: 11px; font-weight: 600; }

/* ===== Lang Toggle ===== */
.lang-toggle-row {
    display: flex;
    gap: 8px;
}
.lang-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.lang-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.settings-action-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
    text-align: left;
    transition: all 0.15s;
}
.settings-action-btn:active { transform: scale(0.98); }
.settings-action-btn.danger { color: var(--danger); border-color: var(--danger); }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--accent);
    box-shadow: 0 4px 20px var(--shadow);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
    text-align: center;
}
.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== Responsive ===== */
@media (max-width: 360px) {
    .awards-grid { grid-template-columns: repeat(2, 1fr); }
    .data-table { font-size: 12px; }
}

/* ============================================================
   V2.0 — 6 sections, home, exercise DB search, chips, records
   ============================================================ */

/* 6-tab bar */
.tab-bar-6 .tab-btn { padding: 8px 2px 6px; gap: 1px; }
.tab-bar-6 .tab-icon { font-size: 17px; line-height: 1; }
.tab-bar-6 .tab-label { font-size: 9px; line-height: 1.15; text-align: center; }

/* Home blocks */
.home-greeting {
    font-size: 20px;
    font-weight: 800;
    margin: 4px 2px 12px;
    color: var(--text);
}
.card-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
}
.block-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: .2px;
}
.placeholder-box {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
}
.ph-icon { font-size: 30px; margin-bottom: 6px; }
.ph-text { font-size: 13px; font-weight: 700; color: var(--text); }
.ph-sub { font-size: 11px; color: var(--text-dim); margin-top: 5px; line-height: 1.45; }
.muted { color: var(--text-dim); font-weight: 600; }

/* Profile grid */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.pf-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pf-k { font-size: 10px; color: var(--text-dim); text-transform: uppercase; }
.pf-v { font-size: 13px; font-weight: 700; color: var(--text); }

/* Last result */
.lr-row { display: flex; align-items: center; justify-content: space-between; }
.lr-name { font-size: 15px; font-weight: 800; color: var(--text); }
.lr-date { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.lr-val { font-size: 22px; font-weight: 800; color: var(--accent); text-align: right; }
.lr-val span { font-size: 12px; }
.lr-delta { font-size: 12px; font-weight: 700; }
.lr-delta.up { color: #22c55e; }
.lr-delta.down { color: #ef4444; }

.stat-row { display: flex; gap: 8px; }

/* Exercise search combobox */
.ex-search-wrap { position: relative; margin-bottom: 10px; }
.ex-search {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 14px;
    font-family: inherit;
}
.ex-search::placeholder { color: var(--text-dim); }
.ex-search:focus { outline: none; border-color: var(--accent); }
.ex-results {
    display: none;
    position: absolute;
    left: 0; right: 0; top: calc(100% + 4px);
    z-index: 50;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 12px;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.ex-results.show { display: block; }
.sr-item {
    padding: 11px 12px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}
.sr-item:last-child { border-bottom: none; }
.sr-item:active { background: var(--bg); }
.sr-name { flex: 1; }
.sr-tag {
    font-size: 9px;
    background: var(--accent);
    color: var(--bg);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 800;
}
.sr-add { color: var(--accent); font-weight: 700; }
.sr-empty { padding: 12px; font-size: 13px; color: var(--text-dim); text-align: center; }

/* Letter icon for custom exercises */
.ex-icon-letter {
    -webkit-mask-image: none !important;
    mask-image: none !important;
    background: transparent !important;
    border: 2px solid var(--accent);
    border-radius: 50%;
    color: var(--accent);
    font-size: 19px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Personal records */
.records-list { display: flex; flex-direction: column; gap: 8px; }
.rec-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 11px;
}
.rec-name { flex: 1; font-size: 13px; font-weight: 700; color: var(--text); }
.rec-val { font-size: 15px; font-weight: 800; color: var(--accent); }
.rec-meta { font-size: 10px; color: var(--text-dim); width: 100%; }
.rec-row { flex-wrap: wrap; }

/* Ready list */
.ready-list { display: flex; flex-direction: column; gap: 7px; }
.ready-item { font-size: 13px; color: var(--text); }

/* Chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.chip.on {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 700;
}
.eq-group { margin-bottom: 10px; }
.eq-group-title { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; font-weight: 700; }

/* Modal pieces */
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.settings-action-btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.hint { font-size: 10.5px; color: var(--text-dim); margin-top: 6px; line-height: 1.4; }
.result-recommended {
    border-color: var(--accent);
}

/* ===== Программа (V2.1) ===== */
.hidden { display: none !important; }
.prog-summary { margin: 14px 0 6px; }
.ps-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border, #2a2a2a); font-size: 14px; }
.ps-row:last-child { border-bottom: none; }
.ps-i { width: 22px; text-align: center; font-size: 15px; }
.ps-k { flex: 1; opacity: .7; }
.ps-v { font-weight: 700; text-align: right; max-width: 55%; }
.prog-avail { font-size: 12px; opacity: .6; text-align: center; margin: 8px 0 4px; }
.prog-create { margin-top: 12px; }
.prog-name { font-size: 13px; opacity: .75; margin: 2px 0 14px; }
.prog-day { border: 1px solid var(--border, #2a2a2a); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.prog-day-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.prog-day-key { width: 24px; height: 24px; border-radius: 8px; background: var(--accent); color: #000; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.prog-day-title { font-weight: 700; font-size: 15px; flex: 1; }
.prog-day-meta { font-size: 11px; opacity: .6; }
.prog-ex { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border, #2a2a2a); }
.prog-ex:first-child { border-top: none; }
.prog-ex-color { width: 4px; height: 30px; border-radius: 3px; flex-shrink: 0; }
.prog-ex-main { flex: 1; min-width: 0; }
.prog-ex-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-ex-sub { font-size: 12px; opacity: .7; margin-top: 1px; }
.prog-ex-icon { width: 26px; height: 26px; color: var(--accent); flex-shrink: 0; }
.prog-ex-icon .ex-icon { width: 26px; height: 26px; }
.prog-cycle-head { display: flex; align-items: center; gap: 8px; padding: 10px 0 4px; font-weight: 700; font-size: 14px; cursor: pointer; }
.prog-cycle-head span:first-child { opacity: .7; }
.cyc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.cyc-table th { text-align: left; opacity: .6; font-weight: 600; font-size: 11px; text-transform: uppercase; padding: 5px 4px; border-bottom: 1px solid var(--border, #2a2a2a); }
.cyc-table td { padding: 6px 4px; border-bottom: 1px solid var(--border, #2a2a2a); }
.cyc-table tr:last-child td { border-bottom: none; }
.prog-actions { margin-top: 14px; }
.settings-action-btn.ghost.danger { color: #ef4444; border-color: #ef4444; }

.prog-sub { font-size: 12px; opacity: .6; margin: -10px 0 12px; }

.prog-weeks-wrap { margin: 14px 0 4px; }
.prog-weeks-label { font-size: 12px; opacity: .6; margin-bottom: 6px; }
.prog-weeks .chip { padding: 6px 14px; font-size: 13px; }

.prog-week-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.wchip { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 42px; padding: 7px 4px; border-radius: 10px; border: 1px solid var(--border, #2a2a2a); background: var(--surface, #1c1c1c); color: var(--text, #e8e8e8); font-size: 15px; font-weight: 700; cursor: pointer; line-height: 1.1; }
.wchip-ph { font-size: 9px; font-weight: 500; opacity: .55; text-transform: uppercase; letter-spacing: .3px; }
.wchip.on { background: var(--accent, #4f8cff); border-color: var(--accent, #4f8cff); color: #fff; }
.wchip.on .wchip-ph { opacity: .85; }

.cyc-on { background: color-mix(in srgb, var(--accent, #4f8cff) 14%, transparent); }
.prog-archive { margin-top: 8px; }
.arch-item { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border, #2a2a2a); }
.arch-item:last-child { border-bottom: none; }
.arch-main { flex: 1; min-width: 0; }
.arch-name { font-size: 14px; font-weight: 600; }
.arch-meta { font-size: 11px; opacity: .6; margin-top: 2px; }
.arch-actions { display: flex; gap: 6px; }
.arch-btn { background: transparent; border: 1px solid var(--border, #333); color: inherit; border-radius: 8px; padding: 5px 9px; font-size: 12px; cursor: pointer; }
.arch-btn.danger { color: #ef4444; border-color: #ef4444; }

/* ===== Каталог и карточка упражнения ===== */
.cat-filters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 10px; }
.cat-filters select { width: 100%; background: var(--card, #1a1a1a); color: inherit; border: 1px solid var(--border, #333); border-radius: 10px; padding: 8px 6px; font-size: 12px; font-family: inherit; }
.cat-count { font-size: 12px; opacity: .6; margin: 10px 0 4px; }
.cat-list { max-height: 52vh; overflow-y: auto; }
.cat-item { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border, #2a2a2a); cursor: pointer; }
.cat-item:last-child { border-bottom: none; }
.cat-ico { width: 30px; height: 30px; color: var(--accent); flex-shrink: 0; }
.cat-ico .ex-icon { width: 30px; height: 30px; }
.cat-main { flex: 1; min-width: 0; }
.cat-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-sub { font-size: 11px; opacity: .6; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar { width: 4px; height: 30px; border-radius: 3px; flex-shrink: 0; }
.cat-empty { padding: 22px 0; text-align: center; opacity: .6; font-size: 13px; }
.exinfo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.exinfo-ico { width: 46px; height: 46px; color: var(--accent); flex-shrink: 0; }
.exinfo-ico .ex-icon { width: 46px; height: 46px; }
.exinfo-name { font-size: 17px; font-weight: 700; }
.exinfo-en { font-size: 12px; opacity: .6; margin-top: 2px; }
.exinfo-row { display: flex; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border, #2a2a2a); font-size: 13px; }
.exinfo-k { width: 108px; opacity: .6; flex-shrink: 0; }
.exinfo-v { flex: 1; }
.exinfo-sec { margin-top: 12px; }
.exinfo-sec-title { font-size: 12px; text-transform: uppercase; opacity: .55; margin-bottom: 4px; }
.exinfo-text { font-size: 13px; line-height: 1.5; opacity: .9; }
.exinfo-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.exinfo-chip { font-size: 11px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border, #333); opacity: .85; }

.prog-add { justify-content: flex-start; gap: 8px; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; padding-left: 14px; }
.cat-go { opacity: .4; font-size: 20px; line-height: 1; }

.exinfo-img { display: flex; align-items: stretch; gap: 6px; margin-bottom: 14px; background: rgba(255,255,255,.02); border: 1px solid var(--border, #2a2a2a); border-radius: 8px; padding: 8px; }
.exinfo-img-ph { flex: 1; display: flex; flex-direction: column; align-items: center; }
.exinfo-img-ph img { width: 100%; max-width: 180px; height: auto; border-radius: 6px; background: #fff; padding: 4px; }
.exinfo-img-lbl { font-size: 10px; text-transform: uppercase; opacity: .6; margin-top: 4px; letter-spacing: .5px; }
.exinfo-img-arrow { display: flex; align-items: center; font-size: 18px; opacity: .5; padding: 0 2px; }

/* ===== Favorites (§3 пункта 3) ===== */
.fav-toggle {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border, #2a2a2a);
    border-radius: 14px;
    background: transparent;
    color: var(--text, #e8e8e8);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: all .15s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.fav-toggle.on {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.fav-toggle:active { transform: scale(.98); }

.cat-num {
    min-width: 26px;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--accent);
    opacity: .85;
}
.cat-fav {
    border: none;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--border, #444);
    padding: 0 2px;
    transition: all .12s;
}
.cat-fav.on { color: var(--accent); text-shadow: 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent); }
.cat-fav:active { transform: scale(1.2); }

/* ===== Editable weight in Program (§4 пункта 4) ===== */
.prog-ex-edit { display: flex; align-items: center; }
.prog-ex-w {
    width: 62px;
    padding: 6px 8px;
    border: 1px solid var(--border, #2a2a2a);
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text, #e8e8e8);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}
.prog-ex-w:focus { outline: none; border-color: var(--accent); }

/* ===== Carousel exercise number (§5 пункта 5) ===== */
.ex-num {
    position: absolute;
    top: 6px; left: 8px;
    font-size: 11px;
    font-weight: 800;
    color: var(--accent);
    opacity: .7;
}
.carousel-card { position: relative; }

/* ===== Plan V2.2 ===== */
.plan-start-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.plan-start-row label { font-size: 13px; opacity: .75; }
.plan-start-row input[type="date"] {
    background: var(--bg-elevated); color: var(--text, #e8e8e8);
    border: 1px solid var(--border, #2a2a2a); border-radius: 10px;
    padding: 7px 10px; font-size: 13px; font-weight: 600;
}
.plan-no-prog { font-size: 13px; opacity: .7; padding: 8px 0; }
.plan-item {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid var(--border, #2a2a2a); border-radius: 14px;
    padding: 11px 12px; margin-bottom: 9px;
}
.plan-item.done { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.plan-date { min-width: 74px; }
.plan-date input[type="date"] {
    background: transparent; color: var(--text, #e8e8e8);
    border: 1px solid var(--border, #2a2a2a); border-radius: 8px;
    padding: 4px 6px; font-size: 12px; font-weight: 700;
}
.plan-main { flex: 1; min-width: 0; }
.plan-day-key { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); color: #000;
    font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.plan-title-txt { font-weight: 700; font-size: 14px; }
.plan-meta { font-size: 11px; opacity: .65; margin-top: 2px; }
.plan-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
    border: 1px solid var(--border, #2a2a2a); opacity: .8; white-space: nowrap; }
.plan-badge.done { color: var(--accent); border-color: var(--accent); opacity: 1; }
.plan-go { font-size: 18px; opacity: .5; }

/* ===== Workout modal ===== */
.wo-summary { display: flex; gap: 8px; margin-bottom: 12px; }
.wo-stat { flex: 1; background: var(--bg-elevated); border: 1px solid var(--border, #2a2a2a);
    border-radius: 12px; padding: 8px 10px; text-align: center; }
.wo-stat-val { font-size: 17px; font-weight: 800; color: var(--accent); }
.wo-stat-lbl { font-size: 10px; opacity: .65; margin-top: 2px; }
.wo-ex { border: 1px solid var(--border, #2a2a2a); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.wo-ex-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.wo-ex-name { font-weight: 700; font-size: 14px; flex: 1; }
.wo-ex-ton { font-size: 12px; font-weight: 700; color: var(--accent); }
.wo-sets { display: flex; flex-direction: column; gap: 5px; }
.wo-set { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.wo-set-idx { width: 20px; font-size: 11px; opacity: .6; }
.wo-chk { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border, #2a2a2a);
    background: transparent; color: var(--bg); font-size: 14px; cursor: pointer; display: flex;
    align-items: center; justify-content: center; flex: none; }
.wo-chk.on { background: var(--accent); border-color: var(--accent); }
.wo-inp { width: 58px; padding: 5px 7px; border: 1px solid var(--border, #2a2a2a); border-radius: 8px;
    background: var(--bg-elevated); color: var(--text, #e8e8e8); font-size: 12px; font-weight: 700; text-align: right; }
.wo-inp:focus { outline: none; border-color: var(--accent); }
.wo-unit { font-size: 11px; opacity: .6; }

/* ===== План: адаптивная вёрстка строк (фикс смартфона) ===== */
@media (min-width: 561px) {
  .plan-item { flex-wrap: nowrap; }
  .plan-main { min-width: 120px; }
  .plan-title-txt, .plan-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plan-date input { width: 132px; }
  .plan-badge { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 560px) {
  .plan-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "key main badge" "date meta go";
    column-gap: 10px; row-gap: 6px; align-items: center;
  }
  .plan-day-key { grid-area: key; }
  .plan-main { grid-area: main; min-width: 0; }
  .plan-title-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plan-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0; }
  .plan-badge { grid-area: badge; font-size: 10px; padding: 3px 6px; max-width: 148px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plan-date { grid-area: date; min-width: 0; }
  .plan-date input { width: 112px; font-size: 12px; padding: 4px 6px; }
  .plan-go { grid-area: go; }
}

/* ===== Разминочные подходы ===== */
.wo-set.wu { opacity: .75; background: rgba(255,140,66,.07); border-radius: 8px; }
.wo-set.wu .wo-set-idx { background: #ff8c42; color: #1a1a1a; }
