:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(600px 420px at 50% 0%, rgba(28, 175, 195, 0.13), transparent 65%),
    linear-gradient(rgba(80, 220, 230, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 220, 230, 0.045) 1px, transparent 1px),
    #060e15;
  background-size: auto, 22px 22px, 22px 22px, auto;
  color: #e7fbff;
  font-family: "Segoe UI", sans-serif;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
#app {
  width: min(430px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding:
    calc(10px + env(safe-area-inset-top))
    14px
    calc(28px + env(safe-area-inset-bottom));
}
.kicker {
  font-family: "Cascadia Mono", ui-monospace, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.66rem;
  color: #8fd8df;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.topbar h1 { font-size: 1.24rem; font-weight: 600; letter-spacing: 0.04em; }
.flag {
  border: 1px solid rgba(122, 246, 255, 0.45);
  background: rgba(14, 52, 66, 0.45);
  padding: 5px 8px;
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  color: #7af6ff;
}

.navtabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 10px;
  padding: 4px;
  background: rgba(5, 18, 26, 0.92);
  border: 1px solid rgba(62, 224, 240, 0.42);
  position: sticky;
  top: calc(4px + env(safe-area-inset-top));
  z-index: 8;
  backdrop-filter: blur(8px);
}
.navtabs button {
  min-height: 52px;
  border: 1px solid transparent;
  background: transparent;
  color: #a9d5dc;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 2px;
  border-radius: 2px;
}
.navtabs svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.navtabs button[aria-selected="true"] {
  color: #041d24;
  background: #3ee0f0;
  border-color: #7af6ff;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(62, 224, 240, 0.35);
}

.live {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  border: 1px solid rgba(62, 224, 240, 0.55);
  background: rgba(8, 40, 50, 0.9);
  color: #7af6ff;
  min-height: 40px;
  text-align: left;
  padding: 8px 12px;
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.78rem;
}

.panel {
  position: relative;
  border: 1px solid rgba(62, 224, 240, 0.34);
  background: rgba(6, 20, 28, 0.82);
  box-shadow: inset 0 0 32px rgba(62, 224, 240, 0.06);
  padding: 12px;
  margin-bottom: 10px;
}
.panel:before, .panel:after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid #3ee0f0;
  pointer-events: none;
}
.panel:before { top: 4px; left: 4px; border-right: 0; border-bottom: 0; }
.panel:after { right: 4px; bottom: 4px; border-left: 0; border-top: 0; }

.meta-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.meta-pill {
  background: rgba(7, 24, 34, 0.9);
  border: 1px solid rgba(62, 224, 240, 0.38);
  padding: 5px 6px;
  text-align: center;
}
.meta-pill b {
  display: block;
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  color: #7af6ff;
  line-height: 1.15;
}
.meta-pill span {
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ecfd6;
}
.resting .meta-pill { border-color: rgba(255, 178, 90, 0.55); }
.resting .meta-pill b { color: #ffb25a; }

.gauge {
  position: relative;
  width: min(100%, 248px);
  margin: 0 auto 6px;
  aspect-ratio: 1;
}
.dial { width: 100%; height: 100%; display: block; overflow: visible; }
.tick-ring { fill: none; stroke: rgba(122, 246, 255, 0.35); stroke-width: 2; stroke-dasharray: 1.4 4.8; }
.round-bg { fill: none; stroke: rgba(62, 224, 240, 0.15); stroke-width: 9; stroke-linecap: butt; }
.round-done {
  fill: none;
  stroke: #19c27c;
  stroke-width: 9;
  stroke-linecap: butt;
  filter: drop-shadow(0 0 5px rgba(25, 194, 124, 0.65));
}
.round-now {
  fill: none;
  stroke: #3ee0f0;
  stroke-width: 9;
  stroke-linecap: butt;
  filter: drop-shadow(0 0 6px rgba(62, 224, 240, 0.75));
}
.ring-inner-bg { fill: none; stroke: rgba(62, 224, 240, 0.14); stroke-width: 5.5; }
.arc-now {
  fill: none;
  stroke: #7af6ff;
  stroke-width: 5.5;
  stroke-linecap: butt;
  filter: drop-shadow(0 0 5px rgba(122, 246, 255, 0.7));
}
.resting .arc-now { stroke: #ffb25a; filter: drop-shadow(0 0 6px rgba(255, 178, 90, 0.75)); }
.ring-deco { fill: none; stroke: rgba(122, 246, 255, 0.22); stroke-width: 1; stroke-dasharray: 2 3; }

.hub {
  position: absolute;
  inset: 22%;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 2px;
}
.hub-k {
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8fd8df;
}
.hub-time {
  font-size: clamp(2.2rem, 10.5vw, 2.95rem);
  line-height: 0.96;
  font-variant-numeric: tabular-nums;
  color: #f3fffe;
  text-shadow: 0 0 12px rgba(62, 224, 240, 0.35);
}
.hub-name { font-size: 0.84rem; color: #c7f6fa; max-width: 144px; line-height: 1.15; }
.hub-sub {
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  color: #79c4cc;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.urgent .hub-time { color: #ffb25a; text-shadow: 0 0 12px rgba(255, 178, 90, 0.45); }

.legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 0 0 6px;
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  color: #9ecfd6;
}
.legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  vertical-align: -1px;
}
.legend .dot-done { background: #19c27c; box-shadow: 0 0 6px rgba(25, 194, 124, 0.7); }
.legend .dot-now { background: #3ee0f0; box-shadow: 0 0 6px rgba(62, 224, 240, 0.7); }

canvas.fig {
  width: 100%;
  height: 256px;
  display: block;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(28, 175, 195, 0.15), transparent 74%);
  border-top: 1px solid rgba(62, 224, 240, 0.2);
  border-bottom: 1px solid rgba(62, 224, 240, 0.2);
  touch-action: none;
  cursor: grab;
}
canvas.fig:active { cursor: grabbing; }
.cam-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-top: 6px;
}
.cam-bar button {
  min-height: 34px;
  border: 1px solid rgba(62, 224, 240, 0.36);
  background: rgba(6, 22, 32, 0.85);
  color: #a9d5dc;
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 2px;
  border-radius: 2px;
}
.cam-bar button[aria-pressed="true"] {
  background: #3ee0f0;
  color: #041d24;
  border-color: #7af6ff;
  font-weight: 700;
}
.cam-hint {
  margin-top: 4px;
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  color: #79b8c2;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.sess-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.sess-bar button {
  min-height: 38px;
  border: 1px solid rgba(62, 224, 240, 0.42);
  background: rgba(8, 28, 38, 0.72);
  color: #c5eef4;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 2px;
}
.sess-bar button[aria-pressed="true"] {
  background: #3ee0f0;
  color: #041d24;
  border-color: #7af6ff;
  font-weight: 700;
}
.ex-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.ex-chips button {
  min-height: 34px;
  border: 1px solid rgba(62, 224, 240, 0.34);
  background: rgba(6, 22, 30, 0.75);
  color: #c3ebf0;
  padding: 4px 8px;
  font-size: 0.74rem;
  border-radius: 2px;
}
.ex-chips button[aria-pressed="true"] {
  background: rgba(25, 194, 124, 0.25);
  border-color: #19c27c;
  color: #e7fbff;
}
.editor {
  margin-top: 10px;
  border-top: 1px solid rgba(62, 224, 240, 0.25);
  padding-top: 10px;
}
.editor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.editor-grid label {
  font-size: 0.72rem;
  color: #9ec9ce;
}
.editor-grid input {
  width: 100%;
  min-height: 36px;
  margin-top: 3px;
  padding: 4px 6px;
  background: #06141c;
  border: 1px solid rgba(62, 224, 240, 0.4);
}
.ed-row {
  display: grid;
  grid-template-columns: 1fr 62px 32px 32px 32px;
  gap: 4px;
  align-items: center;
  margin: 5px 0;
}
.ed-row input {
  min-height: 34px;
  padding: 4px 6px;
  background: #06141c;
  border: 1px solid rgba(62, 224, 240, 0.35);
  text-align: right;
}
.ed-row button, .ed-add button {
  min-height: 34px;
  border: 1px solid rgba(62, 224, 240, 0.35);
  background: rgba(8, 28, 38, 0.7);
  color: #c5eef4;
  padding: 2px 6px;
}
.ed-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 8px;
}
.ed-add select {
  min-height: 38px;
  background: #06141c;
  color: #e7fbff;
  border: 1px solid rgba(62, 224, 240, 0.4);
  padding: 4px 8px;
}
.cue { margin-top: 8px; line-height: 1.35; color: #d5f4f6; font-size: 0.9rem; }
.next { margin-top: 4px; color: #7af6ff; font-size: 0.9rem; }
.acts { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.go, .acts button, .choice, .check, .row button, .meal {
  min-height: 44px;
  border: 1px solid rgba(62, 224, 240, 0.45);
  background: rgba(8, 28, 38, 0.7);
  border-radius: 2px;
  padding: 6px 12px;
}
.go.main, button[aria-pressed="true"] {
  background: #3ee0f0;
  color: #042026;
  border-color: #3ee0f0;
  font-weight: 600;
}
.meal[aria-pressed="true"] {
  background: rgba(25, 194, 124, 0.22);
  color: #e7fbff;
  border-color: #19c27c;
}
.go { width: 100%; margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.wake { margin-top: 8px; font-size: 0.78rem; color: #9ec9ce; }

.anatomy-card {
  margin-top: 8px;
  padding: 14px 10px 12px;
  border-radius: 14px;
  background:
    radial-gradient(ellipse 75% 55% at 50% 42%, rgba(36, 198, 134, 0.14), transparent 72%),
    linear-gradient(155deg, rgba(22, 46, 54, 0.88), rgba(7, 19, 25, 0.96));
  border: 1px solid rgba(154, 245, 226, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 26px rgba(0, 0, 0, 0.45);
}
.anatomy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: center;
}
.anatomy-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.anatomy-tag {
  font-family: "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(158, 207, 214, 0.68);
  margin-bottom: 2px;
}
.anatomy-svg {
  width: 100%;
  max-width: 185px;
  height: auto;
  overflow: visible;
  display: block;
}
.anatomy-svg .silhouette path {
  fill: url(#bodySilhouette);
  stroke: rgba(110, 210, 195, 0.24);
  stroke-width: 1.15;
  stroke-linejoin: round;
}
.anatomy-svg .seam {
  fill: none;
  stroke: rgba(4, 14, 18, 0.85);
  stroke-width: 1.2;
  pointer-events: none;
}
.anatomy-svg .mz {
  cursor: pointer;
  transition: filter 0.18s ease, opacity 0.18s ease;
}
.anatomy-svg .mz path {
  fill: url(#mOff);
  stroke: #041014;
  stroke-width: 1.45;
  stroke-linejoin: round;
  transition: fill 0.18s ease, stroke 0.18s ease;
}
.anatomy-svg .mz .fiber {
  fill: none;
  stroke: rgba(4, 15, 19, 0.72);
  stroke-width: 1;
  pointer-events: none;
}
.anatomy-svg .mz:hover path:not(.fiber) {
  stroke: rgba(122, 246, 255, 0.75);
}
.anatomy-svg .mz.sub path:not(.fiber) {
  fill: url(#mSub);
  stroke: #051619;
}
.anatomy-svg .mz.on {
  filter: url(#muscleGlow);
}
.anatomy-svg .mz.on path:not(.fiber) {
  fill: url(#mOn);
  stroke: #051c16;
  stroke-width: 1.55;
}
.anatomy-svg .mz.on .fiber {
  stroke: rgba(6, 44, 32, 0.65);
}
.anatomy-target {
  margin: 10px 4px 0;
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: #cdebe4;
  font-weight: 500;
}
.zone-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.zone-pill {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(62, 224, 240, 0.3);
  background: rgba(6, 22, 32, 0.82);
  color: #a9d5dc;
  font-size: 0.74rem;
}
.zone-pill.on {
  background: rgba(34, 214, 146, 0.24);
  border-color: #4ff5ab;
  color: #d9ffef;
  box-shadow: 0 0 10px rgba(79, 245, 171, 0.28);
}
.zone-pill.reset {
  border-color: rgba(255, 178, 90, 0.45);
  color: #ffd39b;
}
.plan-list { margin: 8px 0 0; padding-left: 18px; }
.plan-list li { margin: 4px 0; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat strong {
  display: block;
  font-size: 1.8rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat span { color: #9ec9ce; font-size: 0.82rem; }
.macro, .track-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}
.bar { height: 8px; background: #102a30; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #19c27c, #7af6ff); }
.bar.mass i { background: linear-gradient(90deg, #ffb25a, #19c27c); }
.meal-block { margin-top: 10px; }
.meal { width: 100%; text-align: left; padding: 10px; }
.grams { width: 100%; border-collapse: collapse; margin-top: 6px; }
.grams td { padding: 5px 0; border-top: 1px solid rgba(122, 246, 255, 0.12); vertical-align: top; }
.grams td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grams small { color: #9ec9ce; }

label.field { display: block; margin: 8px 0; color: #9ec9ce; font-size: 0.85rem; }
input[type="number"], input[type="date"] {
  display: block;
  width: 100%;
  margin-top: 4px;
  min-height: 44px;
  padding: 8px;
  background: #06141c;
  border: 1px solid rgba(62, 224, 240, 0.4);
}
.log { list-style: none; padding: 0; margin: 8px 0 0; }
.log li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid rgba(122, 246, 255, 0.12);
}
.log button { border: 0; background: transparent; color: #ffb25a; min-height: 40px; }
