/* Plenary canvas UI. Tokens and layout from the verified design mock (docs/m2/design/mock.css). */

:root {
  --chrome: #f6f6f8; --surface: #ffffff; --raised: #ffffff; --border: #e2e2e8; --fg: #1b1b1f; --muted: #5f636b;
  --dim: #676c75; --accent: #6965db; --accent-fg: #ffffff; --accent-soft: rgba(105, 101, 219, .14);
  --hover: rgba(0, 0, 0, .05); --page: #ffffff; --ink: #1e1e1e; --frame: #868e96; --shadow: 0 6px 24px rgba(0, 0, 0, .12);
  --ok: #2f9e44; --warn: #e8590c; --bad: #c92a2a; --info: #5f636b; --label-ink: #1e1e1e;
  --u-maya: #c2410c; --u-dev: #0b7285; --u-priya: #9c36b5; --u-sam: #237032; --laser-tag: #d42a20; --u-tom: #1971c2; --u-me: #6965db;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --vv-height: 100dvh;
  --vv-top: 0px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --chrome: #18181b; --surface: #1f1f23; --raised: #26262b; --border: #313137; --fg: #e9ecef; --muted: #a6a6b0;
  --dim: #8e8e98; --accent: #a8a5ff; --accent-fg: #121212; --accent-soft: rgba(168, 165, 255, .16);
  --hover: rgba(255, 255, 255, .06); --page: #121212; --ink: #e9ecef; --frame: #868e96; --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  --ok: #51cf66; --warn: #ff922b; --bad: #ff6b6b; --info: #a6a6b0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; height: 100dvh; overscroll-behavior: none; }
body { background: var(--chrome); color: var(--fg); font: 13px/1.35 var(--font); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.app { position: fixed; top: var(--vv-top, 0px); left: 0; right: 0; height: 100%; height: 100dvh; height: var(--vv-height, 100dvh); display: flex; flex-direction: column; }

/* ── top bar ── */
.topbar { height: calc(46px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 6px; padding: env(safe-area-inset-top) calc(10px + env(safe-area-inset-right)) 0 calc(10px + env(safe-area-inset-left)); background: var(--chrome); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.tools { display: flex; align-items: center; gap: 2px; }
.sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.tb { height: 30px; min-width: 28px; padding: 0 4px; display: inline-flex; align-items: center; gap: 3px; border-radius: 6px; position: relative; }
.tb:hover { background: var(--hover); }
.tb .ic { font-size: 15px; line-height: 1; }
.tb .k { font-size: 9px; color: var(--dim); }
.tb.on { background: var(--accent); color: var(--accent-fg); }
.tb.on .k { color: inherit; opacity: .75; }
.tb.new::before { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }
.tb[disabled] { opacity: .35; cursor: default; }
.spacer { flex: 1; }
.board-name { font-weight: 600; font-size: 13px; padding: 0 6px; white-space: nowrap; }
.board-name small { font-weight: 400; color: var(--dim); }
.btn { height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn.ghost { border-color: transparent; background: none; }

/* avatars */
.avatars { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; }
.av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700;
  border: 2px solid var(--chrome); margin-left: -7px; position: relative; }
.av:first-child { margin-left: 0; }
.av.live::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); border: 2px solid var(--chrome); }
.av.more { background: var(--raised); color: var(--muted); border-color: var(--chrome); font-weight: 600; width: auto; padding: 0 7px; border-radius: 13px; }
.watching { color: var(--muted); font-size: 12px; white-space: nowrap; }
.watching b { color: var(--fg); font-variant-numeric: tabular-nums; }

/* connection pill */
.pill { height: 26px; padding: 0 10px; border-radius: 13px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.connected { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.reconnecting { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.pill.reconnecting .dot { animation: blink 1s infinite; }
.pill.offline { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.pill.readonly { color: var(--info); background: var(--hover); border-color: var(--border); }
.pill .sub { font-weight: 400; opacity: .85; }
@keyframes blink { 50% { opacity: .2; } }

/* ── main area ── */
.main { flex: 1; display: flex; min-height: 0; position: relative; }
.canvas { flex: 1; position: relative; overflow: hidden; background: var(--page); touch-action: none; overscroll-behavior: none; }
.canvas svg.world { position: absolute; inset: 0; width: 100%; height: 100%; }
.offline-veil { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(135deg, transparent 0 18px, color-mix(in srgb, var(--fg) 3%, transparent) 18px 20px); }

/* the board canvas and its text input */
.canvas canvas.board, #board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; outline: none; display: block; }
.canvas textarea.ink { position: absolute; display: none; resize: none; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--page) 70%, transparent);
  color: var(--ink); padding: 2px; outline: none; font-family: var(--font); line-height: 1.25; z-index: 4; overflow: hidden; }
.toast { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 7; background: var(--raised); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 12px; font-size: 12px; box-shadow: var(--shadow); pointer-events: none; transition: opacity .3s; }
.drop-hint { position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center;
  font-weight: 600; color: var(--accent); z-index: 9; pointer-events: none; }
.list-row { width: 100%; text-align: left; }
.list-row button { min-width: 18px; }
input.rename { font: inherit; width: 110px; border: 1px solid var(--accent); border-radius: 4px; background: var(--surface); color: var(--fg); padding: 1px 4px; }
textarea.field, input.field { color: var(--fg); font: 12px var(--font); resize: vertical; }
.code { width: 100%; min-height: 180px; resize: vertical; }
.lib .item b { font-size: 18px; color: var(--muted); }
.preview canvas { max-width: 100%; max-height: 220px; }
.note-row .acts button { color: inherit; text-decoration: underline; }
.note-row .acts button[disabled] { text-decoration: none; opacity: .5; cursor: not-allowed; }
.timeline .track { cursor: pointer; }
.stub { opacity: .55; }

/* board drawing */
.w-ink { stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.w-txt { fill: var(--ink); font-family: var(--font); }
.w-lbl { fill: var(--label-ink); font-family: var(--font); }
.w-frame { stroke: var(--frame); fill: none; stroke-width: 1.2; }
.w-frame-name { fill: var(--muted); font: 13px var(--font); }
.w-dim { opacity: .45; }

/* overlays on the canvas (screen space) */
.ov { position: absolute; pointer-events: auto; }
.cursor { position: absolute; pointer-events: none; }
.cursor svg { display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.cursor .tag { position: absolute; left: 14px; top: 16px; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px 10px 10px 10px; white-space: nowrap; }
.sel-tag { position: absolute; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.emote { position: absolute; font-size: 26px; pointer-events: none; animation: rise 2.4s ease-out infinite; }
.emote.e2 { animation-delay: .8s; font-size: 22px; }
.emote.e3 { animation-delay: 1.5s; font-size: 20px; }
@keyframes rise { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; transform: translateY(-8px) scale(1); } 100% { transform: translateY(-70px) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .emote, .pill .dot { animation: none !important; } }
.react-chips { position: absolute; display: flex; gap: 4px; }
.chip-r { height: 22px; padding: 0 7px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); font-size: 11px; display: inline-flex; gap: 4px; align-items: center; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chip-r.mine { border-color: var(--accent); background: var(--accent-soft); }
.chip-r b { font-weight: 600; font-variant-numeric: tabular-nums; }
.note-tag { position: absolute; font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.note-tag i { font-style: normal; width: 14px; height: 14px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 8px; font-weight: 700; }

/* comment pins */
.pin { position: absolute; width: 28px; height: 28px; border-radius: 14px 14px 14px 2px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); border: 2px solid var(--page); transform: translate(0, -100%); }
.pin.resolved { background: var(--dim) !important; opacity: .75; }
.pin.active { outline: 3px solid var(--accent-soft); }

/* popovers, dialogs, drawers */
.pop { position: absolute; width: 300px; background: var(--raised); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); z-index: 20; }
.pop header { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; font-size: 12px; }
.pop header .anchor { color: var(--muted); }
.pop .body { padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow: auto; }
.msg { display: flex; gap: 8px; }
.msg .av { margin: 0; width: 24px; height: 24px; flex-shrink: 0; border-color: var(--raised); }
.msg .who { font-weight: 600; font-size: 12px; }
.msg .who span { font-weight: 400; color: var(--dim); margin-left: 4px; }
.msg p { margin: 2px 0 0; font-size: 12.5px; }
.reply { margin: 0 12px 12px; display: flex; gap: 6px; }
.field { flex: 1; min-height: 30px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; color: var(--dim); background: var(--surface); font-size: 12px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }

.dialog-veil { position: absolute; inset: 0; background: rgba(0,0,0,.28); z-index: 30; display: grid; place-items: center; padding: 16px; }
.dialog { width: min(640px, 100%); background: var(--raised); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.dialog h2 { margin: 0; font-size: 15px; padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.dialog .dbody { padding: 14px 16px; display: grid; gap: 12px; }
.dialog footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.code { font: 12px/1.5 var(--mono); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 10px; white-space: pre; overflow: auto; color: var(--fg); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview { border: 1px dashed var(--border); border-radius: 6px; background: var(--page); display: grid; place-items: center; min-height: 150px; }

.drawer { width: 290px; flex-shrink: 0; background: var(--chrome); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.drawer header { padding: 10px 12px; display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--border); }
.drawer header h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { padding: 3px 8px; font-size: 11px; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.notes-list { overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.note-row { padding: 8px; border-radius: 8px; display: flex; gap: 8px; }
.note-row:hover { background: var(--hover); }
.note-row .sw { width: 10px; height: 10px; border-radius: 2px; margin-top: 4px; flex-shrink: 0; }
.note-row .txt { flex: 1; min-width: 0; }
.note-row .meta { font-size: 11px; color: var(--dim); display: flex; gap: 6px; }
.note-row .acts { font-size: 11px; color: var(--muted); display: flex; gap: 8px; margin-top: 3px; }
.note-row .acts .lock { color: var(--dim); }
.compose { margin: 8px; }

/* side panel */
.panel { width: 248px; flex-shrink: 0; background: var(--chrome); border-left: 1px solid var(--border); overflow: auto; position: relative; }
.panel .edge { position: absolute; left: -3px; top: 0; bottom: 0; width: 5px; cursor: col-resize; }
.panel-head { display: flex; gap: 2px; justify-content: flex-end; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.panel-head .tb { height: 24px; min-width: 24px; font-size: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.tabs button { padding: 4px 8px; border-radius: 5px; font-size: 11px; color: var(--muted); }
.tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sec { border-bottom: 1px solid var(--border); padding: 8px 10px 10px; }
.sec h4 { margin: 0 0 8px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.sec h4::before { content: "▾"; color: var(--dim); }
.sec.folded h4::before { content: "▸"; }
.sec.folded > :not(h4) { display: none; }
.sec h4 span { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--dim); }
.row { display: flex; gap: 4px; align-items: center; margin-bottom: 6px; }
.row .lab { width: 50px; flex-shrink: 0; font-size: 11px; color: var(--muted); }
.row .lab i { font-style: normal; font-size: 9px; color: var(--dim); margin-left: 2px; }
.row .opts { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
.c { height: 22px; min-width: 22px; padding: 0 6px; border-radius: 5px; border: 1px solid var(--border); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; background: var(--surface); }
.c.on { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); font-weight: 600; }
.c i { font-style: normal; font-size: 9px; color: var(--dim); }
.sw { width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--border); padding: 0; }
.sw.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.sw.none { background: linear-gradient(135deg, transparent 45%, var(--bad) 45% 55%, transparent 55%), var(--surface); }
.list-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; font-size: 12px; }
.list-row.on { background: var(--accent-soft); }
.list-row .n { color: var(--dim); font-size: 11px; margin-left: auto; }
.lib { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lib .item { aspect-ratio: 1; border: 1px solid var(--border); border-radius: 6px; background: var(--page); display: grid; place-items: center; position: relative; }
.lib .item span { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--muted); }
.hint { font-size: 11px; color: var(--dim); }

/* bottom HUD on the canvas */
.hud { position: absolute; display: flex; gap: 6px; align-items: center; z-index: 5; }
.hud .grp { display: flex; align-items: center; gap: 2px; background: var(--raised); border: 1px solid var(--border); border-radius: 8px; padding: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.hud .grp .tb { height: 28px; min-width: 28px; }
.hud .pct { font-size: 12px; min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.hud-bl { left: calc(12px + env(safe-area-inset-left)); bottom: calc(12px + env(safe-area-inset-bottom)); }
.hud-bc { left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); }
.hud-br { right: calc(12px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); }
.reactions .tb { font-size: 16px; padding: 0 6px; }
.reactions .tb b { font-size: 10px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.reactions .tb[disabled] { opacity: .55; }
.timeline { height: 36px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-top: 1px solid var(--border); background: var(--chrome); flex-shrink: 0; }
.track { flex: 1; height: 18px; position: relative; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--border); border-radius: 1px; }
.track .fill { position: absolute; left: 0; top: 8px; height: 2px; background: var(--accent); }
.track .mark { position: absolute; top: 4px; width: 2px; height: 10px; background: var(--dim); }
.track .head { position: absolute; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); margin-left: -6px; }
.timeline .t { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6; background: var(--raised); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.emote-picker { position: absolute; z-index: 21; background: var(--raised); border: 1px solid var(--border); border-radius: 22px; padding: 4px 6px; display: flex; gap: 2px; box-shadow: var(--shadow); }
.emote-picker button { font-size: 20px; width: 34px; height: 34px; border-radius: 17px; }
.emote-picker button:hover { background: var(--hover); }

/* phone-only bits hidden on desktop */
.w-ink:not([fill]) { fill: none; }
.dock, .sheet { display: none; }
body .phone-only { display: none !important; }

/* ── tablet layout (~768×1024) ── */
@media (max-width: 1024px) {
  .topbar { overflow-x: auto; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
}

/* ── touch layout (phone, ~390 px) ── */
@media (max-width: 640px) {
  .desk-only { display: none !important; }
  body .hud .grp.phone-only { display: inline-flex !important; }
  body .topbar .phone-only { display: inline-flex !important; }
  .topbar { height: calc(48px + env(safe-area-inset-top)); gap: 6px; padding: env(safe-area-inset-top) calc(8px + env(safe-area-inset-right)) 0 calc(8px + env(safe-area-inset-left)); }
  .topbar .theme-btn { display: none; }
  .watching { font-size: 11px; }
  .avatars { gap: 4px; }
  .board-name { font-size: 13px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
  .board-name small { display: none; }
  .pill { padding: 0 8px; }
  .pill .sub { display: none; }
  .av { width: 24px; height: 24px; }
  .panel, .drawer, .timeline { display: none; }
  .dock { display: flex; position: absolute; left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right)); bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 8; background: var(--raised);
    border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 4px; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .dock::-webkit-scrollbar { display: none; }
  .dock .tb { flex: 1 1 0; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 44px; flex-direction: column; gap: 1px; font-size: 8.5px; }
  .dock .tb .ic { font-size: 18px; }
  .dock .tb .k { display: none; }
  .hud-bl { bottom: calc(76px + env(safe-area-inset-bottom)); left: calc(8px + env(safe-area-inset-left)); }
  .hud-bc { display: none; }
  .hud-br { bottom: calc(76px + env(safe-area-inset-bottom)); right: calc(8px + env(safe-area-inset-right)); }
  .hud .grp .tb { height: 40px; min-width: 40px; }
  .sheet { display: flex; flex-direction: column; position: absolute; left: 0; right: 0; bottom: 0; max-height: min(62%, calc(var(--vv-height, 100dvh) - 64px)); z-index: 25; background: var(--chrome);
    border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; box-shadow: var(--shadow); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); transition: transform .18s ease-out; will-change: transform; }
  .sheet.dragging { transition: none; }
  .sheet .sheet-handle { display: flex; align-items: center; justify-content: center; min-height: 28px; flex-shrink: 0; touch-action: none; cursor: grab; }
  .sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 0; flex-shrink: 0; }
  .sheet .tabs { border-bottom: 1px solid var(--border); padding: 4px 10px 8px; }
  .sheet .tabs button { padding: 7px 10px; font-size: 12px; }
  .sheet .scroll { overflow: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
  .sheet .c, .sheet .sw { height: 32px; min-width: 32px; }
  .sheet .sw { width: 32px; }
  .sheet .row .lab { width: 58px; }
  .sheet .tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px; }
  .sheet .tool-grid .tb { height: 62px; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; }
  .sheet .tool-grid .tb .ic { font-size: 20px; }
  .pop { left: calc(8px + env(safe-area-inset-left)) !important; right: calc(8px + env(safe-area-inset-right)); width: auto; top: auto !important; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .dialog-veil { place-items: end stretch; padding: 0; }
  .dialog { width: 100%; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .cols { grid-template-columns: 1fr; }
  .banner { top: 8px; font-size: 11px; white-space: normal; width: calc(100% - 16px); }
}

/* ── coarse pointer (iOS Chrome / touch & tablet) ── */
@media (pointer: coarse) {
  input[type="text"], input[type="search"], input:not([type]), input.field, input.rename,
  textarea, textarea.field, textarea.code, .canvas textarea.ink, #ink, .field {
    font-size: 16px;
  }
  .tb, .hud .grp .tb, .reactions .tb, .emote-picker button, .dock .tb,
  .sheet .tabs button, .sheet .seg button, .sheet .c, .sheet .sw, .sheet .list-row, .sheet .tool-grid .tb {
    min-width: 44px;
    min-height: 44px;
  }
  .btn { min-height: 44px; }
  .sheet .sheet-handle { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .sheet { transition: none !important; } }

svg text { font-family: var(--font); }
[hidden] { display: none !important; }
body.stale .avatars .stack { opacity: .45; filter: grayscale(1); }
body.stale .av.live::after { display: none; }
body.stale .watching { opacity: .45; }
.c[disabled], .sw[disabled], .btn[disabled] { opacity: .4; cursor: not-allowed; }
.panel.ro .sec h4 { opacity: .7; }
/* The page before the canvas (web/adapters/dom/gate.js): signing in, or signed out. */
.signin-gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--chrome); color: var(--fg); }
.signin-gate > div { max-width: min(420px, calc(100vw - 32px)); text-align: center; }
.signin-gate h1 { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.signin-gate p { color: var(--muted); margin: 0 0 16px; }
.signin-gate a.btn { display: inline-block; text-decoration: none; }
