:root { 
    --bg: #fcfaf5; --text: #2c3e50; --primary: #2c3e50; --secondary: #95a5a6; --success: #2ecc71; --danger: #e74c3c;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body { background: var(--bg); font-family: -apple-system, sans-serif; margin: 0; padding: 15px; color: var(--text); }
body.modal-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
}
.app-container { max-width: 500px; margin: 0 auto; }

/* ВЕРХНЯЯ НАВИГАЦИЯ */
.main-nav {
    display: flex;
    justify-content: space-around;
    background: white;
    padding: 10px 5px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}
.nav-btn {
    background: none;
    border: none;
    font-size: 10px;
    font-weight: bold;
    color: var(--secondary);
    cursor: pointer;
    padding: 8px 7px;
    letter-spacing: 1px;
    transition: 0.3s;
    border-bottom: 2px solid transparent;
}
.nav-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

/* УПРАВЛЕНИЕ ВКЛАДКАМИ */
.tab-content {
    display: none;
    animation: fadeIn 0.2s ease-out;
}
.tab-content.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ЗАГОЛОВОК И ДАТА */
.date-navigation { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.date-navigation button { padding: 10px 15px; font-size: 1.2em; cursor: pointer; background: white; border: 1px solid #ddd; border-radius: 8px; }
#currentDateDisplay { line-height: 1.2; text-align: center; font-size: 20px; margin: 0; }
.weekday-label { font-size: 14px; color: var(--secondary); font-weight: normal; }

.stats-panel { border-bottom: 2px solid var(--primary); margin: 15px 0; padding-bottom: 5px; font-size: 0.9em; display: flex; justify-content: space-between; }

/* ЭКРАН СТАТИСТИКИ */
.stats-screen-header {
    align-items: center;
}

.sort-toggle {
    border: 1px solid #ddd;
    background: white;
    color: var(--text);
    border-radius: 8px;
    padding: 8px 11px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.stats-toolbar {
    background: var(--bg);
    padding: 6px 0 14px;
    border-bottom: 1px solid #eee;
}

.stats-mode-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.stats-mode-toggle[hidden] {
    display: none;
}

.stats-mode-toggle button {
    border: 1px solid #ddd;
    border-radius: 999px;
    background: white;
    color: var(--secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    padding: 7px 12px;
}

.stats-mode-toggle button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.year-view-toggle {
    margin: 0 0 10px;
}

.stats-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.stats-navigation button {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.stats-navigation button:disabled {
    color: var(--secondary);
    cursor: default;
    opacity: 0.35;
}

.stats-navigation h4 {
    margin: 0;
    text-align: center;
    font-size: 20px;
}

.stats-list {
    background: white;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 4px 14px;
    margin-top: 14px;
    user-select: text;
    -webkit-user-select: text;
}

.year-stats-list {
    overflow-x: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

.year-stats-table {
    min-width: max-content;
}

.year-stats-row {
    display: grid;
    grid-template-columns: 150px repeat(var(--stats-columns), 72px);
    border-bottom: 1px solid #eee;
}

.year-stats-row:last-child {
    border-bottom: none;
}

.year-stats-cell {
    padding: 11px 8px;
    border-right: 1px solid #eee;
    font-size: 15px;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.year-stats-cell:first-child {
    color: var(--text);
    font-weight: normal;
    left: 0;
    max-width: 150px;
    overflow: hidden;
    position: sticky;
    text-align: left;
    text-overflow: ellipsis;
    z-index: 1;
}

.year-stats-head .year-stats-cell {
    background: #f7f8f8;
    color: var(--text);
    font-size: 15px;
    font-weight: bold;
    text-align: center;
}

.year-stats-head .year-stats-cell:first-child,
.year-stats-row .year-stats-cell:first-child {
    background: white;
}

.year-stats-head .year-stats-cell:first-child {
    color: var(--primary);
}

.year-stats-total,
.year-stats-average {
    font-weight: bold;
}

.stats-copy-button {
    margin-top: 16px;
    margin-bottom: max(16px, env(safe-area-inset-bottom));
    background: #eaf8f0;
    border: 1px solid #c7edd8;
    color: #1f7a46;
}

/* КАРТОЧКА ПРИВЫЧКИ */
.habit-item {
    background: white; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid #eee; cursor: pointer;
}
.habit-info { flex-grow: 1; }
.habit-name { font-weight: bold; font-size: 16px; display: block; margin-bottom: 2px; }
.habit-status-text { font-size: 12px; color: var(--secondary); }
.habit-icon { font-size: 22px; margin-left: 15px; }

/* ДНЕВНИК И СТАТЬИ */
.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 15px; gap: 15px; }
.section-header h2 { margin: 0; }
.journal-progress-wrapper { flex-grow: 1; display: flex; flex-direction: column; gap: 6px; }
.progress-labels { display: flex; justify-content: space-between; align-items: center; }
.badge { background: var(--primary); color: white; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: bold; }

.progress-bar-container { background: #e0e0e0; height: 6px; border-radius: 3px; overflow: hidden; width: 100%; }
.progress-bar-fill { height: 100%; background: var(--success); width: 0%; transition: width 0.4s ease-out; }

.journal-filters { display: flex; gap: 8px; margin-bottom: 20px; }
.filter-btn { 
    flex: 1; padding: 10px; border-radius: 10px; border: 1px solid #ddd; 
    background: white; font-size: 12px; font-weight: bold; color: var(--secondary); cursor: pointer; transition: 0.2s;
}
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.placeholder-text { text-align: center; color: var(--secondary); font-size: 14px; margin-top: 40px; }

.article-card {
    background: white; padding: 18px; border-radius: 12px; margin-bottom: 15px;
    border: 1px solid #eee; box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    cursor: pointer; transition: 0.2s;
}
.article-card:active { transform: scale(0.98); }
.article-card h3 { margin: 0 0 8px 0; font-size: 18px; line-height: 1.3; }
.article-meta { font-size: 12px; color: var(--secondary); display: flex; justify-content: space-between; }

/* БАННЕР ПОДДЕРЖКИ */
.support-banner {
    background: white; border: 2px dashed var(--primary); padding: 20px; border-radius: 15px;
    text-align: center; margin: 20px 0; animation: fadeIn 0.5s ease-out;
}
.support-banner p { margin: 0 0 15px 0; font-size: 14px; font-weight: bold; }

/* ПОЛЕЗНОЕ (СЕТКА) */
.useful-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.tool-card {
    background: white; padding: 20px; border-radius: 15px; text-align: center;
    border: 1px solid #eee; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.exercise-tool-card {
    appearance: none;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    grid-column: 1 / -1;
}
.health-tool-card { appearance: none; color: var(--text); cursor: pointer; font: inherit; grid-column: 1 / -1; text-align: left; }
.health-tool-card .tool-icon { color: #d05b5b; float: left; margin: 0 12px 0 0; }
.health-tracker-card { background: white; border: 1px solid #eee; border-radius: 10px; margin: 0 0 14px; padding: 13px; }
.health-active-card { cursor: pointer; }
.health-card-head { align-items: baseline; display: flex; gap: 10px; justify-content: space-between; }
.health-card-head strong { font-size: 16px; }
.health-card-head span { color: var(--secondary); font-size: 12px; text-align: right; }
.health-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.health-card-actions button, .health-start-button { background: white; border: 1px solid #d7dfe0; border-radius: 8px; color: var(--text); cursor: pointer; font-size: 12px; font-weight: bold; min-height: 36px; padding: 8px 10px; }
.health-card-actions button { flex: 1; }
.health-primary-action, .health-start-button { background: #eaf8f0 !important; border-color: #c7edd8 !important; color: #1f7a46 !important; }
.health-start-button { margin-top: 10px; width: 100%; }
.health-active-info { color: var(--text); font-size: 14px; margin-top: 10px; }
.health-active-info small { color: var(--secondary); display: block; font-size: 12px; margin-top: 3px; }
.health-summary { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
.health-summary div { background: #f7f8f8; border-radius: 8px; padding: 10px 7px; text-align: center; }
.health-summary strong { display: block; font-size: 20px; }
.health-summary span, .health-help, .health-step-help { color: var(--secondary); font-size: 12px; line-height: 1.4; }
.health-help { margin: 14px 0 0; }
.health-intro h3 { margin-top: 0; }
.health-intro p { color: var(--secondary); font-size: 14px; line-height: 1.5; }
.health-level-grid { display: grid; gap: 9px; grid-template-columns: repeat(2, 1fr); }
.health-level-button { background: white; border: 1px solid #d7dfe0; border-radius: 10px; color: var(--text); cursor: pointer; min-height: 74px; }
.health-level-button strong, .health-level-button span { display: block; }
.health-level-button strong { font-size: 23px; }
.health-level-button span { color: var(--secondary); font-size: 12px; margin-top: 2px; }
.health-choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.health-choice-grid button { background: white; border: 1px solid #d7dfe0; border-radius: 999px; color: var(--text); cursor: pointer; font-size: 13px; padding: 9px 11px; }
.health-choice-grid button.selected { background: #eaf8f0; border-color: #7acb9a; color: #1f7a46; }
.health-section-label { color: var(--text); font-size: 13px; font-weight: bold; margin: 17px 0 8px; }
.health-view-toggle, .health-period-toggle { display: flex; gap: 7px; margin-bottom: 14px; }
.health-view-toggle button, .health-period-toggle button { background: white; border: 1px solid #d7dfe0; border-radius: 999px; color: var(--secondary); cursor: pointer; font-size: 12px; font-weight: bold; padding: 8px 11px; }
.health-view-toggle button.active, .health-period-toggle button.active { background: var(--primary); border-color: var(--primary); color: white; }
.health-view-toggle button { flex: 1; }
.health-city-line { align-items: center; color: var(--secondary); display: flex; flex-wrap: wrap; font-size: 12px; gap: 5px; margin: 14px 0; }
.health-city-line strong { color: var(--text); }
.health-city-line button, .health-episode-city { background: transparent; border: 0; color: #1f7a46; cursor: pointer; font-size: 12px; font-weight: bold; padding: 0; text-decoration: underline; }
.health-episode-city { display: block; margin: 0 0 12px; text-align: left; }
.health-weather-insights { color: var(--secondary); display: flex; flex-wrap: wrap; font-size: 12px; gap: 10px; margin: 12px 0 2px; }
.health-weather-insights strong { color: var(--text); }
.health-table-wrap { border: 1px solid #e7ebeb; border-radius: 8px; margin-top: 14px; overflow-x: auto; }
.health-table { border-collapse: collapse; font-size: 12px; min-width: 1090px; width: 100%; }
.health-table th { background: #f4f6f6; color: var(--text); font-weight: bold; white-space: nowrap; }
.health-table th, .health-table td { border-bottom: 1px solid #e7ebeb; padding: 9px 10px; text-align: left; vertical-align: top; }
.health-table td { color: var(--text); max-width: 180px; }
.health-table tbody tr:last-child td { border-bottom: 0; }
.health-empty-cell { color: var(--secondary) !important; text-align: center !important; }
.health-history-button { margin-top: 14px; width: 100%; }
.health-city-search { display: flex; gap: 8px; margin: 14px 0; }
.health-city-search input { border: 1px solid #d7dfe0; border-radius: 8px; color: var(--text); flex: 1; font-size: 15px; min-width: 0; padding: 10px; }
.health-city-search button { background: var(--primary); border: 0; border-radius: 8px; color: white; cursor: pointer; font-size: 12px; font-weight: bold; padding: 0 12px; }
.health-city-results { display: grid; gap: 7px; }
.health-city-results button { background: white; border: 1px solid #e1e6e6; border-radius: 8px; color: var(--text); cursor: pointer; padding: 10px; text-align: left; }
.health-city-results strong, .health-city-results span { display: block; }
.health-city-results span { color: var(--secondary); font-size: 12px; margin-top: 2px; }
.tool-icon { font-size: 30px; display: block; margin-bottom: 10px; }
.tool-title { font-size: 13px; font-weight: bold; color: var(--primary); }
.tool-subtitle { color: var(--secondary); display: block; font-size: 12px; line-height: 1.35; margin-top: 7px; }

/* МИНИ-УПРАЖНЕНИЯ */
.exercise-hub-header { align-items: center; display: grid; gap: 12px; grid-template-columns: 40px minmax(0, 1fr) auto; margin-bottom: 12px; }
.exercise-back-button {
    align-items: center; background: white; border: 1px solid #ddd; border-radius: 8px;
    color: var(--text); cursor: pointer; display: inline-flex; font-size: 20px;
    height: 40px; justify-content: center; padding: 0; width: 40px;
}
.exercise-header-copy { flex: 1; min-width: 0; }
.exercise-header-copy h2 { align-items: center; display: flex; font-size: 21px; line-height: 1.15; margin: 0; min-height: 40px; }
.exercise-header-copy p { color: var(--secondary); font-size: 12px; line-height: 1.35; margin: 2px 0 0; }
.exercise-enable-button {
    background: #eaf8f0; border: 1px solid #c7edd8; border-radius: 8px; color: #1f7a46;
    align-items: center; cursor: pointer; display: inline-flex; font-size: 12px; font-weight: bold; height: 40px; justify-content: center; padding: 0 10px; white-space: nowrap;
}
.exercise-enabled-label { align-items: center; color: #1f7a46; display: inline-flex; font-size: 12px; font-weight: bold; height: 40px; white-space: nowrap; }
.exercise-group { margin: 20px 0; }
.exercise-group-title { color: var(--secondary); font-size: 11px; font-weight: bold; letter-spacing: .7px; margin: 0 0 8px 4px; }
.exercise-card {
    align-items: center; background: white; border: 1px solid #eee; border-radius: 10px;
    color: var(--text); cursor: pointer; display: flex; gap: 12px; margin-bottom: 8px;
    padding: 12px; text-align: left; width: 100%;
}
.exercise-card-icon { align-items: center; background: #f7f8f8; border-radius: 8px; color: var(--primary); display: flex; font-size: 20px; height: 36px; justify-content: center; width: 36px; }
.exercise-card-copy { flex: 1; min-width: 0; }
.exercise-card-title { display: block; font-size: 15px; font-weight: bold; }
.exercise-card-benefit { color: var(--secondary); display: block; font-size: 12px; line-height: 1.3; margin-top: 2px; }
.exercise-card-meta { color: var(--secondary); font-size: 11px; margin-top: 5px; }
.exercise-card-arrow { color: var(--secondary); font-size: 20px; }
.exercise-note { background: #f7f8f8; border: 1px solid #eee; border-radius: 8px; color: var(--secondary); font-size: 12px; line-height: 1.45; margin-top: 15px; padding: 12px; }
.exercise-choice { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.exercise-choice button { background: white; border: 1px solid #ddd; border-radius: 999px; color: var(--secondary); cursor: pointer; font-size: 12px; font-weight: bold; padding: 8px 11px; }
.exercise-choice button.active { background: var(--primary); border-color: var(--primary); color: white; }
.exercise-duration-input { border: 1px solid #ddd; border-radius: 8px; color: var(--text); font-size: 14px; padding: 8px; width: 92px; }
.exercise-detail { background: white; border: 1px solid #eee; border-radius: 12px; padding: 18px; }
.exercise-detail h3 { font-size: 22px; margin: 0; }
.exercise-benefit { color: #1f7a46; font-size: 14px; margin: 7px 0 16px; }
.exercise-detail-text { color: var(--secondary); font-size: 14px; line-height: 1.55; margin: 0; }
.exercise-meta-line { color: var(--secondary); font-size: 12px; margin-top: 14px; }
.exercise-visual-stage { align-items: center; background: #f7f8f8; border: 1px solid #eee; border-radius: 12px; display: flex; height: 230px; justify-content: center; margin: 16px 0; overflow: hidden; position: relative; }
.breath-orb { background: #eaf8f0; border: 2px solid #2ecc71; border-radius: 50%; height: 104px; width: 104px; }
.breath-orb.breathing { animation: breathe-orb 7s ease-in-out infinite; }
@keyframes breathe-orb { 0%,100% { transform: scale(.62); } 43% { transform: scale(1.15); } }
.clock-ring { border: 2px solid var(--primary); border-radius: 50%; height: 158px; position: relative; width: 158px; }
.clock-tick { background: var(--primary); height: 8px; left: calc(50% - 1px); position: absolute; top: 5px; transform: rotate(calc(var(--clock-index) * 30deg)); transform-origin: 1px 74px; width: 2px; }
.clock-number { color: var(--secondary); font-size: 10px; font-variant-numeric: tabular-nums; left: 50%; position: absolute; top: 50%; transform: rotate(calc(var(--clock-index) * 30deg)) translateY(-60px) rotate(calc(var(--clock-index) * -30deg)) translate(-50%, -50%); }
.clock-center { background: var(--primary); border-radius: 50%; height: 7px; left: calc(50% - 3.5px); position: absolute; top: calc(50% - 3.5px); width: 7px; z-index: 2; }
.clock-hand { background: var(--primary); height: 62px; left: calc(50% - 1px); position: absolute; top: 17px; transform: translateZ(0); transform-origin: 1px 62px; width: 2px; will-change: transform; z-index: 1; }
.clock-hand.running { animation: clock-hand 60s steps(60, end) infinite; backface-visibility: hidden; }
@keyframes clock-hand { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.focus-visual { align-items: center; background: white; border: 1px solid #dce4e5; border-radius: 50%; display: flex; flex-direction: column; height: 150px; justify-content: center; position: relative; transition: background .3s ease, border-color .3s ease; width: 150px; }
.focus-visual.focus-near { background: #eaf8f0; border-color: #2ecc71; }
.focus-word { color: var(--primary); font-size: 26px; font-weight: bold; letter-spacing: 1px; }
.focus-hint { color: var(--secondary); font-size: 12px; margin-top: 6px; text-align: center; }
.eye-path { height: 150px; position: relative; width: 150px; }
.eye-path::before { border: 1px dashed #b9c5c7; content: ''; inset: 10px; position: absolute; }
.eye-path-circle::before { border-radius: 50%; }
.eye-dot { background: var(--primary); border-radius: 50%; height: 18px; left: calc(50% - 9px); position: absolute; top: calc(50% - 9px); width: 18px; }
.eye-path.running .eye-dot { animation-duration: 4s; animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.eye-path-vertical.running .eye-dot { animation-name: eyes-vertical; }
.eye-path-horizontal.running .eye-dot { animation-name: eyes-horizontal; }
.eye-path-diag-down.running .eye-dot { animation-name: eyes-diag-down; }
.eye-path-diag-up.running .eye-dot { animation-name: eyes-diag-up; }
.eye-path-square-forward.running .eye-dot { animation-name: eyes-square-forward; animation-timing-function: linear; }
.eye-path-square-reverse.running .eye-dot { animation-name: eyes-square-reverse; animation-timing-function: linear; }
.eye-path-circle-forward.running .eye-dot { animation-name: eyes-circle-forward; animation-timing-function: linear; }
.eye-path-circle-reverse.running .eye-dot { animation-name: eyes-circle-reverse; animation-timing-function: linear; }
@keyframes eyes-vertical { 0%,100% { transform: translateY(-55px); } 50% { transform: translateY(55px); } }
@keyframes eyes-horizontal { 0%,100% { transform: translateX(-55px); } 50% { transform: translateX(55px); } }
@keyframes eyes-diag-down { 0%,100% { transform: translate(-52px,-52px); } 50% { transform: translate(52px,52px); } }
@keyframes eyes-diag-up { 0%,100% { transform: translate(-52px,52px); } 50% { transform: translate(52px,-52px); } }
@keyframes eyes-square-forward { 0% { transform: translate(-52px,-52px); } 25% { transform: translate(52px,-52px); } 50% { transform: translate(52px,52px); } 75% { transform: translate(-52px,52px); } 100% { transform: translate(-52px,-52px); } }
@keyframes eyes-square-reverse { 0% { transform: translate(-52px,-52px); } 25% { transform: translate(-52px,52px); } 50% { transform: translate(52px,52px); } 75% { transform: translate(52px,-52px); } 100% { transform: translate(-52px,-52px); } }
@keyframes eyes-circle-forward { 0% { transform: translate(0,-55px); } 12.5% { transform: translate(39px,-39px); } 25% { transform: translate(55px,0); } 37.5% { transform: translate(39px,39px); } 50% { transform: translate(0,55px); } 62.5% { transform: translate(-39px,39px); } 75% { transform: translate(-55px,0); } 87.5% { transform: translate(-39px,-39px); } 100% { transform: translate(0,-55px); } }
@keyframes eyes-circle-reverse { 0% { transform: translate(0,-55px); } 12.5% { transform: translate(-39px,-39px); } 25% { transform: translate(-55px,0); } 37.5% { transform: translate(-39px,39px); } 50% { transform: translate(0,55px); } 62.5% { transform: translate(39px,39px); } 75% { transform: translate(55px,0); } 87.5% { transform: translate(39px,-39px); } 100% { transform: translate(0,-55px); } }
.eye-eight-svg { height: 150px; overflow: visible; width: 150px; }
.eye-eight-svg path { fill: none; stroke: #b9c5c7; stroke-dasharray: 3 3; stroke-width: 1.2; }
.eye-eight-svg circle { fill: var(--primary); }
.eye-blink-visual { color: var(--primary); font-size: 24px; font-weight: bold; text-align: center; }
.eye-blink-visual small { color: var(--secondary); display: block; font-size: 13px; font-weight: normal; margin-top: 7px; }
.palms-visual { color: var(--primary); font-size: 86px; opacity: .75; }
.shoulder-visual { height: 150px; position: relative; width: 210px; }
.shoulder-spine { background: #9eacad; border-radius: 2px; height: 105px; left: calc(50% - 2px); position: absolute; top: 15px; width: 4px; }
.scapula { border: 3px solid var(--primary); border-bottom-color: transparent; border-radius: 45% 45% 52% 52%; border-top-color: transparent; height: 70px; position: absolute; top: 30px; width: 42px; }
.scapula-left { left: 50px; transform: rotate(-13deg); }
.scapula-right { right: 50px; transform: rotate(13deg); }
.shoulder-visual.running .scapula-left { animation: scapula-left-in 3s ease-in-out infinite alternate; }
.shoulder-visual.running .scapula-right { animation: scapula-right-in 3s ease-in-out infinite alternate; }
.shoulder-label { bottom: 3px; color: var(--secondary); font-size: 11px; font-weight: bold; left: 0; letter-spacing: .8px; position: absolute; right: 0; text-align: center; }
@keyframes scapula-left-in { from { transform: rotate(-13deg) translateX(0); } to { transform: rotate(-13deg) translateX(7px); } }
@keyframes scapula-right-in { from { transform: rotate(13deg) translateX(0); } to { transform: rotate(13deg) translateX(-7px); } }
.hands-visual { align-items: center; color: var(--primary); display: grid; font-size: 82px; height: 130px; justify-items: center; position: relative; width: 130px; }
.hands-visual span { grid-area: 1 / 1; transition: opacity 1.8s ease, transform 1.8s ease; }
.hands-visual .hand-open { opacity: 1; transform: scale(1); }
.hands-visual .hand-fist { opacity: 0; transform: scale(.78); }
.hands-visual.running { animation: hands-step 4s ease-in-out infinite; }
.hands-visual.running .hand-open { animation: hand-open 4s ease-in-out infinite; }
.hands-visual.running .hand-fist { animation: hand-fist 4s ease-in-out infinite; }
@keyframes hand-open { 0%,100% { opacity: 1; transform: scale(1); } 45%,55% { opacity: 0; transform: scale(.78); } }
@keyframes hand-fist { 0%,100% { opacity: 0; transform: scale(.78); } 45%,55% { opacity: 1; transform: scale(1); } }
.heels-visual { align-items: flex-end; display: flex; gap: 28px; height: 135px; justify-content: center; width: 210px; }
.foot-lift { align-items: center; display: flex; flex-direction: column; height: 126px; justify-content: flex-end; position: relative; width: 78px; }
.foot-lift span { color: var(--secondary); font-size: 12px; font-weight: bold; margin-bottom: 8px; }
.foot-lift i { background: var(--secondary); height: 3px; position: relative; width: 72px; }
.foot-lift b { color: var(--primary); font-size: 38px; font-weight: normal; line-height: 1; position: absolute; top: 48px; }
.foot-lift-heels b { transform: rotate(180deg); }
.foot-lift-toes b { transform: rotate(180deg); }
.heels-visual .foot-lift { opacity: .38; transition: opacity .35s ease; }
.heels-visual.heels-heels .foot-lift-heels, .heels-visual.heels-toes .foot-lift-toes { opacity: 1; }
.heels-visual.heels-heels.running .foot-lift-heels b { animation: heel-lift 2.4s ease-in-out infinite alternate; }
.heels-visual.heels-toes.running .foot-lift-toes b { animation: toe-lift 2.4s ease-in-out infinite alternate; }
@keyframes heel-lift { from { transform: rotate(180deg) translateY(0); } to { transform: rotate(180deg) translateY(22px); } }
@keyframes toe-lift { from { transform: rotate(180deg) translateY(0); } to { transform: rotate(180deg) translateY(22px); } }
.feet-visual { align-items: center; display: flex; gap: 35px; height: 140px; justify-content: center; }
.feet-visual span { color: var(--primary); font-size: 78px; }
.feet-visual.running span { animation: foot-clockwise 3s linear infinite; }
.feet-visual.feet-counterclockwise.running span { animation-name: foot-counterclockwise; }
.feet-visual.feet-opposite-out.running span:first-child, .feet-visual.feet-opposite-in.running span:last-child { animation-name: foot-clockwise; }
.feet-visual.feet-opposite-out.running span:last-child, .feet-visual.feet-opposite-in.running span:first-child { animation-name: foot-counterclockwise; }
@keyframes foot-clockwise { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes foot-counterclockwise { from { transform: rotate(0); } to { transform: rotate(-360deg); } }
.kegel-visual { align-items: center; color: var(--primary); display: flex; font-size: 106px; gap: 4px; height: 140px; justify-content: center; }
.kegel-visual span { display: inline-block; transition: transform var(--kegel-phase, 2s) linear, opacity var(--kegel-phase, 2s) linear; }
.kegel-side { opacity: .72; }
.kegel-core { color: #7acb9a; font-size: 36px; opacity: .3; }
.kegel-visual.kegel-relax .kegel-left { transform: translateX(-18px) scale(1.08); }
.kegel-visual.kegel-relax .kegel-right { transform: translateX(18px) scale(1.08); }
.kegel-visual.kegel-relax .kegel-core { opacity: .18; transform: scale(.72); }
.kegel-visual.kegel-squeeze .kegel-left { transform: translateX(0) scale(.72); }
.kegel-visual.kegel-squeeze .kegel-right { transform: translateX(0) scale(.72); }
.kegel-visual.kegel-squeeze .kegel-core { opacity: 1; transform: scale(1.15); }
.kegel-visual.kegel-rest span { opacity: .25; transform: scale(.62); }
.exercise-lesson-step { color: var(--secondary); font-size: 12px; font-weight: bold; text-align: center; }
.exercise-lesson-title { font-size: 22px; margin: 8px 0 5px; text-align: center; }
.exercise-lesson-copy { color: var(--secondary); font-size: 14px; line-height: 1.45; margin: 0 auto; max-width: 310px; text-align: center; }
.exercise-timer { font-size: 38px; font-variant-numeric: tabular-nums; font-weight: bold; margin: 12px 0 0; text-align: center; }
.exercise-timer-phase { color: var(--secondary); font-size: 14px; margin: 6px 0 0; text-align: center; }
.exercise-timer-actions { display: flex; gap: 8px; margin-top: 14px; }
.exercise-timer-actions button { flex: 1; }
.exercise-secondary-button { background: white; border: 1px solid #ddd; border-radius: 10px; color: var(--text); cursor: pointer; font-size: 14px; font-weight: bold; padding: 13px; }
.gender-choice { background: white; border: 1px solid #eee; border-radius: 12px; padding: 20px; text-align: center; }
.gender-choice h3 { font-size: 21px; margin: 0 0 8px; }
.gender-choice p { color: var(--secondary); font-size: 13px; line-height: 1.45; margin: 0 0 18px; }
.gender-choice .exercise-choice { justify-content: center; }
.complex-progress-text { color: var(--secondary); font-size: 12px; margin-top: 3px; }
.complex-children { display: grid; gap: 8px; }
.complex-child-row { align-items: center; background: white; border: 1px solid #eee; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; padding: 12px; }
.complex-child-row span { font-size: 14px; }
.complex-child-row small { color: var(--secondary); display: block; margin-top: 3px; }
.complex-child-icon { font-size: 20px; margin-left: 12px; }
.complex-summary { color: var(--secondary); font-size: 13px; margin: 0 0 14px; }
.complex-stats-breakdown { background: #f7f8f8; border-bottom: 1px solid #eee; margin: 0 -14px; padding: 8px 14px; }
.complex-stats-line { align-items: center; display: flex; gap: 8px; justify-content: space-between; padding: 8px 0; }
.complex-stats-line span:first-child { color: var(--text); flex: 1; font-size: 14px; }
.complex-stats-line .stat-count { font-size: 13px; }
.complex-stats-line .stat-percent { font-size: 13px; }

/* КНОПКИ */
.main-button { 
    width: 100%; padding: 15px; border: none; border-radius: 12px; 
    font-size: 16px; font-weight: bold; cursor: pointer; color: white; background: var(--primary);
}

/* ОБНОВЛЕНИЕ PWA */
.update-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 2000;
    max-width: 500px;
    margin: 0 auto;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    font-size: 14px;
    font-weight: bold;
}

.update-banner[hidden] {
    display: none;
}

.update-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.update-actions button {
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}

#refreshApp {
    background: var(--success);
    color: white;
}

#dismissUpdate {
    background: rgba(255,255,255,0.16);
    color: white;
}

/* МОДАЛКИ (БАЗОВЫЕ) */
.modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100dvh; 
    background: rgba(0,0,0,0.6); 
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    overscroll-behavior: contain;
    touch-action: none;
}

.modal-content { 
    background: var(--bg); 
    margin: 0 auto; 
    padding: 0; 
    width: 90%; 
    max-width: 450px; 
    border-radius: 20px; 
    max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom))); 
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    touch-action: auto;
}

.modal-header { 
    padding: 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.modal-body { 
    padding: 20px; 
    overflow-y: auto; 
    flex-grow: 1;
    min-height: 0;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.close { font-size: 28px; cursor: pointer; color: var(--secondary); }

.modal-footer {
    padding: 14px 20px max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid #eee;
    background: var(--bg);
    flex-shrink: 0;
}

/* СПИСКИ В МОДАЛКАХ */
.status-btn { 
    display: flex; align-items: center; padding: 15px; margin-bottom: 10px;
    background: white; border: 2px solid transparent; border-radius: 12px; cursor: pointer; width: 100%; max-width: 100%; text-align: left;
}
.status-info { flex-grow: 1; }
.status-title { font-weight: bold; display: block; }
.status-desc { font-size: 12px; color: #7f8c8d; }
.group-title { font-size: 11px; font-weight: bold; margin: 12px 0 6px 5px; text-transform: uppercase; letter-spacing: 0.5px; }
#statusModal .modal-header { padding-bottom: 14px; padding-top: 14px; }
#statusModal .modal-body { padding-bottom: 10px; padding-top: 8px; }
#statusModal .modal-footer { padding-bottom: max(10px, env(safe-area-inset-bottom)); padding-top: 10px; }
#statusModal .group-title:first-child { margin-top: 0; }
#statusModal .status-btn { margin-bottom: 7px; padding: 12px 14px; }

.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #eee; }
.stat-row-clickable { cursor: pointer; }
.stat-name { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.stat-values { display: flex; justify-content: flex-end; align-items: center; min-width: 110px; }
.stat-count { width: 60px; text-align: right; color: var(--secondary); font-variant-numeric: tabular-nums; }
.stat-percent { width: 50px; text-align: right; font-weight: bold; color: var(--success); font-variant-numeric: tabular-nums; }

.status-breakdown {
    background: #f7f8f8;
    border-bottom: 1px solid #eee;
    margin: 0 -14px;
    padding: 10px 14px 12px;
}

.status-breakdown-group {
    margin-bottom: 8px;
}

.status-breakdown-title {
    color: var(--text);
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
}

.status-breakdown-line {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 3px 0;
    color: var(--secondary);
    font-size: 14px;
}

.status-breakdown-line strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.status-breakdown-unknown span {
    color: var(--danger);
}

.archived-label {
    border: 1px solid #ddd;
    border-radius: 999px;
    color: var(--secondary);
    font-size: 10px;
    font-weight: normal;
    margin-left: 6px;
    padding: 1px 6px;
    vertical-align: middle;
}

.settings-subtitle {
    color: var(--text);
    font-size: 12px;
    font-weight: bold;
    margin: 14px 0 8px;
    text-transform: uppercase;
}

.settings-empty {
    color: var(--secondary);
    font-size: 13px;
    margin: 0 0 10px;
}

.manage-habit-row {
    align-items: center;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 0;
}

.manage-habit-row span {
    font-size: 14px;
}

.manage-habit-row.archived span {
    color: var(--secondary);
}

.manage-habit-row button {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    padding: 7px 10px;
}
.mini-switch { display: inline-flex; }
.mini-switch button {
    border-radius: 0;
    color: var(--secondary);
    font-size: 11px;
    min-width: 38px;
    padding: 6px 8px;
}
.mini-switch button:first-child { border-radius: 7px 0 0 7px; }
.mini-switch button:last-child { border-left: 0; border-radius: 0 7px 7px 0; }
.mini-switch button.active {
    background: #eaf8f0;
    border-color: #c7edd8;
    color: #1f7a46;
}
.mini-switch button.inactive {
    background: #f4f5f5;
    color: #7f8c8d;
}

.add-habit-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; padding: 0 5px; }
.add-habit-form input { flex-grow: 1; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; }
.add-habit-form select { background: white; border: 1px solid #ddd; border-radius: 8px; color: var(--text); font-size: 12px; padding: 10px; }
.add-habit-form button { padding: 10px 20px; background: var(--success); color: white; border: none; border-radius: 8px; font-weight: bold; }
.complex-editor { background: #f7f8f8; border: 1px solid #eee; border-radius: 8px; margin-top: 14px; padding: 12px; }
.complex-editor-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 8px; }
.complex-editor-head strong { font-size: 14px; }
.complex-editor-row { align-items: center; display: flex; justify-content: space-between; padding: 7px 0; }
.complex-editor-row span { font-size: 13px; }
.complex-editor-row button { background: white; border: 1px solid #ddd; border-radius: 7px; color: var(--text); cursor: pointer; font-size: 11px; font-weight: bold; padding: 5px 7px; }

/* СПЕЦИФИЧНЫЕ СТИЛИ ДЛЯ МОДАЛКИ СТАТЬИ */
#articleModal .modal-content {
    max-width: 600px;
}

#articleModal .modal-body {
    background: white;
}

.article-text-content {
    line-height: 1.7;
    font-size: 17px;
    color: #2c3e50;
}

/* Исправление отступов для списков в статьях трекера */
.article-text-content ol, .article-text-content ul {
    padding-left: 1.2rem;
    margin-top: 15px;
    margin-bottom: 15px;
}

.article-text-content li {
    margin-bottom: 10px;
}

.article-text-content h1, .article-text-content h2 { margin-top: 20px; color: var(--primary); }
.article-text-content p { margin-bottom: 16px; }
.article-text-content img { 
    max-width: 100%; 
    height: auto; 
    border-radius: 12px; 
    margin: 10px 0; 
    display: block;
}

#articleModal .main-button {
    border-radius: 0;
    flex-shrink: 0;
}

@media (max-width: 380px) {
    body { padding: 12px; }
    .nav-btn { font-size: 9px; padding: 8px 5px; }
    .stats-navigation h4 { font-size: 18px; }
    .sort-toggle { padding: 8px 9px; font-size: 11px; }
}
