/* Programming screen: always dark. Steps 1-3 sit in a card on a faint dot grid, step 4 is a
   black screen with the GIF. */
.program { position: fixed; inset: 0; z-index: 100; background: #000; color: #c9c9c9; overflow-y: auto; color-scheme: dark; --text: #c9c9c9; --muted: #8d8d8d; --raised: #1a1a1a; --border: #2e2e2e; --line: #2e2e2e; }
.program.prepare { background: radial-gradient(rgb(255 255 255 / 0.08) 1px, transparent 1.5px) 0 0 / 20px 20px, #0b0b0b; }
.program-stage { min-height: 100%; display: grid; }
.program-inner { min-height: 100%; display: grid; align-content: center; justify-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-2); }
.program h2 { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: -0.01em; }
.program h2:focus { outline: none; }
.program h3 { font-size: var(--fs-body); line-height: var(--lh-body); }
.program-panel { width: min(560px, 100%); display: grid; gap: var(--sp-2); }
.prepare .program-panel { padding: var(--sp-3); background: rgb(19 21 24 / 0.92); border: 1px solid var(--line); border-radius: var(--radius); }
.program-panel ol, .program-list { display: grid; gap: var(--sp-1); padding-left: var(--sp-3); }
.program-panel ol { list-style: decimal; }
.program-list { list-style: disc; }
.program-tips { display: grid; gap: var(--sp-1); }
.program-tips li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-1); align-items: start; color: var(--muted); font-size: var(--fs-small); line-height: var(--lh-small); }
.program-tips .icon { color: var(--text); }
.program-tips .icon svg { width: 18px; height: 18px; }
.program-buttons { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.program .btn { background: #141414; color: #bdbdbd; border-color: var(--border); }
.program .btn:hover:not(:disabled) { background: #1f1f1f; }
.program .btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.program .btn-primary:hover:not(:disabled) { background: var(--accent); }
.program .btn-primary:disabled { background: var(--raised); border-color: var(--border); color: var(--muted); }
.program .btn-big { min-height: 56px; padding: 0 var(--sp-3); font-size: var(--fs-title); }

/* Step indicator: 1 Switch · 2 Get ready · 3 Enter PIN · 4 Program */
.program-progress { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-1) var(--sp-2); padding: 0; list-style: none; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
.program-progress li { display: flex; align-items: center; gap: var(--sp-1); }
.step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 50%; font-size: var(--fs-caption); }
.program-progress .done .step-num { border-color: var(--muted); }
.program-progress [aria-current] { color: var(--text); font-weight: 500; }
.program-progress [aria-current] .step-num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (max-width: 479px) { .program-progress li:not([aria-current]) .step-label { display: none; } }
.flashing .program-progress { opacity: 0.6; }

/* Step 1: switch cards */
.switch-card { display: flex; align-items: center; gap: var(--sp-2); }
.switch-card-text { display: grid; gap: 2px; }
.switch-drawing { display: inline-flex; flex: none; color: var(--text); }

/* Step 3: PIN */
.pin-digits { font-size: 40px; line-height: 48px; color: var(--text); letter-spacing: 0.04em; }
.pin-custom { display: grid; gap: var(--sp-1); }
.pin-custom[hidden] { display: none; }
.pin-input { width: 12ch; min-height: var(--tap); padding: 0 12px; background: #141414; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-s); font-size: var(--fs-title); }
.pin-error:empty { display: none; }
.pin-error { color: var(--danger); }
.program-notice { padding: 12px var(--sp-2); border: 1px solid var(--danger); border-radius: var(--radius-s); color: var(--text); font-size: var(--fs-small); line-height: var(--lh-small); }
.pulse-note:empty { display: none; }
.pulse-note { text-align: center; }
.link-button { justify-self: start; min-height: var(--tap); padding: 0; background: none; border: 0; color: var(--accent-strong); font: inherit; font-size: var(--fs-small); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Step 3 run: the pulse circle */
.pulse-stage { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; }
.pulse-circle { display: grid; place-items: center; width: 160px; height: 160px; border-radius: 50%; border: 2px solid #3a3a3a; background: #0b0b0b; transition: transform 0.08s ease-out, background 0.04s, box-shadow 0.08s; }
.pulse-circle.count { border-color: var(--muted); }
.pulse-circle.lit { background: var(--accent); border-color: var(--accent); transform: scale(1.08); box-shadow: 0 0 48px var(--accent-glow); }
.pulse-number { font-size: 48px; line-height: 1; color: var(--text); }
.pulse-word { min-height: 40px; font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.pulse-progress { min-height: var(--lh-small); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .pulse-circle, .pulse-circle.lit { transform: none; box-shadow: none; }
}

/* Step 4: the flashing square */
.flash-cue { max-width: 360px; text-align: center; font-size: var(--fs-body); line-height: var(--lh-body); color: #8d8d8d; }
.flash-hint { max-width: 360px; text-align: center; font-size: var(--fs-small); line-height: var(--lh-small); color: #8d8d8d; }
.flash-img { display: block; width: min(300px, calc(100vw - 32px), calc(100vh - 260px)); min-width: 160px; height: auto; aspect-ratio: 1 / 1; image-rendering: pixelated; background: #000; }
.program.flashing .program-buttons { justify-content: center; }
.program.flashing .btn { color: #8d8d8d; background: #0b0b0b; }

/* Step 3: pauses and the HOLD at the end */
.pulse-word { text-align: center; }
.pulse-word.waiting { color: var(--muted); }
.pulse-circle.pause { border-color: #262626; background: #050505; }
/* HOLD: a full, steady ring whose fill drains as the countdown runs (--hold-left goes 1 to 0). */
.pulse-circle.hold {
  --hold-left: 1;
  border: 6px solid var(--accent);
  background: conic-gradient(var(--accent) calc(var(--hold-left) * 360deg), #0b0b0b 0);
  box-shadow: 0 0 32px var(--accent-glow);
  transition: none;
}
/* Smaller than the pulse words: "RELEASE · LEAVE IT" must stay on one line at 375 px. */
.pulse-word.holding { color: var(--accent-strong); font-size: var(--fs-display); line-height: 40px; text-wrap: balance; }

/* Step 3: the rhythm timeline. Pieces are placed in percent, so the strip scales to any width. */
.rhythm { width: 100%; }
.rhythm[hidden] { display: none; }
.rhythm-drawing { display: grid; gap: 4px; }
.rhythm-title { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--muted); }
.rhythm-bar { position: relative; height: 28px; }
.rhythm-base { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--border); }
.rhythm-piece { position: absolute; bottom: 0; height: 100%; }
.rhythm-piece.is-count::before { content: ''; position: absolute; left: 0; bottom: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.rhythm-piece.is-click { height: 16px; background: #bdbdbd; border-radius: 2px 2px 0 0; }
.rhythm-piece.is-hold { height: 100%; background: var(--accent); border-radius: 3px 3px 0 0; }
.rhythm-piece.past { opacity: 0.3; }
.rhythm-piece.is-click.now { background: var(--accent); }
.rhythm-piece.is-count.now::before { background: var(--accent); }
.rhythm-piece.is-hold.next { outline: 2px solid var(--text); outline-offset: 2px; }
.rhythm-head { position: absolute; top: -4px; bottom: -4px; left: 0; width: 2px; margin-left: -1px; background: var(--text); display: none; }
.rhythm.running .rhythm-head { display: block; }
.rhythm-label { text-align: right; font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--accent-strong); }
