:root {
  --brown: #725752;
  --sage-gray: #878E88;
  --aqua: #96C0B7;
  --sage-light: #D4DFC7;
  --cream: #FEF6C9;
  --water-ink: #315e53;
  --chart-fill: #96c0b760;
  --muscle-active: #507766;
  --muscle-neutral: #bac2af;
  --muscle-body: #e3e8d9;
  --bg1: var(--sage-light);
  --bg2: var(--cream);
  --card: #fffdf3ee;
  --card-s: #fffdf3;
  --ink: #302925;
  --muted: #50483f;
  --line: #c2c9b4;
  --accent: var(--brown);
  --accent-strong: #58433d;
  --accent-soft: var(--aqua);
  --surface-tint: #edf1e4;
  --ok: #355e50;
  --warn: #f3efda;
  --shadow: 0 2px 4px #382a2412, 0 7px 18px #3b4a3b15;
  --nav-h: 64px;
}

body { background: radial-gradient(ellipse at 50% 0, var(--cream) 7%, #e6ecdd 70%, var(--sage-light) 100%) fixed; padding-bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px)); }
body.timer-visible { padding-bottom: calc(var(--nav-h) + 82px + env(safe-area-inset-bottom, 0px)); }
.app { max-width: 700px; padding: 10px 14px 0; }
.card, .ex, .sheet { border: 1px solid var(--line); border-radius: 19px; }
.card, .ex { box-shadow: var(--shadow); }
h1, h2, h3 { letter-spacing: -.025em; }
h2 { font-size: 17px; }
.card > h2:first-child, .card > .row h2 { margin: 0 0 7px; }
.sub { font-size: 13px; }
.btn { min-height: 44px; border-radius: 14px; background: linear-gradient(105deg, var(--brown), var(--accent-strong)); box-shadow: 0 4px 9px #5041362a; }
.btn.sec { background: var(--surface-tint); border: 1px solid var(--sage-gray); color: var(--accent-strong); }
.btn.sm, .pill { border-radius: 100px; }
.btn:disabled, .link:disabled { opacity: .54; cursor: default; }
.btn:hover:not(:disabled), .icon-btn:hover:not(:disabled), .next-card:hover, .routine-card:hover, .library-card:hover, .quick-links button:hover, .progress-stats button:hover { filter: brightness(.97); }
.chip { border: 1px solid var(--line); border-radius: 100px; background: var(--card-s); min-height: 42px; padding: 8px 13px; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 2px 6px #5041362a; }
.main-tabs { margin: 2px 0 10px; padding: 5px; border-radius: 19px; background: #d4dfc7aa; }
.main-tabs .chip { flex: 1; padding-inline: 9px; }
.progress-tabs { gap: 4px; }
.progress-tabs .chip { min-height: 38px; }
.week-tabs .chip, .day-tabs .chip { flex: 1 1 0; min-width: 0; padding-inline: 6px; border-radius: 10.5px; }
.bar, .bar i { border-radius: 100px; }
.bar i { background: linear-gradient(90deg, #476759, #688f7d); }
.note, .opt, .hist span, .kv div, .inl input, .fld input, .fld textarea, .fld select, .kg input { border-radius: 12px; }
.ring, .ring b, .av, .avbtn, .check { border-radius: 50%; }
.ring { width: 72px; height: 72px; background: conic-gradient(#507766 calc(var(--p)*1%), var(--sage-light) 0); }
.ring b { width: 58px; height: 58px; font-size: 18px; background: var(--card-s); }
.sheet { width: min(100%, 590px); background: var(--card-s); max-height: min(91dvh, 850px); padding: 18px; }
.sheet .x { border-radius: 50%; background: var(--surface-tint); color: var(--accent-strong); }
.toast { border-radius: 13px; }
.ico, .ico svg { width: 24px; height: 24px; display: inline-block; flex: none; vertical-align: middle; }
.ico svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.screen-header { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; gap: 4px; margin: 0 0 12px; }
.screen-header h1 { text-align: center; font-size: clamp(17px, 5vw, 23px); font-weight: 800; line-height: 1.1; }
.header-clock { grid-column: 1 / -1; justify-self: center; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 9px; padding: 4px 10px; border-radius: 8px; background: var(--surface-tint); color: var(--muted); font-size: 12px; font-weight: 800; }
.header-clock span { color: var(--accent-strong); white-space: nowrap; }
.header-clock span time { margin-inline-start: 4px; font-variant-numeric: tabular-nums; }
.icon-btn { display: inline-grid; place-items: center; border: 0; border-radius: 14px; background: var(--sage-light); color: var(--accent-strong); min-width: 42px; min-height: 42px; padding: 4px 8px; font-weight: 800; }
nav { background: #fffdf3f5; border-color: var(--line); backdrop-filter: blur(14px); }
nav .in { max-width: 700px; }
nav button { font-size: 12px; gap: 4px; }
nav button.on { color: var(--accent); }
nav button.on .ico-home svg, nav button.on .ico-me svg { fill: var(--aqua); }
.menu-list .opt { display: flex; align-items: center; gap: 12px; min-height: 49px; font-weight: 800; }
.menu-list .ico, .profile-panel summary .ico:first-child { color: var(--accent); }

.hero { position: relative; isolation: isolate; overflow: hidden; text-align: center; border: 1px solid var(--line); border-radius: 23px; background: var(--sage-light); box-shadow: var(--shadow); }
.hero-heading { position: relative; z-index: 1; padding-top: 7px; background: linear-gradient(var(--cream), var(--cream) 78%, transparent); }
.hero-heading p { font-size: 13px; font-weight: 800; padding: 5px 8px 3px; }
.brand { font-size: clamp(34px, 10.5vw, 44px); color: var(--accent-strong); }
.brand span { font-family: system-ui, sans-serif; display: inline-block; color: var(--aqua); font-size: .68em; transform: rotate(-10deg); text-shadow: 1px 2px 0 var(--accent-strong); }
.hero-art { width: 100%; height: min(65vw, 245px); overflow: hidden; }
.hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 72%; }
.clock { position: relative; gap: 12px; margin: -15px 7px 0; padding: 9px 14px; background: var(--card-s); }
.clock-icons { display: grid; color: var(--accent-strong); gap: 5px; }
.clock .t { font-size: 22px; margin: 1px 0 3px; }
.clock .d { font-size: 14px; text-transform: none; }
.clock .d::first-letter { text-transform: uppercase; }
.clock time { display: block; }
.home-data > h2 { margin: 10px 0 7px; }
.next-card { width: 100%; min-height: 63px; text-align: left; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--sage-light); }
.next-card .ico, .quick-links .ico, .progress-stats .ico { color: var(--accent); }
.next-card .ico-plan, .next-card .ico-plan svg { width: 34px; height: 34px; }
small { display: block; font-size: 12px; color: var(--muted); }
.weekly { margin-top: 9px; padding: 10px; }
.weekly .row { gap: 9px; }
.weekly .ring { width: 63px; height: 63px; }
.weekly .ring b { width: 51px; height: 51px; }
.stats { font-size: 12px; line-height: 1.3; }
.stats .stat-icon { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 3px; border-radius: 50%; font-size: 10px; font-weight: 800; background: var(--sage-light); color: var(--ok); vertical-align: middle; }
.stats .stat-icon.blue { background: var(--aqua); color: #284f46; }
.stat-icon .ico, .stat-icon .ico svg { width: 11px; height: 11px; }
.mini-bars { height: 49px; display: flex; align-items: end; gap: 4px; }
.mini-bars i { width: 6px; height: var(--h); border-radius: 3px 3px 1px 1px; background: linear-gradient(var(--aqua), #587e70); }
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 9px 0 12px; }
.quick-links .card, .progress-stats .card { margin: 0; font-size: 12px; font-weight: 800; }
.quick-links .card { display: grid; justify-items: center; gap: 4px; padding: 7px 4px; }
.quick-links .ico-water { color: var(--water-ink); }
.cycle-card { margin-top: 12px; }

.routine-list { display: grid; gap: 10px; }
.routine-list .routine-card { display: flex; position: relative; width: 100%; min-height: 135px; padding: 0; overflow: hidden; text-align: left; align-items: stretch; margin: 0; }
.routine-card .ex-art { position: relative; border: 0; border-radius: 0; width: 38%; height: auto; min-height: 135px; }
.routine-card .ex-art img { position: absolute; inset: 0; }
.routine-copy { display: grid; align-content: center; gap: 3px; padding: 12px 28px 12px 13px; }
.routine-copy b { font-size: 19px; }
.routine-copy strong { font-size: 14px; line-height: 1.2; }
.routine-copy .pill { justify-self: start; margin-top: 4px; }
.routine-card > .ico { position: absolute; right: 8px; bottom: 10px; color: var(--accent-strong); }
.search-label { display: block; font-weight: 800; margin-bottom: 12px; font-size: 13px; }
.search-label input { display: block; width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 10px 13px; margin-top: 4px; background: var(--card-s); }
.library-list { display: grid; gap: 8px; }
.library-list .library-card { display: flex; align-items: center; width: 100%; text-align: left; gap: 10px; margin: 0; padding: 8px; }
.library-card .ex-art { width: clamp(88px, 27vw, 118px); height: auto; aspect-ratio: 5 / 4; }
.library-card > .ico { color: var(--accent-strong); }
.ex-art { border-radius: 13px; }
.ex { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 4fr); gap: clamp(9px, 2.5vw, 16px); padding: clamp(8px, 2.5vw, 14px); align-items: start; }
.ex > .ex-art { width: 100%; height: auto; aspect-ratio: 3 / 4; }
.ex-copy { text-align: left; overflow-wrap: anywhere; }
.ex-copy h3 { margin-top: 5px; }
.ex-copy .target { margin-top: 4px; }
.ex-copy .sets { gap: 4px; margin-top: 8px; }
.ex-copy .set { width: clamp(36px, 10vw, 44px); height: 44px; }
.ex-copy .meta { gap: 6px 10px; margin-top: 8px; }
.ex-copy .kg input { width: clamp(54px, 17vw, 78px); padding-inline: 5px; }
.ex-copy .rests { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; width: min(100%, 230px); }
.ex-copy .rests span { grid-column: 1 / -1; }
.ex-copy .rests button { padding: 5px 0; min-height: 34px; white-space: nowrap; }
.ex-copy .acts { column-gap: 12px; row-gap: 0; }
.ex-copy .acts button { text-align: left; min-height: 34px; }
.ex.ok { background: #edf4e8; border-color: var(--aqua); }
.set, .rests button { border-radius: 10px; }
.detail-label { font-size: 14px; font-weight: 800; padding: 0 44px 4px 0; color: var(--accent-strong); }
.detail-title { margin: 6px 0 10px; }
.detail-title h2 { font-size: clamp(23px, 6vw, 31px); line-height: 1.12; margin: 0; }
.detail-title .favorite { font-size: 27px; }
.sheet.detail-sheet { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.detail-contents { overflow: auto; padding: 16px 18px; }
.detail-footer { flex: none; padding: 9px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.detail-sheet .ex-art { width: 100%; height: auto; aspect-ratio: 1; max-height: 42dvh; }
.detail-sheet .ex-art img { object-fit: contain; background: var(--surface-tint); }
.detail-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 10px; }
.muscle-panel { display: grid; justify-items: center; gap: 6px; margin: 0; padding: 8px; background: var(--surface-tint); border-radius: 12px; text-align: center; }
.muscle-panel figcaption { display: grid; gap: 2px; font-size: 12px; line-height: 1.25; }
.muscle-panel figcaption span { color: var(--muted); }
.muscle-diagram { display: block; width: min(100%, 126px); height: auto; }
.muscle-diagram text { font: 700 9px Nunito, sans-serif; fill: var(--muted); }
.muscle-diagram path { stroke-width: .65; stroke-linejoin: round; }
.muscle-body { fill: var(--muscle-body); stroke: var(--sage-gray); }
.muscle-neutral { fill: var(--muscle-neutral); stroke: var(--muscle-body); }
.muscle-active { fill: var(--muscle-active); stroke: var(--card-s); }
.exercise-diagram { display: grid; place-items: center; padding: 4px; }
.exercise-diagram .muscle-diagram { width: 100%; max-height: 100%; }
.work-next + .muscle-panel { display: flex; align-items: center; gap: 10px; text-align: left; margin-top: 8px; }
.work-next + .muscle-panel .muscle-diagram { width: 78px; flex: none; }
.detail-target, .detail-rest { border-radius: 13px; background: var(--sage-light); padding: 8px; text-align: center; font-size: 13px; }
.detail-target b, .detail-target span { display: block; }
.detail-target b { font-size: 17px; }
.detail-rest { margin-top: 6px; background: var(--surface-tint); font-weight: 800; }
.detail-rest .ico svg { width: 20px; height: 20px; }
.steps li::marker { color: var(--accent); font-weight: 800; }

.timer { display: none; }
.timer-visible .timer { display: block; }
.timer-in, .timer.run .timer-in { background: linear-gradient(105deg, var(--brown), var(--accent-strong)); border-radius: 16px; max-width: 672px; }
.tring, .tring b { border-radius: 50%; }
.tbtn { border-radius: 11px; }
.timer-panel { display: grid; justify-items: center; gap: 12px; padding: 8px 0 17px; }
.work-dial { width: min(54vw, 212px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#507766, var(--aqua) calc(var(--p, 100)*1%), var(--sage-light) 0); }
.work-dial > div { display: grid; align-content: center; justify-items: center; background: var(--card-s); width: 88%; height: 88%; border-radius: 50%; }
.work-dial b { font-size: clamp(34px, 12vw, 53px); letter-spacing: -.04em; line-height: 1.02; font-variant-numeric: tabular-nums; }
.work-dial span { font-weight: 800; }
.timer-actions { display: flex; align-items: center; gap: 8px; }
.timer-actions .btn { width: auto; min-width: 127px; }
.work-next { width: 100%; display: flex; align-items: center; text-align: left; padding: 0; gap: 10px; border: 0; background: transparent; }
.work-next .target { display: block; white-space: normal; margin: 3px 0; }
.work-next .ex-art { width: clamp(95px, 32vw, 145px); height: auto; aspect-ratio: 5 / 4; }
.work-progress { padding-block: 5px; }
.check-row, .record-line { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 5px 0; }
.check-row + .check-row, .record-line + .record-line { border-top: 1px solid var(--line); }
.check-row button { border: none; text-align: left; background: none; padding: 4px 0; font-size: 14px; font-weight: 700; }
.check { width: 17px; height: 17px; border: 2px solid var(--sage-gray); flex: none; display: grid; place-items: center; line-height: 1; font-size: 11px; }
.check.checked { color: white; border-color: var(--ok); background: var(--ok); }
.work-count { text-align: center; font-size: 13px; font-weight: 800; margin-top: 6px; color: var(--accent-strong); }

.hydration .row { align-items: center; }
.hydration .row > .ico, .hydration .row > .ico svg { width: 42px; height: 51px; color: var(--water-ink); fill: var(--aqua); }
.hydration h2 { margin-top: 0; }
.water-total { font-size: 15px; color: var(--water-ink); font-weight: 800; margin-bottom: 5px; }
.water-total b { font-size: 26px; color: var(--ink); }
.water-bar { background: var(--sage-light); }
.water-bar i, .add-water { background: var(--water-ink); }
.add-water { color: white; font-size: 27px; }
.water-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; gap: 4px; }
.water-actions .sub, .water-actions .link { font-size: 11px; }
.moods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.mood { border: 1px solid transparent; background: transparent; border-radius: 15px; font-size: 13px; font-weight: 800; padding: 5px 2px; }
.mood span { display: block; font-size: 37px; }
.mood[aria-pressed="true"] { background: var(--sage-light); border-color: var(--sage-gray); }
.energy output { color: var(--accent-strong); padding-left: 6px; }
.energy input { accent-color: var(--water-ink); padding: 0; min-height: 34px; }

.calh { background: var(--sage-light); border-radius: 14px; padding: 4px; margin-bottom: 8px; }
.calh .chip { border: 0; background: transparent; font-size: 20px; }
.cal .cell { border-radius: 11px; }
.cal .cell.today { outline: 2px solid var(--accent); background: var(--aqua); }
.cal .cell.done { background: #e6f1e3; }
.cal .cell.plan { background: var(--surface-tint); }
.legend { column-gap: 10px; row-gap: 3px; }
.streak { display: flex; align-items: center; gap: 16px; background: var(--cream); }
.streak > span { font-size: 37px; }
.streak h2 { margin: 0; }

.progress-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 10px 0; }
.progress-stats .card { display: flex; gap: 6px; align-items: center; text-align: left; padding: 10px; }
.progress-stats b { display: block; font-size: 18px; }
.big-stat { color: var(--accent-strong); font-size: 26px; }
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.photo-grid .photo-card { margin: 0; padding: 0; overflow: hidden; font-weight: 800; }
.photo-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-card span { display: block; padding: 6px; }
.photo-full { display: block; width: 100%; max-height: 62vh; object-fit: contain; border-radius: 14px; margin: 8px 0 14px; }
.profile-hero { text-align: center; padding: 6px 0 12px; }
.profile-hero .av { border: 4px solid var(--aqua); }
.profile-hero h2 { margin: 7px 0 3px; font-size: 23px; }
.profile-hero .kv b { font-size: 14px; }
.profile-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.profile-goal { margin: 9px 4px 0; overflow-wrap: anywhere; }
.profile-panel { padding: 0; overflow: clip; }
.profile-panel + .profile-panel { margin-top: 8px; }
.profile-panel summary { display: flex; align-items: center; gap: 9px; padding: 11px 12px; min-height: 57px; cursor: pointer; }
.profile-panel summary::-webkit-details-marker { display: none; }
.profile-panel[open] summary > .ico-next { transform: rotate(90deg); }
.profile-content { padding: 0 12px 12px; }

@media (min-width: 630px) {
  .app { padding-top: 15px; }
  .home-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 14px; align-items: start; }
  .home-data > h2 { margin-top: 0; }
  .hero-art { height: auto; aspect-ratio: 1.12; }
  .routine-list { grid-template-columns: 1fr 1fr; }
  .library-list { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .modal { align-items: center; }
}
@media (max-width: 355px) {
  .app { padding-inline: 9px; }
  .progress-tabs .chip, .week-tabs .chip, .day-tabs .chip { padding-inline: 6px; font-size: 12px; }
  .mini-bars { display: none; }
  .timer .tbtn { padding-inline: 8px; }
}
