/* Phase-0 skeleton of the look. The real design pass is phase 8; what matters
   here is that the palette and the rules live in one place from the start.
   Legibility outranks theming: a session is read at arm's length, sweating,
   in bad light. */

:root {
  --void:   #07070a;
  --panel:  #0e0e12;
  --edge:   #1d1d24;
  --bone:   #e8e3d7;
  --ash:    #8b8b95;
  --blood:  #b3121f;
  --ember:  #e0321f;

  --gap: 1rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--void);
  color: var(--bone);
  font: 16px/1.5 ui-sans-serif, system-ui, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

header {
  padding: 1.75rem var(--gap) 1.25rem;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 13vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone);
  text-shadow: 0 0 22px rgba(179, 18, 31, 0.55);
}

.sub {
  margin: 0.4rem 0 0;
  color: var(--ash);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* Spiked rule. A row of triangles masked out of a blood gradient. */
.spikes {
  height: 13px;
  background: linear-gradient(90deg, #35000a, var(--blood) 35%, var(--ember) 50%, var(--blood) 65%, #35000a);
  -webkit-mask: conic-gradient(from -45deg at 50% 0, #000 0 90deg, transparent 0) 50% / 18px 100% repeat-x;
          mask: conic-gradient(from -45deg at 50% 0, #000 0 90deg, transparent 0) 50% / 18px 100% repeat-x;
}
.spikes.flip { transform: scaleY(-1); }

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: var(--gap);
  display: grid;
  gap: var(--gap);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--blood);
  padding: 1rem;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ember);
}

h3 {
  margin: 1rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0; }
dt { color: var(--ash); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }
dd { margin: 0; font-variant-numeric: tabular-nums; }

.meta { margin: 0; color: var(--ash); font-size: 0.85rem; }

.sets { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.set {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.45rem 0.6rem;
  background: #121218;
  border-left: 2px solid var(--edge);
  font-variant-numeric: tabular-nums;
}

/* Ramp sets are dimmed because they are not evidence: progression rules read
   work sets only (PLAN.md 3.3). The UI should say so without a legend. */
.set.ramp { opacity: 0.55; }
/* Not yet done: shown as what was asked, visibly not as what happened. */
.set.planned .load { color: var(--ash); }
.set.planned { opacity: 0.6; }
.set.work { border-left-color: var(--blood); }

.set .role {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ash);
}

.set.out-short .load,
.set.out-failed .load { color: var(--ember); }

.note {
  color: var(--ash);
  font-size: 0.82rem;
  margin: 0.4rem 0 0;
}
.set .note { grid-column: 2; }
.session-note { border-top: 1px solid var(--edge); padding-top: 0.6rem; margin-top: 0.9rem; }


footer {
  padding: 1rem;
  text-align: center;
  color: #4a4a52;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* ------------------------------------------------ today / schedule */

.today .cycle {
  margin: 0 0 0.75rem;
  color: var(--ash);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.today .cycle span {
  margin-left: 0.5rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid currentColor;
}
.phase-build  { color: var(--bone); }
.phase-deload { color: #d8a33a; }
.phase-ended  { color: var(--ember); }

.due {
  margin: 0;
  font-size: clamp(1.35rem, 6.5vw, 1.9rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.15;
}
.due.rest { color: var(--ash); }

.logged {
  vertical-align: middle;
  margin-left: 0.5rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--ash);
  color: var(--ash);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.next {
  margin: 0.6rem 0 0;
  color: var(--ash);
  font-size: 0.85rem;
}

.warning {
  margin: 0.8rem 0 0;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--ember);
  background: rgba(224, 50, 31, 0.08);
  font-size: 0.85rem;
}
.warning.w-deload { border-left-color: #d8a33a; background: rgba(216, 163, 58, 0.08); }

/* "at limit" means the set finished with nothing spare -- the difference
   between a week that earns more weight and one that does not. */
.limit {
  margin-left: 0.5rem;
  color: #d8a33a;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* A one_of session whose weekly slot is filled: still startable, not asked for. */
.due.optional { color: var(--ash); }

/* ================================================================ runner */

body.runner { padding-bottom: 2rem; }

.bar {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
}
.back { color: var(--bone); text-decoration: none; font-size: 1.4rem; line-height: 1; }
.bar-title {
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-meta { color: var(--ash); font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; }

#stage {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.1rem 1rem 0;
  display: grid;
  gap: 0.75rem;
  justify-items: stretch;
  text-align: center;
}

.stagehead h2 { margin: 0; color: var(--ember); }
.stagehead .meta { margin: 0.2rem 0 0; }

.setcount {
  margin: 0; color: var(--ash);
  font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase;
}
.target {
  margin: 0;
  font-size: clamp(1.4rem, 7vw, 2rem);
  font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* The clock is the loudest thing on the page, and has to read from across a
   garage. Tabular numerals so the digits do not jitter as it counts. */
.readout {
  display: grid; gap: 0.1rem;
  padding: 1rem 0.5rem;
  border: 1px solid var(--edge);
  background: #101016;
}
.clock {
  font-size: clamp(4rem, 26vw, 7.5rem);
  font-weight: 900; line-height: 0.95;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.clocklabel {
  color: var(--ash);
  font-size: 0.68rem; letter-spacing: 0.24em; text-transform: uppercase;
}
.readout.hot   { border-color: var(--blood); box-shadow: inset 0 0 40px rgba(179,18,31,0.25); }
.readout.hot .clock { color: #fff; text-shadow: 0 0 26px rgba(224,50,31,0.7); }
.readout.ready { border-color: #2c6e3f; }
.readout.ready .clock { color: #7ddc9a; }

/* Buttons are thumb-sized and sit in the lower half of the screen, because
   that is where a hand already is. */
.btn {
  appearance: none;
  width: 100%;
  min-height: 3.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--edge);
  background: #16161d;
  color: var(--bone);
  font: inherit;
  font-size: 1.05rem; font-weight: 800;
  letter-spacing: 0.16em; text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;          /* no double-tap zoom delay */
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }

.btn-go   { background: var(--blood); border-color: var(--ember); min-height: 4.5rem; font-size: 1.3rem; }
.btn-stop { background: #2a0a0e; border-color: var(--blood); min-height: 4.5rem; font-size: 1.3rem; }
.btn-yes  { background: #123021; border-color: #2c6e3f; }
.btn-no   { background: #33260a; border-color: #d8a33a; }
.btn-quiet { background: #101016; color: var(--ash); font-size: 0.75rem; min-height: 2.9rem; }
.btn-step { font-size: 1.8rem; letter-spacing: 0; }
.btn-finish { background: var(--blood); border-color: var(--ember); margin-top: 0.5rem; }

.twoup, .stepper { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.ask { margin: 0; color: var(--ash); font-size: 0.95rem; letter-spacing: 0.08em; }

/* One pip per set: what happened, at a glance, without a legend. */
.pips {
  list-style: none; margin: 0.25rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
}
.pip {
  min-width: 2.6rem; padding: 0.3rem 0.35rem;
  border: 1px solid var(--edge); background: #101016;
  color: var(--ash);
  font-size: 0.7rem; font-variant-numeric: tabular-nums;
}
.pip.ramp   { opacity: 0.55; }
.pip.ok     { border-color: #2c6e3f; color: #7ddc9a; }
.pip.short  { border-color: var(--ember); color: var(--ember); }
.pip.skip   { border-color: var(--edge); color: #55555e; text-decoration: line-through; }
.pip.limit  { border-bottom-width: 3px; border-bottom-color: #d8a33a; }

.status {
  margin: 0; padding: 0.4rem 0.6rem;
  border-left: 3px solid #d8a33a; background: rgba(216,163,58,0.1);
  color: #d8a33a; font-size: 0.78rem; text-align: left;
}

.sheet {
  max-width: 34rem;
  margin: 1.2rem auto 0;
  padding: 0 1rem;
  display: grid;
  gap: 0.6rem;
}
.blockcard {
  border: 1px solid var(--edge); border-left: 3px solid var(--edge);
  background: var(--panel); padding: 0.75rem 0.9rem;
}
.blockcard.done { border-left-color: #2c6e3f; opacity: 0.75; }
.blockcard h3 { margin: 0 0 0.3rem; font-size: 0.85rem; }
.item { margin: 0.2rem 0; color: var(--ash); font-size: 0.82rem; }

.finish { margin-top: 0.4rem; }
.finish label { display: block; margin-bottom: 0.9rem; color: var(--ash); font-size: 0.78rem;
  letter-spacing: 0.12em; text-transform: uppercase; }
.finish input[type=range] { width: 100%; margin-top: 0.5rem; accent-color: var(--blood); }
.finish textarea {
  width: 100%; margin-top: 0.4rem; padding: 0.6rem;
  background: #101016; border: 1px solid var(--edge); color: var(--bone);
  font: inherit; text-transform: none; letter-spacing: normal;
}
.feelval { color: var(--bone); font-size: 1rem; }

/* Start button on the landing page. */
.startform { margin-top: 0.9rem; }

/* The lead-in before a hang: present, but visibly not the hang itself. */
.readout.setup { border-color: #d8a33a; }
.readout.setup .clock { color: #d8a33a; }

/* ------------------------------------------------------------ sign in */

.login label {
  display: block; margin-bottom: 0.9rem;
  color: var(--ash); font-size: 0.72rem;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.login input {
  width: 100%; margin-top: 0.4rem; padding: 0.8rem;
  background: #101016; border: 1px solid var(--edge); color: var(--bone);
  font: inherit; font-size: 1.05rem;
  letter-spacing: normal; text-transform: none;
}
.login input:focus { outline: none; border-color: var(--blood); }
.login code { color: var(--bone); font-size: 0.9em; }

/* Session-type links, so any workout is reachable on any day. */
.others { display: grid; gap: 0.4rem; margin-top: 0.3rem; }
.otherrow {
  display: grid; grid-template-columns: 1fr auto auto; gap: 0.4rem; align-items: center;
}
.otherrow .name {
  color: var(--bone); font-size: 0.82rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.otherrow .btn { min-height: 2.5rem; font-size: 0.65rem; padding: 0.4rem 0.7rem; width: auto; }
/* Same colour language as the mode bars, so the button and the page it leads to
   agree before you tap. */
.btn-records  { border-color: var(--blood); color: var(--bone); background: #2a0a0e; }
.btn-practice { border-color: #d8a33a; color: #d8a33a; background: #1a1509;
                text-align: center; text-decoration: none; }
/* Which mode you are in, stated on the page rather than inferred from which
   button you think you pressed. Amber never writes; blood always does. The
   recording state used to be the unlabelled one -- which is the wrong way round,
   since it is the one with consequences. */
.modebar {
  margin: 0; padding: 0.5rem 0.8rem;
  border-left: 3px solid;
  font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.modebar.practice  { border-color: #d8a33a; background: rgba(216,163,58,0.12); color: #d8a33a; }
.modebar.recording { border-color: var(--blood); background: rgba(179,18,31,0.12); color: var(--ember); }
.logoutform { text-align: center; margin: 1.2rem 0 0; }
.logoutform .btn { width: auto; min-height: 2.4rem; font-size: 0.62rem; padding: 0.4rem 1rem; }

/* Rest ran past the top of its window: not an error, just drift worth seeing. */
.readout.late { border-color: #d8a33a; }
.readout.late .clock { color: #d8a33a; }

/* Destructive and rare: quiet, and last. */
.discard { margin-top: 1.5rem; text-align: center; }
.btn-discard {
  width: auto; min-height: 2.4rem; padding: 0.4rem 1rem;
  background: transparent; border-color: var(--edge);
  color: #6b4046; font-size: 0.62rem;
}
.btn-discard:hover { color: var(--ember); border-color: var(--blood); }

/* A session started and not finished. Surfaced so it can be resumed or removed,
   rather than sitting in the database displacing the last real one. */
.inprogress { border-left-color: #d8a33a; }
.inprogress h2 { color: #d8a33a; }
.inprogress .twoup { margin-top: 0.7rem; }
.inprogress .btn { text-align: center; text-decoration: none; display: block; }

/* ------------------------------------------------------ suggestions */

.suggestions { border-left-color: #2c6e3f; }
.sugg {
  padding: 0.6rem 0 0.7rem;
  border-top: 1px solid var(--edge);
}
.sugg:first-of-type { border-top: 0; }

.sugg-head { margin: 0 0 0.2rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; }
.sugg-block {
  font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.sugg-line { color: var(--ash); font-size: 0.7rem; }

/* The move is the answer, so it is the loudest line. A hold is stated plainly
   rather than dressed up: holding is the expected outcome, not a failure. */
.sugg-move {
  margin: 0;
  font-size: 1.15rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.s-add_load .sugg-move,
.s-add_set .sugg-move,
.s-advance_level .sugg-move { color: #7ddc9a; }
.s-hold .sugg-move { color: var(--bone); }

.sugg-why { margin: 0.25rem 0 0; color: var(--ash); font-size: 0.8rem; }
.sugg-notice {
  margin: 0.4rem 0 0; padding: 0.4rem 0.6rem;
  border-left: 3px solid #d8a33a; background: rgba(216,163,58,0.1);
  color: #d8a33a; font-size: 0.78rem;
}

/* Correcting the set just logged. Quiet, because it is an exception -- but
   present on every rest, because that is the only moment you are free and still
   remember what happened. */
.correction {
  margin-top: 0.6rem; padding-top: 0.6rem;
  border-top: 1px solid var(--edge);
}
.correction-label {
  margin: 0 0 0.4rem;
  color: var(--ash);
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* Unlocking a finished record for correction. Quiet: it is rarely right. */
.reopen { margin-top: 0.8rem; }
.reopen .btn { width: auto; padding: 0.4rem 1rem; min-height: 2.4rem; font-size: 0.62rem; }
