/* Watch along on the bigger screen: /link (type the phone's code / scan the QR), /watch (Batch 3b: the front door +
   the live view). The brand look (paper, ink, coral; fonts self-hosted like app.css — the CSP allows no third-party fonts).
   Text ≥15px, targets ≥44px, contrast AA (muted #6E6577 on paper 5.2:1; ink on coral 5.7:1), reduced motion respected. */
@font-face { font-family:"Bricolage Grotesque"; font-style:normal; font-weight:800; font-display:swap;
  src:url(/assets/fonts/bricolage-grotesque-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family:"DM Sans"; font-style:normal; font-weight:400; font-display:swap; src:url(/assets/fonts/dm-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family:"DM Sans"; font-style:normal; font-weight:500 600; font-display:swap; src:url(/assets/fonts/dm-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family:"DM Sans"; font-style:normal; font-weight:700 900; font-display:swap; src:url(/assets/fonts/dm-sans-latin-700-normal.woff2) format("woff2"); }
:root { --paper:#FFF8F0; --b-ink:#1B1530; --coral:#FF5A36; --butter:#FFE28A; --teal:#0F9D8A; --b-muted:#6E6577; --b-line:#EADFD2; --peach:#FFE3D6;
  /* SD-11 role tokens (the same names as app.css; theme-dark.css gives their dark values) */
  --surface:#fff; --raised:#fff; --outline:#1B1530; --shadow:#1B1530; --focus:#1B1530; --on-accent:#1B1530; --inv-bg:#1B1530; --inv-fg:#FFF8F0;
  --coral-h:#FF6B4A; --mint:#D9F5EF; --grid:#F2E9DF; --placeholder:#8A8090; --err:#B42318; --err-ring:#FAD4CF; --note:#8A2A12; --you-who:var(--butter); --butter-card:var(--butter);
  --f-head:"Bricolage Grotesque",ui-rounded,system-ui,sans-serif; --f-body:"DM Sans",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
.watch-body { background: var(--paper); color: var(--b-ink); font: 17px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
a { color: var(--b-ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.link-brand { display: flex; align-items: center; gap: 10px; margin: 0; font: 800 20px/1.1 var(--f-head); letter-spacing: -.01em; color: var(--b-ink); }
.link-orb { width: 26px; height: 26px; border-radius: 50%; flex: none; border: 2px solid var(--outline);
  background: radial-gradient(circle at 32% 28%, #FFE7A8 0%, #FFB547 18%, var(--coral) 52%, #E2336B 100%); }

/* ---- /link and the /watch front door ---- */
.link { max-width: 36rem; margin: 0 auto; padding: 48px 22px; display: flex; flex-direction: column; align-items: flex-start; }
.link h1 { font: 800 40px/1.08 var(--f-head); letter-spacing: -.02em; margin: 34px 0 12px; }
.link-lead { margin: 0 0 18px; font-size: 19px; }
.link-note { margin: 0 0 18px; padding: 12px 16px; border: 2px solid var(--outline); border-radius: 16px; background: var(--butter-card); }
.link-form { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.link-form label { font-weight: 700; min-height: 44px; display: flex; align-items: flex-end; }
.link-form input { width: 100%; min-height: 64px; padding: 12px 18px; border-radius: 18px; border: 2px solid var(--outline); background: var(--surface); color: var(--b-ink);
  font: 700 32px/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .35em; text-transform: uppercase; }
.link-form input::placeholder { color: var(--placeholder); }
.link-form input[aria-invalid=true] { border-color: var(--err); box-shadow: 0 0 0 3px var(--err-ring); }
.link-err { margin: 0; color: var(--err); font-weight: 600; }
.link-btn { align-self: flex-start; margin-top: 6px; min-height: 52px; padding: 0 30px; border-radius: 999px; border: 2px solid var(--outline); background: var(--coral);
  color: var(--on-accent); font: 700 17px var(--f-body); cursor: pointer; box-shadow: 4px 4px 0 var(--shadow); }
.link-btn:hover { background: var(--coral-h); }
.link-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--shadow); }
.link-small { margin: 22px 0 0; color: var(--b-muted); font-size: 15px; }
.link-text-btn { min-height: 44px; padding: 8px 0; background: none; border: 0; color: var(--b-ink); font: 600 17px var(--f-body); text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; }
.link-cancel { margin: 8px 0 0; }
/* V1b2: the QR beside the code box (stacked on narrow screens) */
.link.has-qr { max-width: 54rem; }
.link-ways { display: flex; flex-direction: column; gap: 18px; width: 100%; }
.link-qr { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.link-qr svg { display: block; width: 220px; height: 220px; border-radius: 14px; border: 2px solid var(--outline); background: #fff; }
.link-qr figcaption { font-weight: 700; }
.link-or { margin: 0; color: var(--b-muted); text-align: center; }
@media (min-width: 760px) {
  .link-ways { flex-direction: row; align-items: center; gap: 34px; }
  .link-ways .link-form { flex: 1; }
}
/* Batch 3b: the front door — "waiting for a code to be typed"; the stopped screen is blank */
.w-door .link-form input { letter-spacing: .6em; text-align: center; max-width: 340px; }
.w-waitline { display: flex; align-items: center; gap: 10px; margin: 18px 0 0; font-weight: 600; }
.w-pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--coral); flex: none; animation: w-pulse 1.4s ease-in-out infinite alternate; }
@keyframes w-pulse { to { opacity: .3; transform: scale(.8); } }
.w-stopped-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 22px;
  background: var(--paper); text-align: center; }
.w-stopped { margin: 0; font: 800 34px/1.15 var(--f-head); letter-spacing: -.01em; color: var(--b-ink); }
.w-stopped-page .link-btn { align-self: center; display: inline-flex; align-items: center; text-decoration: none; margin-top: 0; }
@media (max-width: 860px) { .w-stopped { font-size: 28px; } }

/* ---- /watch: the live view ---- */
.is-watch { overflow: hidden; }
.watch { height: 100vh; display: flex; flex-direction: column; }
.watch-top { display: flex; align-items: center; gap: 12px 18px; padding: 12px 24px; border-bottom: 2px solid var(--outline); background: var(--raised); flex-wrap: wrap; }
.w-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border: 2px solid var(--outline); border-radius: 999px; background: var(--butter);
  color: var(--on-accent); font-weight: 700; font-size: 15px; }
.watch-from { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; }
.w-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--teal); flex: none; box-shadow: 0 0 0 3px var(--mint); }
[data-state=working] .w-dot { background: var(--coral); box-shadow: 0 0 0 3px var(--peach); animation: w-pulse 1s ease-in-out infinite alternate; }
.watch-end { margin: 0; }
.w-stop { min-height: 44px; padding: 0 22px; border: 2px solid var(--outline); border-radius: 999px; background: var(--surface); color: var(--b-ink); font: 700 17px var(--f-body); cursor: pointer; }
.w-stop:hover { background: var(--peach); }
.watch-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.watch-site { padding: 18px 24px 24px; min-height: 0; display: flex; flex-direction: column; gap: 10px;
  background: repeating-linear-gradient(0deg, transparent 0 23px, var(--grid) 23px 24px), repeating-linear-gradient(90deg, transparent 0 23px, var(--grid) 23px 24px), var(--paper); }
.watch-site-tag { margin: 0; font-weight: 700; font-size: 15px; }
.watch-frame { flex: 1; min-height: 0; width: 100%; border: 2px solid var(--outline); border-radius: 14px; background: #fff; box-shadow: 8px 8px 0 var(--shadow); }
.watch-side { display: flex; flex-direction: column; min-height: 0; border-left: 2px solid var(--outline); background: var(--raised); }
.w-panel { padding: 16px 20px 6px; }
.w-panel h2 { margin: 0 0 10px; font: 800 22px/1.15 var(--f-head); letter-spacing: -.01em; }
.w-now { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.watch-log { flex: 1; min-height: 0; overflow: hidden; list-style: none; margin: 0; padding: 0 2px 8px; display: flex; flex-direction: column; gap: 10px; }
.w-cap { padding: 10px 14px; border-radius: 18px; border: 2px solid var(--outline); background: var(--paper); }
.w-cap.you { background: var(--inv-bg); color: var(--inv-fg); border-radius: 18px 18px 6px 18px; }
.w-cap.sky { border-radius: 18px 18px 18px 6px; }
.w-who { display: block; font-size: 15px; font-weight: 700; }
.w-cap.you .w-who { color: var(--you-who); }
.watch-text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; }
.watch-note { margin: 6px 0 0; font-size: 15px; color: var(--note); }
.w-cap.you .watch-note { color: var(--you-who); }
.msg-pin { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 4px; padding: 2px 10px 2px 6px; border-radius: 999px; background: var(--coral);
  color: var(--on-accent); font-size: 15px; font-weight: 700; line-height: 1.4; }
.msg-pin::before { content: ""; width: 16px; height: 16px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231B1530' d='M12 2a7 7 0 0 0-7 7c0 5 7 13 7 13s7-8 7-13a7 7 0 0 0-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E") center/contain no-repeat; }
.w-steps { list-style: none; margin: 0; padding: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.w-steps li { display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 17px; }
.w-steps li::before { content: ""; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--outline); flex: none; background: var(--surface); }
.w-steps li.done::before { background: var(--teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3 3 7-7' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; border-color: var(--teal); }
.w-steps li.doing::before { background: var(--coral); animation: w-pulse 1s ease-in-out infinite alternate; }
.w-steps li.w-empty { color: var(--b-muted); font-size: 15px; }
.w-steps li.w-empty::before { display: none; }
.help-links { list-style: none; margin: 6px 0 0; padding: 0; }
.help-links a { font-weight: 600; color: inherit; }
.watch-hint { margin: 0; padding: 12px 20px 16px; color: var(--b-muted); font-size: 15px; border-top: 2px dashed var(--b-line); }
@media (prefers-reduced-motion: reduce) { .w-pulse, [data-state=working] .w-dot, .w-steps li.doing::before { animation: none; } }
@media (max-width: 860px) {
  .is-watch { overflow: auto; }
  .watch { height: auto; min-height: 100vh; }
  .watch-top { padding: 10px 16px; gap: 8px 10px; }
  .watch-top .link-brand { font-size: 17px; gap: 8px; }
  .watch-top .link-orb { width: 22px; height: 22px; }
  .watch-from { margin: 0; width: 100%; order: 3; font-size: 15px; }
  .watch-end { margin-left: auto; }
  .watch-main { grid-template-columns: 1fr; }
  .watch-site { height: 62vh; padding: 12px 16px 18px; }
  .watch-frame { box-shadow: 5px 5px 0 var(--shadow); }
  .watch-side { border-left: 0; border-top: 2px solid var(--outline); }
  .watch-log { flex: none; height: 46vh; }
  .link h1 { font-size: 32px; }
}
