/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH / TerraVita / Version 1.0       # ||
|| # ----------------------------------------- # ||
|| # Indoors: the builder, the player and      # ||
|| # what you have been doing.                 # ||
|| ############################################# ||
\*===============================================*/

/*
  EVERYTHING HERE LEANS ON tl-ui.css AND terravita.css. The buttons are
  .tl-btn, the figures are .tv-fig and the progress bar is .tl-meter. What is
  new is the four things this page has that nothing else does: a form that
  asks four questions, a screen readable from the floor, a consistency grid,
  and a field for what you are lifting.

  The number strips are NOT .tl-kpis, which is the one place this page parts
  company with the shared vocabulary. That component stretches its children
  edge to edge, which is right for a row of six figures on a dashboard and
  leaves a screen's width of nothing between three.

  No colour is defined here. Every one is a --tl-* or --tv-q-* token, so this
  page follows the day and night faces without knowing they exist.
*/

/*
  HIDDEN HAS TO WIN, AND BY DEFAULT IT DOES NOT.

  The `hidden` attribute is `display: none` in the browser's own stylesheet,
  which any author `display` beats. Three sections here set `display: flex` and
  all three are toggled with `hidden`, so the player and the empty plan both
  rendered underneath the builder: a giant 0, a Stop button and a progress bar
  on a page nobody had started.

  Stated once, for this page's own elements rather than globally, because a
  bare `[hidden]` rule is the kind of thing another stylesheet later fights.
*/
.tvita-page [hidden],
.tvita-play[hidden],
.tvita-plan[hidden] {
  display: none !important;
}

.tvita-page {
  padding-block: 1.5rem 3rem;
}

/*
  THE FRAMEWORK GIVES EVERY <section> 7.5rem OF VERTICAL PADDING, and this
  page has five of them nested inside it.

  style.css styles the bare element, which is right for the landing page it
  was written for: there a section is a band of the page and wants air round
  it. Here a section is a heading and a chart, and the rule put 120px above
  the balance bars, 120px more above the consistency grid and 120px again
  above the tiles, which read as three things that had failed to load. The
  outer .tvita-page overrides it for itself and the override did not reach
  its children.

  Their own spacing is set where they are laid out, in rem, next to the rest
  of this page's rhythm.
*/
.tvita-page section {
  padding-block: 0;
}

/*
  THE HEAD, WITH THE WAY BACK ON THE RIGHT. This page is today and the
  profile tab is the last three months, and the two want to be one press
  apart in both directions.
*/
.tvita-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem 1.5rem;
}

.tvita-head .tl-pagehead-copy {
  /* A paragraph is read, not scanned: past about 62 characters the eye
     loses the start of the next line. */
  max-width: 46ch;
}

.tvita-back {
  flex: none;
  margin-top: 0.3rem;
}

/* ----------------------------------------------------------- the builder --*/

/*
  THE CONSOLE: four questions and their button, in one panel, hairline
  separated.

  THREE COLUMNS COUNTED, NOT auto-fit, and that is the whole fix. auto-fit
  with a 15rem floor makes four tracks on a desktop and there are three
  questions to put in them, so the panel drew an empty beige cell in its top
  right corner on every wide screen: a hole in the middle of the first thing
  anybody sees.
*/
.tvita-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--tl-hairline);
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius-lg, 12px);
  overflow: hidden;
  margin-bottom: 1rem;
}

@media (min-width: 48em) {
  .tvita-form {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tvita-field {
  background: var(--tl-panel);
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* The kit is the one question that needs a sentence, so it gets the full row. */
.tvita-field--wide {
  grid-column: 1 / -1;
}

.tvita-hint {
  margin: -0.3rem 0 0;
  font-size: 0.78rem;
  color: var(--tl-dim);
}

.tvita-minutes {
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 5.5ch;
  text-align: center;
}

.tvita-stepper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tvita-stepper .tl-btn {
  width: 2.4rem;
  flex: none;
  justify-content: center;
}

.tvita-range {
  width: 100%;
  accent-color: var(--tl-accent);
}

/*
  A SEGMENTED CONTROL, and the pressed state is a fill rather than an outline.
  Three outlined buttons with one slightly darker is a control people press
  twice to find out which one is on.
*/
.tvita-seg,
.tvita-kit {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tvita-seg .tl-btn,
.tvita-kit .tl-btn {
  flex: 1 1 auto;
  justify-content: center;
}

.tvita-kit .tl-btn {
  flex: 0 1 auto;
}

/*
  The footer cell. Paper rather than panel, so the row that acts reads as
  the base of the console and not as a fifth question.
*/
.tvita-field--foot {
  grid-column: 1 / -1;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  background: var(--tl-paper-deep);
}

.tvita-field--foot .tl-btn-accent {
  padding-inline: 1.4rem;
}

.tvita-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--tl-muted);
  cursor: pointer;
}

.tvita-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--tl-radius, 8px);
  background: var(--tl-danger-bg);
  color: var(--tl-danger);
  font-size: 0.9rem;
}

/* Finishing a session says so in the same place a failure would. */
.tvita-error.is-good {
  background: var(--tl-success-bg);
  color: var(--tl-success);
}

/*
  A session somebody stopped part way is neither. Green would congratulate
  them for it and red would tell them off for being interrupted, so it is the
  page's own quiet panel: what was kept, stated plainly.
*/
.tvita-error.is-part {
  background: var(--tl-paper-deep);
  color: var(--tl-muted);
}

/* -------------------------------------------------------------- the plan --*/

.tvita-plan {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

/*
  THE TICKET: what the session comes to, and the one button worth pressing.

  It replaces a full width strip of statistics with the Start button floating
  to the right of it, which read as two unrelated things: the figures
  stretched edge to edge with acres of nothing between them, and the button
  had no card to belong to.
*/
.tvita-ticket {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.9rem 1.4rem;
  padding: 0.95rem 1.1rem 1rem;
  border: 1px solid var(--tl-hairline-strong);
  border-radius: var(--tl-radius-lg, 12px);
  background: var(--tl-panel);
}

.tvita-ticket-figs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 2.4rem;
}

.tvita-tk {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.tvita-tk-label {
  font-family: var(--tl-font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--tl-dim);
}

.tvita-tk-value {
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: 1.45rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tvita-tk-value small {
  font-size: 0.62em;
  font-weight: 600;
  margin-left: 0.15em;
  color: var(--tl-muted);
}

.tvita-startbtn {
  font-size: 1rem;
  padding-inline: 1.8rem;
  align-self: stretch;
}

/* The bar and its legend run the full width under both, which is what makes
   them read as a caption to the figures rather than a third column. */
.tvita-ticket-spine {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--tl-hairline);
}

/*
  THE SESSION IN ONE LINE, coloured by quality in the order it is done. The
  parcours panel has the same bar for the same reason: it is drawn from the
  same list as the cards below, so the two cannot disagree about what is in
  the session.
*/
.tvita-bar {
  display: flex;
  gap: 2px;
  height: 8px;
}

.tvita-bar i {
  flex: 1;
  border-radius: 99px;
  background: var(--tl-hairline-strong);
}

.tvita-bar i[data-q="mobility"],
.tvita-bar i[data-q="coordination"] { background: var(--tv-q-mobility); }
.tvita-bar i[data-q="endurance"]    { background: var(--tv-q-endurance); }
.tvita-bar i[data-q="strength"]     { background: var(--tv-q-strength); }

.tvita-trained {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0;
  font-family: var(--tl-font-mono);
  font-size: 0.68rem;
  color: var(--tl-muted);
}

.tvita-trained-label {
  color: var(--tl-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.tvita-trained span[data-q]::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.4rem;
  background: var(--tl-hairline-strong);
}

.tvita-trained span[data-q="mobility"]::before,
.tvita-trained span[data-q="coordination"]::before { background: var(--tv-q-mobility); }
.tvita-trained span[data-q="endurance"]::before    { background: var(--tv-q-endurance); }
.tvita-trained span[data-q="strength"]::before     { background: var(--tv-q-strength); }

/*
  A COLUMN PER BLOCK, AND ALL OF THEM ON ONE ROW ON A DESKTOP.

  17rem was the floor, which gives three tracks inside a 1140px container and
  leaves the cool down stranded on a second row beside an empty half screen.
  A session is warm, main, main, cool, read left to right; 15rem fits the four
  of them and still leaves each card wider than the 74px figure plus a
  readable measure.
*/
.tvita-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.8rem;
  /* Each card is as tall as what is in it. Stretched to the tallest, the warm
     up and the cool down drew half a card of empty panel underneath three
     exercises, which reads as something that failed to load. */
  align-items: start;
}

.tvita-block {
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius-lg, 12px);
  background: var(--tl-panel);
  overflow: hidden;
}

.tvita-block-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--tl-hairline);
  font-family: var(--tl-font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--tl-dim);
}

.tvita-block-stage {
  color: var(--tl-ink);
  font-weight: 500;
}

.tvita-block-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.tvita-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

/*
  A ROW PER EXERCISE, drawing on the left. 74px is the floor terravita.css
  sets for a jointed figure: below that the limbs merge and it stops being
  readable on a phone.
*/
.tvita-item {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--tl-hairline);
}

.tvita-item:last-child {
  border-bottom: 0;
}

.tvita-item-art {
  display: block;
  background: var(--tl-paper-deep);
  border-radius: var(--tl-radius-sm, 6px);
  padding: 3px;
}

.tvita-item-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  /* The drop button hangs off the top right of the copy column. */
  position: relative;
  padding-right: 1.4rem;
}

/*
  NOT THIS ONE.

  Quiet until the row is under the cursor, because it is a destructive-looking
  control on every line of a list somebody is reading: at full strength it
  would be twelve crosses competing with twelve exercise names. It is always
  in the tab order and always visible to a screen reader; what changes is the
  opacity.
*/
.tvita-drop {
  position: absolute;
  top: -0.15rem;
  right: -0.2rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--tl-dim);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.tvita-item:hover .tvita-drop,
.tvita-drop:focus-visible {
  opacity: 1;
}

.tvita-drop:hover,
.tvita-drop:focus-visible {
  background: var(--tl-paper-deep);
  color: var(--tl-ink);
}

/* No hover on a touch screen, so there it is simply always there. */
@media (hover: none) {
  .tvita-drop {
    opacity: 0.55;
  }
}

/*
  WHAT IS BEING LEFT OUT, AND THE WAY BACK IN.

  Each one is a button carrying its own name and a turn-back arrow, so the
  list doubles as the undo: nothing is removed that cannot be seen and
  restored in one press.
*/
.tvita-skipped {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-top: 0.15rem;
}

.tvita-skipped-label {
  font-family: var(--tl-font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--tl-dim);
}

.tvita-unskip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.5rem;
  border: 1px dashed var(--tl-hairline-strong);
  border-radius: 99px;
  background: none;
  color: var(--tl-muted);
  font-size: 0.74rem;
  cursor: pointer;
}

.tvita-unskip:hover,
.tvita-unskip:focus-visible {
  border-style: solid;
  border-color: var(--tl-accent);
  color: var(--tl-accent);
}

.tvita-unskip span {
  font-size: 0.9em;
}

.tvita-item-name {
  font-family: var(--tl-font-display);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.tvita-item-dose {
  font-family: var(--tl-font-mono);
  font-size: 0.74rem;
  color: var(--tl-ink);
}

.tvita-item-how {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--tl-muted);
}

/*
  WHAT YOU ARE LIFTING.

  Only on the exercises that come in kilograms, which rig.php decides: a band
  has a colour and not a weight, and a number field under a press-up is a
  question with no answer. It sits between the dose and the how-to on the
  plan, and under the how-to in the player, which is the order they are read
  in both places.

  A NUMBER INPUT AND NOT A STEPPER, because the answers are 8, 12, 16, 20 and
  a stepper in half kilogram steps is thirty presses to get from one to the
  next. The half kilogram step is there for the keyboard and the spinner.
*/
.tvita-kgfield {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
  align-self: flex-start;
  padding: 0.2rem 0.55rem 0.2rem 0.6rem;
  border: 1px solid var(--tl-hairline-strong);
  border-radius: 99px;
  background: var(--tl-white, var(--tl-panel));
  cursor: text;
}

.tvita-kgfield-label,
.tvita-kgfield-unit {
  font-family: var(--tl-font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--tl-dim);
}

.tvita-kgfield-unit {
  text-transform: none;
  letter-spacing: 0;
}

.tvita-kg {
  width: 4ch;
  border: 0;
  padding: 0;
  background: none;
  color: var(--tl-ink);
  font-family: var(--tl-font-mono);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tvita-kg:focus {
  outline: none;
}

.tvita-kgfield:focus-within {
  border-color: var(--tl-accent);
}

/* The player's copy is read from further away and holds a bigger number. */
.tvita-play .tvita-kgfield {
  padding: 0.35rem 0.8rem;
  margin-top: 0.5rem;
}

.tvita-play .tvita-kg {
  font-size: 1.3rem;
  width: 5ch;
}

/* ------------------------------------------------------------ the player --*/

/*
  READABLE FROM THE FLOOR AT ARM'S LENGTH, which is the whole brief. One
  exercise, one number, one way out, and the number is the biggest thing on
  the page by a long way.
*/
.tvita-play {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  min-height: min(80vh, 34rem);
  padding: 1rem 0 2rem;
}

.tvita-play-top {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tvita-play-round {
  font-family: var(--tl-font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--tl-dim);
}

.tvita-quit {
  margin-left: auto;
}

.tvita-stagearea {
  display: grid;
  grid-template-columns: minmax(8rem, 15rem) 1fr;
  gap: 1.2rem;
  align-items: center;
}

.tvita-fig {
  background: var(--tl-paper-deep);
  border-radius: var(--tl-radius-lg, 12px);
  padding: 0.6rem;
}

.tvita-play-copy {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.tvita-play-kind {
  font-family: var(--tl-font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--tl-accent);
}

.tvita-play-name {
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

.tvita-play-dose {
  font-family: var(--tl-font-mono);
  font-size: 1.1rem;
  margin: 0;
  color: var(--tl-ink);
}

.tvita-play-how {
  margin: 0;
  max-width: 46ch;
  color: var(--tl-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.tvita-clock {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tvita-count {
  font-family: var(--tl-font-mono);
  font-weight: 500;
  font-size: clamp(3.4rem, 16vw, 7rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/*
  THE LEAD-IN, counting you in. The number is the accent rather than the ink,
  so five seconds of counting cannot be mistaken for a work interval already
  running: it is the same distinction resting makes, in the other direction.
*/
.tvita-play.is-ready .tvita-count,
.tvita-play.is-ready .tvita-play-kind {
  color: var(--tl-accent);
}

.tvita-play.is-ready .tl-meter-fill {
  background: var(--tl-accent-2);
}

/*
  RESTING LOOKS DIFFERENT, and it has to: the one question somebody asks while
  lying on the floor is whether they are supposed to be working. So the whole
  screen changes colour rather than a word changing.
*/
.tvita-play.is-resting .tvita-count,
.tvita-play.is-resting .tvita-play-kind {
  color: var(--tl-cta);
}

.tvita-play.is-resting .tl-meter-fill {
  background: var(--tl-cta);
}

.tvita-next {
  margin: 0;
  font-family: var(--tl-font-mono);
  font-size: 0.78rem;
  color: var(--tl-dim);
}

.tvita-play-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: auto;
}

.tvita-play-actions .tl-btn {
  min-width: 7rem;
  justify-content: center;
}

/* ------------------------------------------------------- the stop dialogue --*/

/*
  A DIALOGUE, NOT A CONFIRM.

  Fixed to the viewport because the player can be scrolled anywhere by the
  time somebody stops, and a panel that appears above the fold of a page they
  are not looking at is a panel they do not see.

  The two verbs are stacked rather than side by side, each with a line saying
  what it does: "keep" and "delete" as adjacent buttons of equal weight is
  exactly how somebody loses a session they meant to keep.
*/
.tvita-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgb(0 0 0 / 0.45);
}

.tvita-modal-card {
  width: min(26rem, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.3rem 1.4rem 1.1rem;
  border: 1px solid var(--tl-hairline-strong);
  border-radius: var(--tl-radius-lg, 12px);
  background: var(--tl-panel);
  box-shadow: var(--tl-lift-lg, 0 18px 48px rgb(0 0 0 / 0.18));
}

.tvita-modal-title {
  margin: 0 0 0.35rem;
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1.15;
}

.tvita-modal-sofar {
  margin: 0 0 1rem;
  color: var(--tl-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.tvita-modal-actions {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.tvita-modal-actions .tl-btn {
  justify-content: center;
  width: 100%;
}

/* A gap before the second verb, so the two are never one tap apart. */
.tvita-modal-bin {
  margin-top: 0.7rem;
  border-color: var(--tl-danger, #A6382C);
  color: var(--tl-danger, #A6382C);
}

.tvita-modal-bin:hover,
.tvita-modal-bin:focus-visible {
  background: var(--tl-danger-bg);
  color: var(--tl-danger, #A6382C);
}

.tvita-modal-why {
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--tl-dim);
}

/* Carrying on is the quiet one, and the one Escape and the backdrop pick. */
.tvita-modal-carry {
  width: 100%;
  justify-content: center;
  border-color: transparent;
  color: var(--tl-muted);
}

/* ------------------------------------------------ what you have been doing --*/

.tvita-stats {
  border-top: 1px solid var(--tl-hairline-strong);
  padding-top: 1.2rem;
}

.tvita-stats-body {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  /* Clear of the section kicker above it, which is set in the same mono
     uppercase as the first label inside: without the gap the two read as one
     heading that had been typed twice. */
  margin-top: 0.9rem;
}

/*
  THE BALANCE LEADS AND THE COUNTS CAPTION IT.

  It used to open on a full width strip of three big numbers with the balance
  underneath, which put "34 sessions" in the largest type on the page. That is
  a number somebody reads once. The balance is the one figure here that says
  something they did not already know, so it takes the width and the counts
  stand in a column beside it.
*/
.tvita-stats-lead {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
  align-items: start;
}

/*
  THREE READINGS OF THE SAME THREE MONTHS, ACROSS ONE BAND: what you trained,
  when you trained it, and how much of it there was.

  The grid used to sit on its own row below, which left the balance bars on
  a line of their own with a screen's width of nothing to their right, and
  pushed the calendar far enough down that the two were never seen together.
  They answer next to each other: a strength-heavy balance and a sparse
  October are the same story told twice.
*/
@media (min-width: 62em) {
  .tvita-stats-lead {
    grid-template-columns: minmax(0, 1fr) auto 13rem;
    gap: 2.2rem;
  }
}

.tvita-balance,
.tvita-grid-wrap,
.tvita-most {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tvita-most {
  margin-top: 1.6rem;
}

/* ---- the counted figures ---- */

.tvita-tally {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (min-width: 62em) {
  .tvita-tally {
    grid-template-columns: 1fr;
    gap: 0.9rem;
    padding-left: 1.6rem;
    border-left: 1px solid var(--tl-hairline);
  }
}

.tvita-tally-cell {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.tvita-tally-label {
  font-family: var(--tl-font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--tl-dim);
}

.tvita-tally-value {
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: 1.75rem;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.tvita-tally-value small {
  font-size: 0.5em;
  font-weight: 600;
  margin-left: 0.1em;
  color: var(--tl-muted);
}

/* The second number, which would otherwise want a tile of its own: how many
   were started and stopped, how long the streak runs. */
.tvita-tally-note {
  font-size: 0.72rem;
  color: var(--tl-dim);
}

.tvita-bars {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/*
  BARS, NOT A RING, and it is a real decision. Four qualities share three
  colours by design (mobility and coordination are the same gold, which
  terravita.css argues for), and a ring with two segments in one colour reads
  as one segment with a seam in it. A bar carries its own label, so two golds
  are two labelled rows rather than an ambiguity.
*/
/*
  The track is capped rather than fluid. Given a whole column it grew to
  six hundred pixels and a fourteen per cent fill became a stub at the far
  left with its own label stranded at the far right: two ends of one figure
  too far apart to read as one.
*/
.tvita-barrow {
  display: grid;
  grid-template-columns: 7rem minmax(0, 20rem) 2.6rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.tvita-barrow-name {
  color: var(--tl-muted);
}

.tvita-barrow-track {
  display: block;
  height: 8px;
  border-radius: 99px;
  background: var(--tl-paper-deep);
  overflow: hidden;
}

.tvita-barrow-track span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--tl-hairline-strong);
}

.tvita-barrow[data-q="mobility"] .tvita-barrow-track span,
.tvita-barrow[data-q="coordination"] .tvita-barrow-track span { background: var(--tv-q-mobility); }
.tvita-barrow[data-q="endurance"] .tvita-barrow-track span    { background: var(--tv-q-endurance); }
.tvita-barrow[data-q="strength"] .tvita-barrow-track span     { background: var(--tv-q-strength); }

.tvita-barrow-pct {
  font-family: var(--tl-font-mono);
  font-size: 0.74rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--tl-dim);
}

.tvita-note {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--tl-dim);
  max-width: 44ch;
}

/*
  THE CONSISTENCY GRID: a column per week, Monday at the top. Four steps
  rather than a continuous scale, because the question is "did I train" and
  not "how hard": a gradient invites reading a shade as a measurement.
*/
/*
  The whole grid scrolls as one, months and days together, so a narrow screen
  cannot slide the labels out of step with the columns they name.

  SIDEWAYS ONLY, AND THE SECOND AXIS HAS TO BE SAID OUT LOUD. Setting
  overflow-x alone makes the computed overflow-y `auto` rather than the
  `visible` it looks like, which is in the spec and catches everybody. This
  box sits in an `auto` grid track, so it is exactly as wide as the calendar:
  a vertical scrollbar that appears there eats fifteen pixels of that width,
  which pushes the last column out, which brings up a horizontal scrollbar
  too. On a machine set to show scrollbars always, the twelve week grid drew
  with a bar down its right, a bar along its bottom, and today's square, the
  one square anybody looks for, hidden underneath.
*/
.tvita-cal-wrap {
  overflow: auto hidden;
  padding-bottom: 0.2rem;
}

.tvita-cal,
.tvita-cal-months {
  display: flex;
  gap: 4px;
  width: max-content;
}

/*
  ROOM FOR THE LABEL TO HANG INTO.

  A month label is allowed to run past its own 14px column, and visible
  overflow from a descendant counts towards a scroll container's scrollable
  area: three letters over the last column is enough to put a horizontal bar
  under a grid that fits perfectly well. The padding absorbs the overhang so
  there is nothing to scroll to, and it costs a strip of empty space nobody
  can see.
*/
.tvita-cal-months {
  margin-bottom: 0.3rem;
  padding-right: 1.6rem;
}

.tvita-cal-month {
  width: 14px;
  font-family: var(--tl-font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: var(--tl-dim);
  /* The label names its own column and is allowed to run past it: three
     letters do not fit in fourteen pixels and clipping them to "J" would
     leave January, June and July telling the same story. */
  white-space: nowrap;
  overflow: visible;
}

.tvita-cal-week {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tvita-cal-day {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--tl-paper-deep);
  border: 1px solid var(--tl-hairline);
}

.tvita-cal-day[data-n="1"] { background: var(--tl-accent-3, var(--tl-accent-dim)); border-color: transparent; }
.tvita-cal-day[data-n="2"] { background: var(--tl-accent-2); border-color: transparent; }
.tvita-cal-day[data-n="3"] { background: var(--tl-accent); border-color: transparent; }

/*
  A DAY THAT WAS STARTED AND STOPPED, which is neither a mark nor a blank.
  Outlined rather than filled: the shape says something happened, the empty
  middle says it did not count. A half filled square would have been read as
  half as much training, which is a different claim.
*/
.tvita-cal-day[data-part="1"] {
  border-color: var(--tl-accent-2);
  border-style: dashed;
}

/*
  WHAT YOU DO MOST, AND HOW WELL.

  These were .stpf-minitiles, which is a component defined in the profile's
  own stylesheet: on the profile tab they drew correctly and on this page
  they were unstyled text, "21Goblet squat" run together with no tile around
  it, because nothing here loads profile-sections.css. Their own class, and
  the tile now carries the best as well as the count, which is the half worth
  having: 21 goblet squats is a habit and 20 kg is progress.
*/
.tvita-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.6rem;
}

.tvita-tile {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.65rem 0.75rem 0.6rem;
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius, 8px);
  background: var(--tl-panel);
}

.tvita-tile-name {
  font-family: var(--tl-font-display);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
}

.tvita-tile-times {
  font-family: var(--tl-font-mono);
  font-size: 0.68rem;
  color: var(--tl-dim);
}

.tvita-tile-best {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--tl-hairline);
}

.tvita-tile-best i {
  font-family: var(--tl-font-mono);
  font-style: normal;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--tl-dim);
}

.tvita-tile-best b {
  font-family: var(--tl-font-mono);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  color: var(--tl-ink);
}

.tvita-empty {
  margin: 0;
  color: var(--tl-dim);
  font-size: 0.88rem;
}

/* ------------------------------------------------------- the session, done --*/

/*
  THE SAME PAGE, A FOURTH STATE: the session is over and this says what it came
  to. A night hero, because the moment is the finale and the landing sets its
  finale on the night ground too, then the record on paper underneath: what was
  done, what was skipped, and what it adds up to.

  Every colour is a token. The hero carries .tv-on-night, which lifts the
  quality hues for the dark ground in either face.
*/
.tvita-done {
  display: flex;
  flex-direction: column;
  gap: 2.6rem;
  padding-block: 0.5rem 1rem;
}

.tvita-done-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
  padding: clamp(1.4rem, 4vw, 3rem);
  /* The edge, for the night face: its paper is nearly this ground, and
     without a line the panel dissolved into the page around it. */
  border: 1px solid var(--tl-night-line);
  border-radius: var(--tl-radius-xl, 14px);
  background: var(--tl-night);
  color: var(--tl-night-ink);
}

/* The landing's contour rings, standing behind the numbers. */
.tvita-done-rings {
  position: absolute;
  z-index: -1;
  right: -14rem;
  top: -20rem;
  width: 48rem;
  height: 48rem;
  pointer-events: none;
}

.tvita-done-rings path {
  fill: none;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke: var(--tl-night-line);
}

.tvita-done-rings path:nth-child(1) { stroke: var(--tl-night-line-3); }
.tvita-done-rings path:nth-child(2),
.tvita-done-rings path:nth-child(3) { stroke: var(--tl-night-line-2); }

.tvita-done-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem 3rem;
}

.tvita-done-copy {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  max-width: 40rem;
}

.tvita-done-kicker {
  font-family: var(--tl-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--tl-sage);
}

.tvita-done-title {
  margin: 0;
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: clamp(2.8rem, 8vw, 6.6rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--tl-night-bright);
}

/* The one word in the accent. Sage when it did not count: kept is not a
   celebration, and the orange would say it was. */
.tvita-done-title em {
  font-style: italic;
  color: var(--tl-cta);
}

.tvita-done.is-part .tvita-done-title em {
  color: var(--tl-sage);
}

.tvita-done-sub {
  margin: 0;
  max-width: 36rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--tl-night-ink);
}

.tvita-done-figs {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.tvita-done-big,
.tvita-done-fig {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tvita-done-big b {
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: clamp(3.4rem, 9vw, 7.4rem);
  line-height: 0.85;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  color: var(--tl-night-bright);
}

.tvita-done-big span,
.tvita-done-fig span {
  font-family: var(--tl-font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tl-night-muted);
}

.tvita-done-big span {
  color: var(--tl-sage);
}

.tvita-done-trio {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2.4rem;
}

.tvita-done-fig b {
  font-family: var(--tl-font-display);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--tl-night-bright);
}

.tvita-done-fig small {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--tl-night-muted);
}

/*
  THE SESSION, SET BY SET: the leg rail from the activity page, one block per
  set. Coloured where it was done, outlined where it was skipped, a shade off
  the ground where the session stopped before it.
*/
.tvita-rail {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tvita-rail-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--tl-font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tl-night-muted);
}

.tvita-rail-head b {
  font-weight: 500;
  color: var(--tl-night-ink);
}

.tvita-rail-groups {
  display: flex;
  gap: 8px;
}

.tvita-rail-group {
  flex-basis: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tvita-rail-sets {
  display: flex;
  gap: 3px;
  height: 26px;
}

.tvita-rail-sets i {
  flex-basis: 0;
  min-width: 3px;
  border-radius: 4px;
}

.tvita-rail-label {
  overflow: hidden;
  font-family: var(--tl-font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--tl-night-muted);
}

.tvita-rail-label .is-short {
  display: none;
}

.tvita-rail-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.4rem;
}

.tvita-rail-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  font-size: 0.8rem;
}

.tvita-rail-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.tvita-rail-legend i {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.tvita-rail-when {
  font-family: var(--tl-font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tl-night-muted);
}

/* One set, three answers, drawn the same in the rail, its legend and the pips. */
.tvita-rail-sets i[data-r="done"][data-q="mobility"],
.tvita-rail-sets i[data-r="done"][data-q="coordination"],
.tvita-rail-legend i[data-q="mobility"],
.tvita-pips i[data-r="done"][data-q="mobility"],
.tvita-pips i[data-r="done"][data-q="coordination"] { background: var(--tv-q-mobility); }
.tvita-rail-sets i[data-r="done"][data-q="endurance"],
.tvita-rail-legend i[data-q="endurance"],
.tvita-pips i[data-r="done"][data-q="endurance"]     { background: var(--tv-q-endurance); }
.tvita-rail-sets i[data-r="done"][data-q="strength"],
.tvita-rail-legend i[data-q="strength"],
.tvita-pips i[data-r="done"][data-q="strength"]      { background: var(--tv-q-strength); }

.tvita-rail-sets i[data-r="skipped"],
.tvita-rail-legend i[data-r="skipped"] {
  background: transparent;
  border: 1.5px dashed var(--tl-night-muted);
}

.tvita-rail-sets i[data-r="missed"],
.tvita-rail-legend i[data-r="missed"] {
  background: var(--tl-night-line);
  box-shadow: inset 0 0 0 1px var(--tl-night-line-2);
}

/* ---- the record ---- */

.tvita-done-body {
  display: grid;
  gap: 2.6rem 3.5rem;
}

@media (min-width: 62em) {
  .tvita-done-body {
    grid-template-columns: minmax(0, 1fr) 25rem;
    align-items: start;
  }
}

.tvita-done-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.tvita-done-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--tl-font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tl-cta-hover);
}

.tvita-done-eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  background: currentColor;
}

/* A second heading further down the same column wants air above it. */
.tvita-done-col > .tvita-done-eyebrow ~ .tvita-done-eyebrow {
  margin-top: 1.6rem;
}

.tvita-done-h {
  margin: 0 0 0.4rem;
  font-family: var(--tl-font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.tvita-done-h--sm {
  margin: 0;
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
}

.tvita-done-subhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
}

.tvita-done-subhead span {
  font-family: var(--tl-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tl-muted);
}

.tvita-done-list {
  overflow: hidden;
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius-lg, 12px);
  background: var(--tl-panel);
}

.tvita-done-stage {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid var(--tl-hairline);
  background: var(--tl-paper-deep);
  font-family: var(--tl-font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tl-muted);
}

.tvita-done-item {
  display: grid;
  grid-template-columns: 3.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid var(--tl-hairline);
}

.tvita-done-item:last-child {
  border-bottom: 0;
}

.tvita-done-art {
  display: block;
  width: 3.6rem;
  height: 3.6rem;
  padding: 0.25rem;
  border-radius: var(--tl-radius-sm, 6px);
  background: var(--tl-paper-deep);
}

.tvita-done-art .tv-fig {
  width: 100%;
  height: 100%;
}

/* An exercise nothing of which was done: there, and plainly not done. */
.tvita-done-item.is-out .tvita-done-art {
  background: transparent;
  border: 1.5px dashed var(--tl-hairline-strong);
  opacity: 0.55;
}

.tvita-done-item.is-out .tvita-done-name {
  color: var(--tl-muted);
}

.tvita-done-what {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.tvita-done-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
  font-weight: 600;
}

.tvita-done-dose {
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--tl-muted);
}

.tvita-done-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.tvita-pips {
  display: flex;
  gap: 4px;
}

.tvita-pips i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--tl-hairline);
}

.tvita-pips i[data-r="skipped"] {
  background: transparent;
  border: 1.5px dashed var(--tl-dim);
}

.tvita-done-time {
  font-family: var(--tl-font-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--tl-muted);
}

.tvita-done-time.is-word {
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/*
  What it earned, as a chip on the row and on the card. Tints of the two
  accents, mixed from the tokens, so they follow the face.
*/
.tvita-chip {
  align-self: flex-start;
  border-radius: 99px;
  padding: 0.2rem 0.55rem;
  font-family: var(--tl-font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tvita-chip.is-best {
  background: color-mix(in srgb, var(--tl-cta) 16%, transparent);
  color: var(--tl-cta-hover);
}

.tvita-chip.is-first {
  background: color-mix(in srgb, var(--tl-accent) 18%, transparent);
  color: var(--tl-accent-hover);
}

.tvita-done-skips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.8rem;
}

.tvita-done-skip {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  border: 1.5px dashed var(--tl-hairline-strong);
  border-radius: var(--tl-radius-lg, 12px);
}

.tvita-done-skip .tvita-done-art {
  width: 3rem;
  height: 3rem;
}

.tvita-done-missed {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.2rem;
  border-radius: var(--tl-radius-lg, 12px);
  background: var(--tl-paper-deep);
}

.tvita-done-missed span {
  color: var(--tl-muted);
}

.tvita-done-note {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--tl-muted);
}

/* ---- what it adds up to ---- */

.tvita-done-tally {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius-lg, 12px);
  background: var(--tl-hairline);
}

.tvita-done-tally div {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 1rem;
  background: var(--tl-paper-deep);
}

.tvita-done-tally span {
  font-family: var(--tl-font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tl-muted);
}

.tvita-done-tally b {
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tvita-done-tally small {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--tl-muted);
}

.tvita-done-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius-lg, 12px);
  background: var(--tl-panel);
}

.tvita-done-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--tl-font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tl-muted);
}

.tvita-done-marklegend {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: 0.06em;
  text-transform: none;
  font-size: 0.72rem;
}

.tvita-done-marklegend i {
  width: 2px;
  height: 12px;
  background: var(--tl-ink);
}

.tvita-done-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.tvita-done-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius-lg, 12px);
  background: var(--tl-panel);
}

.tvita-done-card.is-wide {
  grid-column: 1 / -1;
}

.tvita-done-card .tvita-done-art {
  width: 100%;
  height: 6.5rem;
  padding: 0.4rem;
}

.tvita-done-cardtitle {
  font-family: var(--tl-font-display);
  font-weight: 700;
  font-size: 1.3rem;
}

.tvita-done-kg {
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tvita-done-kg small {
  font-size: 0.5em;
  font-weight: 600;
  color: var(--tl-muted);
}

/* The balance with today's mark on it: the track lets the mark stand proud. */
.tvita-done-bars .tvita-barrow {
  grid-template-columns: 6.5rem minmax(0, 1fr) 2.6rem;
}

.tvita-done-bars .tvita-barrow-track {
  position: relative;
  overflow: visible;
}

.tvita-barrow-mark {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 16px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--tl-ink);
}

.tvita-done-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--tl-hairline-strong);
}

.tvita-done-actions p {
  margin: 0;
  color: var(--tl-muted);
}

.tvita-done-actions div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

/* Today, ringed, on every grid on the page. */
.tvita-cal-day[data-today="1"] {
  outline: 2px solid var(--tl-cta);
  outline-offset: 1px;
}

/*
  THE PLAYER, SAVING. The last interval has ended and the answer has not come
  back: the clock stops being a clock and says so, in the accent, the colour
  the lead-in counted you in with.
*/
.tvita-play.is-finishing .tvita-count {
  font-family: var(--tl-font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 10vw, 4.6rem);
  color: var(--tl-accent);
}

.tvita-play.is-finishing .tl-meter-fill {
  background: var(--tl-accent);
}

/* ------------------------------------------------------------ narrow ------*/

@media (max-width: 640px) {
  .tvita-stagearea {
    grid-template-columns: 1fr;
  }

  /* The figure stands down on a phone: the name, the dose and the clock are
     what somebody reads mid-exercise, and the drawing is what they looked at
     before they started. */
  .tvita-fig {
    max-width: 11rem;
  }

  .tvita-item {
    grid-template-columns: 62px 1fr;
  }

  .tvita-play-actions .tl-btn {
    flex: 1 1 auto;
  }

  .tvita-done-item {
    grid-template-columns: 3rem minmax(0, 1fr) auto;
    padding-inline: 0.9rem;
  }

  .tvita-done-art {
    width: 3rem;
    height: 3rem;
  }

  .tvita-done-tally b {
    font-size: 1.3rem;
  }

  .tvita-rail-label .is-long {
    display: none;
  }

  .tvita-rail-label .is-short {
    display: inline;
  }
}

/* ----------------------------------------------- the profile tab ---------

  The same figures as the page, asked a different way: the page is for
  somebody who has just finished and is looking at today, the profile for
  somebody looking back. So the trend leads here and the balance leads there,
  and the bars below are the same component in both.
*/

.tvita-profile .tl-stat-grid {
  margin-bottom: 0.4rem;
}

/*
  THE CHANGE IS A COUNT, NOT A PERCENTAGE. Four sessions to six is "+50%",
  which sounds like a transformation and is two sessions: on numbers this
  small a percentage is noise dressed as insight. So it reads "+2 on the four
  weeks before", and the colour carries the direction.
*/
.tvita-delta,
.tvita-flat {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--tl-font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.02em;
}

.tvita-delta.is-up   { color: var(--tl-success); }
.tvita-delta.is-down { color: var(--tl-muted); }
.tvita-flat          { color: var(--tl-dim); }

/*
  Down is muted rather than red. A quieter month is not an error, and
  colouring it as one is the kind of thing that makes somebody close the tab
  rather than open the planner.
*/

.tvita-profile .tvita-bars {
  margin-bottom: 0.5rem;
}

.tvita-profile .stpf-minitiles {
  margin-top: 0.2rem;
}

/*
  THE LAST DOZEN SESSIONS, each with a way to delete it.

  A row, not a card: this is a list somebody scans for the one they did not
  do, and twelve cards would be twelve objects competing with the figures
  above them. The bin is quiet until the row is under the cursor, for the same
  reason the drop control on the plan is.
*/
.tvita-sessions {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--tl-hairline);
  border-radius: var(--tl-radius, 8px);
  overflow: hidden;
}

.tvita-session {
  display: flex;
  align-items: baseline;
  gap: 0.5rem 0.9rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.7rem;
  background: var(--tl-panel);
  border-bottom: 1px solid var(--tl-hairline);
  font-size: 0.86rem;
}

.tvita-session:last-child {
  border-bottom: 0;
}

.tvita-session-when {
  flex: 0 0 3.6rem;
  font-family: var(--tl-font-mono);
  font-size: 0.74rem;
  color: var(--tl-dim);
}

.tvita-session-what {
  flex: 1 1 9rem;
  min-width: 0;
  color: var(--tl-ink);
}

.tvita-session-time {
  font-family: var(--tl-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--tl-muted);
}

/*
  A session that does not count says how much of it happened, in the page's
  own quiet colours. Red would be telling somebody off for being interrupted.
*/
.tvita-session-part {
  padding: 0.05rem 0.45rem;
  border: 1px dashed var(--tl-hairline-strong);
  border-radius: 99px;
  font-family: var(--tl-font-mono);
  font-size: 0.68rem;
  color: var(--tl-dim);
}

.tvita-session-bin {
  margin-left: auto;
  padding: 0.15rem 0.4rem;
  border: 0;
  border-radius: var(--tl-radius-sm, 6px);
  background: none;
  color: var(--tl-dim);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.tvita-session:hover .tvita-session-bin,
.tvita-session-bin:focus-visible {
  opacity: 1;
}

.tvita-session-bin:hover,
.tvita-session-bin:focus-visible {
  background: var(--tl-danger-bg);
  color: var(--tl-danger, #A6382C);
}

.tvita-session-bin[disabled] {
  opacity: 0.4;
  cursor: default;
}

@media (hover: none) {
  .tvita-session-bin {
    opacity: 0.6;
  }
}

