/* Layout and components. All colours come from tokens.css. */

/* Layout concept: a quiet presenter stage. The phone sits centre-stage; the
   "Prepared for TikTok" notes run down the right like a speaker's script. */

:root {
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-app: -apple-system, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --panel-w: 400px;
  --topbar-h: 64px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  height: 100%;
  margin: 0;
  background: var(--shell-bg);
  color: var(--shell-fg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--shell-focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell ---------- */
.app { height: 100%; display: grid; grid-template-rows: auto 1fr; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 10px 20px;
  background: var(--shell-surface);
  border-bottom: 1px solid var(--shell-border);
  position: relative; z-index: 5;
}
.brand { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.brand b { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: 0.01em; }
.brand span { font-size: 12px; color: var(--shell-muted); }
.journey-pick { display: flex; align-items: center; gap: 8px; min-width: 0; }
.journey-pick label { font-size: 12px; color: var(--shell-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.journey-pick select {
  min-width: 0; max-width: 300px; height: 38px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--shell-border);
  background: var(--shell-surface-2);
}
.stepnav { display: flex; align-items: center; gap: 6px; }
.stepcount { font-size: 13px; color: var(--shell-muted); font-variant-numeric: tabular-nums; min-width: 92px; text-align: center; }
.tbtn {
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--shell-border); background: var(--shell-surface-2);
  font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
}
.tbtn:hover { border-color: var(--shell-accent); }
.tbtn[disabled] { opacity: 0.45; cursor: default; }
.tbtn.primary { background: var(--shell-accent); color: var(--shell-on-accent); border-color: var(--shell-accent); }
.tbtn[aria-pressed="true"] { background: var(--shell-accent-soft); border-color: var(--shell-accent); }
.tbtn.quiet { background: transparent; border-color: transparent; color: var(--shell-muted); font-weight: 500; font-size: 13px; padding: 0 8px; }
.tbtn.quiet:hover { color: var(--shell-fg); border-color: var(--shell-border); }
.tbtn.quiet.armed { color: var(--status-stopped); border-color: var(--status-stopped); }
.tbtn svg { width: 16px; height: 16px; }

.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w);
  min-height: 0; background: var(--shell-stage);
}
.app.panel-hidden .stage { grid-template-columns: minmax(0, 1fr); }
.app.panel-hidden .panel { display: none; }

/* ---------- Phone column ---------- */
.phone-col {
  container-type: size;
  min-height: 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px;
}
.device-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px 0 6px; border-radius: 999px;
  background: var(--shell-surface); border: 1px solid var(--shell-border);
  font-size: 13px; font-weight: 600;
}
.device-chip .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--shell-surface); background: var(--role-teen); }
.device-chip .dot svg { width: 13px; height: 13px; }
.device-chip[data-role="parent"] .dot { background: var(--role-parent); }
.device-chip[data-role="other"] .dot { background: var(--role-other); }
.device-chip small { font-weight: 500; color: var(--shell-muted); font-size: 12px; }

.phone {
  position: relative;
  width: min(100cqw - 32px, (100cqh - 60px) * 0.4621, 410px);
  aspect-ratio: 390 / 844;
  max-width: 100%;
  border-radius: 46px;
  padding: 11px;
  background: var(--frame);
  box-shadow: 0 0 0 1px var(--frame-edge), 0 24px 60px -18px var(--stage-shadow);
}
.phone-screen {
  container-type: inline-size;
  position: relative; width: 100%; height: 100%;
  border-radius: 36px; overflow: hidden;
  background: var(--app-bg);
}
.handoff {
  font-size: 12.5px; color: var(--shell-muted); min-height: 18px; text-align: center;
}
.handoff strong { color: var(--shell-fg); }

/* ---------- Presenter panel ---------- */
.panel {
  min-height: 0; overflow-y: auto;
  background: var(--shell-surface);
  border-left: 1px solid var(--shell-border);
  padding: 22px 24px 28px;
  display: flex; flex-direction: column; gap: 18px;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-head h2 {
  margin: 0; font-family: var(--font-display); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--shell-accent);
}
.panel-head span { font-size: 12px; color: var(--shell-muted); }
.screen-id { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.code {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; background: var(--shell-surface-2); border: 1px solid var(--shell-border);
}
.kind { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--shell-muted); }
.panel h3 { margin: 6px 0 0; font-family: var(--font-display); font-size: 22px; line-height: 1.2; text-wrap: balance; }
.psec { display: flex; flex-direction: column; gap: 6px; }
.psec h4 {
  margin: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--shell-muted); display: flex; align-items: center; gap: 6px;
}
.psec h4 svg { width: 14px; height: 14px; }
.psec p, .psec li { margin: 0; font-size: 14.5px; max-width: 62ch; }
.psec ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.psec.gap { background: var(--gap-soft); border-radius: var(--radius); padding: 12px 14px; }
.psec.gap h4 { color: var(--gap-mark); }
.psec.check { background: var(--check-soft); border-radius: var(--radius); padding: 12px 14px; }
.psec.check h4 { color: var(--check-mark); }
.psec.note p { font-size: 13px; color: var(--shell-muted); }
.inferred {
  font-size: 12.5px; color: var(--shell-muted);
  border: 1px dashed var(--shell-border); border-radius: 10px; padding: 8px 10px;
}
.inferred b { color: var(--shell-fg); }

.tracker { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--shell-border); border-radius: var(--radius); overflow: hidden; }
.trow { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--shell-border); }
.trow:first-child { border-top: 0; }
.trow .num { font-family: var(--font-mono); font-size: 12px; color: var(--shell-muted); }
.trow .lbl { font-size: 13.5px; min-width: 0; }
.trow .lbl small { display: block; font-size: 12px; color: var(--shell-muted); }
.trow.tiktok { background: var(--shell-surface-2); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 3px 9px 3px 6px; border-radius: 999px;
}
.pill svg { width: 13px; height: 13px; }
.pill.c { color: var(--status-complete); background: var(--status-complete-soft); }
.pill.p { color: var(--status-processing); background: var(--status-processing-soft); }
.pill.w { color: var(--status-pending); background: var(--status-pending-soft); }
.pill.x, .pill.s { color: var(--status-stopped); background: var(--status-stopped-soft); }
.pill.n, .pill.na { color: var(--status-idle); background: var(--status-idle-soft); }

.panel details { border-top: 1px solid var(--shell-border); padding-top: 12px; }
.panel summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--shell-muted); }
.panel dl { margin: 10px 0 0; display: grid; gap: 8px; }
.panel dt { font-weight: 700; font-size: 13px; }
.panel dd { margin: 0; font-size: 13px; color: var(--shell-muted); }
.panel .src { font-size: 12px; color: var(--shell-muted); }

/* ---------- Narrow layouts ---------- */
@media (max-width: 999px) {
  html, body { height: auto; }
  .app { height: auto; display: block; }
  .topbar { position: sticky; top: env(safe-area-inset-top, 0px); }
  .stage { display: block; }
  .phone-col { height: calc(100dvh - var(--topbar-h)); min-height: 520px; }
  .panel { border-left: 0; border-top: 1px solid var(--shell-border); padding: 22px 16px 40px; }
  .panel > * { max-width: 680px; margin-inline: auto; width: 100%; }
  .journey-pick { order: 3; flex: 1 1 100%; }
  .journey-pick select { flex: 1; max-width: none; }
}
@media (max-width: 599px) {
  .topbar { padding: 8px 16px; gap: 8px; }
  .brand span { display: none; }
  .stepcount { min-width: 0; font-size: 12px; }
  .tbtn { padding: 0 10px; }
  .tbtn .lbl-long { display: none; }
  .phone-col { padding: 8px 0 0; gap: 6px; min-height: 560px; }
  .phone { width: 100%; height: calc(100% - 64px); aspect-ratio: auto; border-radius: 0; padding: 0; box-shadow: none; background: transparent; }
  .phone-screen { border-radius: 0; border-top: 1px solid var(--shell-border); }
}

/* ======================================================================
   Phone screens. Sizes are in em; 1em = 16px on a 390px-wide phone.
   ====================================================================== */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--app-bg); color: var(--app-ink);
  font-family: var(--font-app);
  font-size: calc(100cqw / 24.375);
  line-height: 1.35;
  color-scheme: light;
  overflow: hidden;
}
.screen :focus-visible { outline: 0.18em solid var(--app-link); outline-offset: 0.12em; }
.sb { flex: none; height: 2.9em; display: flex; align-items: center; justify-content: space-between; padding: 0.4em 1.75em 0; font-weight: 600; font-size: 0.95em; font-variant-numeric: tabular-nums; }
.sb .icons { display: flex; gap: 0.35em; align-items: center; }
.sb svg { height: 0.8em; width: auto; }
.nav { flex: none; height: 2.9em; display: flex; align-items: center; padding: 0 0.6em; gap: 0.25em; }
.nav .title { flex: 1; text-align: center; font-weight: 700; font-size: 1em; margin-right: 2.6em; }
.nav .title small { display: block; font-weight: 500; font-size: 0.72em; color: var(--app-faint); }
.iconbtn { width: 2.6em; height: 2.6em; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: inherit; }
.iconbtn svg { width: 1.45em; height: 1.45em; }
.body { flex: 1; min-height: 0; overflow-y: auto; padding: 0.4em 2em 1.4em; display: flex; flex-direction: column; gap: 1em; overscroll-behavior: contain; }
.body.tight { gap: 0.7em; }
.foot { flex: none; padding: 0.8em 1.6em 0.3em; display: flex; flex-direction: column; gap: 0.55em; align-items: stretch; }
.wm { flex: none; text-align: center; font-size: 0.6em; letter-spacing: 0.16em; text-transform: uppercase; color: var(--app-faint); padding: 0.5em 0 1em; }

.h1 { margin: 0; font-size: 1.9em; font-weight: 800; line-height: 1.08; letter-spacing: -0.015em; text-wrap: balance; }
.h1.sm { font-size: 1.55em; }
.h1:focus { outline: none; }
.sub { margin: -0.3em 0 0; font-size: 0.94em; color: var(--app-sub); line-height: 1.4; }
.sec-label { margin: 0.4em 0 -0.4em; font-size: 0.95em; font-weight: 700; }
.small { font-size: 0.8em; color: var(--app-sub); line-height: 1.4; }
.center { text-align: center; }
.a { color: var(--app-link); font-weight: 600; background: none; border: 0; padding: 0; font-size: inherit; cursor: pointer; text-decoration: none; }
.a:hover { text-decoration: underline; }

/* Buttons */
.btn {
  height: 3.25em; border-radius: 999px; border: 0; width: 100%;
  font-weight: 700; font-size: 1em;
  background: var(--app-primary); color: var(--app-on-primary);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
}
.btn:active { background: var(--app-primary-pressed); }
.btn[aria-disabled="true"] { background: var(--app-primary-disabled); }
.btn.teal { background: var(--te-teal); color: var(--te-on-teal); }
.btn.teal:active { background: var(--te-teal-pressed); }
.btn.teal[aria-disabled="true"] { opacity: 0.45; }
.btn.danger { background: var(--app-danger); color: var(--app-on-primary); }
.btn.ghost { background: var(--app-field); color: var(--app-ink); }
.btn.outline { background: var(--app-bg); color: var(--app-ink); border: 0.08em solid var(--app-line); }
.btn.link { background: transparent; color: var(--app-link); height: 2.4em; }
.btn svg { width: 1.2em; height: 1.2em; }
.btn.sm { height: 2.5em; font-size: 0.85em; width: auto; padding: 0 1.2em; }
.btn-row { display: flex; gap: 0.6em; }
.btn-row > * { flex: 1; }

.demo-fill {
  align-self: flex-end;
  display: inline-flex; align-items: center; gap: 0.4em;
  font-size: 0.74em; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.45em 0.9em; border-radius: 999px;
  border: 0.1em dashed var(--app-link); color: var(--app-link); background: var(--app-bg);
  margin-bottom: -0.4em;
}
.demo-fill svg { width: 1.1em; height: 1.1em; }

/* Fields */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55em; }
.field {
  position: relative; background: var(--app-field); border-radius: 0.7em;
  padding: 0.45em 0.85em 0.5em; min-width: 0;
  border: 0.1em solid transparent;
}
.field label, .field .lab { display: block; font-size: 0.72em; color: var(--app-sub); }
.field input, .field .val, .field select {
  display: block; width: 100%; border: 0; background: transparent; padding: 0.1em 0 0;
  font-size: 1em; color: var(--app-ink); outline: none; min-width: 0;
}
.field input::placeholder { color: var(--app-faint); }
.field:focus-within { border-color: var(--app-ink); }
.field.ro { background: var(--app-field); }
.field.ro .val { color: var(--app-ink); }
.field .badge { position: absolute; right: 0.75em; top: 50%; transform: translateY(-50%); }
.field.invalid { border-color: var(--app-error); background: var(--app-error-soft); }
.err { display: flex; align-items: flex-start; gap: 0.35em; color: var(--app-error); font-size: 0.75em; margin-top: 0.3em; font-weight: 600; }
.err svg { width: 1.2em; height: 1.2em; flex: none; }
.fwrap { min-width: 0; }
.formerr { background: var(--app-error-soft); color: var(--app-error); border-radius: 0.7em; padding: 0.6em 0.8em; font-size: 0.8em; font-weight: 600; display: flex; gap: 0.5em; align-items: flex-start; }
.formerr svg { width: 1.3em; height: 1.3em; flex: none; }

.okbadge { display: inline-flex; align-items: center; gap: 0.3em; color: var(--app-ok); font-weight: 700; font-size: 0.78em; }
.okbadge svg { width: 1.15em; height: 1.15em; }

/* Birthday picker */
.wheel { display: grid; grid-template-columns: 0.8fr 1.4fr 1fr; gap: 0.4em; background: var(--app-field); border-radius: 0.8em; padding: 0.5em; }
.wheel select { height: 2.6em; border: 0; border-radius: 0.55em; background: var(--app-bg); padding: 0 0.5em; font-size: 1em; font-weight: 600; color: var(--app-ink); min-width: 0; }
.wheel label { display: block; font-size: 0.68em; color: var(--app-sub); margin: 0 0 0.25em 0.3em; }

/* Code boxes */
.codebox { position: relative; }
.codebox input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; padding: 0; font-size: 16px; cursor: text; z-index: 1;
}
.codebox .cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.5em; }
.codebox .cell {
  height: 3.1em; border-radius: 0.6em; background: var(--app-field);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.15em; color: var(--app-ink);
}
.codebox:focus-within .cell.active { box-shadow: inset 0 0 0 0.12em var(--app-ink); }
.codebox:focus-within { outline: 0.18em solid var(--app-link); outline-offset: 0.25em; border-radius: 0.7em; }
.qt { display: flex; align-items: center; justify-content: center; gap: 0.6em; background: var(--app-field); border-radius: 0.6em; padding: 0.55em; border: 0; width: 100%; font-size: 0.85em; }
.qt b { font-family: var(--font-mono); letter-spacing: 0.1em; }
.checkline { display: flex; align-items: center; gap: 0.55em; font-size: 0.78em; color: var(--app-sub); }
.checkline input { width: 1.2em; height: 1.2em; accent-color: var(--app-primary); }

/* Cards */
.card { border-radius: 0.9em; padding: 0.85em 1em; display: flex; flex-direction: column; gap: 0.3em; }
.card.te { background: var(--te-teal-soft); color: var(--app-ink); }
.card.ok { background: var(--app-ok-soft); }
.card.pink { background: var(--app-pink-soft); border: 0.08em solid var(--app-pink-line); }
.card.plain { border: 0.08em solid var(--app-line); }
.card.field { background: var(--app-field); }
.card h4 { margin: 0; font-size: 0.92em; display: flex; align-items: center; gap: 0.4em; }
.card h4 svg { width: 1.15em; height: 1.15em; flex: none; }
.card.te h4 { color: var(--te-teal); }
.card.ok h4 { color: var(--app-ok); }
.card p { margin: 0; font-size: 0.8em; color: var(--app-sub); line-height: 1.4; }
.tealtxt { color: var(--te-teal); }

.techip { display: inline-flex; align-items: center; gap: 0.35em; color: var(--te-teal); font-weight: 700; font-size: 0.74em; }
.techip svg { width: 1.2em; height: 1.2em; }

.who { display: flex; align-items: center; gap: 0.7em; }
.avatar { width: 2.4em; height: 2.4em; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-fg); display: grid; place-items: center; font-weight: 800; flex: none; }
.who b { display: block; font-size: 0.95em; }
.who small { display: block; font-size: 0.74em; color: var(--app-sub); }

/* Steps checklist (T2, T3) */
.steps { border: 0.08em solid var(--app-line); border-radius: 1em; padding: 0.4em 1em; display: flex; flex-direction: column; }
.stp { display: grid; grid-template-columns: 1.7em 1fr; gap: 0.7em; padding: 0.75em 0; align-items: start; border-top: 0.06em solid var(--app-line); }
.stp:first-child { border-top: 0; }
.stp .ic { width: 1.7em; height: 1.7em; border-radius: 50%; display: grid; place-items: center; font-size: 0.85em; font-weight: 700; }
.stp .ic svg { width: 100%; height: 100%; }
.stp.done .ic { color: var(--app-ok); }
.stp.wait .ic { border: 0.12em solid var(--app-primary); color: var(--app-primary); }
.stp.todo .ic { background: var(--app-field); color: var(--app-sub); }
.stp.run .ic { border: 0.15em solid var(--app-line); border-top-color: var(--te-teal); animation: spin 0.9s linear infinite; }
.stp.fail .ic { color: var(--app-error); }
.stp b { display: block; font-size: 0.92em; }
.stp small { display: block; font-size: 0.76em; color: var(--app-sub); margin-top: 0.1em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Setting rows */
.rows { display: flex; flex-direction: column; }
.srow { display: flex; align-items: center; gap: 0.8em; padding: 0.7em 0; border-top: 0.06em solid var(--app-line); min-height: 3.1em; }
.srow:first-child { border-top: 0; }
.srow .t { flex: 1; min-width: 0; }
.srow .t b { display: block; font-size: 0.9em; font-weight: 600; }
.srow .t small { display: block; font-size: 0.74em; color: var(--app-sub); }
.srow .v { font-size: 0.85em; color: var(--app-ink); white-space: nowrap; display: flex; align-items: center; gap: 0.3em; }
.srow .v.muted { color: var(--app-sub); }
.srow .v svg { width: 1em; height: 1em; }
.srow select { border: 0; background: var(--app-field); border-radius: 0.5em; padding: 0.35em 0.5em; font-size: 0.85em; color: var(--app-ink); }
.srow.btnrow { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; padding-left: 0; padding-right: 0; color: inherit; font: inherit; cursor: pointer; }

.sw { position: relative; display: inline-flex; align-items: center; gap: 0.45em; font-size: 0.78em; color: var(--app-sub); cursor: pointer; }
.sw input { appearance: none; -webkit-appearance: none; margin: 0; width: 2.9em; height: 1.75em; border-radius: 999px; background: var(--app-switch-off); position: relative; cursor: pointer; transition: background 0.15s; }
.sw input::after { content: ""; position: absolute; top: 0.2em; left: 0.2em; width: 1.35em; height: 1.35em; border-radius: 50%; background: var(--app-knob); transition: transform 0.15s; }
.sw input:checked { background: var(--app-primary); }
.sw input:checked::after { transform: translateX(1.15em); }
.sw input:focus-visible { outline: 0.18em solid var(--app-link); outline-offset: 0.15em; }
.sw .st { min-width: 1.6em; text-align: right; font-weight: 600; }

/* Status chips in phone */
.chip { display: inline-flex; align-items: center; gap: 0.3em; font-size: 0.66em; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.3em 0.6em; border-radius: 999px; white-space: nowrap; }
.chip svg { width: 1.2em; height: 1.2em; }
.chip.active { background: var(--app-ok-soft); color: var(--app-ok); }
.chip.used { background: var(--app-field); color: var(--app-sub); }
.chip.revoked { background: var(--app-error-soft); color: var(--app-error); }
.chip.version, .chip.review { background: var(--app-pink-soft); color: var(--app-primary-pressed); }
.chip.example { background: var(--te-teal-soft); color: var(--te-teal-pressed); }
.chip.rec { background: var(--app-pink-soft); color: var(--app-primary-pressed); }

/* Choice cards */
.choice {
  width: 100%; text-align: left; border-radius: 0.9em; padding: 0.85em 1em;
  border: 0.1em solid var(--app-line); background: var(--app-bg); color: var(--app-ink);
  display: flex; gap: 0.75em; align-items: flex-start;
}
.choice b { display: block; font-size: 0.92em; }
.choice small { display: block; font-size: 0.76em; color: var(--app-sub); margin-top: 0.15em; }
.choice .grow { flex: 1; min-width: 0; }
.screen svg.chev { width: 1em; height: 1em; flex: none; color: var(--app-faint); align-self: center; }
.choice[aria-checked="true"], .choice[aria-pressed="true"] { border-color: var(--app-ink); box-shadow: inset 0 0 0 0.06em var(--app-ink); }
.choice.teal[aria-checked="true"] { border-color: var(--te-teal); box-shadow: inset 0 0 0 0.06em var(--te-teal); }
.choice .radio { width: 1.25em; height: 1.25em; border-radius: 50%; border: 0.12em solid var(--app-faint); flex: none; margin-top: 0.1em; display: grid; place-items: center; }
.choice[aria-checked="true"] .radio { border-color: var(--app-ink); }
.choice[aria-checked="true"] .radio::after { content: ""; width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--app-ink); }
.choice.teal[aria-checked="true"] .radio { border-color: var(--te-teal); }
.choice.teal[aria-checked="true"] .radio::after { background: var(--te-teal); }
.pillopt { height: 3em; border-radius: 999px; border: 0; background: var(--app-field); font-weight: 600; font-size: 0.92em; width: 100%; color: var(--app-ink); }
.pillopt[aria-pressed="true"] { background: var(--app-ink); color: var(--app-bg); }
.interest { display: flex; justify-content: space-between; align-items: center; height: 3em; border-radius: 0.8em; border: 0; background: var(--app-field); padding: 0 1em; font-size: 0.92em; font-weight: 600; width: 100%; color: var(--app-ink); }
.interest .ring { width: 1.25em; height: 1.25em; border-radius: 50%; border: 0.12em solid var(--app-faint); display: grid; place-items: center; }
.interest[aria-pressed="true"] .ring { background: var(--app-primary); border-color: var(--app-primary); color: var(--app-on-primary); }
.interest .ring svg { width: 0.8em; height: 0.8em; }

/* Login (C1) */
.logo-ph { display: block; margin: 0.6em auto 0.4em; width: 5.5em; height: auto; }
.logo-ph.sm { width: 2.4em; margin: 0; border-radius: 0.5em; }
.or { display: flex; align-items: center; gap: 0.8em; color: var(--app-sub); font-size: 0.8em; }
.or::before, .or::after { content: ""; flex: 1; height: 0.06em; background: var(--app-line); }
.social { height: 3em; border-radius: 999px; border: 0.08em solid var(--app-line); background: var(--app-bg); font-weight: 600; font-size: 0.88em; width: 100%; color: var(--app-ink); }
.phonefield { display: flex; gap: 0.5em; }
.phonefield .cc { background: var(--app-field); border-radius: 0.7em; padding: 0 0.8em; display: flex; align-items: center; font-weight: 600; font-size: 0.92em; white-space: nowrap; }
.phonefield .field { flex: 1; }

/* Web page chrome */
.urlbar { margin: 0.2em 1.2em 0.4em; height: 2.4em; border-radius: 0.7em; background: var(--url-bar); display: flex; align-items: center; justify-content: center; gap: 0.4em; font-size: 0.82em; color: var(--app-ink); flex: none; }
.urlbar svg { width: 0.95em; height: 0.95em; }
.tebrand { display: flex; align-items: center; gap: 0.4em; font-weight: 800; color: var(--te-teal); font-size: 0.95em; }
.tebrand svg { width: 1.25em; height: 1.25em; }
.tebrand small { font-weight: 500; color: var(--app-sub); font-size: 0.78em; }

/* Lock screen (P1) */
.screen.lock { background: linear-gradient(170deg, var(--lock-a), var(--lock-b) 58%, var(--lock-c)); color: var(--lock-fg); }
.lockdate { text-align: center; font-weight: 600; font-size: 1.05em; margin-top: 1.2em; }
.lockclock { text-align: center; font-weight: 700; font-size: 5.4em; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.notif { margin: auto 0.9em 1.2em; border: 0; text-align: left; width: calc(100% - 1.8em); background: var(--lock-card); color: var(--app-ink); border-radius: 1.3em; padding: 0.85em 1em; display: grid; grid-template-columns: 2.3em 1fr; gap: 0.7em; }
.notif .top { display: flex; justify-content: space-between; font-size: 0.78em; color: var(--app-sub); }
.notif b { font-size: 0.88em; display: block; margin-top: 0.1em; }
.notif p { margin: 0.15em 0 0; font-size: 0.85em; }

/* Feed (E1, AD6, A1 context) */
.screen.feed { background: linear-gradient(160deg, var(--feed-video-a), var(--feed-bg) 55%, var(--feed-video-b)); color: var(--feed-fg); }
.feedtabs { display: flex; justify-content: center; gap: 1.2em; font-weight: 700; font-size: 0.95em; padding-top: 0.6em; color: var(--feed-fg-dim); }
.feedtabs span:last-child { color: var(--feed-fg); text-decoration: underline; text-underline-offset: 0.45em; text-decoration-thickness: 0.12em; }
.feedcap { position: absolute; left: 1.2em; bottom: 6em; right: 4em; font-size: 0.85em; color: var(--feed-fg); }
.feedcap b { display: block; }
.feedbanner { margin: 0.8em 1em 0; background: var(--lock-card); color: var(--app-ink); border-radius: 0.9em; padding: 0.7em 0.9em; font-size: 0.8em; }

/* Sheets and overlays inside the phone */
.scrim { position: absolute; inset: 0; background: var(--app-scrim); display: flex; align-items: flex-end; z-index: 3; }
.sheet { width: 100%; max-height: 88%; background: var(--app-bg); color: var(--app-ink); border-radius: 1.4em 1.4em 0 0; display: flex; flex-direction: column; }
.sheet .body { padding-top: 1.4em; }
.grabber { width: 2.6em; height: 0.3em; border-radius: 999px; background: var(--app-line); margin: 0.6em auto 0; flex: none; }
.overlay-center { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: var(--app-scrim); }
.faceid { width: 9em; padding: 1.4em 1em 1.2em; border-radius: 1.4em; background: var(--lock-card); color: var(--app-ink); display: flex; flex-direction: column; align-items: center; gap: 0.6em; font-size: 0.95em; font-weight: 600; text-align: center; }
.faceid svg { width: 3.6em; height: 3.6em; color: var(--app-ink); }
.faceid.ok svg { color: var(--app-ok); }
.busy { background: var(--app-bg); color: var(--app-ink); border-radius: 1.2em; padding: 1.2em 1.4em; width: 78%; display: flex; flex-direction: column; gap: 0.6em; align-items: center; text-align: center; }
.busy .spinner { width: 2.2em; height: 2.2em; border-radius: 50%; border: 0.22em solid var(--app-line); border-top-color: var(--te-teal); animation: spin 0.9s linear infinite; }
.busy b { font-size: 0.95em; }
.busy small { font-size: 0.76em; color: var(--app-sub); }
/* Toast sits under the status bar, aligned to the screen's button margins, so it never covers a primary action. */
.toast { position: absolute; left: 2em; right: 2em; top: 3.9em; z-index: 6; background: var(--app-toast-bg); color: var(--app-toast-fg); border-radius: 1em; padding: 0.85em 1.1em; font-size: 0.8em; line-height: 1.35; display: flex; gap: 0.6em; align-items: center; animation: toast-in 0.18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-0.4em); } to { opacity: 1; transform: none; } }
.toast svg { width: 1.2em; height: 1.2em; flex: none; }

/* SMS (B1) */
.sms { display: flex; flex-direction: column; gap: 0.5em; }
.bubble { background: var(--sms-in); border-radius: 1.1em; padding: 0.65em 0.85em; font-size: 0.88em; max-width: 86%; line-height: 1.38; }
.bubble .a { color: var(--sms-link); text-decoration: underline; font-weight: 500; }
.smsmeta { text-align: center; font-size: 0.7em; color: var(--app-sub); }

/* Chat (A1) */
.msg { border-radius: 1.1em; padding: 0.65em 0.9em; font-size: 0.88em; max-width: 84%; }
.msg.me { align-self: flex-end; background: var(--app-primary); color: var(--app-on-primary); }
.msg.bot { align-self: flex-start; background: var(--app-field); }
.product { display: flex; gap: 0.7em; align-items: center; background: var(--app-bg); border-radius: 0.8em; padding: 0.55em; margin: 0.4em 0; }
.product .img { width: 3em; height: 3em; border-radius: 0.5em; background: linear-gradient(135deg, var(--avatar-bg), var(--app-pink-soft)); flex: none; }
.product b { font-size: 0.9em; display: block; }
.product small { font-size: 0.76em; color: var(--app-sub); display: block; }

/* Record lists */
.rec { display: flex; flex-direction: column; }
.ritem { display: grid; grid-template-columns: 1fr auto; gap: 0.6em; align-items: center; padding: 0.75em 0; border-top: 0.06em solid var(--app-line); }
.ritem:first-child { border-top: 0; }
.ritem b { display: block; font-size: 0.9em; font-weight: 600; }
.ritem small { display: block; font-size: 0.74em; color: var(--app-sub); }
.ritem .st { display: inline-flex; align-items: center; gap: 0.3em; font-size: 0.74em; font-weight: 700; white-space: nowrap; }
.ritem .st svg { width: 1.2em; height: 1.2em; }
.ritem .st.ok { color: var(--app-ok); }
.ritem .st.no { color: var(--app-error); }
.ritem .st.muted { color: var(--app-sub); }
.authcard { border: 0.08em solid var(--app-line); border-radius: 0.9em; padding: 0.8em 0.9em; display: flex; flex-direction: column; gap: 0.35em; }
.authcard .hd { display: flex; justify-content: space-between; gap: 0.5em; align-items: flex-start; }
.authcard b { font-size: 0.92em; }
.authcard small { font-size: 0.74em; color: var(--app-sub); }
.authcard .acts { display: flex; gap: 0.5em; margin-top: 0.2em; }
.mini { height: 2.1em; padding: 0 0.9em; border-radius: 999px; border: 0; background: var(--app-field); font-weight: 700; font-size: 0.74em; color: var(--app-ink); }
.mini.red { color: var(--app-danger); background: var(--app-error-soft); }
.seal { display: flex; gap: 0.5em; align-items: flex-start; background: var(--te-teal-soft); color: var(--te-teal-pressed); border-radius: 0.8em; padding: 0.6em 0.8em; font-size: 0.76em; }
.seal svg { width: 1.3em; height: 1.3em; flex: none; }
.chain { display: flex; flex-direction: column; gap: 0.2em; border: 0.08em solid var(--app-line); border-radius: 0.9em; padding: 0.6em 0.9em; }
.link-num { width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--app-ok); color: var(--app-on-primary); display: grid; place-items: center; font-size: 0.8em; font-weight: 800; flex: none; }

/* Camera simulation (F1) */
.cam { margin: 0 auto; width: 12em; height: 12em; border-radius: 50%; background: var(--camera-bg); display: grid; place-items: center; color: var(--feed-fg-dim); font-size: 0.8em; text-align: center; padding: 1.5em; border: 0.35em solid var(--camera-ring); }

/* QR (today) */
.qr { width: 11em; height: 11em; margin: 0.4em auto; color: var(--app-ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .stp.run .ic, .busy .spinner { border-top-color: var(--app-line); }
}
.codebox.invalid .cell { box-shadow: inset 0 0 0 0.1em var(--app-error); background: var(--app-error-soft); }
.wheel.invalid { box-shadow: inset 0 0 0 0.1em var(--app-error); background: var(--app-error-soft); }
