:root {
  color-scheme: light dark;
  --page: light-dark(#edf0e8,#151b17);
  --paper: light-dark(#fcfdf8,#202923);
  --soft: light-dark(#e2ecd8,#293b2c);
  --ink: light-dark(#19271e,#edf5e8);
  --muted: light-dark(#4f6052,#adbdad);
  --line: light-dark(#d3ddcf,#414f43);
  --brand: light-dark(#234633,#c9eea7);
  --on: light-dark(#fff,#203324);
  --warning: light-dark(#755010,#f4cd80);
  --alert: light-dark(#8c382e,#ffb5ac);
  font: 16px/1.5 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--brand); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .button {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 9px 15px;
  min-height: 46px; cursor: pointer; text-align: center; display: inline-flex; align-items: center;
  justify-content: center; text-decoration: none; color: var(--ink); line-height: 1.25; font-weight: 600;
}
button:hover, .button:hover { border-color: var(--brand); }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--brand); border-color: transparent; color: var(--on); }
.quiet { background: transparent; }
.danger { color: var(--alert); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
input:not([type=checkbox]), select, textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px;
  min-height: 46px; padding: 8px 10px; background: var(--paper);
}
input[type=checkbox] { accent-color: var(--brand); width: 20px; height: 20px; margin: 0; }
textarea { resize: vertical; min-height: 86px; }
label { display: grid; gap: 4px; min-width: 0; font-size: .88rem; color: var(--muted); }
label > input, label > select, label > textarea { font-size: 1rem; color: var(--ink); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; min-width: 0; margin: 0; }
legend { padding-inline: 6px; color: var(--muted); }
h1,h2,h3,p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.85rem,6vw,2.65rem); line-height: 1.05; letter-spacing: -.05em; }
h2 { font-size: 1.22rem; line-height: 1.2; letter-spacing: -.02em; }
h3 { font-size: 1.05rem; line-height: 1.25; }
small,.muted { color: var(--muted); }
.alert { color: var(--alert); }
.warning { color: var(--warning); }
.shell { width: min(100% - 32px, 980px); margin-inline: auto; }
.bar { border-bottom: 1px solid var(--line); background: var(--paper); padding-top: var(--tg-content-safe-area-inset-top,0px); }
.topline { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 750; }
.logo { border-radius: 10px; background: var(--brand); color: var(--on); display: grid; place-items: center; width: 34px; height: 34px; }
.layout { display: grid; grid-template-columns: 156px minmax(0,1fr); gap: 30px; padding-block: 26px 50px; }
.navigation { display: grid; align-content: start; gap: 5px; }
.navigation button { justify-content: flex-start; border-color: transparent; background: transparent; }
.navigation [aria-current=page] { background: var(--soft); }
main, .stack, form { display: grid; align-content: start; gap: 15px; min-width: 0; }
.heading { display: grid; gap: 7px; margin-block: 3px 7px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 17px; display: grid; gap: 12px; min-width: 0; }
.hero { background: var(--soft); border-color: transparent; padding: 22px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.spread { justify-content: space-between; }
.pair,.triple { display: grid; gap: 8px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.triple { grid-template-columns: repeat(3,minmax(0,1fr)); }
.grow { flex: 1; }
.line { border-top: 1px solid var(--line); padding-top: 10px; }
.tag { color: var(--muted); border-radius: 24px; border: 1px solid var(--line); padding: 3px 9px; font-size: .82rem; }
.numeric { font-variant-numeric: tabular-nums; }
.timer { font-weight: 750; font-size: 1.35rem; }
.exercise-list { display: grid; gap: 8px; }
.exercise-list button { text-align: left; justify-content: space-between; gap: 10px; }
.exercise-list [aria-pressed=true] { background: var(--soft); border-color: var(--brand); }
.save-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.save-bar .primary { flex: 1; }
.hint p, .notes { white-space: pre-wrap; }
.chart { display: grid; gap: 8px; }
.chart-row { display: grid; grid-template-columns: 65px minmax(0,1fr) 72px; align-items: center; gap: 9px; }
meter { width: 100%; height: 15px; accent-color: var(--brand); }
details { min-width: 0; }
details > summary { cursor: pointer; padding-block: 4px; font-weight: 600; }
details[open] > summary { margin-bottom: 8px; }
dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 20px; width: min(100% - 24px,590px); max-height: 88dvh; }
dialog::backdrop { background: #0a110aa0; }
#live { position: fixed; }
.sr { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.empty { padding: 20px; border: 1px dashed var(--line); border-radius: 16px; }
@media (max-width: 680px) {
  .layout { display: block; padding: 19px 0 calc(90px + env(safe-area-inset-bottom)); }
  .navigation { position: fixed; inset: auto 0 0; z-index: 3; background: var(--paper); border-top: 1px solid var(--line);
    padding: 5px max(5px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left));
    display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 2px; }
  .navigation button { justify-content: center; padding: 8px 1px; font-size: .82rem; }
  .shell { width: calc(100% - 24px); }
  .panel { padding: 13px; }
  .hero { padding: 17px; }
  .topline { min-height: 58px; }
  .brand { font-size: .93rem; }
}
