/*
  RawBoard design tokens.
  Shape rule: interactive controls are full pills, surfaces are 20px, text inputs are 14px.
  Colour rule: neutrals everywhere; lime (--live) only ever means "this tab is alive".
  Primary buttons are ink: inverted text colour, so they read the same in both themes.
*/
.auth-home { display:flex;width:max-content;align-items:center;gap:8px;font-size:13px;color:var(--text-2);text-decoration:none;margin-bottom:24px; }
.auth-home:hover { color:var(--text);text-decoration:underline; }
.auth-legal { font-size:11px;line-height:1.7;color:var(--text-2);margin:22px 0 0; }
.auth-legal a { text-underline-offset:3px; }
.auth-pricing { display:inline-flex;font-size:12px;margin-top:12px;color:var(--text-2);text-underline-offset:3px; }
@font-face {
  font-family: 'Geist';
  src: url('/vendor/geist/geist-sans/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/vendor/geist/geist-mono/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #f3f4f4;
  --surface: #fbfbfb;
  --surface-2: #eceeef;
  --line: rgb(17 19 20 / 0.09);
  --line-strong: rgb(17 19 20 / 0.16);
  --text: #111314;
  --text-2: #565c61;
  --text-3: #7d8388;
  --ink: #111314;
  --on-ink: #f6f7f7;
  --live: #7cc414;
  --live-ink: #3d6606;
  --live-soft: rgb(124 196 20 / 0.14);
  --danger: #c2372b;
  --danger-soft: rgb(194 55 43 / 0.1);
  --stage: #0b0c0d;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.6) inset, 0 12px 32px -18px rgb(30 40 50 / 0.35);

  --r-surface: 20px;
  --r-input: 14px;
  --r-pill: 999px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-h: 100dvh;

  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f10;
    --surface: #161819;
    --surface-2: #1e2123;
    --line: rgb(236 238 240 / 0.08);
    --line-strong: rgb(236 238 240 / 0.15);
    --text: #eceef0;
    --text-2: #a2a8ad;
    --text-3: #7a8086;
    --ink: #eceef0;
    --on-ink: #111314;
    --live: #a3e635;
    --live-ink: #b8ef5e;
    --live-soft: rgb(163 230 53 / 0.12);
    --danger: #ff7a6b;
    --danger-soft: rgb(255 122 107 / 0.12);
    --shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 16px 40px -20px rgb(0 0 0 / 0.7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
a.btn, a.icon-btn { text-decoration: none; }
[hidden] { display: none !important; }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; font-feature-settings: 'zero' 0; }

/* Billing extends the existing account UI: quiet surfaces, readable data. */
.billing-page { max-width: 1080px; padding-bottom: calc(48px + var(--safe-bottom)); }
.billing-header { display:flex; gap:12px; align-items:center; margin:12px 0 30px; }
.billing-header h1 { font-size:28px; letter-spacing:-.025em; line-height:1.2; margin:0; }
.billing-page h2 { font-size:21px; letter-spacing:-.02em; margin:0 0 12px; }
.billing-page h3 { font-size:19px; margin:0 0 16px; }
.billing-intro, .billing-note { max-width:72ch; color:var(--text-2); }
.billing-note { font-size:13px; line-height:1.6; margin:10px 0; overflow-wrap:anywhere; }
.billing-current { padding:26px 0 30px; border-bottom:1px solid var(--line-strong); }
.billing-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; margin:24px 0; font-variant-numeric:tabular-nums; }
.billing-metric { min-width:0; }
.billing-metric dt { font-size:12px; color:var(--text-2); margin-bottom:6px; }
.billing-metric dd { font-size:17px; font-weight:580; margin:0; overflow-wrap:anywhere; }
.billing-actions { display:flex; flex-wrap:wrap; gap:10px; margin:18px 0; }
.billing-redeem { display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px; max-width:460px; }
.billing-redeem .billing-field { flex:1; min-width:150px; margin:0; }
.billing-redeem .billing-note { flex-basis:100%; margin:0; }
.billing-choose { padding-top:38px; }
.billing-plans { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin:24px 0; }
.billing-plan { padding:22px; border-right:1px solid var(--line-strong); }
.billing-plan:first-child { padding-left:0; }
.billing-plan:last-child { border-right:0; }
.billing-plan p { font-size:14px; }
.billing-plan .billing-price { font-size:30px; font-weight:650; letter-spacing:-.03em; margin:10px 0 22px; font-variant-numeric:tabular-nums; }
.billing-price span { font-size:13px; font-weight:450; color:var(--text-2); letter-spacing:0; }
.billing-plan .btn { width:100%; margin-top:18px; font-size:13px; padding:0 14px; white-space:normal; }
.billing-input { width:100%; height:44px; border:1px solid var(--line-strong); background:var(--surface); border-radius:var(--r-input); padding:0 12px; caret-color:var(--live-ink); }
.billing-input::placeholder { color:var(--text-2); }
.billing-field { display:grid; gap:6px; font-size:13px; color:var(--text-2); margin:14px 0; }
.billing-field input, .billing-field select { color:var(--text); }
.billing-toggle { display:flex; gap:10px; align-items:center; font-size:14px; grid-column:1/-1; }
.billing-toggle input { accent-color:var(--live-ink); width:18px; height:18px; }
.admin-toolbar { display:flex; gap:12px; align-items:center; margin:28px 0 18px; }
.admin-toolbar input { max-width:350px; }
.admin-account-list { font-variant-numeric:tabular-nums; }
.admin-list-head, .admin-account-row { display:grid; grid-template-columns:1.25fr 1fr 1.2fr 1fr; gap:16px; align-items:center; width:100%; text-align:left; }
.admin-list-head { font-size:12px; color:var(--text-2); padding:14px 16px; }
.admin-account-row { border:0; border-top:1px solid var(--line); background:transparent; padding:18px 16px; border-radius:0; font-size:14px; }
.admin-account-row:hover, .admin-account-row:focus-visible { background:var(--surface-2); }
.admin-account-row strong { font-weight:590; overflow-wrap:anywhere; }
.admin-account-row small { display:block; color:var(--text-2); font-size:12px; margin-top:4px; }
.admin-details { scroll-margin-top:24px; padding:30px 0; border-top:1px solid var(--line-strong); margin-top:34px; }
.admin-detail-heading { display:flex; justify-content:space-between; align-items:center; }
.admin-detail-heading h2 { margin:0; }
.admin-gift { display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.admin-gift .billing-field { min-width:130px; flex:1; max-width:220px; margin:0; }
.admin-gift .btn { height:44px; }
.admin-destructive { margin-top:26px; padding-top:18px; border-top:1px solid var(--line-strong); max-width:72ch; }
.admin-destructive summary { cursor:pointer; font-size:14px; color:var(--danger); }
.admin-destructive .billing-field { max-width:320px; }
.admin-settings { padding:38px 0; border-top:1px solid var(--line-strong); margin-top:38px; }
.admin-setting-form { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px 24px; margin-top:22px; }
.admin-setting-form .billing-field { margin:0; }
.admin-setting-form .btn { justify-self:start; margin-top:12px; }
.admin-setting-form .billing-note { grid-column:1/-1; }
.billing-page ::selection { background:var(--live-soft); color:var(--text); }
@media (max-width:650px) {
  .billing-header h1 { font-size:24px; }
  .billing-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:22px 16px; }
  .billing-plans { display:block; }
  .billing-plan, .billing-plan:first-child { padding:24px 0; border:0; border-bottom:1px solid var(--line-strong); }
  .billing-plan:last-child { border-bottom:0; }
  .billing-plan .btn { max-width:330px; font-size:14px; }
  .admin-list-head { display:none; }
  .admin-account-row { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; padding:20px 8px; }
  .admin-account-row [data-label]::before { content:attr(data-label); display:block; color:var(--text-2); font-size:11px; margin-bottom:4px; }
  .admin-setting-form { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
  .admin-toolbar { gap:8px; }
  .billing-actions .btn { white-space:normal; height:auto; min-height:40px; }
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-weight: 560; font-size: 15px; letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-quiet { background: var(--surface-2); color: var(--text); }
.btn-line { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn .ph { font-size: 18px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: var(--r-pill);
  border: 0; background: transparent;
  font-size: 22px;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.3; cursor: default; transform: none; }
.ai-mark { color: var(--live-ink); font-size: 15px; font-weight: 750; letter-spacing: -0.04em; }
@media (hover: hover) and (pointer: fine) {
  .icon-btn:not(:disabled):hover { background: var(--surface-2); }
  .btn-quiet:not(:disabled):hover { background: var(--line-strong); }
}

/* Fields: label above, error below */
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; font-weight: 520; color: var(--text); }
.input {
  width: 100%; height: 50px; padding: 0 16px;
  border-radius: var(--r-input);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 16px; /* 16px stops iOS zooming on focus */
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--line); }
.field-error { font-size: 13.5px; color: var(--danger); min-height: 0; }
.field.has-error .input { border-color: var(--danger); }

/* App frame */
#app { min-height: var(--app-h); }
.page {
  width: 100%; max-width: 1080px; margin: 0 auto;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 40px);
}
@media (min-width: 768px) { .page { padding-left: 32px; padding-right: 32px; } }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 640; font-size: 17px; letter-spacing: -0.02em;
  text-decoration: none;
}
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--ink); color: var(--on-ink); font-size: 18px;
}

/* Auth */
.auth {
  min-height: var(--app-h);
  display: grid; align-content: start; gap: 40px;
  width: 100%; max-width: 1080px; margin: 0 auto;
  padding: calc(var(--safe-top) + 20px) 16px calc(var(--safe-bottom) + 32px);
}
.auth-copy h1 {
  margin: 48px 0 14px;
  font-size: clamp(2.3rem, 9vw, 3.6rem); line-height: 1.02; letter-spacing: -0.045em; font-weight: 640;
  max-width: 11ch;
}
.auth-copy p { margin: 0; color: var(--text-2); font-size: 17px; max-width: 34ch; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid; gap: 18px;
  width: 100%; max-width: 420px;
}
.auth-form { display: grid; gap: 16px; }
.form-error {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r-input);
  background: var(--danger-soft); color: var(--danger); font-size: 14px;
}
.form-error .ph { font-size: 18px; margin-top: 1px; }
@media (min-width: 900px) {
  .auth {
    grid-template-columns: 1.15fr 1fr; align-content: center; align-items: center;
    padding-left: 48px; padding-right: 48px; gap: 64px;
  }
  .auth .brand { position: absolute; top: calc(var(--safe-top) + 28px); left: 48px; }
  .auth-copy h1 { margin-top: 0; }
  .auth-card { justify-self: end; padding: 28px; }
}

.segmented {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px; border-radius: var(--r-pill);
  background: var(--surface-2);
}
.segmented button {
  position: relative; z-index: 1;
  height: 38px; border: 0; background: transparent; border-radius: var(--r-pill);
  font-size: 14px; font-weight: 540; color: var(--text-2);
  transition: color 200ms ease;
}
.segmented button[aria-pressed='true'] { color: var(--text); }
.segmented .thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: var(--r-pill); background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--line);
  transition: transform 260ms var(--ease-out);
}
.segmented[data-mode='register'] .thumb { transform: translateX(100%); }
.segmented.single { grid-template-columns: 1fr; }
.segmented.single .thumb { width: calc(100% - 8px); }

/* Board */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; margin-bottom: 20px;
}
.account-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 6px 0 14px;
  border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: transparent;
  font-size: 14px; font-weight: 520;
  transition: transform 160ms var(--ease-out);
}
.account-btn:active { transform: scale(0.97); }
.account-btn .avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-pill);
  background: var(--surface-2); font-size: 13px; font-weight: 620; text-transform: uppercase;
}

.board-head { display: grid; gap: 18px; margin-bottom: 28px; }
.board-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.board-title h1 { margin: 0; font-size: clamp(2rem, 7vw, 2.75rem); letter-spacing: -0.04em; line-height: 1; font-weight: 640; }
.slots { display: grid; gap: 8px; justify-items: end; }
.slot-meter { display: flex; gap: 4px; }
.slot-meter span {
  width: 22px; height: 6px; border-radius: var(--r-pill); background: var(--line-strong);
  transition: background-color 240ms ease;
}
.slot-meter span.on { background: var(--live); }
.slot-label { font-size: 13px; color: var(--text-2); }

.composer {
  display: flex; gap: 8px; align-items: stretch;
}
.composer .input-wrap { position: relative; flex: 1; }
.composer .input-wrap .ph {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 18px; color: var(--text-3); pointer-events: none;
}
.composer .input { padding-left: 44px; border-radius: var(--r-pill); height: 52px; }
.composer .btn { height: 52px; }
.composer-note { font-size: 13.5px; color: var(--text-2); margin: -6px 0 0 4px; }

.reset-note {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-surface);
  background: var(--surface-2);
  font-size: 14px; color: var(--text-2);
}
.reset-note .ph { font-size: 20px; color: var(--text); margin-top: 1px; }
.reset-note strong { color: var(--text); font-weight: 560; font-variant-numeric: tabular-nums; }

.tabs-grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .tabs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }

.tab-card {
  position: relative;
  display: grid; grid-template-columns: 92px 1fr; gap: 14px;
  padding: 10px; padding-right: 12px;
  border-radius: var(--r-surface);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 180ms var(--ease-out);
  animation: rise 360ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
.tab-card:active { transform: scale(0.985); }
.tab-card .open-link { position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.tab-thumb {
  position: relative; overflow: hidden;
  aspect-ratio: 3 / 4; border-radius: 12px;
  background: var(--surface-2);
}
.tab-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  opacity: 0; transition: opacity 240ms ease;
}
.tab-thumb img.ready { opacity: 1; }
.tab-thumb .fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 26px; color: var(--text-3);
}
.tab-body { display: grid; align-content: space-between; gap: 10px; min-width: 0; padding: 4px 0; }
.tab-title {
  margin: 0; padding-right: 36px;
  font-size: 15.5px; font-weight: 560; letter-spacing: -0.01em; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tab-host { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.tab-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.live-dot {
  position: relative; width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--live); flex: none;
}
.live-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: inherit;
  border: 2px solid var(--live); opacity: 0;
  animation: pulse 2.4s var(--ease-out) infinite;
}
.tab-status.on-screen { color: var(--live-ink); font-weight: 520; }
.tab-close {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 36px; height: 36px; font-size: 18px; color: var(--text-2);
}
.tab-confirm {
  position: absolute; inset: 0; z-index: 3;
  display: grid; align-content: center; justify-items: center; gap: 12px;
  padding: 16px; border-radius: inherit;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  text-align: center;
  animation: fade 160ms ease-out both;
}
.tab-confirm p { margin: 0; font-size: 14.5px; font-weight: 540; }
.tab-confirm .row { display: flex; gap: 8px; }

@media (min-width: 720px) {
  .tab-card { grid-template-columns: 1fr; padding: 10px; }
  .tab-thumb { aspect-ratio: 4 / 5; }
  .tab-body { padding: 4px 6px 6px; }
  .tab-title { padding-right: 0; }
  .tab-close { top: 16px; right: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
}

.skeleton .tab-thumb, .skeleton .sk-line {
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--line-strong) 50%, var(--surface-2) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton { animation: none; }
.sk-line { height: 12px; border-radius: var(--r-pill); }
.sk-line.w60 { width: 60%; } .sk-line.w40 { width: 40%; } .sk-line.w80 { width: 80%; }

.empty {
  display: grid; justify-items: start; gap: 10px;
  padding: 36px 24px; border-radius: var(--r-surface);
  border: 1.5px dashed var(--line-strong);
}
.empty .ph { font-size: 30px; color: var(--text-2); }
.empty h2 { margin: 6px 0 0; font-size: 19px; letter-spacing: -0.02em; font-weight: 600; }
.empty p { margin: 0; color: var(--text-2); max-width: 44ch; font-size: 15px; }
@media (min-width: 720px) { .empty { grid-column: 1 / -1; } }

/* Sheets and toasts */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgb(0 0 0 / 0.4);
  opacity: 0; transition: opacity 240ms ease;
}
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 520px; margin: 0 auto;
  padding: 10px 16px calc(var(--safe-bottom) + 16px);
  border-radius: var(--r-surface) var(--r-surface) 0 0;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  transform: translateY(100%);
  transition: transform 320ms var(--ease-drawer);
}
.sheet.open { transform: translateY(0); }
.sheet .grabber { width: 36px; height: 5px; border-radius: var(--r-pill); background: var(--line-strong); margin: 0 auto 12px; }
.sheet h3 { margin: 4px 4px 4px; font-size: 18px; letter-spacing: -0.02em; font-weight: 600; }
.sheet .sheet-sub { margin: 0 4px 14px; color: var(--text-2); font-size: 14px; }
.sheet-list { display: grid; gap: 4px; margin-bottom: 12px; }
.sheet-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 56px; padding: 8px 12px; border: 0; border-radius: 14px;
  background: transparent; text-align: left;
  transition: background-color 160ms ease, transform 160ms var(--ease-out);
}
.sheet-item:active { transform: scale(0.98); background: var(--surface-2); }
.sheet-item[aria-current='true'] { background: var(--surface-2); }
.sheet-item .ph { font-size: 22px; color: var(--text-2); }
.sheet-item .grow { flex: 1; min-width: 0; }
.sheet-item .t { display: block; font-weight: 540; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-item .s { display: block; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-item .check { color: var(--text); }
.browser-menu { max-height: min(84dvh, 740px); overflow-y: auto; overscroll-behavior: contain; }
.browser-activity { margin: 4px 4px 14px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.browser-pin .t, .browser-pin .s { white-space: normal; overflow: visible; }
.browser-pin .check { visibility: hidden; flex: none; }
.browser-pin[aria-checked='true'] .check { visibility: visible; color: var(--live-ink); }
.browser-pin[aria-checked='true'] > .ph { color: var(--live-ink); }
.browser-pin:disabled { opacity: 0.6; }
.browser-zoom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 4px; border-block: 1px solid var(--line); margin-bottom: 8px; }
.browser-zoom-controls { display: flex; align-items: center; gap: 4px; }
.browser-zoom-value { min-width: 46px; text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; }
.browser-zoom .btn { min-height: 44px; }
.tabs-sheet { display: flex; flex-direction: column; max-height: 82dvh; }
.tabs-sheet .sheet-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.tabs-sheet > :not(.sheet-list) { flex: none; }
.icon-btn.has-pin { color: var(--live-ink); }
.tab-status.sleeping .live-dot { background: var(--text-3); }
.saved-password-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); }
.saved-password-row .grow { flex: 1; min-width: 0; }
.saved-password-row .t, .saved-password-row .s { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.saved-password-row .t { font-size: 14px; font-weight: 600; }
.saved-password-row .s { margin-top: 3px; font-size: 12px; color: var(--text-2); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet .input { margin-bottom: 12px; }
.invite-sheet { display: flex; flex-direction: column; max-height: 82dvh; }
.invite-list { display: grid; gap: 8px; min-height: 0; max-height: 38dvh; overflow: auto; margin: 12px 0; }
.invite-row { padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.invite-row-code { display: flex; align-items: center; gap: 8px; }
.invite-code { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 24px; font-weight: 700; letter-spacing: 0.16em; }
.invite-expiry { display: block; margin-top: 5px; color: var(--text-2); font-size: 12px; }
.dialog-message { margin: 0 4px 16px; white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto; }

.assistant-sheet {
  --live-ink: #b8ef5e;
  height: min(76dvh, 700px);
  display: flex; flex-direction: column;
}
.assistant-sheet .grabber { flex: none; }
.assistant-heading { display: flex; align-items: center; gap: 8px; }
.assistant-heading > .ph { font-size: 20px; color: var(--live-ink); }
.assistant-heading h3 { margin: 0; }
.assistant-source {
  margin: 4px 4px 0; color: var(--text); font-size: 13px; font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.assistant-disclosure { margin: 2px 4px 12px; color: var(--text-2); font-size: 12px; }
.assistant-transcript {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 14px;
  padding: 14px 2px; border-top: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.assistant-turn { min-width: 0; padding: 0 4px; }
.assistant-turn-label { margin-bottom: 6px; color: var(--text-2); font-size: 12px; font-weight: 650; }
.assistant-answer { max-width: 72ch; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.assistant-key-answer { display: block; color: var(--live-ink); font-size: 16px; font-weight: 750; line-height: 1.45; }
.assistant-explanation { margin-top: 9px; }
.assistant-parts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.assistant-parts-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 12px; }
.assistant-parts-head strong { color: var(--text); font-weight: 650; }
.assistant-progress { height: 5px; overflow: hidden; border-radius: var(--r-pill); background: var(--surface-2); }
.assistant-progress span { display: block; height: 100%; border-radius: inherit; background: var(--live-ink); transition: width 200ms ease; }
.assistant-part, .assistant-fill { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.assistant-part .grow, .assistant-fill > span { flex: 1 1 120px; min-width: 0; }
.assistant-part > .btn, .assistant-fill > .btn { flex: none; max-width: 100%; min-height: 44px; height: auto; margin-left: auto; white-space: normal; }
.assistant-part small, .assistant-fill small { display: block; overflow-wrap: anywhere; color: var(--text-2); font-size: 11px; }
.assistant-part strong, .assistant-fill strong { display: block; overflow-wrap: anywhere; font-size: 13px; font-weight: 600; }
.assistant-part[data-state='done'] strong { color: var(--live-ink); }
.assistant-part .part-mark { flex: none; color: var(--text-2); }
.assistant-part[data-state='done'] .part-mark { color: var(--live-ink); }
.assistant-confidence { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--danger); font-size: 12px; font-weight: 500; }
.assistant-confidence > .ph { flex: none; font-size: 14px; }
.assistant-thought { margin: 0; color: var(--text-2); font-size: 12px; line-height: 1.45; }
.assistant-retry { margin: 8px 0 0; }
.assistant-fill-all { justify-self: start; }
.assistant-form { display: flex; align-items: end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.assistant-question {
  flex: 1; min-width: 0; min-height: 48px; max-height: 112px; resize: vertical;
  padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-input);
  background: var(--surface-2); outline: none; font-size: 14px; line-height: 1.4;
}
.assistant-question:focus { border-color: var(--text-2); }
.assistant-question::placeholder { color: var(--text-2); opacity: 1; }
.assistant-send { height: 48px; padding: 0 16px; }

.toast-host {
  position: fixed; left: 0; right: 0; z-index: 60;
  top: calc(var(--safe-top) + 12px);
  display: grid; justify-items: center; gap: 8px;
  padding: 0 16px; pointer-events: none;
}
.toast {
  display: flex; gap: 10px; align-items: center;
  max-width: 440px; padding: 11px 16px;
  border-radius: var(--r-pill);
  background: var(--ink); color: var(--on-ink);
  font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.5);
  transition: transform 300ms var(--ease-out), opacity 300ms ease;
  @starting-style { transform: translateY(-12px) scale(0.97); opacity: 0; }
}
.toast.leaving { transform: translateY(-8px) scale(0.98); opacity: 0; transition-duration: 180ms; }
.toast .ph { font-size: 18px; }

/* Viewer */
.viewer {
  position: fixed; inset: 0;
  height: var(--app-h);
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--stage); color: #eceef0;
  --text: #eceef0; --text-2: #a2a8ad; --text-3: #7a8086;
  --surface: #161819; --surface-2: #1e2123; --line: rgb(236 238 240 / 0.08); --line-strong: rgb(236 238 240 / 0.15);
  --ink: #eceef0; --on-ink: #111314;
  --live: #a3e635; --live-ink: #b8ef5e;
  color-scheme: dark;
}
.v-top, .v-bottom {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  background: #121415;
}
.v-top { padding: calc(var(--safe-top) + 6px) 8px 6px; border-bottom: 1px solid var(--line); }
.v-bottom {
  justify-content: space-around;
  padding: 4px 8px calc(var(--safe-bottom) + 4px);
  border-top: 1px solid var(--line);
}
.address {
  flex: 1; min-width: 0; position: relative;
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 14px;
  border: 0; border-radius: var(--r-pill);
  background: var(--surface-2);
  font-size: 14.5px; text-align: left;
  transition: transform 160ms var(--ease-out);
}
.address:active { transform: scale(0.985); }
.address .ph { font-size: 15px; color: var(--text-2); flex: none; }
.address .host { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.address-form { flex: 1; display: flex; gap: 6px; }
.address-form .input { flex: 1; min-width: 0; width: auto; height: 40px; border-radius: var(--r-pill); background: var(--surface-2); border-color: transparent; font-size: 16px; }
.address-form .input:focus { border-color: var(--line-strong); box-shadow: none; }
.progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden;
  opacity: 0; transition: opacity 200ms ease;
}
.progress.on { opacity: 1; }
.progress::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40%;
  background: var(--live);
  animation: indeterminate 1.1s var(--ease-in-out) infinite;
}
.stage {
  position: relative; overflow: hidden;
  touch-action: auto; user-select: text; -webkit-user-select: text; -webkit-touch-callout: default;
}
.dom-stage { position: absolute; inset: 0; background: white; overflow: hidden; color: black; }
.has-device-game .dom-stage { top: 36px; background: var(--surface); }
.device-game-info { position: absolute; inset: 0 0 auto; height: 36px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.device-game-info[hidden] { display: none; }
.device-game-note { display: flex; gap: 8px; align-items: center; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; min-height: 32px; }
.device-game-info .icon-btn { width: 32px; height: 32px; }
.device-game-open { margin-left: auto; margin-right: 8px; white-space: nowrap; }
.device-game-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--surface); }
.dom-stage .replayer-wrapper { position: absolute; inset: 0; }
.dom-stage iframe { display: block; border: 0; width: 100% !important; height: 100% !important; }
.dom-stage .replayer-mouse, .dom-stage .replayer-mouse-tail { display: none !important; }
.stage-state {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  padding: 24px; text-align: center; background: var(--stage);
}
.stage-state .ph { font-size: 32px; color: var(--text-2); }
.stage-state h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -0.02em; font-weight: 600; }
.stage-state p { margin: 0 0 8px; color: var(--text-2); max-width: 34ch; font-size: 15px; }
.stage-skeleton {
  position: absolute; inset: 0; z-index: 1; padding: 20px; display: grid; align-content: start; gap: 14px;
  background: var(--stage);
}
.stage-skeleton .sk-line { height: 14px; }
.stage-skeleton .sk-block { height: 180px; border-radius: 16px; }
.stage-skeleton .sk-line, .stage-skeleton .sk-block {
  background: linear-gradient(100deg, #17191a 30%, #222527 50%, #17191a 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
.pill-float {
  position: absolute; left: 50%; bottom: 14px; z-index: 4;
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: var(--r-pill); border: 1px solid var(--line-strong);
  background: rgb(22 24 25 / 0.92); color: var(--text);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 14px; font-weight: 540;
  transform: translateX(-50%);
  transition: transform 220ms var(--ease-out), opacity 220ms ease;
  @starting-style { transform: translateX(-50%) translateY(10px); opacity: 0; }
}
.pill-float:active { transform: translateX(-50%) scale(0.97); }
.pill-float .ph { font-size: 18px; }
.pill-float.top { top: 12px; bottom: auto; }
.tab-count {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 5px;
  border: 1.75px solid currentColor; border-radius: 7px;
  font-size: 12px; font-weight: 640;
}
.icon-btn[aria-pressed='true'] { background: var(--surface-2); color: var(--live-ink); }

/* Motion */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@keyframes pulse { 0% { opacity: 0.6; transform: scale(0.6); } 70%, 100% { opacity: 0; transform: scale(1.6); } }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .sheet, .toast, .segmented .thumb, .pill-float { transition-property: opacity; }
  .live-dot::after { display: none; }
  .progress::before { width: 100%; opacity: 0.6; animation: none; }
}
