/* WristMarkCompanion's pages. The viewer is a camera app, dark always; the marker
   and privacy pages follow the system's light or dark. System fonts only: the
   Content-Security-Policy keeps every request on this origin. */

/* Hidden means hidden, also where a rule below sets the element's display (the action
   bar is a flex box): the browser's own [hidden] rule loses to any author rule. */
[hidden] {
  display: none !important;
}

:root {
  color-scheme: light dark;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --bg: #f6f7fb;
  --surface: #fff;
  --surface-2: #eef0f6;
  --border: rgb(15 20 40 / 12%);
  --text: #12151d;
  --muted: #5d6578;
  /* 5.3:1 or more on the light backgrounds (WCAG AA for text); dark mode below. */
  --accent: #2f57d8;
  --accent-2: #7c4ddb;
  --accent-text: #fff;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 10px 30px rgb(0 0 0 / 12%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #4f7cff;
    --accent-2: #8b5cf6;
    --bg: #0b0d12;
    --surface: #141821;
    --surface-2: #1c2130;
    --border: rgb(255 255 255 / 9%);
    --text: #e8ecf4;
    --muted: #98a1b3;
    --shadow: 0 10px 30px rgb(0 0 0 / 45%);
  }
}

/* The viewer: dark whatever the system says. */
.app {
  color-scheme: dark;
  --accent: #4f7cff;
  --accent-2: #8b5cf6;
  --bg: #0b0d12;
  --surface: #141821;
  --surface-2: #1c2130;
  --border: rgb(255 255 255 / 9%);
  --text: #e8ecf4;
  --muted: #98a1b3;
  --shadow: 0 10px 30px rgb(0 0 0 / 45%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: 0 16px max(16px, env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* Buttons: quiet by default, the primary one in the accent's gradient. */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: 600 15px/1.2 var(--font);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

button:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}

button:active {
  transform: scale(0.98);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-2));
}

button.primary {
  min-height: 52px;
  padding: 14px 28px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
  font-size: 17px;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent);
}

input,
textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  vertical-align: middle;
}

/* The viewer's top bar: the name and the debug switch. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 0 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
}

.brand-soft {
  color: var(--muted);
  font-weight: 500;
}

.logo {
  width: 32px;
  height: 32px;
}

.chip {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
}

.chip svg {
  width: 16px;
  height: 16px;
}

/* The camera and the overlay on top of it, the same size. The stage keeps the
   camera's aspect (--aspect, set once it is known) and fits the screen's height. */
.stage {
  --aspect: 0.75;
  position: relative;
  width: min(100%, calc((100dvh - 150px) * var(--aspect)));
  aspect-ratio: var(--aspect);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgb(91 140 255 / 18%), transparent 60%),
    radial-gradient(90% 70% at 50% 100%, rgb(139 92 246 / 14%), transparent 60%),
    #07090d;
  box-shadow: var(--shadow);
}

@media (min-aspect-ratio: 1/1) {
  .stage {
    --aspect: 1.333;
  }
}

#camera,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#camera {
  display: block;
  object-fit: fill;
  background: #000;
}

body[data-state="idle"] #camera {
  visibility: hidden;
}

#overlay {
  pointer-events: none;
}

/* One finger scrolls the page; two pinch the model (js/zoom.js). While a model shows,
   one finger turns it (js/touch.js), and the page scrolls outside the stage. */
.stage {
  touch-action: pan-y;
}

body[data-model] .stage {
  touch-action: none;
}

/* A gesture the model reacted to, for a moment, at the stage's top. */
.gesture-chip {
  position: absolute;
  top: 12px;
  left: 50%;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font: 600 14px/1.2 var(--font);
  transform: translateX(-50%);
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  from {
    transform: translateX(-50%) scale(0.8);
    opacity: 0;
  }
}

/* The zoom, for a moment after it changes. */
.zoom-chip {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 12px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 999px;
  background: rgb(10 12 18 / 65%);
  color: #fff;
  font: 600 14px/1.2 var(--font);
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* The start screen, on the stage until the camera runs. */
.intro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px;
  text-align: center;
}

body:not([data-state="idle"]) .intro {
  display: none;
}

.intro-art {
  width: min(42%, 170px);
  height: auto;
  margin-bottom: 8px;
}

.intro-cube {
  animation: float 3.2s ease-in-out infinite;
}

@keyframes float {
  50% {
    transform: translateY(-6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-cube,
  .status::before {
    animation: none;
  }
}

.intro h1 {
  margin: 0;
  font-size: clamp(24px, 6vw, 32px);
}

.steps {
  margin: 12px 0 20px;
  padding: 0;
  list-style: none;
  counter-reset: step;
  color: var(--muted);
  text-align: left;
}

.steps li {
  counter-increment: step;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.steps strong {
  color: var(--text);
}

.fineprint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* The status, a pill on the camera's image; its dot says searching or tracking. */
.status {
  position: absolute;
  left: 50%;
  bottom: 14px;
  max-width: calc(100% - 28px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 999px;
  background: rgb(10 12 18 / 65%);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.status::before {
  content: "";
  display: inline-block;
  margin-right: 8px;
  vertical-align: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

body[data-state="idle"] .status {
  display: none;
}

body[data-state="starting"] .status::before {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

body[data-state="searching"] .status::before {
  background: var(--warn);
  animation: pulse 1.4s ease-in-out infinite;
}

body[data-state="tracking"] .status::before {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgb(16 185 129 / 25%);
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

/* The debug overlay: a glass panel on the camera's image, its numbers colored by
   how good they are, and a chart of the last ten seconds. */
.debug {
  position: absolute;
  top: 12px;
  left: 12px;
  width: min(220px, calc(100% - 24px));
  padding: 10px 12px 8px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 14px;
  background: rgb(10 12 18 / 66%);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.debug-title {
  margin: 0 0 6px;
  color: #9aa3b5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.debug-rows {
  display: grid;
  gap: 2px;
  margin: 0;
}

.debug-rows div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.debug-rows dt {
  color: #b8c0cf;
}

.debug-rows dd {
  margin: 0;
  font: 600 12px/1.5 var(--mono);
  font-variant-numeric: tabular-nums;
}

[data-health="good"] {
  color: #34d399;
}

[data-health="fair"] {
  color: #fbbf24;
}

[data-health="poor"] {
  color: #f87171;
}

.debug-chart {
  display: block;
  width: 100%;
  height: 36px;
  margin-top: 8px;
  border-radius: 6px;
  background: rgb(255 255 255 / 4%);
}

.debug-legend {
  display: flex;
  gap: 10px;
  margin: 4px 0 0;
  color: #9aa3b5;
  font-size: 10px;
}

.debug-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 3px;
  margin-right: 4px;
  vertical-align: middle;
  border-radius: 2px;
  background: currentColor;
}

.debug-legend .debug-key-rate::before {
  background: #34d399;
}

.debug-legend .debug-key-fps::before {
  background: #7aa2ff;
}

.debug-legend span:last-child::before {
  display: none;
}

/* The error card, on the stage in place of the status. */
.failure {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px;
  background: rgb(7 9 13 / 85%);
  text-align: center;
}

body[data-state="error"] .failure {
  display: flex;
}

body[data-state="error"] .status {
  display: none;
}

.failure-icon {
  width: 44px;
  height: 44px;
  color: var(--danger);
}

.failure h2 {
  margin: 8px 0 0;
  font-size: 22px;
}

.failure p {
  max-width: 28em;
  margin: 4px 0 16px;
  color: var(--muted);
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  max-width: 960px;
  margin: 20px auto 0;
  font-size: 14px;
}

.links a {
  color: var(--muted);
  text-decoration: none;
}

.links a:hover {
  color: var(--text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* The guided device test (?test), under the camera's image: large targets, as the
   other hand holds the watch. */
.guide {
  margin: 16px auto 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.guide h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.guide p {
  margin: 8px 0;
}

.guide-live {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #07090d;
  color: #6ee7b7;
  font: 13px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: pre-wrap;
}

.guide-kicker {
  display: flex;
  justify-content: space-between;
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-kicker span {
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

.guide-muted {
  color: var(--muted);
  font-size: 14px;
}

progress {
  width: 100%;
  height: 6px;
  margin: 8px 0;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  appearance: none;
}

progress::-webkit-progress-bar {
  background: var(--surface-2);
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.guide-big {
  margin: 8px 0;
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

/* The countdown before a capture, and the capture's progress. */
.guide-countdown {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 12px 0;
  text-align: center;
}

.guide-countdown p {
  margin: 0;
  color: var(--muted);
}

.guide-ring {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 6px solid var(--accent);
  border-radius: 50%;
  font-size: 40px;
  font-weight: 800;
  animation: ring 1s ease-out;
}

@keyframes ring {
  from {
    transform: scale(1.25);
    opacity: 0.4;
  }
}

/* A capture's numbers, as tiles. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.tile {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
}

.tile strong {
  font-size: 18px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tile[data-health] strong {
  color: inherit;
}

.tile[data-health="good"] {
  border-color: rgb(52 211 153 / 45%);
}

.tile[data-health="fair"] {
  border-color: rgb(251 191 36 / 45%);
}

.tile[data-health="poor"] {
  border-color: rgb(248 113 113 / 50%);
}

.tile-label,
.tile-detail {
  color: var(--muted);
  font-size: 12px;
}

.guide-result,
.guide-report {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font: 13px/1.45 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.guide-report {
  max-height: 50vh;
  overflow: auto;
}

.guide-note {
  padding: 8px 12px;
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}

/* The sections, as cards with their number and how far they are. */
.guide-sections {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.section-card {
  width: 100%;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
}

.section-number {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  font-size: 13px;
}

.section-text {
  display: grid;
  flex: 1;
  gap: 2px;
}

.section-text span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.section-status {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(52 211 153 / 15%);
  color: #34d399;
  font-size: 12px;
  white-space: nowrap;
}

button.quiet {
  background: transparent;
}

/* A step's first action is its main one (Measure, Save and next, Start). */
.guide .actions > button:first-child:not(.quiet) {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.guide .field {
  display: block;
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

/* The marker page: the marker always on white, its quiet zone must be light. */
.markers main {
  max-width: 560px;
  padding-top: 24px;
}

.marker-sheet {
  padding: 24px;
  border-radius: 20px;
  background: #fff;
  color: #111;
  text-align: center;
  box-shadow: var(--shadow);
}

#marker {
  width: min(480px, 100%);
  height: auto;
}

.marker-id {
  margin: 8px 0 0;
  font-weight: 700;
}

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
}

.controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.controls input {
  width: 5em;
  margin: 0;
  text-align: center;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* The privacy page: text at a readable width, on a card. */
.text {
  max-width: 44em;
  margin: 24px auto;
  padding: clamp(20px, 5vw, 40px);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  line-height: 1.6;
}

.text h1 {
  margin-top: 0;
  font-size: 32px;
}

.text h2,
.text h3 {
  margin-top: 1.6em;
}

.text li {
  margin: 6px 0;
}

a.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

/* Read by screen readers, not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* The stage's own buttons: switch camera, full screen. */
.stage-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

body[data-state="idle"] .stage-controls,
body[data-state="error"] .stage-controls {
  display: none;
}

.icon-button {
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 50%;
  background: rgb(10 12 18 / 60%);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.icon-button svg {
  width: 22px;
  height: 22px;
}

.icon-button[aria-pressed="true"] {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.icon-button[aria-busy="true"] svg {
  animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes pulse {
  to {
    opacity: 0.35;
  }
}

/* The free hand's fingertip (js/hands.js): a ring, filled on the model, small while
   pinching, the accent while it holds the model. */
.hand-cursor {
  position: absolute;
  top: var(--y, 50%);
  left: var(--x, 50%);
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 40%);
  pointer-events: none;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.hand-cursor.over {
  background: rgb(255 255 255 / 35%);
}

.hand-cursor[data-state="pinching"],
.hand-cursor[data-state="grabbing"] {
  transform: scale(0.6);
}

.hand-cursor[data-state="grabbing"] {
  border-color: var(--accent);
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .hand-cursor,
  .icon-button[aria-busy="true"] svg {
    transition: none;
    animation: none;
  }
}

/* What the model's gestures do, as buttons above the status. */
.model-actions {
  position: absolute;
  left: 50%;
  bottom: 60px;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

body:not([data-state="tracking"]) .model-actions {
  display: none;
}

.model-actions button {
  min-height: 40px;
  border-color: rgb(255 255 255 / 16%);
  border-radius: 999px;
  background: rgb(10 12 18 / 62%);
  color: #fff;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Tips while the watch isn't found: the status wraps. */
body.with-tips .status {
  max-width: min(92%, 30em);
  border-radius: 16px;
  white-space: normal;
  text-align: center;
}

.failure-detail {
  margin-top: 12px;
  color: var(--muted);
  font: 12px/1.4 var(--mono);
  opacity: 0.8;
}

.fineprint a {
  color: var(--text);
}

/* A button that looks like the footer's links. */
.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
}

.link-button:hover {
  color: var(--text);
  border: 0;
}

/* The help, a dialog over the page. */
.help {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.help::backdrop {
  background: rgb(0 0 0 / 55%);
  backdrop-filter: blur(4px);
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.help-head h2 {
  margin: 0;
}

.help h3 {
  margin: 18px 0 6px;
  font-size: 16px;
}

.help .steps {
  color: var(--text);
}

.help ul {
  margin: 0;
  padding-left: 20px;
}

.help-gestures {
  display: grid;
  gap: 6px;
  margin: 0;
}

.help-gestures div {
  display: grid;
  grid-template-columns: 7em 1fr;
  gap: 8px;
}

.help-gestures dt {
  font-weight: 700;
}

.help-gestures dd {
  margin: 0;
  color: var(--muted);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  font: 600 13px/1.4 var(--mono);
  text-align: center;
}

/* Full screen: the stage alone, as large as the window allows in its own aspect. */
body.immersive {
  padding: 0;
  background: #000;
  overflow: hidden;
}

body.immersive .topbar,
body.immersive .links,
body.immersive .guide {
  display: none;
}

body.immersive .stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: min(100vw, calc(100dvh * var(--aspect)));
  margin: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.page-title {
  margin: 8px 0 4px;
  font-size: 24px;
  text-align: center;
}

/* A narrow phone: the header's buttons as icons; their labels stay for screen readers. */
@media (max-width: 440px) {
  .topbar .chip {
    width: 40px;
    padding: 0;
  }

  .chip-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* The control channel's panel (js/remote.js), under the camera like the device test. */
.remote {
  max-width: 560px;
  margin: 16px auto 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.remote-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.remote h2 {
  margin: 0;
  font-size: 18px;
}

.remote p {
  margin: 10px 0;
}

.remote-badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, #2fbf71 22%, transparent);
  color: #2fbf71;
  font-size: 13px;
  font-weight: 600;
}

.remote progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}

.remote-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}

.remote-buttons button {
  min-height: 44px;
  border-radius: 999px;
}

.remote-buttons button[aria-pressed="true"] {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.remote-buttons .danger {
  margin-left: auto;
  color: #ff6b6b;
}

.remote-actions {
  margin-bottom: 0;
}

/* The Watch button while a watch is connected. */
#remote-toggle.is-on {
  color: #2fbf71;
}
