/* =============================================================================
   Family Command Center — phone setup site
   -----------------------------------------------------------------------------
   Served by the Worker as a static asset. No build step, no framework, no CDN.

   Design intent: this is the calm, legible companion to a dark premium TV
   dashboard — same palette family, but a *phone* page first. That means thumb
   reach over decoration: one column, a single primary action per screen, 48px
   minimum hit targets (above the 44pt floor), and 17px body text so nobody has
   to pinch-zoom in a parking lot.

   Light mode is the default because setup happens in daylight as often as not.
   Dark mode mirrors the TV's own palette (#0B1420 ground, #172534 cards).
   ========================================================================== */

/* ----------------------------------------------------------------- tokens -- */
:root {
  color-scheme: light dark;

  /* Light palette */
  --bg:            #f3f5f9;
  --bg-accent:     #e7ecf5;
  --surface:       #ffffff;
  --surface-2:     #eef1f7;
  --surface-3:     #e3e8f0;
  --text:          #0e1824;
  --text-dim:      #4c5c70;
  --text-faint:    #5b687c;   /* 4.99:1 on --surface-2, 5.65:1 on --surface */
  --line:          #d5dce7;
  --line-strong:   #b9c4d3;
  --accent:        #1c5fe0;
  --accent-ink:    #ffffff;
  --accent-soft:   #e5edfd;
  --danger:        #b3261e;
  --danger-soft:   #fdeceb;
  --warn:          #8a5300;
  --warn-soft:     #fdf1dc;
  --ok:            #15704a;
  --ok-soft:       #e3f4ec;
  --focus:         #0b4fd0;
  --focus-halo:    rgba(255, 255, 255, 0.95);

  --radius:        16px;
  --radius-sm:     10px;
  --radius-pill:   999px;
  --tap:           48px;        /* > 44pt minimum */
  --gap:           14px;
  --pad:           16px;
  --shadow:        0 1px 2px rgba(14, 24, 36, .06), 0 6px 18px rgba(14, 24, 36, .06);
  --shadow-lift:   0 2px 6px rgba(14, 24, 36, .10), 0 12px 28px rgba(14, 24, 36, .10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Dark mode: do not fight the OS. Mirror the TV palette. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0b1420;
    --bg-accent:   #101d2c;
    --surface:     #172534;
    --surface-2:   #203145;
    --surface-3:   #2a3d53;
    --text:        #ffffff;
    --text-dim:    #a9bacb;
    --text-faint:  #8c9fb3;
    --line:        rgba(255, 255, 255, .12);
    --line-strong: rgba(255, 255, 255, .28);
    --accent:      #5fa0ff;
    --accent-ink:  #07121f;
    --accent-soft: rgba(95, 160, 255, .16);
    --danger:      #ff8d95;
    --danger-soft: rgba(244, 112, 126, .16);
    --warn:        #f5c178;
    --warn-soft:   rgba(245, 175, 98, .16);
    --ok:          #7fd8a5;
    --ok-soft:     rgba(101, 199, 139, .16);
    --focus:       #9cc4ff;
    --focus-halo:  rgba(7, 18, 31, .95);
    --shadow:      0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .30);
    --shadow-lift: 0 2px 8px rgba(0, 0, 0, .45), 0 16px 36px rgba(0, 0, 0, .40);
  }
}

/* ------------------------------------------------------------------ reset -- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.5 var(--font);
  /* Stops iOS Safari from zooming past the layout on orientation change. */
  overflow-wrap: break-word;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

h1, h2, h3, p, dl, dd, ul, ol, fieldset, legend { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button { font: inherit; color: inherit; }
svg { display: block; flex: none; }

/* Everything focusable gets the same unmistakable ring. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}
/* Older WebKit: keep the default ring rather than removing it. */

.vis-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -120%);
  z-index: 20;
  background: var(--surface);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- layout -- */
.shell {
  max-width: 34rem;              /* comfortable on a tablet, full width on a phone */
  margin: 0 auto;
  padding: 18px var(--pad) 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
  min-height: 100dvh;
}

.masthead { display: flex; flex-direction: column; gap: 10px; }
.masthead__eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.masthead__title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }

main { display: flex; flex-direction: column; gap: 18px; }

.step { display: flex; flex-direction: column; gap: 16px; }

/* `.step` is an author rule, so it overrides the browser's default
   [hidden] { display: none }. Without this every step rendered at once and the
   wizard showed the whole flow as one long page — the step machinery was
   working, the stylesheet was undoing it. */
[hidden] { display: none !important; }
.step__title {
  font-size: 26px;
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -.02em;
}
.step__title--hero { font-size: 30px; }
.step__title:focus { outline: none; }
.step__title:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.step__lede { color: var(--text-dim); font-size: 16px; }

.footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.footer__text { font-size: 13px; color: var(--text-faint); }

/* --------------------------------------------------------------- stepper -- */
/* Five labels have to survive a 320px-wide phone without pushing the body into
   a horizontal scroll, so items may shrink below their text width and the
   labels wrap instead of overflowing. */
.stepper { min-width: 0; }
.stepper__list { display: flex; gap: 6px; }
.stepper__item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding-top: 8px;
  border-top: 3px solid var(--line);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.stepper__dot {
  width: 22px; height: 22px;
  border-radius: var(--radius-pill);
  display: grid; place-items: center;
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
}
.stepper__item[data-state="done"] { border-top-color: var(--accent); color: var(--text-dim); }
.stepper__item[data-state="done"] .stepper__dot { background: var(--accent-soft); color: var(--accent); }
.stepper__item[aria-current="step"] { border-top-color: var(--accent); color: var(--text); }
.stepper__item[aria-current="step"] .stepper__dot { background: var(--accent); color: var(--accent-ink); }
.stepper__label { max-width: 100%; overflow-wrap: anywhere; }

/* ----------------------------------------------------------------- cards -- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card--quiet {
  background: var(--surface-2);
  box-shadow: none;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.card--quiet > div { flex: 1; min-width: 0; }
.card__title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}
.card__icon { color: var(--accent); display: block; }
.card__icon svg { width: 20px; height: 20px; }
.card__lede { color: var(--text-dim); font-size: 15px; }
.fineprint { color: var(--text-faint); font-size: 13.5px; line-height: 1.55; }
.fineprint--center { text-align: center; }

.scope {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
  white-space: nowrap;
}

/* pairing code */
.card--code { align-items: center; text-align: center; gap: 8px; }
.code__label {
  font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-faint);
}
.code__value {
  font-family: var(--mono);
  font-size: clamp(34px, 12vw, 46px);
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.1;
  color: var(--text);
}
.code__hint { font-size: 13.5px; color: var(--text-faint); }

.account__label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.account__email { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }

/* ----------------------------------------------------------------- lists -- */
.list__caption {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-faint);
  margin-top: 2px;
}
.list { display: flex; flex-direction: column; gap: 9px; }
.list li {
  position: relative;
  padding-left: 28px;
  font-size: 15.5px;
  color: var(--text-dim);
  line-height: 1.45;
}
.list li::before {
  position: absolute;
  left: 0; top: .1em;
  width: 20px;
  text-align: center;
  font-weight: 700;
}
.list--check li::before { content: "\2713"; color: var(--ok); }
.list--cross li::before { content: "\2715"; color: var(--danger); }

.note {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: var(--radius);
  padding: 13px 14px;
  font-size: 15px;
  color: var(--text);
}
.note__icon { color: var(--accent); }
.note__icon svg { width: 20px; height: 20px; }
.note strong { font-weight: 700; }

/* --------------------------------------------------------------- buttons -- */
.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16.5px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .12s ease, background-color .12s ease, box-shadow .12s ease;
}
.btn:active { transform: scale(.985); }
.btn--block { width: 100%; }
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
  font-weight: 700;
}
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
@media (prefers-color-scheme: dark) {
  .btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
}
.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn--small { min-height: 40px; padding: 8px 14px; font-size: 14.5px; font-weight: 600; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .55; pointer-events: none; }
.btn__icon svg { width: 19px; height: 19px; }

.actions { display: flex; flex-direction: column; gap: 10px; }
.actions--stack { gap: 10px; }

.icon-btn {
  -webkit-appearance: none;
  appearance: none;
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  touch-action: manipulation;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.icon-btn--danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn--bare { border-color: transparent; background: transparent; }

/* ---------------------------------------------------------------- fields -- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field--flush { flex: 1; min-width: 0; gap: 0; }
.field__label { font-size: 14px; font-weight: 650; color: var(--text); }
.field__help { font-size: 13.5px; color: var(--text-faint); line-height: 1.45; }

.input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: var(--tap);
  padding: 11px 13px;
  font: inherit;
  font-size: 17px;              /* 17px keeps iOS from zooming on focus */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.input::placeholder { color: var(--text-faint); }
.input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input--name { font-weight: 650; }
.input--num { width: 4.5ch; text-align: center; padding: 11px 4px; -moz-appearance: textfield; }
.input--num::-webkit-outer-spin-button,
.input--num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.select {
  /* Hand-drawn chevron, inline so nothing is fetched. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%235b687c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 20px 20px;
  padding-right: 40px;
}
@media (prefers-color-scheme: dark) {
  .select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%238c9fb3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* segmented radio group */
.seg { display: flex; gap: 8px; }
.seg__opt { flex: 1; display: block; position: relative; }
.seg__opt input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; opacity: 0;
  cursor: pointer;
}
.seg__opt span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 12px;
  text-align: center;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.seg__opt input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.seg__opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: var(--tap);
  cursor: pointer;
  position: relative;
}
.switch--block { width: 100%; }
.switch--compact { min-height: var(--tap); min-width: var(--tap); justify-content: flex-end; }
.switch input {
  position: absolute;
  width: 100%; height: 100%;
  inset: 0;
  margin: 0; opacity: 0;
  cursor: pointer;
}
.switch__text { font-size: 15.5px; font-weight: 600; order: -1; flex: 1; }
.switch__track {
  width: 52px; height: 32px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  padding: 2px;
  transition: background-color .15s ease, border-color .15s ease;
}
.switch__knob {
  width: 26px; height: 26px;
  border-radius: var(--radius-pill);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  transition: transform .15s ease;
}
.switch input:checked + .switch__track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch__track .switch__knob { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* color swatches */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; display: block; width: var(--tap); height: var(--tap); }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.swatch__chip {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  border-radius: var(--radius-pill);
  background: var(--swatch, #888);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.swatch__chip::after {
  content: "";
  width: 18px; height: 10px;
  border-left: 3px solid var(--swatch-ink, #fff);
  border-bottom: 3px solid var(--swatch-ink, #fff);
  border-radius: 2px;
  transform: rotate(-45deg) translate(1px, -2px);
  opacity: 0;
}
.swatch input:checked + .swatch__chip {
  border-color: var(--text);
  box-shadow: inset 0 0 0 2px var(--surface);
}
.swatch input:checked + .swatch__chip::after { opacity: 1; }
.swatch input:focus-visible + .swatch__chip { outline: 3px solid var(--focus); outline-offset: 3px; }

/* icon picker */
.icons { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-choice { position: relative; display: block; width: var(--tap); height: var(--tap); }
.icon-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.icon-choice__glyph {
  display: grid;
  place-items: center;
  width: 100%; height: 100%;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.icon-choice__glyph svg { width: 24px; height: 24px; }
.icon-choice input:checked + .icon-choice__glyph {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.icon-choice input:focus-visible + .icon-choice__glyph { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ rows -- */
.rows { display: flex; flex-direction: column; gap: 12px; }
.row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.row__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  min-height: 60px;
}
.row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row__title { font-size: 16.5px; font-weight: 650; overflow-wrap: anywhere; }
.row__meta { font-size: 13px; color: var(--text-faint); }
.row__detail {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 4px 14px 16px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}
.row__detail--open, .row[data-on="true"] .row__detail { display: flex; padding-top: 14px; }
/* A family row leads with a 40px avatar instead of an 18px dot. */
.row--profile .row__head { padding: 12px; gap: 10px; }
.row[data-on="false"] { background: var(--surface-2); box-shadow: none; }
.row[data-on="false"] .row__title { color: var(--text-dim); }
.row__note { font-size: 13.5px; color: var(--text-faint); }

.dot {
  width: 18px; height: 18px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--dot, var(--text-faint));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}
.avatar {
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  background: var(--dot, var(--text-faint));
  color: var(--dot-ink, #fff);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}
.avatar svg { width: 22px; height: 22px; }

.order { gap: 10px; }
.order__controls { display: flex; align-items: center; gap: 8px; }
.order__pos {
  min-width: 5.5ch;
  text-align: center;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* buffers */
.buffer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.buffer:last-child { border-bottom: 0; }
.buffer__text { flex: 1; min-width: 42%; display: flex; flex-direction: column; gap: 2px; }
.buffer__name { font-size: 15.5px; font-weight: 650; }
.buffer__hint { font-size: 13px; color: var(--text-faint); }
.stepper-input { display: flex; align-items: center; gap: 4px; }
.stepper-input__unit { font-size: 13.5px; color: var(--text-faint); font-weight: 600; }
.stepper-input__field { display: block; }

/* ------------------------------------------------------- status & errors -- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar__count { flex: 1; min-width: 100%; font-size: 13.5px; color: var(--text-faint); }
.toolbar__buttons { display: flex; gap: 8px; }

.loading { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 15.5px; padding: 8px 0; }
.spinner {
  width: 22px; height: 22px;
  border-radius: var(--radius-pill);
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.empty__title { font-weight: 700; }
.empty__text { font-size: 14.5px; color: var(--text-dim); }

.banner {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  border-radius: var(--radius);
  padding: 13px;
}
.banner[data-tone="error"] { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.banner[data-tone="ok"]    { background: var(--ok-soft);     border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.banner__icon { color: var(--warn); }
.banner[data-tone="error"] .banner__icon { color: var(--danger); }
.banner[data-tone="ok"] .banner__icon { color: var(--ok); }
.banner__icon svg { width: 22px; height: 22px; }
.banner__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.banner__title { font-weight: 700; font-size: 15.5px; }
.banner__text { font-size: 14.5px; color: var(--text-dim); }
.banner__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.banner #banner-dismiss { width: 36px; height: 36px; min-width: 36px; border-color: transparent; background: transparent; }
.banner #banner-dismiss svg { width: 18px; height: 18px; }

.save-state { font-size: 13px; color: var(--text-faint); min-height: 1.2em; }
.save-state[data-tone="error"] { color: var(--danger); font-weight: 600; }
.save-state[data-tone="ok"] { color: var(--ok); }

/* done / fatal */
.done, .fatal { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; padding: 8px 0; }
.done__mark, .fatal__mark {
  width: 76px; height: 76px;
  border-radius: var(--radius-pill);
  display: grid; place-items: center;
  background: var(--ok-soft);
  color: var(--ok);
}
.done__mark svg, .fatal__mark svg { width: 40px; height: 40px; }
.fatal__mark { background: var(--warn-soft); color: var(--warn); }
.fatal__mark[data-tone="error"] { background: var(--danger-soft); color: var(--danger); }

.summary { display: flex; flex-direction: column; gap: 10px; }
.summary__item { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.summary__item dt { font-size: 14.5px; color: var(--text-dim); }
.summary__item dd { font-size: 15.5px; font-weight: 650; text-align: right; overflow-wrap: anywhere; }

/* --------------------------------------------------------- accommodations -- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --line: #6b7889; --line-strong: #44525f; --text-dim: #2c3a4a; --text-faint: #3b4a5c; }
  .card, .row { border-width: 2px; }
}

/* Roomier on a tablet or in landscape, still a single column. */
@media (min-width: 30rem) {
  .shell { padding: 26px 24px 48px; gap: 24px; }
  .masthead__title { font-size: 24px; }
  .step__title { font-size: 28px; }
  .buffer__text { min-width: 0; }
}


/* ---- Pairing-code entry -------------------------------------------------
   Typed, not pre-filled: see the comment in index.html. Sized for a thumb and
   wide-tracked so a 6-7 character code is easy to check against the TV. */
.code__input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0.35rem 0 0.5rem;
  padding: 0.85rem 0.75rem;
  font: 600 1.6rem/1.2 var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface-2, rgba(127, 127, 127, 0.08));
  border: 2px solid var(--border);
  border-radius: 12px;
  min-height: 56px; /* comfortable tap target */
}
.code__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
}
.code__error {
  margin: 0 0 0.6rem;
  color: var(--danger, #b3261e);
  font-size: 0.95rem;
  font-weight: 600;
}

/* ---- Confirmed pairing code, shown on the Connect step -------------------
   Small and inline: at this point the code has done its job, and repeating it
   at full size would compete with the decision the screen is actually asking
   for. */
.code__confirmed {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--text-muted, #6b7a8d);
  text-align: center;
}
.code__value--inline {
  font: 600 1rem/1 var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  letter-spacing: 0.1em;
  color: var(--text);
}

/* ---- Required-field error ------------------------------------------------
   Shown inline beneath the field rather than as a banner, so the message sits
   where the correction has to happen. */
.field__error {
  display: block;
  margin-top: 0.35rem;
  color: var(--danger, #b3261e);
  font-size: 0.95rem;
  font-weight: 600;
}
.input[aria-invalid="true"] {
  border-color: var(--danger, #b3261e);
}
