:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --ink: #20221e;
  --muted: #62665b;
  --line: #dedfd5;
  --control-line: #898e80;
  --surface: #efefe7;
  --acid: #d2f566;
  --acid-hover: #c5ea53;
  --green: #4b631c;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
::selection { background: var(--acid); color: var(--ink); }
:focus-visible { outline: 2px solid #567323; outline-offset: 4px; }
.icon-library { width: 0; height: 0; position: absolute; pointer-events: none; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(1112px, calc(100% - 64px)); margin-inline: auto; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; padding-block: 5px; font-size: 19px; font-weight: 750; letter-spacing: -.025em; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--ink); color: var(--acid); }
.brand-mark .icon { width: 23px; height: 23px; stroke-width: 2.35; }
.nav { display: flex; align-items: center; gap: 10px; }
.nav a { min-height: 44px; padding: 0 16px; border-radius: 7px; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 14px; font-weight: 600; color: var(--muted); }
.nav .icon { width: 17px; height: 17px; }
.nav a[aria-current] { background: var(--surface); color: var(--ink); }

.main-shell { padding-block: 42px 55px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 26px; }
.page-heading h1 { font-size: 54px; line-height: 1.15; letter-spacing: -.04em; font-weight: 760; }
.today-date { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.today-date .icon { width: 17px; height: 17px; }
.primary-button, .secondary-button, .text-button, .icon-button { min-height: 44px; border: 1px solid transparent; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 700; white-space: nowrap; background: transparent; }
.primary-button { min-height: 48px; padding: 0 18px; background: var(--acid); }
.secondary-button { padding: 0 14px; border-color: var(--line); }
.text-button { padding-inline: 8px; color: var(--green); }
.icon-button { width: 44px; padding: 0; }
.secondary-button .icon { width: 17px; height: 17px; }

.training-cover {
  min-height: 228px;
  display: flex;
  align-items: center;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 9px;
  color: #fafbf4;
  background: #191a17;
}
.training-cover::before { content: ""; position: absolute; z-index: -1; inset: 0 0 0 27%; background: url("./assets/training.webp") right 54% / cover no-repeat; mask-image: linear-gradient(90deg, transparent 7%, #000 58%); }
.cover-copy { min-width: 0; padding: 30px 38px; width: min(65%, 680px); }
.training-cover h2 { font-size: 42px; line-height: 1.2; font-weight: 760; letter-spacing: -.035em; overflow-wrap: anywhere; }
.cover-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 13px; margin-top: 14px; font-variant-numeric: tabular-nums; }
.cover-meta p { color: #e4e7d9; font-size: 15px; line-height: 1.5; }
.cover-meta .workout-kind { border-left: 1px solid #909387; padding-left: 13px; color: #d2f566; font-size: 12px; font-weight: 650; }

.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(275px, .55fr); column-gap: 35px; margin-top: 34px; align-items: stretch; }
.section-heading { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 12px; }
.section-heading h2, .plan-day-heading h2 { font-size: 23px; font-weight: 750; letter-spacing: -.025em; }
.exercise-heading { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.exercise-tools { display: flex; align-items: center; gap: 12px; }
.exercise-tools .text-button { margin-block: -5px; }
.workout-progress { color: var(--muted); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.workout-progress.complete { color: var(--green); }
.exercise-row {
  width: 100%; min-height: 66px; padding: 10px 2px 10px 0; border: 0; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 37px minmax(0, 1fr) auto 33px; align-items: center; column-gap: 13px;
  background: transparent; text-align: left;
}
.exercise-number { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--muted); }
.exercise-info { display: grid; gap: 4px; overflow-wrap: anywhere; }
.exercise-name { font-size: 16px; font-weight: 700; }
.exercise-note { font-size: 12px; color: var(--muted); line-height: 1.45; }
.exercise-volume { font-size: 13px; color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.exercise-check { justify-self: end; display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid var(--control-line); border-radius: 6px; }
.exercise-check .icon { width: 15px; height: 15px; visibility: hidden; stroke-width: 2.2; }
.exercise-row[aria-pressed="true"] .exercise-check { background: var(--acid); border-color: #a6c453; }
.exercise-row[aria-pressed="true"] .exercise-check .icon { visibility: visible; }
.empty-state { padding-block: 24px; color: var(--muted); font-size: 14px; line-height: 1.65; }

.timer-section { border-left: 1px solid var(--line); padding-left: 35px; min-width: 0; }
.timer-heading { min-height: 44px; }
.timer-label { display: flex; align-items: center; gap: 9px; }
.timer-label > .icon { width: 22px; height: 22px; }
.timer-heading .icon-button { margin-right: -6px; color: var(--muted); }
.dial { width: 178px; aspect-ratio: 1; margin: 3px auto 11px; display: grid; place-items: center; position: relative; }
.dial-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); fill: none; stroke-width: 4px; }
.dial-track { stroke: var(--line); }
.dial-progress { stroke: #a8cc4c; stroke-linecap: round; stroke-dasharray: 100 100; transition: stroke-dasharray 200ms linear; }
.dial-readout { position: relative; text-align: center; }
.timer-value { font-size: 44px; font-weight: 740; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.timer-status { margin-top: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.dial[data-mode="done"] .timer-status { color: var(--green); }
.timer-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.timer-presets button { min-height: 44px; min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: transparent; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.timer-presets button[aria-pressed="true"] { background: var(--surface); border-color: var(--green); color: var(--green); }
.timer-actions { margin-bottom: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.reset-button { width: 48px; min-height: 48px; border-color: var(--line); }
.custom-duration { margin-top: 14px; }
.custom-duration label { display: block; margin-bottom: 7px; }
.custom-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.timer-only.dashboard { display: block; max-width: 465px; margin: 24px auto 0; }
.timer-only .timer-section { border: 0; padding: 0; }
.timer-only .timer-label h2 { font-size: 32px; }
.timer-only .dial { width: min(260px, 88%); margin-block: 15px 21px; }
.timer-only .timer-value { font-size: 58px; }

.plan-page { max-width: 850px; }
.page-description { color: var(--muted); padding-top: 10px; font-size: 14px; line-height: 1.6; }
.week-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.week-picker button { position: relative; min-width: 0; min-height: 49px; padding-inline: 3px; border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: 14px; font-weight: 650; color: var(--muted); }
.week-picker button[aria-pressed="true"] { border-bottom-color: var(--ink); color: var(--ink); }
.week-picker button[data-today="true"]::after { content: ""; position: absolute; top: 11px; left: calc(50% + 14px); width: 5px; height: 5px; border-radius: 50%; background: #648728; }
.plan-day-heading { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 24px; margin-bottom: 19px; }
.rest-option { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--muted); }
.rest-option input { accent-color: var(--green); width: 17px; height: 17px; margin: 0; }
.form-label { display: block; margin-bottom: 8px; }
.form-label, .custom-duration label, .plan-row label { color: var(--muted); font-size: 13px; font-weight: 650; }
input:not([type="checkbox"]), textarea { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--control-line); border-radius: 7px; padding: 8px 11px; color: var(--ink); font: inherit; font-size: 16px; background: #fbfbf8; }
input::placeholder, textarea::placeholder { color: #697061; opacity: 1; }
input.plan-name { max-width: 420px; }
.plan-exercise-heading { margin-top: 22px; border-bottom: 1px solid var(--line); }
.plan-exercise-heading h3 { font-size: 17px; }
.plan-row { display: grid; grid-template-columns: 24px minmax(135px, 1.15fr) minmax(66px, .45fr) minmax(72px, .48fr) minmax(140px, 1.1fr) 44px; gap: 10px; align-items: end; padding-block: 15px; border-bottom: 1px solid var(--line); }
.plan-row input { margin-top: 6px; }
.plan-row-number { align-self: end; display: flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.remove-exercise { color: var(--muted); }
.plan-save { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; }
.plan-status { color: var(--muted); font-size: 13px; line-height: 1.5; }
.storage-error { margin-bottom: 16px; color: #8b361e; font-size: 14px; line-height: 1.5; }

.records-heading { align-items: center; }
.records-heading .primary-button .icon { width: 17px; height: 17px; }
#records-status:empty, #record-status:empty { margin: 0; }
#records-status:not(:empty) { margin-bottom: 12px; color: var(--green); }
#records-empty { border-top: 1px solid var(--line); }
.record-entry { border-top: 1px solid var(--line); }
.record-entry:last-child { border-bottom: 1px solid var(--line); }
.record-summary, .record-plan-picker > summary { cursor: pointer; list-style: none; }
.record-summary::-webkit-details-marker, .record-plan-picker > summary::-webkit-details-marker { display: none; }
.record-summary { min-height: 76px; display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; align-items: center; gap: 15px; padding-block: 12px; }
.record-summary-main { display: grid; gap: 4px; overflow-wrap: anywhere; }
.record-summary-name { font-size: 19px; font-weight: 750; }
.record-summary-counts, .record-entry-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.record-summary > .icon { color: var(--muted); }
.record-entry[open] .record-summary > .icon, .record-plan-picker[open] > summary > .icon { transform: rotate(90deg); }
.record-details { padding: 2px 0 12px; }
.record-entry-note, .record-entry-exercise p { color: var(--muted); font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.record-entry-note { margin-bottom: 12px; }
.record-entry-exercise { border-top: 1px solid var(--line); padding: 12px 0; overflow-wrap: anywhere; }
.record-entry-exercise p { margin-top: 7px; }
.record-entry-exercise ol { list-style: none; margin: 7px 0 0; padding: 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.record-entry-exercise li { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: baseline; gap: 8px; padding-block: 3px; }
.record-edit { margin-left: -8px; }

.record-fields { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); gap: 12px; }
.record-field { display: grid; gap: 7px; min-width: 0; color: var(--muted); font-size: 13px; font-weight: 650; }
.record-field :is(input, textarea) { font-weight: 400; }
.record-field textarea { resize: vertical; line-height: 1.5; }
.record-field input[type="datetime-local"] { display: block; appearance: none; }
.record-session-note { margin-top: 14px; }
.record-plan-picker { border-bottom: 1px solid var(--line); }
.record-plan-picker > summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 650; color: var(--green); }
.record-plan-picker > summary > .icon { width: 17px; height: 17px; }
.record-plan-options { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 12px; }
.record-plan-options button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.record-plan-options p { color: var(--muted); font-size: 14px; }
.record-exercise { min-inline-size: 0; border: 0; border-bottom: 1px solid var(--line); margin: 16px 0 0; padding: 0 0 16px; }
.record-exercise legend { padding: 0; margin-bottom: 10px; color: var(--ink); font-size: 15px; font-weight: 750; }
.record-exercise-head { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: end; margin-bottom: 13px; }
.record-exercise-head .record-field { grid-template-columns: minmax(0, 1fr); }
.record-set-heading, .record-set { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.record-set-heading { margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 650; }
.record-set + .record-set { margin-top: 6px; }
.record-set-number { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.record-add-set { margin: 3px 0 4px -8px; }
.record-save { position: sticky; bottom: 0; padding-block: 8px; background: var(--paper); border-top: 1px solid var(--line); }
.record-save .primary-button { margin-left: auto; }
.record-form :is(input, textarea, button) { scroll-margin-bottom: 78px; }

@media (hover: hover) {
  .nav a:hover, .secondary-button:hover, .icon-button:not(:disabled):hover, .text-button:hover, .timer-presets button:not(:disabled):hover, .week-picker button:hover { background: var(--surface); color: var(--ink); }
  .exercise-row:hover { background: #efefe775; }
  .record-summary:hover { background: #efefe775; }
  .primary-button:hover { background: var(--acid-hover); }
}

@media (max-width: 760px) {
  html { scroll-padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  body { padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
  .shell { width: calc(100% - 40px); }
  .header-inner { min-height: 62px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 33px; height: 33px; border-radius: 8px; }
  .brand-mark .icon { width: 21px; height: 21px; }
  .nav { position: fixed; z-index: 2; bottom: 0; left: 0; right: 0; justify-content: center; gap: 0; padding: 3px 15px calc(3px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
  .nav a { width: min(25%, 138px); min-height: 53px; border-radius: 0; flex-direction: column; gap: 4px; padding: 5px; font-size: 12px; }
  .nav .icon { width: 20px; height: 20px; }
  .nav a[aria-current] { background: transparent; color: var(--green); }
  .nav a[aria-current] .icon { stroke-width: 2.1; }
  .main-shell { padding-block: 25px calc(87px + env(safe-area-inset-bottom)); }
  .page-heading { margin-bottom: 19px; }
  .page-heading h1 { font-size: 41px; }
  .today-date { font-size: 13px; margin-bottom: 7px; }
  .page-heading .secondary-button { padding-inline: 9px; gap: 5px; font-size: 13px; }
  .training-cover { min-height: 166px; }
  .training-cover::before { left: 0; background-position: 66% 55%; background-size: cover; mask-image: linear-gradient(90deg, transparent 2%, #000 62%); }
  .cover-copy { width: 100%; padding: 23px 20px; }
  .training-cover h2 { font-size: 32px; }
  .cover-meta { margin-top: 10px; gap: 6px 9px; }
  .cover-meta p { font-size: 14px; }
  .cover-meta .workout-kind { padding-left: 9px; }
  .dashboard { display: block; margin-top: 23px; }
  .section-heading h2, .plan-day-heading h2 { font-size: 21px; }
  .exercise-heading { padding-bottom: 8px; }
  .exercise-row { min-height: 56px; padding-block: 7px; grid-template-columns: 23px minmax(0, 1fr) auto 26px; column-gap: 9px; }
  .exercise-name { font-size: 15px; }
  .exercise-volume, .exercise-number { font-size: 12px; }
  .timer-section { border-left: 0; padding-left: 0; margin-top: 20px; }
  .dashboard:not(.timer-only) .timer-section { display: grid; grid-template-columns: 94px minmax(0, 1fr); gap: 0 16px; }
  .dashboard:not(.timer-only) .timer-heading { grid-column: 1 / -1; }
  .dashboard:not(.timer-only) .dial { grid-column: 1; grid-row: 2; width: 86px; margin: 0; }
  .dashboard:not(.timer-only) .timer-value { font-size: 27px; }
  .dashboard:not(.timer-only) .timer-status { font-size: 10px; margin-top: 3px; }
  .dashboard:not(.timer-only) .timer-actions { grid-column: 2; grid-row: 2; align-self: center; margin: 0; }
  .dashboard:not(.timer-only) .timer-presets, .dashboard:not(.timer-only) .custom-duration { grid-column: 1 / -1; }
  .timer-only.dashboard { margin-top: 0; }
  .timer-only .timer-section { margin-top: 0; }
  .plan-row { grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr) 44px; row-gap: 10px; padding-block: 13px; }
  .plan-row-number { grid-column: 1; grid-row: 1; }
  .row-name { grid-column: 2 / 4; grid-row: 1; }
  .remove-exercise { grid-column: 4; grid-row: 1; }
  .row-sets { grid-column: 2; }
  .row-reps { grid-column: 3; }
  .row-note { grid-column: 2 / 5; }
  .plan-save { position: sticky; bottom: calc(60px + env(safe-area-inset-bottom)); padding-block: 8px; background: var(--paper); border-top: 1px solid var(--line); }
  .plan-form :is(input, button) { scroll-margin-bottom: 78px; }
  .records-heading .primary-button { padding-inline: 11px; }
  .record-fields { grid-template-columns: minmax(0, 1fr); }
  .record-summary { min-height: 68px; gap: 8px; }
  .record-summary-name { font-size: 16px; }
  .record-summary-counts, .record-entry-date { font-size: 12px; }
  .record-set, .record-set-heading { grid-template-columns: 31px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px; }
}

@media (max-width: 355px) {
  .shell { width: calc(100% - 32px); }
  .page-heading h1 { font-size: 36px; }
  .page-heading { gap: 9px; }
  .exercise-row { column-gap: 7px; }
  .exercise-tools { gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .dial-progress { transition: none; }
}
