/* PunchPace brand: ink, warm off-white, punch orange; Saira (SIL OFL 1.1) for display type */
@font-face {
  font-family: Saira;
  src: url(saira.woff2) format('woff2');
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Saira;
  src: url(saira-italic.woff2) format('woff2');
  font-weight: 500 800;
  font-style: italic;
  font-display: swap;
}
:root {
  color-scheme: dark;
  accent-color: var(--accent);
}
::selection {
  background: var(--selection);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-md) / 1.5 var(--font-body);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
}
button:hover {
  background: var(--surface-raised);
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.01em;
}
button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button.ghost {
  background: none;
  border-color: transparent;
  color: var(--text-muted);
}
button.danger {
  color: var(--danger-text);
}
input,
select,
textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  width: 100%;
}
textarea {
  resize: vertical;
}
input[type='checkbox'] {
  width: auto;
}
label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.view {
  display: none;
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-16);
}
.view.on {
  display: block;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
h1 {
  font: italic 800 var(--fs-3xl) / 1.2 var(--font-display);
  margin: 0;
}
#appName {
  line-height: 0;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 214px;
}
#appName .brand {
  display: block;
  width: 100%;
  height: auto;
}
.brand .lw {
  fill: var(--logo-word);
}
.brand .lm {
  fill: var(--logo-mark);
}
h2 {
  font: italic 800 var(--fs-2xl) / 1.25 var(--font-display);
  margin: 0;
}
.muted {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.rcard {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.rcard {
  transition: transform var(--duration-base);
  gap: var(--space-3);
}
.rcard.arch {
  opacity: 0.6;
}
.rcard.drag {
  transition: none !important;
  position: relative;
  z-index: 5;
  box-shadow: 0 8px 24px var(--shadow);
  background: var(--surface-raised);
}
.handle {
  color: var(--text-muted);
  touch-action: none;
  cursor: grab;
  padding: var(--space-3) var(--space-1);
  margin: -12px 0 -12px -8px;
  display: flex;
  opacity: 0.6;
}
.rcard .dot {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-round);
  display: grid;
  place-items: center;
  font-size: var(--fs-2xl);
  flex: none;
}
.rcard .info {
  flex: 1;
  min-width: 0;
}
.rcard .go {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-round);
  padding: 0;
  font-size: var(--fs-xl);
}
/* home: today's routines as full cards, the rest as compact rows */
.sech {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: var(--space-1) 0 var(--space-2);
}
.sech:not(.shead)::before,
.sech .sht::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 0.78em;
  margin-right: var(--space-2);
  background: var(--accent);
  transform: skewX(-16deg);
  vertical-align: -0.04em;
} /* brand slash */
.grp + .sech,
.noday + .sech {
  margin-top: var(--space-5);
}
/* Order button: opens the order view (all routines in their real order, drag to reorder, Done to go back) */
.sech.shead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 24px;
}
.sech .sht {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sech .sbtn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-half) var(--space-2);
  margin-right: -8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  border-radius: var(--radius-md);
  opacity: 0.8;
}
.sech .sbtn:hover {
  opacity: 1;
}
.sech .sbtn.on {
  color: var(--accent-text);
  opacity: 1;
}
.sech .shb {
  display: flex;
  gap: var(--space-1);
  flex: none;
}
.sech .shb .sbtn:not(:last-child) {
  margin-right: 0;
}
/* week */
.wsum {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-sm);
}
.wseg {
  display: inline-flex;
  gap: var(--space-half);
  padding: var(--space-1);
  margin: -16px 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.wseg button {
  border: none;
  background: none;
  padding: var(--space-1) var(--space-4);
  font-size: var(--fs-sm);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}
.wseg button.on {
  background: var(--border);
  color: var(--text);
  font-weight: 600;
}
.wday.plan .wd b {
  font-size: var(--fs-sm);
  padding-top: var(--space-2);
}
.wsum > span {
  display: inline-block;
}
.wcard {
  padding: 0 var(--space-4);
}
.wday {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.wday:last-child {
  border-bottom: none;
}
.wday .wd {
  width: 40px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}
.wday .wd b {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wday .wd span {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: 700;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-round);
}
.wday.today .wd span {
  background: var(--accent);
  color: var(--on-accent);
}
.wday.today .wd b {
  color: var(--accent-text);
}
.wl {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-1);
}
.wday .wt {
  flex-basis: 100%;
  font-size: var(--fs-sm);
  padding: 1px 0 0 var(--space-half);
}
.wdn {
  color: var(--success);
  white-space: nowrap;
}
.wdn .ic {
  display: inline;
  vertical-align: -1px;
  margin-right: var(--space-1);
}
.wrest {
  font-size: var(--fs-sm);
  padding-top: var(--space-1);
}
.wchip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  max-width: 100%;
  line-height: 1.3;
}
.wchip > .ic:first-child {
  color: var(--c);
  flex: none;
}
.wchip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wchip.add {
  border-style: dashed;
  border-color: var(--c);
}
.wchip.sk {
  opacity: 0.5;
}
.wchip.sk span {
  text-decoration: line-through;
}
.wday.past .wchip:not(.done):not(.nl),
.wchip.miss {
  opacity: 0.5;
}
.wchip small {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-left: -4px;
}
.wchip.nl > .ic:last-child {
  color: var(--text-muted);
  flex: none;
}
.wkey {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.wkey .wchip {
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-sm);
  padding: var(--space-1) var(--space-2);
  --c: var(--text-muted);
}
.wkey .wchip.add {
  border-style: dashed;
  border-color: var(--text-muted);
}
.wchip.done > .ic:last-child {
  color: var(--success);
  flex: none;
}
.wleg {
  font-size: var(--fs-sm);
  margin: var(--space-3) 0 0;
  line-height: 1.6;
}
.wleg b {
  color: var(--text);
  font-weight: 600;
}
.card.noday {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  border-style: dashed;
  background: none;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.rcard .skip {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  flex: none;
  opacity: 0.55;
  margin-right: -4px;
}
.rcard .skip:hover {
  opacity: 1;
}
.rcard.mini.tod {
  border-color: var(--c);
  box-shadow: inset 3px 0 0 var(--c);
} /* drag state: today's routines keep a colour mark */
#list.sorting {
  touch-action: none;
  user-select: none;
}
#list {
  position: relative;
}
.dslot {
  position: absolute;
  left: 0;
  right: 0;
  border: 2px dashed var(--text-muted);
  border-radius: var(--radius-lg);
  opacity: 0.5;
  pointer-events: none;
  transition: top var(--duration-base);
} /* where the dragged row will land */
.rcard.drag.cancel {
  opacity: 0.55;
}
.dslot.same {
  border-style: solid;
  opacity: 0.3;
}
.rcard.drag.lift {
  transition: transform var(--duration-base) ease-out !important;
}
.rcard.landed {
  box-shadow: 0 0 0 2px var(--c);
}
.rcard.flash {
  animation: flash 1.3s ease-out;
}
@keyframes flash {
  0%,
  35% {
    outline: 2px solid var(--c);
    outline-offset: 2px;
  }
  100% {
    outline: 2px solid transparent;
    outline-offset: 6px;
  }
}
.rcard .undo {
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-xs);
  flex: none;
  white-space: nowrap;
}
.rcard.skipped .dot,
.rcard.skipped b {
  opacity: 0.6;
}
.rcard.today {
  border-color: var(--c);
  box-shadow: inset 0 0 0 1px var(--c);
}
.rcard.done {
  opacity: 0.6;
}
.rcard.today.soft {
  border-color: color-mix(in srgb, var(--c) 40%, var(--border));
  box-shadow: none;
} /* with a suggestion: the other routines left for today get a quieter outline */
.rcard .nxt {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 1px var(--space-2);
  border-radius: var(--radius-md);
  background: var(--c);
  color: var(--on-accent);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 2px;
}
.sech.part {
  font-size: var(--fs-xs);
  margin: var(--space-3) 0 var(--space-2);
  opacity: 0.85;
}
.sech.part::before {
  opacity: 0.5;
}
.sech.part.now {
  opacity: 1;
}
.sech.part.now::before {
  opacity: 1;
}
.sech.part .pn {
  color: var(--accent-text);
}
.sech.part .pt {
  font-weight: 500;
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.8;
}
.sech + .sech.part {
  margin-top: 0;
}
.days.whens button {
  max-width: none;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
}
.rcard .ok {
  display: inline-flex;
  vertical-align: -3px;
  margin-left: var(--space-2);
  color: var(--success);
}
.rcard.mini {
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  gap: var(--space-3);
}
.rcard.mini .handle {
  padding: var(--space-2) var(--space-1);
  margin: -8px 0 -8px -8px;
}
.rcard.mini .dot {
  width: 32px;
  height: 32px;
}
.rcard.mini .info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--space-2);
  line-height: 1.35;
} /* name, then the details; on a narrow row the details move under the name */
.rcard.mini .info b,
.rcard.mini .info .muted {
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rcard.mini .info b {
  font-weight: 600;
}
.rcard.mini .info .muted {
  font-size: var(--fs-sm);
}
.rcard.mini .go {
  width: 40px;
  height: 40px;
}
.days {
  display: flex;
  gap: var(--space-2);
}
.days button {
  flex: 1 1 0;
  min-width: 0;
  max-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-round);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
}
/* editor head: Days takes two columns next to Logging; the explainers share one line */
.grid > .wide {
  grid-column: span 2;
}
/* routine settings: three rows of three (rounds · how it plays · days and logging); two columns on narrow screens */
.grid.hgrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 560px) {
  .grid.hgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid.hgrid > .wide,
  .grid.hgrid > .wm {
    grid-column: 1/-1;
  }
}
@media (max-width: 340px) {
  .grid > .wide {
    grid-column: 1/-1;
  }
}
.tips {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-5);
}
.tips > details[open] {
  flex-basis: 100%;
}
.days button.on {
  background: var(--c);
  border-color: var(--c);
  color: var(--on-accent);
}
.row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-3);
  align-items: end;
}
.grid > div {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}
.grid > div > label {
  line-height: 1.25;
  margin-bottom: var(--space-1);
}
.grid input,
.grid select {
  height: 40px;
}
input.dur.bad,
input.dur.bad:focus {
  border-color: var(--danger) !important;
}

.durw {
  position: relative;
}
.durw input {
  padding-right: 62px;
}
.durw .ds {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 28px;
  padding: 0;
  border: none;
  background: var(--surface);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--fs-lg);
  line-height: 1;
  touch-action: manipulation;
  user-select: none;
}
.durw .ds:hover,
.durw .ds:active {
  background: var(--surface-raised);
  color: var(--text);
}
.durw .ds[data-d='-1'] {
  right: 34px;
}
.durw .ds[data-d='1'] {
  right: 4px;
}
label .dh {
  color: var(--text-muted);
  opacity: 0.75;
}
label .dh.bad {
  color: var(--danger-text);
  opacity: 1;
}
.block {
  border-left: 4px solid var(--accent);
}
.block .head {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-3);
}
.block .head input {
  font-weight: 600;
}
.tag {
  font-size: var(--fs-xs);
  padding: var(--space-half) var(--space-2);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  white-space: nowrap;
}
/* a move with a tone: its colour (--t) as a light tint, the text mixed a little towards --text so it stays readable */
.tag.t {
  background: color-mix(in srgb, var(--t) 12%, transparent);
  color: color-mix(in srgb, var(--t) 85%, var(--text));
}
.icon {
  padding: var(--space-2) var(--space-3);
}
.settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4) var(--space-4);
}
.settings > div > label {
  line-height: 1.25;
  margin-bottom: var(--space-1);
}
.settings .tg {
  grid-column: 1/-1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
}
#eSndBox[hidden] {
  display: none;
}
@media (max-width: 560px) {
  .settings {
    grid-template-columns: minmax(0, 1fr);
  }
}
.cuecount {
  font-size: var(--fs-sm);
  margin-top: var(--space-1);
  min-height: 0;
}
.chk {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  color: var(--text);
}
.nst {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  vertical-align: -2px;
}
/* runner */
#run {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom));
  transition: background 0.3s;
  user-select: none;
}
#run.on {
  display: flex;
}
#run .top {
  width: 100%;
  max-width: 760px;
}
#run .bar {
  height: 6px;
  background: var(--tint-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: var(--space-2);
}
#run .bar i {
  display: block;
  height: 100%;
  background: var(--text);
  width: 0;
  transition: width var(--duration-slow);
}
#run .meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
#stage {
  position: relative;
  width: min(80vw, 50vh);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: none;
}
#stage svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
#stage .center {
  text-align: center;
  z-index: 1;
  width: 72%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}
#phase {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(15px, 2.6vh, 20px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  max-width: 92vw;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#big {
  font-family: var(--font-display);
  font-size: clamp(64px, 16vh, 150px);
  font-weight: 700;
  line-height: 1;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.02em;
  text-box: trim-both cap alphabetic;
  margin: 0.1em 0;
} /* trimmed to the digits (cap height to baseline), so they sit exactly in the middle */
#cueLine {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(20px, 4.2vh, 34px);
  font-weight: 700;
  line-height: 1.15;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#cueLine:empty {
  display: none;
}
#stage.cue #cueLine {
  display: -webkit-box;
  min-height: 1.15em;
}
#big .ic {
  position: static;
  inset: auto;
  transform: none;
  width: 0.8em;
  height: 0.8em;
  display: block;
  margin: 0 auto;
}
#big:has(.ic) {
  margin: 0;
}
#sub {
  font-size: clamp(14px, 2.4vh, 19px);
  color: var(--text-muted);
  min-height: 1.4em;
  max-width: 100%;
}
#stage.nosub #sub {
  display: none;
}
#call {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(26px, 6vh, 56px);
  font-weight: 800;
  min-height: 1.2em;
  text-align: center;
  letter-spacing: 0;
  max-width: 92vw;
  line-height: 1.1;
}
#call:empty {
  min-height: 0;
}
#pips {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
  max-width: 90vw;
  min-height: 14px;
}
#pips b {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-round);
  background: var(--border);
  transition: all var(--duration-base);
}
#pips b.done {
  background: var(--text);
}
#pips b.now {
  background: var(--text);
  transform: scale(1.5);
}
#next {
  font-size: var(--fs-md);
  color: var(--text-muted);
  text-align: center;
}
#run .ctrl {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr auto 1fr 1fr;
  align-items: center;
  justify-items: center;
  width: 100%;
  max-width: 400px;
}
#run .ctrl button {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-round);
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--tint-1);
  border-color: var(--border);
  color: var(--text);
}
#run .ctrl button.sm {
  width: 48px;
  height: 48px;
  background: none;
  border-color: transparent;
  color: var(--text-muted);
}
#run .ctrl #pp {
  width: 76px;
  height: 76px;
  background: var(--text);
  color: var(--bg);
  border: none;
}
#tapHint {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.flash {
  animation: fl 0.25s;
}
details.info {
  margin-top: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
details.info > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  user-select: none;
}
details.info > summary::-webkit-details-marker {
  display: none;
}
details.info > summary:before {
  content: '';
  width: 0;
  height: 0;
  border-left: 6px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform var(--duration-base);
}
details.info[open] > summary:before {
  transform: rotate(90deg);
}
details.info > summary:hover {
  color: var(--text);
}
details.info .body {
  margin: var(--space-2) 0 0 17px; /* lines up with the summary text after its marker */
  line-height: 1.5;
}
details.info .body p {
  margin: 0 0 var(--space-2);
}
@keyframes fl {
  0% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}
#done {
  text-align: center;
}

.ic {
  display: block;
  flex: none;
}
button {
  white-space: nowrap;
}
header .row {
  flex-wrap: nowrap;
  gap: var(--space-1);
}
header {
  flex-wrap: nowrap;
}
.ib {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
/* sync status: a small dot on Settings, only while syncing (after a moment), offline or failed */
#setBtn {
  position: relative;
}
#syncDot {
  position: absolute;
  top: 8px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
  background: var(--text-muted);
  box-shadow: 0 0 0 2px var(--bg);
}
#syncDot[hidden] {
  display: none;
}
#syncDot.s-err {
  background: var(--danger);
}
#syncDot.s-busy {
  animation: dotin 0.2s 1.5s both;
}
@keyframes dotin {
  from {
    opacity: 0;
  }
}
/* end of the list: New routine (dashed card), then Reorder and Archived as quiet list tools */
.addrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 56px;
  margin: 0;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  background: none;
  color: var(--text);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: var(--fs-md);
}
.addrow .ic {
  color: var(--accent-text);
}
.addrow:hover {
  border-color: var(--accent);
  background: none;
}
.lfoot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.lfoot button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  padding-left: 0;
  padding-right: 0;
}
.lfoot button:hover {
  color: var(--text);
}
.iconpick {
  width: 52px;
  flex: none;
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--bg);
  border: 1px solid var(--border);
}
.iconpick:hover {
  background: var(--surface);
}
.icongrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.icongrid[hidden] {
  display: none;
}
.swatches {
  display: flex;
  gap: var(--space-2); /* all 8 colours on one row on a phone */
  flex-wrap: wrap;
  margin-top: var(--space-3);
}
.swatches button {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-round);
  padding: 0;
  background: var(--c);
  border: 2px solid transparent;
  display: grid;
  place-items: center;
  color: var(--on-accent);
  transition: transform var(--duration-fast);
}
.swatches button:hover {
  background: var(--c);
  transform: scale(1.08);
}
.swatches button.on {
  box-shadow:
    0 0 0 2px var(--surface),
    0 0 0 4px var(--c);
}
.icongrid button {
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text-muted);
}
.rcard .dot {
  color: var(--text);
}
.rcard .go {
  display: grid;
  place-items: center;
}
.rcard .go .ic {
  margin-left: var(--space-1);
}
.block .head .icon {
  display: grid;
  place-items: center;
  padding: var(--space-2) var(--space-2);
}
.cuecount span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
/* the voice can't keep up with a block: what happens instead (editor), and the run-screen line that says so */
.vnote {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-size: var(--fs-sm);
}
.vnote .vw {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  color: var(--warning);
  font-weight: 600;
}
.vnote .vw .ic {
  flex: none;
  margin-top: var(--space-1);
}
.vnote .vst {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.vnote .vst button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-half) var(--space-3);
  font-size: var(--fs-sm);
}
.pvp {
  padding: var(--space-half) var(--space-2);
  display: inline-grid;
  place-items: center;
  color: var(--text-muted);
}
.pvp:hover {
  color: var(--text);
} /* ▶: a combo as set under Calls */
#tapHint.rsv {
  min-height: 1.4em;
}
#rName {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#rName span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.block .head input {
  flex: 1;
  min-width: 0;
}
@media (max-width: 480px) {
  .block .head {
    gap: var(--space-half);
  }
  .block .head .icon {
    padding: var(--space-2) var(--space-1);
  }
  .block .head input {
    margin-right: var(--space-1);
  }
  .grid {
    gap: var(--space-3);
  }
}
#doneView {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  width: 100%;
  max-width: 420px;
  text-align: center;
}
#run.fin > *:not(#doneView) {
  display: none !important;
}
#run.fin #doneView {
  display: flex;
}
#doneView .badge {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-round);
  background: var(--accent-soft);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
#doneView h2 {
  margin: 0;
  font-size: var(--fs-3xl);
}
#doneView .dname {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-md);
  margin-top: -12px;
}
#doneView .stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--space-3);
  width: 100%;
  margin-top: var(--space-2);
}
#doneView .stat {
  background: var(--tint-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-2);
}
#doneView .stat b {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#doneView .stat span {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
#doneView .acts {
  display: flex;
  gap: var(--space-3);
  width: 100%;
  margin-top: var(--space-3);
}
#doneView .nextb {
  width: 100%;
  height: 56px;
  font-size: var(--fs-lg);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  min-width: 0;
}
#doneView .nextb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#doneView .nextb + .acts {
  margin-top: 0;
}
#doneView .acts button {
  flex: 1;
  height: 48px;
  font-size: var(--fs-md);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
/* home actions: same visual gap between the icons and up to + Routine (icon padding = half the gap) */
#lib header {
  gap: var(--space-4);
}
#lib header .row {
  gap: var(--space-1);
}
#lib header .row button.ghost {
  min-width: 44px;
  height: 44px;
  padding: 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 480px) {
  #lib header {
    gap: var(--space-3);
  }
  #lib header .row {
    gap: 0;
  }
  #lib header .row button.ghost {
    min-width: 42px;
    padding: 0 var(--space-2);
  }
  header .hb .lbl {
    display: none;
  }
  header .hb {
    padding: var(--space-2) var(--space-3);
  }
  header .row button.primary {
    padding: var(--space-2) var(--space-3);
  }
  header .eb {
    padding: 0 var(--space-3);
  }
}
@media (max-width: 660px) {
  header .hb:has(+ .row .eb) .lbl,
  header .eb.hb .lbl {
    display: none;
  }
  header .eb.hb {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
} /* editor actions: Back, Archive and Delete icon-only before the row gets too wide */
@media (max-width: 400px) {
  header .eb.tst .lbl {
    display: none;
  }
  header .eb.tst {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
} /* small phones: Test icon-only too, so the sound control fits */
/* editor actions: one style (outlined, icon + label, same height); Start only differs in colour */
header .eb {
  height: 38px;
  padding: 0 var(--space-4);
  gap: var(--space-2);
  font-weight: 600;
}
header .eb.go1 {
  color: var(--accent-text);
  border-color: var(--accent);
}
header .eb.danger {
  color: var(--danger-text);
}
#histBtn {
  gap: var(--space-2);
  color: var(--text-muted);
}
#histBtn.on {
  color: var(--accent-text);
}
#histBtn b {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
}
.hstats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.hstat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-2);
  text-align: center;
}
.hstat b {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hstat span {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.hstat.fire b {
  color: var(--accent-text);
}
.heat {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  gap: var(--space-1);
}
.heat i {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--heat-0);
}
.heat i.l1 {
  background: var(--heat-1);
}
.heat i.l2 {
  background: var(--heat-2);
}
.heat i.l3 {
  background: var(--heat-3);
}
.heat i.lo {
  background: var(--heat-log);
}
.heat i.fut {
  background: none;
}
.heat i.today {
  outline: 1.5px solid var(--text-muted);
  outline-offset: 1px;
}
.heatwrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2);
  align-items: stretch;
}
.heatdays {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: var(--space-1);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1;
}
.heatdays span {
  display: flex;
  align-items: center;
}
.legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
}
.legend i {
  width: 11px;
  height: 11px;
  border-radius: var(--radius-sm);
  display: inline-block;
}
.legend .l0 {
  background: var(--heat-0);
}
.legend .l1 {
  background: var(--heat-1);
}
.legend .l2 {
  background: var(--heat-2);
}
.legend .l3 {
  background: var(--heat-3);
}
.legend .lo {
  background: var(--heat-log);
  margin-left: var(--space-3);
}
.hday {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: var(--space-4) 0 var(--space-2);
  font-weight: 600;
}
.hitem {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-2);
}
.hitem .dot {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-round);
  display: grid;
  place-items: center;
  flex: none;
}
.hitem .info {
  flex: 1;
  min-width: 0;
}
.hitem .info b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hitem .info span {
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
#doneView .streak {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--accent-text);
  font-weight: 700;
  font-size: var(--fs-md);
  margin-top: -8px;
}
@media (max-width: 480px) {
  .hstat b {
    font-size: var(--fs-2xl);
  }
  .hstats {
    gap: var(--space-2);
  }
}
.sflow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.sround {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3) var(--space-3);
  width: 100%;
}
.sround .sflow {
  margin-top: var(--space-1);
}
.sround .sl {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 600;
}
.sc {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-sm);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text);
}
.sc svg {
  color: var(--c, var(--text-muted));
}
.sc.rest,
.sc.rrest {
  background: color-mix(in srgb, var(--step-rest) 12%, transparent);
  border-color: color-mix(in srgb, var(--step-rest) 35%, transparent);
  color: var(--step-rest-text);
}
.sc.rrest {
  border-style: dashed;
}
.sc.prep {
  color: var(--text-muted);
}
.sc.wait {
  color: var(--text-muted);
  border-style: dashed;
}
.sc.done {
  color: var(--success);
}
.sa {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
#run .lw {
  display: flex;
  justify-content: center;
}
#live {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  background: var(--tint-1);
  border-color: var(--border);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-3);
}
#live[hidden] {
  display: none;
}
#run .ml {
  display: flex;
  align-items: center;
  gap: var(--space-half);
  min-width: 0;
}
#minBtn {
  flex: none;
  padding: var(--space-1);
  margin: -8px 0 -8px -8px;
  background: none;
  border-color: transparent;
  color: var(--text-muted);
}
#minBtn:hover {
  color: var(--text);
}
.rcard.live {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-color: var(--c);
  box-shadow: inset 0 0 0 1px var(--c);
}
.rcard.live:hover {
  background: var(--surface-raised);
}
#mbTx {
  font-variant-numeric: tabular-nums;
}
.rcard.live .mexp {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--text-muted);
  margin-right: -4px;
}
#mbP {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  background: var(--c);
}
#live b {
  color: var(--text);
}
.livebar {
  border-color: var(--accent);
}
.amsg {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-sm);
  color: var(--notice);
}
.amsg a,
.anote a {
  color: inherit;
}
.anote {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.acct-k {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: var(--space-4) 0 var(--space-1);
}
.meth {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  border-top: 1px solid var(--border);
}
.meth:last-of-type {
  border-bottom: 1px solid var(--border);
}
.meth span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meth b {
  font-weight: 600;
}
.sstat {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 32px;
}
.sstat .ghost {
  padding: var(--space-1) var(--space-2);
  display: inline-flex;
}
.sstat [hidden] {
  display: none;
}
.acct-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
dialog.ask {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  width: calc(100% - 32px);
  max-width: 380px;
}
dialog.ask::backdrop {
  background: var(--scrim);
}
dialog.ask h2 {
  margin: 0 0 var(--space-2);
}
dialog.ask p {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
dialog.ask p b {
  color: var(--text);
  font-weight: 600;
}
dialog.ask .chk {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin: var(--space-1) 0 var(--space-4);
  color: var(--text);
  font-size: var(--fs-sm);
}
dialog.ask .chk input {
  margin-top: var(--space-1);
}
dialog.ask .btns {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
dialog.ask .btns button {
  min-height: 44px; /* touch target (design/README.md) */
}
/* a choice led by the situation it fits (ask() buttons with a lead), e.g. the sign-out dialog */
dialog.ask .choice {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
dialog.ask .choice + :not(.choice) {
  margin-top: var(--space-2);
}
dialog.ask .choice h3 {
  margin: 0;
  font-size: var(--fs-md);
  color: var(--text);
}
dialog.ask .choice p {
  margin: 0;
}
/* messages at the bottom of the screen (ui/html.js toast): errors, or info */
#toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%);
  width: max-content;
  max-width: 90%;
  background: var(--danger-surface);
  color: var(--text);
  border: 1px solid var(--danger-border);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  z-index: 9999;
  font-size: var(--fs-md);
  cursor: pointer;
}
#toast.info {
  background: var(--surface-raised);
  border-color: var(--tint-3);
}
/* small utilities for styles that repeat in the HTML templates. They stand in for inline styles, so like those they win
   over the component rules (!important) */
.text {
  color: var(--text) !important;
}
.text-muted {
  color: var(--text-muted) !important;
}
.fs-sm {
  font-size: var(--fs-sm) !important;
}
.m-0 {
  margin: 0 !important;
}
.mt-3 {
  margin-top: var(--space-3) !important;
}
.mb-2 {
  margin-bottom: var(--space-2) !important;
}
.mb-3 {
  margin-bottom: var(--space-3) !important;
}
.span-all {
  grid-column: 1/-1 !important;
}
.w-auto {
  width: auto !important;
  max-width: 100% !important;
  align-self: flex-start !important;
}
.tap {
  cursor: pointer !important;
}
.dim {
  opacity: 0.5 !important;
}
.link {
  padding: 0 !important;
  text-decoration: underline !important;
  color: inherit !important;
}
/* the sound control (ui/sound.js volCtl): mute, volume and level, as a panel under a speaker button or inline in Settings */
.volctl {
  display: contents; /* the panel is placed against the bar the speaker sits in */
}
#edit header {
  position: relative;
}
.volpop {
  position: absolute;
  right: 0;
  width: min(320px, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-2);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 5;
}
.volpop.up {
  bottom: calc(100% + var(--space-2));
}
.volpop.down {
  top: calc(100% + var(--space-2));
}
.volpop[hidden] {
  display: none;
}
.volpop,
.volrow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.volpop .volmute,
.volrow .volmute,
#run .ctrl .volmute {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-round);
  background: var(--tint-1);
  border: 1px solid var(--border);
  color: var(--text);
}
.volmute[aria-pressed='true'],
#run .ctrl .volmute[aria-pressed='true'] {
  color: var(--accent-text);
}
.volrange {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: none;
  background: none;
}
.volpct {
  flex: none;
  min-width: 52px;
  text-align: right;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
