/* ==========================================================================
   SnipFerry — design system
   Mobile-first. Tokens first, then base, layout shell, components, pages.
   ========================================================================== */

@font-face {
  font-family: 'Bricolage';
  src: url('/fonts/bricolage-bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Palette: deep forest ink on a cool, green-tinted paper; lime signals sharing */
  --bg: #f6f8f4;
  --surface: #ffffff;
  --surface-2: #eef3ec;
  --surface-3: #e3ebe0;
  --ink: #11261a;
  --ink-2: #2c4436;
  --muted: #5b6e61;
  --faint: #8a9b8e;
  --line: #dce5d8;
  --line-strong: #c5d3c0;
  --brand: #1f5a3a;
  --brand-strong: #164a2f;
  --brand-soft: #e3efe0;
  --brand-text: #1f5a3a;
  --lime: #c6ee73;
  --lime-ink: #1a3a10;
  --btn: #1f5a3a;
  --btn-hover: #174a2f;
  --btn-ink: #ffffff;
  --danger: #b93a26;
  --danger-soft: #fbe9e5;
  --warn: #8a5a00;
  --warn-soft: #fbf0d6;
  --code-bg: #fbfcfa;
  --focus: 0 0 0 3px rgba(198, 238, 115, .9), 0 0 0 5px rgba(31, 90, 58, .55);
  --shadow-sm: 0 1px 2px rgba(17, 38, 26, .06), 0 1px 1px rgba(17, 38, 26, .04);
  --shadow-md: 0 10px 30px -12px rgba(17, 38, 26, .18), 0 2px 6px rgba(17, 38, 26, .05);
  --shadow-lg: 0 30px 80px -30px rgba(17, 38, 26, .35);

  /* Type */
  --font-display: 'Bricolage', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;

  /* Shape & rhythm */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --gutter: 16px;
  --header-h: 60px;
  --max: 1200px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Legacy aliases used by older markup / scripts */
  --paper: var(--surface);
  --green: var(--brand-text);
  --pale: var(--brand-soft);
  --shadow: var(--shadow-md);
}

.dark {
  color-scheme: dark;
  --bg: #0d1611;
  --surface: #142019;
  --surface-2: #1a2920;
  --surface-3: #213328;
  --ink: #e6f0e7;
  --ink-2: #c4d4c7;
  --muted: #9bb0a0;
  --faint: #6f8475;
  --line: #26372c;
  --line-strong: #345040;
  --brand: #2e7a4e;
  --brand-strong: #3a8d5d;
  --brand-soft: #1c3326;
  --brand-text: #9fd88a;
  --btn: #c6ee73;
  --btn-hover: #d6f592;
  --btn-ink: #10230f;
  --danger: #f08a78;
  --danger-soft: #3a1a15;
  --warn: #f2c66b;
  --warn-soft: #33290f;
  --code-bg: #111c15;
  --focus: 0 0 0 3px rgba(198, 238, 115, .85);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .8);
}

@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (min-width: 960px) { :root { --gutter: 32px; --header-h: 68px; } }

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.menu-open { overflow: hidden; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
a { color: inherit; text-decoration: none; }
p a, li a, .legal-content a { color: var(--brand-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
[hidden] { display: none !important; }
::selection { background: var(--lime); color: var(--lime-ink); }
code, kbd, pre { font-family: var(--font-mono); font-size: .9em; }
:where(p code, li code, td code) { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; word-break: break-word; }
kbd { background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: .8em; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.12; color: var(--ink); margin: 0; text-wrap: balance; }
p { text-wrap: pretty; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: none; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 1000; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-shell, .room-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-shell > main, .room-shell > main { flex: 1; }
.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: var(--header-h); max-width: var(--max); margin: auto; padding-inline: var(--gutter); display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -.03em; color: var(--ink); flex: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: var(--lime); box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); transition: transform .25s var(--ease); }
.brand:hover .brand-mark { transform: translate(1px, -1px) rotate(-4deg); }
.brand-dot { display: none; }
.primary-nav { display: none; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.header-auth { display: none !important; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: background .15s, border-color .15s; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.theme-toggle .icon-moon { display: none; }
.dark .theme-toggle .icon-sun { display: none; }
.dark .theme-toggle .icon-moon { display: block; }
.menu-toggle[aria-expanded="true"] { background: var(--surface-2); }

.mobile-menu { border-top: 1px solid var(--line); background: var(--bg); height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); overflow-y: auto; padding: 8px var(--gutter) 20px; animation: menuIn .18s var(--ease); }
.mobile-menu nav { display: grid; gap: 2px; }
.mobile-menu nav a { display: flex; flex-direction: column; padding: 12px 12px; border-radius: var(--r-md); }
.mobile-menu nav a span { font-weight: 650; font-size: 17px; }
.mobile-menu nav a small { color: var(--muted); font-size: 13px; }
.mobile-menu nav a:hover, .mobile-menu nav a[aria-current="page"] { background: var(--surface-2); }
.mobile-auth { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.mobile-auth .nav-login-btn, .mobile-auth .nav-signup-btn { flex: 1; justify-content: center; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (min-width: 960px) {
  .primary-nav { display: flex; align-items: center; gap: 2px; margin-left: 20px; }
  .primary-nav a { padding: 8px 12px; border-radius: 10px; font-size: 15px; font-weight: 550; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
  .primary-nav a:hover { background: var(--surface-2); color: var(--ink); }
  .primary-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--brand); }
  .header-auth { display: flex !important; }
  .menu-toggle { display: none; }
  .mobile-menu { display: none !important; }
}

/* Auth bits rendered by auth.js */
.nav-auth-container { display: flex; align-items: center; gap: 6px; }
.nav-login-btn, .nav-signup-btn { display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border-radius: 12px; font-size: 15px; font-weight: 600; transition: background .15s, transform .15s; }
.nav-login-btn { color: var(--ink); border: 1px solid transparent; }
.nav-login-btn:hover { background: var(--surface-2); }
.nav-signup-btn { background: var(--btn); color: var(--btn-ink); }
.nav-signup-btn:hover { background: var(--btn-hover); }
.user-pill-dropdown { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.user-badge-link { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; padding-right: 4px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--lime); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.nav-logout-btn { background: none; border: 0; color: var(--muted); font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 999px; }
.nav-logout-btn:hover { color: var(--danger); background: var(--danger-soft); }
.mobile-auth .user-pill-dropdown { width: 100%; justify-content: space-between; padding: 6px; border-radius: var(--r-md); }

/* --------------------------------------------------------------------------
   Buttons, links, badges
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 650; font-size: 16px; line-height: 1; white-space: nowrap;
  transition: background .15s, transform .15s var(--ease), box-shadow .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--btn); color: var(--btn-ink); box-shadow: 0 8px 20px -10px rgba(31, 90, 58, .7); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-primary span[aria-hidden], .btn-dark span[aria-hidden] { color: var(--lime); font-size: 1.1em; }
.dark .btn-primary span[aria-hidden] { color: inherit; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { background: var(--ink-2); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn-block { width: 100%; }
.text-link { font-weight: 600; color: var(--brand-text); display: inline-flex; align-items: center; gap: 6px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.link-btn { background: none; border: 0; padding: 6px 8px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--brand-text); }
.link-btn:hover { background: var(--surface-2); }
.link-btn.muted { color: var(--muted); }

.eyebrow, .kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--brand-text); letter-spacing: 0; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #6cc04a; box-shadow: 0 0 0 0 rgba(108, 192, 74, .5); animation: pulse 2.4s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(108, 192, 74, .45); } 70% { box-shadow: 0 0 0 7px rgba(108, 192, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(108, 192, 74, 0); } }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--brand-soft); color: var(--brand-text); }

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); min-width: 0; }
.field > span.hint, .field span.optional { font-weight: 400; color: var(--faint); }
.field-label { display: block; }
.input, .field input, .field select, .auth-field input, .auth-field select, .auth-field textarea, .join-row input, .password-panel input {
  width: 100%; min-height: 46px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background-color: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 400; outline: none; transition: border-color .15s, box-shadow .15s;
}
.auth-field textarea { padding: 12px 14px; min-height: 120px; resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238a9b8e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px !important; }
.input:focus, .field input:focus, .field select:focus, .auth-field input:focus, .auth-field select:focus, .auth-field textarea:focus, .join-row input:focus, .password-panel input:focus, .copy-row:focus-within {
  border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; margin: 0; cursor: pointer; }
.dark input[type="checkbox"] { accent-color: var(--lime); }
.form-error { color: var(--danger); font-size: 14px; margin: 10px 0 0; font-weight: 500; }
.form-status { color: var(--brand-text); font-size: 14px; margin: 10px 0 0; font-weight: 600; }

/* Toggle chips — checkbox options that read as on/off pills */
.toggle-chip { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; font-size: 14px; line-height: 1.35; }
.toggle-chip:hover { border-color: var(--line-strong); }
.toggle-chip input { margin-top: 1px; }
.toggle-chip strong { display: block; font-weight: 650; color: var(--ink); }
.toggle-chip small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.toggle-chip:has(input:checked) { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 60%, var(--surface)); }
.toggle-chip.burn:has(input:checked) { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); background: var(--danger-soft); }

/* Breadcrumbs */
.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a:hover { color: var(--brand-text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb span[aria-hidden] { color: var(--faint); }

/* --------------------------------------------------------------------------
   Section scaffolding
   -------------------------------------------------------------------------- */
.section { padding-block: 56px; }
.section-tight { padding-block: 32px; }
@media (min-width: 960px) { .section { padding-block: 88px; } }
.section-heading { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; max-width: 720px; }
.section-heading h2 { font-size: clamp(28px, 6vw, 44px); }
.section-heading p { margin: 0; color: var(--muted); font-size: 17px; }
.section-heading.row { max-width: none; flex-direction: row; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.section-squiggle { display: none; }

/* --------------------------------------------------------------------------
   Home — hero + composer
   -------------------------------------------------------------------------- */
.hero { position: relative; padding: 28px 0 40px; overflow: hidden; }
.account-promo { width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--max) - 2 * var(--gutter)); margin-top: 20px; padding: 20px; display: grid; gap: 18px; border: 1px solid var(--line-strong); border-left: 5px solid var(--brand); border-radius: var(--r-lg); background: linear-gradient(115deg, var(--brand-soft), var(--surface)); box-shadow: var(--shadow-sm); }
.account-promo-kicker { display: inline-block; color: var(--brand-text); font-size: 12px; font-weight: 650; letter-spacing: .03em; margin-bottom: 8px; }
.account-promo h2 { font-size: clamp(21px, 4.5vw, 26px); line-height: 1.2; letter-spacing: -.02em; margin: 0 0 10px; }
.account-promo-benefits { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.account-promo-benefits strong { color: var(--ink); font-weight: 600; }
.account-promo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.account-promo-actions .text-link { font-size: 13px; }
.dark .account-promo { border-left-color: var(--lime); }
@media (min-width: 760px) { .account-promo { grid-template-columns: minmax(0, 1fr) auto; gap: 32px; padding: 22px 26px; } .account-promo-actions { flex-direction: column; justify-content: center; gap: 12px; } }
.hero::before {
  content: ''; position: absolute; inset: -40% -20% auto auto; width: 720px; height: 720px; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--lime) 35%, transparent), transparent 70%);
  opacity: .55; z-index: 0;
}
.dark .hero::before { opacity: .12; }
.hero-grid { position: relative; z-index: 1; display: grid; gap: 28px; }
.hero-copy { display: flex; flex-direction: column; gap: 16px; }
.hero h1 { font-size: clamp(40px, 11vw, 76px); letter-spacing: -.045em; line-height: .98; }
.hero-lede { font-size: 18px; color: var(--muted); margin: 0; max-width: 34ch; }
.hero-points { list-style: none; padding: 0; margin: 4px 0 0; display: none; gap: 8px; font-size: 15px; color: var(--ink-2); }
.hero-points li { display: flex; align-items: center; gap: 10px; }
.hero-points svg { color: var(--brand-text); flex: none; }

@media (min-width: 640px) { .hero-points { display: grid; } }
@media (min-width: 960px) {
  .hero { padding: 64px 0 72px; }
  .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: start; }
  .hero-join { margin-top: 12px; }
}

.composer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.composer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.composer-title { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; }
.composer-title .dots { display: flex; gap: 5px; }
.composer-title .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); display: block; }
.composer-hint { font-size: 13px; color: var(--muted); display: none; }
@media (min-width: 640px) { .composer-hint { display: inline; } }
.magic-input-box { position: relative; background: var(--code-bg); }
.magic-input-box textarea {
  display: block; width: 100%; min-height: 180px; max-height: 50vh; resize: vertical; border: 0; outline: 0; padding: 16px;
  background: transparent; color: var(--ink); font: 15px/1.6 var(--font-mono); tab-size: 2;
}
@media (min-width: 960px) { .magic-input-box textarea { min-height: 240px; padding: 20px; } }
.magic-input-box textarea::placeholder { color: var(--faint); }
.magic-input-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px 6px 16px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.magic-input-footer .actions { display: flex; gap: 2px; }

/* Detection panel */
.magic-detection-panel { margin: 0; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--surface-2); animation: slideDown .22s var(--ease); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.detection-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.detection-badge { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--brand); color: #fff; }
.dark .detection-badge { background: var(--lime); color: var(--lime-ink); }
.detection-summary { font-size: 13px; color: var(--muted); }
.detection-actions { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.detection-actions::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .detection-actions { flex-wrap: wrap; overflow: visible; } }
.magic-act-btn { flex: none; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; transition: background .15s, border-color .15s; }
.magic-act-btn:hover { border-color: var(--brand); color: var(--brand-text); }
.magic-act-btn-primary { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
.magic-act-btn-primary:hover { background: var(--btn-hover); color: var(--btn-ink); }
.detection-preview-box { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.preview-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 650; }
.preview-header > div { display: flex; gap: 6px; }
.detection-preview-box pre { margin: 0; padding: 14px; font: 13px/1.6 var(--font-mono); max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-word; color: var(--ink); }

/* Room options */
.composer-options { padding: 16px; display: grid; gap: 14px; border-top: 1px solid var(--line); }
.option-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toggle-row { display: grid; gap: 8px; }
@media (min-width: 640px) { .toggle-row { grid-template-columns: 1fr 1fr; } }
.more-options { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.more-options summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-weight: 600; font-size: 14px; color: var(--ink-2); border-radius: var(--r-md); }
.more-options summary::-webkit-details-marker { display: none; }
.more-options summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); transition: transform .2s; margin-right: 4px; }
.more-options[open] summary::after { transform: rotate(-135deg); }
.more-options .more-body { padding: 4px 14px 14px; display: grid; gap: 12px; }
.slug-input { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.slug-input span { display: flex; align-items: center; padding: 0 10px; background: var(--surface-2); color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
.slug-input input { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.slug-input input[readonly] { color: var(--faint); cursor: not-allowed; }
.composer-submit { display: flex; flex-direction: column; gap: 10px; }
.composer-submit p { margin: 0; font-size: 13px; color: var(--muted); }
@media (min-width: 640px) { .composer-submit { flex-direction: row-reverse; align-items: center; justify-content: space-between; } .composer-submit .btn { min-width: 220px; } }
.composer-join { padding: 14px 16px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* Join row (code entry) */
.join-row { display: flex; flex-direction: column; gap: 8px; }
.join-row label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.join-row form { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .3em; font-family: var(--font-mono); font-weight: 600; font-size: 17px; text-align: center; }
.join-row input::placeholder { letter-spacing: .12em; font-family: var(--font-body); font-weight: 500; font-size: 15px; }
.join-row button { width: 48px; flex: none; border: 0; border-radius: var(--r-md); background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; }
.join-row button:hover { background: var(--btn-hover); }

/* Recent rooms */
.recent-rooms-grid { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
.recent-rooms-grid::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .recent-rooms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); overflow: visible; margin: 0; padding: 0; } }
.recent-room-card { flex: 0 0 200px; scroll-snap-align: start; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); transition: border-color .15s, transform .15s var(--ease); }
.recent-room-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.recent-room-card strong { font-family: var(--font-mono); font-size: 17px; letter-spacing: .12em; color: var(--ink); }
.recent-room-card small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.recent-room-card .open { font-size: 14px; font-weight: 650; color: var(--brand-text); }

/* Quick tools strip */
.quick-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .quick-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .quick-tools { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.quick-tool { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; min-height: 118px; }
.quick-tool:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-tool .qt-icon { font-family: var(--font-mono); font-weight: 700; font-size: 14px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.quick-tool strong { font-size: 16px; font-weight: 650; margin-top: 4px; }
.quick-tool span:last-child { font-size: 13px; color: var(--muted); line-height: 1.4; }
.see-all { margin-top: 18px; }

/* How it works */
.how-section { background: var(--surface-2); border-block: 1px solid var(--line); }
.steps { display: grid; gap: 12px; counter-reset: step; }
@media (min-width: 800px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.steps article { position: relative; padding: 22px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.step-num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.step-symbol { display: none; }
.steps h3 { font-size: 20px; margin: 14px 0 6px; }
.steps p { margin: 0; color: var(--muted); font-size: 15px; }

/* Privacy */
.privacy-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: center; }
@media (min-width: 900px) { .privacy-section { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; } }
.privacy-copy h2 { font-size: clamp(30px, 6vw, 48px); margin: 10px 0 14px; }
.privacy-copy > p { color: var(--muted); font-size: 17px; margin: 0; }
.privacy-list { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 14px; }
.privacy-list li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.privacy-list .pi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.privacy-list strong { display: block; font-weight: 650; }
.privacy-list span { color: var(--muted); font-size: 15px; }
.privacy-art { position: relative; grid-template-columns: minmax(0, 1fr); aspect-ratio: 4 / 3; border-radius: var(--r-xl); background: var(--ink); color: var(--bg); overflow: hidden; display: grid; place-items: center; padding: 24px; }
.dark .privacy-art { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.cipher { width: 100%; max-width: 420px; font: 13px/1.7 var(--font-mono); }
.cipher-line { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.06); margin-bottom: 8px; overflow: hidden; }
.cipher-line b { flex: none; font-family: var(--font-body); font-size: 12px; font-weight: 650; color: var(--lime); min-width: 74px; }
.cipher-line span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.cipher-line.locked span { opacity: .55; }
.cipher-caption { margin-top: 14px; font-size: 13px; opacity: .7; font-family: var(--font-body); }
.privacy-note { display: none; }

/* Home FAQ */
.faq-list { display: grid; gap: 10px; max-width: 860px; }
.faq-list details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.faq-list summary { cursor: pointer; list-style: none; padding: 16px 18px; font-weight: 650; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: '+'; font-size: 22px; line-height: 1; color: var(--faint); transition: transform .2s; }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details p { margin: 0; padding: 0 18px 18px; color: var(--muted); }

/* Final CTA */
.final-cta { text-align: center; padding: 56px var(--gutter); border-radius: var(--r-xl); background: var(--ink); color: var(--bg); margin-bottom: 56px; }
.final-cta h2 { color: inherit; font-size: clamp(30px, 6vw, 52px); margin: 0 0 22px; }
.final-cta p { color: color-mix(in srgb, var(--bg) 70%, transparent); margin: -10px auto 24px; max-width: 46ch; }
.final-cta .btn-primary { background: var(--lime); color: var(--lime-ink); }
.final-cta .btn-primary:hover { background: #d6f592; }
.dark .final-cta { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.dark .final-cta p { color: var(--muted); }

/* --------------------------------------------------------------------------
   Live room
   -------------------------------------------------------------------------- */
.room-main { width: 100%; max-width: var(--max); margin: auto; padding: 18px var(--gutter) 56px; }
.room-heading { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.back-link:hover { color: var(--brand-text); }
.room-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.room-title-line h1 { font-size: clamp(28px, 7vw, 40px); letter-spacing: -.035em; margin-right: 4px; }
.room-heading p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.mode-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.mode-badge.editable { background: var(--brand-soft); color: var(--brand-text); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.mode-badge.e2ee-badge { background: var(--ink); color: var(--lime); border-color: transparent; }
.dark .mode-badge.e2ee-badge { background: var(--brand-soft); }
.mode-badge.burn-mode { background: var(--danger) !important; color: #fff !important; border-color: transparent; }
.room-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.room-meta-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.code-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface); padding: 6px 12px; border-radius: 10px; font-family: var(--font-mono); font-size: 18px; font-weight: 700; letter-spacing: .14em; color: var(--ink); transition: border-color .15s; }
.code-chip:hover { border-color: var(--brand); }
.code-chip::after { content: ''; width: 14px; height: 14px; background: currentColor; opacity: .45; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='8' y='8' width='12' height='12' rx='2' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M16 8V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h3' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='8' y='8' width='12' height='12' rx='2' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M16 8V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h3' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat; }
.room-meta small { font-size: 13px; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-text); font-size: 13px; font-weight: 650; white-space: nowrap; }
.status-pill.offline { background: var(--warn-soft); color: var(--warn); }
.status-pill.offline .pulse { background: currentColor; animation: none; }
@media (min-width: 800px) {
  .room-heading { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .room-meta { justify-content: flex-end; }
}

.room-alert, .e2ee-alert, .burn-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); margin-bottom: 12px; font-size: 14px; line-height: 1.45; }
.room-alert { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.e2ee-alert { background: var(--brand-soft); color: var(--ink-2); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.e2ee-alert strong { color: var(--brand-text); }
.burn-alert { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }

.room-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1040px) { .room-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; } .share-section { position: sticky; top: calc(var(--header-h) + 16px); } }
.editor-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.room-toolbar { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.toolbar-left { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-inline: 4px; }
.toolbar-right { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.toolbar-right::-webkit-scrollbar { display: none; }
@media (min-width: 1240px) { .room-toolbar { flex-direction: row; align-items: center; justify-content: space-between; } .toolbar-left { justify-content: flex-start; gap: 16px; } }
.language-select { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.language-select select { border: 1px solid var(--line); background-color: var(--surface-2); color: var(--ink); border-radius: 9px; height: 34px; padding: 0 10px; font-size: 14px; font-weight: 600; outline: none; }
.language-select select:disabled { opacity: .75; }
.presence { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #6cc04a; }
.tool-button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s; }
.tool-button:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.tool-button.primary { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
.tool-button.primary:hover { background: var(--btn-hover); }
.editor-frame { position: relative; display: flex; height: 52vh; min-height: 300px; background: var(--code-bg); overflow: auto; }
@media (min-width: 960px) { .editor-frame { height: 560px; } }
.editor-frame:fullscreen { height: 100vh; background: var(--code-bg); }
.line-rail { min-width: 46px; padding: 18px 10px 18px 0; text-align: right; color: var(--faint); border-right: 1px solid var(--line); font: 14px/1.65 var(--font-mono); white-space: pre; user-select: none; overflow: hidden; }
.editor-frame textarea, .code-preview { width: 100%; height: 100%; margin: 0; padding: 18px; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font: 14px/1.65 var(--font-mono); tab-size: 2; white-space: pre; overflow: auto; }
.editor-frame textarea::placeholder { color: var(--faint); }
.editor-frame textarea:disabled { color: var(--ink); -webkit-text-fill-color: var(--ink); opacity: 1; }
.code-preview code { font: inherit; }
.editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
#save-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#char-count { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.code-preview .tok-key { color: #a1408f; }
.code-preview .tok-string { color: #3f7d2a; }
.code-preview .tok-number { color: #b0611c; }
.code-preview .tok-comment { color: var(--faint); font-style: italic; }
.code-preview .tok-tag { color: #2a6f9b; }
.dark .code-preview .tok-key { color: #e39bd6; }
.dark .code-preview .tok-string { color: #a6dd85; }
.dark .code-preview .tok-number { color: #f1b27a; }
.dark .code-preview .tok-tag { color: #8cc6ee; }

.share-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.share-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.share-heading h2 { font-size: 22px; margin: 2px 0 4px; }
.share-heading p { margin: 0; font-size: 14px; color: var(--muted); }
.share-heading img { flex: none; width: 104px; height: 104px; border-radius: 12px; border: 1px solid var(--line); padding: 6px; background: #fff; }
.share-grid { display: grid; gap: 14px; margin-top: 16px; }
.share-option-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.share-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); font-size: 15px; flex: none; }
.share-option-head strong { display: block; font-size: 14px; }
.share-option-head small { display: block; font-size: 13px; color: var(--muted); }
.copy-row { display: flex; border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); }
.copy-row input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 0; background: transparent; color: var(--ink-2); font: 13px var(--font-mono); outline: 0; }
.copy-row button { flex: none; border: 0; border-left: 1px solid var(--line-strong); background: var(--surface); color: var(--brand-text); padding: 0 14px; font-weight: 650; font-size: 14px; }
.copy-row button:hover { background: var(--brand-soft); }
.native-share { margin-top: 14px; }
.share-footnote { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

.password-panel { max-width: 520px; margin: 24px auto; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 32px 20px; box-shadow: var(--shadow-md); }
.password-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); font-size: 26px; }
.password-panel h2 { font-size: 24px; margin: 16px 0 6px; }
.password-panel > p { color: var(--muted); font-size: 15px; margin: 0; }
.password-panel form { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
@media (min-width: 560px) { .password-panel form { flex-direction: row; } .password-panel input { flex: 1; } }

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */
.not-found { max-width: 640px; margin: auto; padding: 72px var(--gutter); display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.not-found h1 { font-size: clamp(36px, 8vw, 60px); letter-spacing: -.04em; }
.not-found p { color: var(--muted); margin: 0 0 10px; font-size: 17px; }
.not-found .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Auth pages
   -------------------------------------------------------------------------- */
.auth-page { display: flex; align-items: flex-start; justify-content: center; padding: 28px var(--gutter) 56px; }
@media (min-width: 640px) { .auth-page { align-items: center; padding-block: 64px; } }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 28px 22px; }
@media (min-width: 640px) { .auth-card { padding: 36px 34px; } }
.auth-header { margin-bottom: 22px; }
.auth-icon { display: none; }
.auth-header h1 { font-size: 30px; letter-spacing: -.03em; margin: 0 0 8px; }
.auth-header p { margin: 0; color: var(--muted); font-size: 15px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.auth-field label span, .auth-field label small { font-weight: 400; color: var(--faint); }
.auth-btn { min-height: 50px; border: 0; border-radius: 14px; background: var(--btn); color: var(--btn-ink); font-weight: 650; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px; transition: background .15s; }
.auth-btn:hover { background: var(--btn-hover); }
.auth-btn.danger { background: var(--danger); color: #fff; }
.auth-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--brand-soft); color: var(--ink-2); font-size: 14px; }
.auth-footer { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); display: grid; gap: 8px; text-align: center; }
.auth-footer p { margin: 0; }
.auth-footer a { color: var(--brand-text); font-weight: 650; }
.auth-footer .guest-link { color: var(--muted); font-weight: 500; font-size: 14px; }
.password-field { position: relative; }
.password-field input { padding-right: 64px; }
.password-field button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--brand-text); font-size: 13px; font-weight: 650; padding: 6px 8px; border-radius: 8px; }

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.dash-page { width: 100%; max-width: var(--max); margin: auto; padding: 24px var(--gutter) 64px; }
.dash-header { display: flex; flex-direction: column; gap: 16px; margin-bottom: 22px; }
@media (min-width: 760px) { .dash-header { flex-direction: row; align-items: center; justify-content: space-between; } }
.dash-user-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.dash-avatar-large { width: 56px; height: 56px; border-radius: 16px; background: var(--brand); color: var(--lime); display: grid; place-items: center; font-family: var(--font-display); font-size: 24px; flex: none; }
.dash-user-info h1 { font-size: 26px; letter-spacing: -.03em; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; }
.dash-user-meta { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.dash-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-header-actions .btn { flex: 1; }
@media (min-width: 760px) { .dash-header-actions .btn { flex: none; } }
.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.dash-stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
@media (min-width: 640px) { .dash-stat-card { padding: 20px 22px; } }
.dash-stat-num { font-family: var(--font-display); font-size: clamp(26px, 6vw, 36px); color: var(--ink); line-height: 1; }
.dash-stat-lbl { font-size: 13px; color: var(--muted); margin-top: 6px; }
.dash-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tab { flex: none; padding: 12px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 15px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.dash-tab:hover { color: var(--ink); }
.dash-tab.active { color: var(--ink); border-color: var(--brand); }
.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-item-title { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-item-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.dash-item-actions { display: flex; gap: 8px; }
.dash-btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; font-weight: 600; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; }
.dash-btn-sm:hover { background: var(--surface-2); }
.dash-btn-sm.danger { color: var(--danger); }
.dash-empty { padding: 40px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--muted); font-size: 15px; }
.dash-empty p { margin: 0 0 14px; }
.snippet-form { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px; }
.snippet-form textarea { min-height: 120px; font-family: var(--font-mono); font-size: 14px; }
.snippet-form .row { display: flex; gap: 8px; justify-content: flex-end; }
.pane-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.pane-heading h2 { font-size: 20px; }
.settings-card { max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.settings-card h2 { font-size: 20px; margin-bottom: 14px; }
.settings-card dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; font-size: 15px; }
.settings-card dt { color: var(--muted); }
.settings-card dd { margin: 0; font-weight: 600; word-break: break-all; }
.settings-card hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.settings-card p { color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   Tools directory
   -------------------------------------------------------------------------- */
.tools-dir-page { width: 100%; max-width: var(--max); margin: auto; padding: 28px var(--gutter) 64px; }
.tools-dir-hero { margin-bottom: 18px; }
.tools-dir-hero h1 { font-size: clamp(34px, 8vw, 56px); letter-spacing: -.04em; margin: 8px 0 10px; }
.tools-dir-hero p { margin: 0; color: var(--muted); font-size: 17px; max-width: 60ch; }
.tools-search { position: sticky; top: var(--header-h); z-index: 5; background: var(--bg); padding: 12px 0; margin-bottom: 6px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box input { width: 100%; height: 50px; border-radius: 14px; border: 1px solid var(--line-strong); padding: 0 16px 0 44px; font-size: 16px; background: var(--surface); color: var(--ink); outline: none; }
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.tools-filter-bar { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.tools-filter-bar::-webkit-scrollbar { display: none; }
.filter-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px; transition: background .15s, color .15s; }
.filter-chip small { font-weight: 500; color: var(--faint); }
.filter-chip:hover { border-color: var(--brand); }
.filter-chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filter-chip.active small { color: inherit; opacity: .7; }
.tools-count { margin: 6px 0 12px; font-size: 14px; color: var(--muted); }
.tools-dir-grid { display: grid; gap: 8px; }
@media (min-width: 700px) { .tools-dir-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (min-width: 1040px) { .tools-dir-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-dir-card { position: relative; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: start; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.tool-dir-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tool-dir-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); font: 700 14px var(--font-mono); }
.tool-dir-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tool-dir-name { font-weight: 650; font-size: 16px; color: var(--ink); }
.tool-dir-desc { font-size: 14px; color: var(--muted); line-height: 1.45; }
.tool-dir-tag { font-size: 12px; font-weight: 600; color: var(--faint); padding-top: 2px; }
.tool-dir-item { position: relative; display: grid; }
.tool-pin { position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--faint); display: grid; place-items: center; }
.tool-pin:hover { background: var(--surface-2); color: var(--warn); }
.tool-pin[aria-pressed="true"] { color: var(--warn); }
.tool-pin[aria-pressed="true"] svg path { fill: currentColor; }
.tools-empty { grid-column: 1 / -1; }
/* Legacy markup used on the features page */
.tool-dir-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tool-dir-card h3 { font-size: 19px; margin: 0 0 6px; }
.tool-dir-card p { font-size: 15px; color: var(--muted); margin: 0; }
.tool-dir-link { display: inline-flex; margin-top: 14px; font-size: 14px; font-weight: 650; color: var(--brand-text); }
.feature-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .feature-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.feature-grid .tool-dir-card { display: flex; flex-direction: column; align-items: stretch; padding: 22px; }

/* --------------------------------------------------------------------------
   Legal / content pages
   -------------------------------------------------------------------------- */
.legal-page { width: 100%; max-width: 820px; margin: auto; padding: 28px var(--gutter) 64px; }
.legal-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 26px 20px; }
@media (min-width: 640px) { .legal-card { padding: 44px 48px; } }
.legal-card h1 { font-size: clamp(32px, 7vw, 46px); letter-spacing: -.035em; margin: 0 0 8px; }
.legal-updated { display: block; font-size: 14px; color: var(--muted); margin-bottom: 26px; }
.legal-content { font-size: 16px; line-height: 1.75; color: var(--ink-2); }
.legal-content h2 { font-size: 22px; margin: 34px 0 10px; }
.legal-content h2:first-child { margin-top: 0; }
.legal-content p, .legal-content ul, .legal-content ol { margin: 0 0 16px; }
.legal-content ul, .legal-content ol { padding-left: 22px; }
.legal-content li { margin-bottom: 8px; }
.legal-content li::marker { color: var(--brand-text); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer, footer.room-footer { margin-top: auto; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 15px; }
.footer-inner { max-width: var(--max); margin: auto; padding: 40px var(--gutter) 24px; display: grid; gap: 28px; }
@media (min-width: 900px) { .footer-inner { grid-template-columns: 1.2fr 2fr; gap: 48px; padding-top: 56px; } }
.footer-brand p { margin: 12px 0 0; max-width: 34ch; }
.footer-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 16px; }
@media (min-width: 640px) { .footer-links { grid-template-columns: repeat(4, 1fr); } }
.footer-links h2 { font-family: var(--font-body); font-size: 14px; font-weight: 650; color: var(--ink); letter-spacing: 0; margin: 0 0 10px; }
.footer-links a { display: block; padding: 5px 0; color: var(--muted); }
.footer-links a:hover { color: var(--ink); }
.footer-base { max-width: var(--max); margin: auto; padding: 16px var(--gutter) 28px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
@media (min-width: 640px) { .footer-base { flex-direction: row; justify-content: space-between; } }

/* --------------------------------------------------------------------------
   Toasts & announcement bar
   -------------------------------------------------------------------------- */
.site-toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 9999;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-size: 15px; font-weight: 600; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; transition: opacity .2s, transform .25s var(--ease);
}
.site-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.site-toast[data-tone="error"] { background: var(--danger); color: #fff; }
.announcement-bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 9px var(--gutter); background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 550; text-align: center; }
.announcement-bar button { background: transparent; border: 0; color: inherit; opacity: .7; font-size: 16px; padding: 2px 6px; border-radius: 6px; }
.announcement-bar button:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Motion preferences
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.snippet-preview { font-family: var(--font-mono); max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Guest vs free account (/free-account)
   -------------------------------------------------------------------------- */
.compare-hero { padding-top: 28px; padding-bottom: 24px; max-width: 860px; margin-inline: 0; }
@media (min-width: 960px) { .compare-hero { padding-top: 56px; padding-bottom: 36px; margin-inline: auto; max-width: var(--max); } .compare-hero h1, .compare-hero p { max-width: 760px; } }
.compare-hero h1 { font-size: clamp(34px, 8vw, 58px); letter-spacing: -.045em; line-height: 1.02; margin: 8px 0 14px; }
.compare-hero p { font-size: 18px; color: var(--muted); margin: 0; max-width: 60ch; }
.compare-cards { display: grid; gap: 14px; padding-bottom: 40px; }
@media (min-width: 820px) { .compare-cards { grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; } }
.compare-card { display: flex; flex-direction: column; gap: 18px; padding: 22px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); }
@media (min-width: 640px) { .compare-card { padding: 30px 28px; } }
.compare-card.is-account { border: 2px solid var(--ink); box-shadow: var(--shadow-lg); }
.dark .compare-card.is-account { border-color: var(--lime); }
.compare-card-head { display: flex; gap: 14px; align-items: center; }
.compare-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.is-account .compare-icon { background: var(--brand); color: var(--lime); }
.compare-card h2 { font-size: 26px; }
.compare-card-head p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }
.compare-capacity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.compare-capacity > div { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.compare-capacity dt { font-size: 12px; line-height: 1.4; color: var(--muted); }
.compare-capacity dd { margin: 4px 0 0; font-size: 22px; line-height: 1.2; font-weight: 700; color: var(--ink); }
.compare-restriction { margin: 0; padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: 13px; line-height: 1.5; }
.is-account .compare-capacity > div { background: var(--brand-soft); }
.compare-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; flex: 1; }
.compare-list li { position: relative; padding-left: 30px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.compare-list li::before { content: ''; position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 10.5 2.6 2.5L14 7.5' fill='none' stroke='%231f5a3a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 20px no-repeat; }
.dark .compare-list li::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 10.5 2.6 2.5L14 7.5' fill='none' stroke='%239fd88a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.compare-list strong { display: block; color: var(--ink); font-weight: 650; font-size: 16px; }
.compare-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 56px; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; }
@media (min-width: 640px) { .compare-table { font-size: 15px; } }
.compare-table th, .compare-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare-table thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 14px; color: var(--muted); font-weight: 650; }
.compare-table thead th:last-child { color: var(--ink); }
.compare-table tbody th { font-weight: 550; color: var(--ink); }
.compare-table td { width: 28%; color: var(--ink-2); }
.compare-table tr.group th { background: color-mix(in srgb, var(--surface-2) 60%, transparent); font-size: 13px; font-weight: 650; color: var(--brand-text); padding-block: 9px; }
.compare-table tr:last-child th, .compare-table tr:last-child td { border-bottom: 0; }
.compare-table td.yes::before, .compare-table td.no::before, .compare-table td.partial::before { margin-right: 5px; font-weight: 800; }
.compare-table td.yes::before { content: '✓'; color: var(--brand-text); }
.compare-table td.no { color: var(--faint); }
.compare-table td.no::before { content: '–'; color: var(--faint); }
.compare-table td.partial::before { content: '~'; color: var(--warn); }
:root { --usage-warning: #9c4c12; }
.usage-panel { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 16px; margin: 16px 0; }
.usage-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.usage-heading a { font-size: 12px; color: var(--muted); }
.usage-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 8px 0 0; }
.usage-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 14px; }
.usage-metrics > div { min-width: 0; }
.usage-metrics span, .usage-metrics small { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; }
.usage-metrics strong { display: block; font-size: 19px; margin: 3px 0; }
.usage-warning { margin: 12px 0 0; padding: 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; line-height: 1.5; }
.at-limit, .room-text-limit.is-over label { color: var(--usage-warning); }
.room-text-limit { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px 12px; font-size: 12px; color: var(--muted); }
.room-text-limit progress { flex: 1; min-width: 100px; max-width: 220px; height: 6px; accent-color: var(--brand); }
.dark { --usage-warning: #ffc084; }
.auth-password-help, .auth-security-note { font-size: .82rem; line-height: 1.55; color: var(--muted); margin: 0; }
.auth-security-note { margin-top: 1.2rem; }
.settings-card .auth-form { max-width: 430px; margin: 1rem 0 1.5rem; }
/* Authenticator setup and one-time recovery codes. */
.mfa-panel { margin-top: 24px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.mfa-panel h2 { margin-top: 0; }
.mfa-panel img { display: block; max-width: 100%; height: auto; margin: 16px auto; border-radius: 12px; background: #fff; }
.mfa-secret, .mfa-recovery-codes { display: block; padding: 12px; border-radius: 8px; background: var(--surface-2); font-family: var(--font-mono); overflow-wrap: anywhere; user-select: all; }
.mfa-recovery-codes { line-height: 1.8; white-space: pre-wrap; }
