/* Dark, one accent. The bottom of the lift screen is the button. */
:root {
  --bg: #0d0e0c;
  --surface: #181916;
  --raised: #22241f;
  --line: #2b2d28;
  --ink: #f1f0ea;
  --muted: #8e9087;
  --accent: #d4f26a;
  --accent-ink: #12150a;
  --warn: #f0b45a;
  --extra: #6ac8f2;
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main { max-width: 560px; margin: 0 auto; }

h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }

button, .button {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 16px;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { cursor: default; }
button:focus-visible, .button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.quiet { all: unset; color: var(--muted); font-size: 0.875rem; padding: 10px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
button.wide { width: 100%; }

/* ---------- screen ---------- */

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom));
}

.top { display: flex; align-items: center; gap: 12px; }
.segs { flex: 1; display: flex; gap: 6px; }
.seg {
  all: unset;
  flex: 1;
  height: 32px;
  cursor: pointer;
  position: relative;
}
.seg::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 14px;
  height: 4px; border-radius: 2px;
  background: var(--line);
}
.seg.done::after { background: var(--muted); }
.seg.skipped::after { background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 7px); }
.seg.here::after { background: var(--accent); }
.seg.end { flex: 0 0 18px; }
.seg.end::after { left: 5px; right: 5px; top: 11px; height: 8px; border-radius: 50%; }
.seg.end:not(.here)::after { background: var(--muted); }

.menu { display: grid; place-items: center; width: 32px; height: 32px; }
.menu span, .menu span::before, .menu span::after {
  display: block; width: 18px; height: 2px; border-radius: 1px; background: var(--muted); position: relative;
}
.menu span::before, .menu span::after { content: ""; position: absolute; }
.menu span::before { top: -6px; }
.menu span::after { top: 6px; }

.head { padding: 6px 0 0; }
.head h1 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.01em; }
.name { all: unset; cursor: pointer; }
.tags { color: var(--accent); font-size: 0.85rem; margin-top: 4px; }

.how { margin-left: 8px; color: var(--muted); font-size: 0.8rem; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; vertical-align: middle; }

/* Form steps: a sheet over the lift. */
.scrim { all: unset; position: fixed; inset: 0; z-index: 10; background: rgb(0 0 0 / 0.6); }
.info {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11;
  max-width: 560px; max-height: 85dvh; margin: 0 auto; overflow: auto;
  padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  background: var(--raised); border-radius: 20px 20px 0 0;
}
.info h2 { font-size: 1.15rem; }
.steps { margin: 10px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.info-links { display: flex; gap: 20px; align-items: center; margin-top: 12px; }
.info-links a { color: var(--accent); font-size: 0.875rem; }

/* ---------- readout ---------- */

.readout { padding: 12px 0 4px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }

.big { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.num { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.num input, .num .value {
  font: 700 4.75rem/1 system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  text-align: center;
  min-width: 1.3ch;
  -moz-appearance: textfield;
}
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num input:focus { outline: none; border-bottom: 2px solid var(--accent); }
.num .value { width: auto; }
.unit { color: var(--muted); font-size: 1.1rem; }
.nudge {
  width: 48px; height: 48px; min-height: 0; padding: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 1.5rem;
  flex: none;
}

.scheme { font-size: 1.15rem; font-weight: 600; }
.hint { color: var(--muted); font-size: 0.875rem; }
.change { font-size: 0.9rem; }
.change.warn { color: var(--warn); }

.small-step { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.small-step button { width: 40px; min-height: 40px; padding: 0; background: none; }
.small-step input {
  font: 600 1.1rem system-ui, sans-serif; color: var(--ink); text-align: center;
  width: 4.5ch; background: none; border: 0; border-bottom: 1px solid var(--line);
  -moz-appearance: textfield;
}

/* One side of the bar, plates drawn to scale. */
.plates {
  display: flex; align-items: center; gap: 3px;
  height: 64px; margin-top: 4px;
  position: relative;
}
.plates::before {
  content: ""; position: absolute; left: -24px; right: -24px; top: 50%;
  height: 4px; margin-top: -2px; background: var(--line); z-index: 0;
}
.collar { width: 6px; height: 22px; background: var(--muted); border-radius: 2px; z-index: 1; margin-right: 3px; }
.plate { display: flex; flex-direction: column; align-items: center; z-index: 1; height: 100%; justify-content: center; position: relative; min-width: 22px; }
.plate i { display: block; width: 12px; height: calc(var(--h) * 52px); background: var(--ink); border-radius: 3px; }
.plate b { position: absolute; bottom: -16px; font-size: 0.7rem; font-weight: 500; color: var(--muted); }
.plates .empty { z-index: 1; background: var(--bg); padding: 0 8px; color: var(--muted); font-size: 0.875rem; }
.plates + .change, .plates + .hint { margin-top: 14px; }

.pips { display: flex; gap: 10px; background: none; border: 0; padding: 10px 12px; min-height: 0; }
.pips i { display: block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); }
.pips i.on { background: var(--accent); }

.logged { flex: 0; padding-top: 32px; }
.logged .summary { font-size: 1.25rem; font-weight: 600; }

/* ---------- pad ---------- */

.pad {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}
.pad-row { display: flex; gap: 6px; }
.pad-row .band { flex: 1; min-width: 0; height: 76px; padding: 8px; }
.pad-row .band .label { font-size: 1.05rem; }
.caption { color: var(--muted); font-size: 0.875rem; text-align: center; padding-bottom: 2px; }
.band {
  flex: none;
  height: 136px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  user-select: none; -webkit-user-select: none;
}
.band .label { font-size: 1.4rem; font-weight: 700; }
.band .sub { font-size: 0.85rem; color: var(--muted); }
.band.go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.band.go .sub { color: inherit; opacity: 0.7; }
.band:active { filter: brightness(1.25); }
.band:disabled { opacity: 0.35; filter: none; }
.band.running { background: var(--raised); }
.count { font: 700 4rem/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }

/* ---------- summary ---------- */

.summary-view { padding-top: 20px; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.summary-view h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
.week { display: flex; align-items: center; gap: 12px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.dots i.on { background: var(--accent); }
.dots i.extra { background: var(--extra); border-color: var(--extra); }
.today { list-style: none; margin: 0; padding: 0; font-size: 1.25rem; font-weight: 600; }
.today li { padding: 10px 0; border-top: 1px solid var(--line); }
.today .superset, .today .optional { --tone: var(--accent); padding-left: 12px; border-left: 3px solid var(--tone); }
.today .optional { --tone: var(--extra); }
.today .label { display: block; color: var(--tone); font-size: 0.8rem; font-weight: 500; }
.today li div { padding-top: 6px; }
.summary-view > .hint { margin-top: 16px; }

/* ---------- superset ---------- */

.superset-bar { margin-top: 2px; }
.handover { color: var(--accent); font-size: 0.8rem; }
.sides { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.swap { color: var(--accent); font-size: 0.85rem; flex: none; }
.side {
  all: unset; flex: 1; min-width: 0; box-sizing: border-box; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 5px 8px; border-radius: 10px;
  border: 1px solid var(--line); color: var(--muted); font-size: 0.8rem;
}
.side > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side.here { border-color: var(--accent); color: var(--ink); }
.side .pips { padding: 0; gap: 3px; display: flex; flex: none; }
.side .pips i { width: 8px; height: 8px; border-width: 1px; }

/* ---------- dev (localhost only) ---------- */

.dev { position: fixed; left: 6px; top: 45%; z-index: 20; display: flex; align-items: flex-start; gap: 6px; }
.dev-toggle { min-height: 0; padding: 3px 7px; font-size: 0.7rem; border-radius: 8px; opacity: 0.7; background: var(--raised); }
.dev-panel { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); box-shadow: 0 6px 24px rgb(0 0 0 / 0.5); }
.dev-panel button { min-height: 34px; padding: 4px 10px; font-size: 0.85rem; }

/* ---------- undo line ---------- */

.toast {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 4px; padding-left: 2px;
  color: var(--muted); font-size: 0.875rem;
}
.toast span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { flex: none; min-height: 32px; padding: 4px 12px; color: var(--accent); font-weight: 600; background: none; border: 0; }

/* ---------- more ---------- */

.more { padding: calc(8px + env(safe-area-inset-top)) var(--gutter) calc(32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 24px; }
.more-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 1; }
.more-head h1 { font-size: 1.5rem; }
.close { color: var(--muted); text-decoration: none; font-size: 1.3rem; width: 44px; height: 44px; display: grid; place-items: center; }
.more section { display: flex; flex-direction: column; gap: 10px; }
.more h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.fold summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; color: var(--muted); }
.fold[open] summary::after { content: "−"; }
.more h3 { font-size: 0.95rem; margin-top: 6px; }
.history, .exercises { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.history li { display: grid; grid-template-columns: 56px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.exercises li { border-top: 1px solid var(--line); }
.exercises summary { list-style: none; display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; }
.exercises summary::-webkit-details-marker { display: none; }
.exercises summary span, .exercises details p { padding-bottom: 8px; }
.exercises .now { color: var(--accent); font-size: 0.75rem; font-weight: 500; padding: 0; }
form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.field input {
  font: inherit; color: var(--ink); min-height: 44px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.message { color: var(--accent); }
.alert .buttons { margin-top: 8px; }

@media (max-height: 700px) {
  .num input, .num .value { font-size: 4rem; }
  .band { height: 112px; }
  .pad-row .band { height: 60px; }
  .plates { height: 50px; }
  .plate i { height: calc(var(--h) * 40px); }
}

/* iPhone: no double-tap zoom anywhere. */
html { touch-action: manipulation; }
.field input { width: 100%; min-width: 0; }

.alert { margin: 8px var(--gutter) 0; padding: 10px 12px; border-radius: 12px; background: var(--raised); color: var(--warn); font-size: 0.9rem; }

/* Timer cue you can see from across the room: a short flash of the accent. */
@keyframes flash { from { background: var(--accent); } to { background: var(--bg); } }
body.flash { animation: flash 0.8s ease-out; }
