/* instantsite: one stylesheet, themes by tokens. */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --radius: 6px;
  --side-w: 280px;
  --fast: 120ms;

  /* light */
  --bg: #f6f6f4;
  --panel: #ffffff;
  --panel-2: #efefec;
  --line: #e0e0dc;
  --line-strong: #c9c9c3;
  --text: #1c1c1a;
  --text-2: #5b5b56;
  --text-3: #8a8a84;
  --accent: #15803d;
  --accent-soft: #dcfce7;
  --focus: #2563eb;
  --danger: #b91c1c;
  --warn: #a16207;
  --tab-preview: #fef3c7;
  --tab-preview-text: #713f12;
  --tab-dirty: #fde2e4;
  --tab-dirty-text: #881337;
  --tab-saved: #dcfce7;
  --tab-saved-text: #14532d;
  --shadow: 0 8px 28px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f11;
    --panel: #15171a;
    --panel-2: #1c1f23;
    --line: #262a2f;
    --line-strong: #353a41;
    --text: #e8e8e6;
    --text-2: #a5a8ad;
    --text-3: #6f747b;
    --accent: #22c55e;
    --accent-soft: #10291a;
    --focus: #60a5fa;
    --danger: #f87171;
    --warn: #fbbf24;
    --tab-preview: #3a2f0b;
    --tab-preview-text: #fde68a;
    --tab-dirty: #3d1520;
    --tab-dirty-text: #fecdd3;
    --tab-saved: #0f2e1b;
    --tab-saved-text: #bbf7d0;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f11;
  --panel: #15171a;
  --panel-2: #1c1f23;
  --line: #262a2f;
  --line-strong: #353a41;
  --text: #e8e8e6;
  --text-2: #a5a8ad;
  --text-3: #6f747b;
  --accent: #22c55e;
  --accent-soft: #10291a;
  --focus: #60a5fa;
  --danger: #f87171;
  --warn: #fbbf24;
  --tab-preview: #3a2f0b;
  --tab-preview-text: #fde68a;
  --tab-dirty: #3d1520;
  --tab-dirty-text: #fecdd3;
  --tab-saved: #0f2e1b;
  --tab-saved-text: #bbf7d0;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
kbd { font: 11px var(--mono); color: var(--text-3); }

/* ---------- layout ---------- */
/* The app is exactly the window. Panels scroll inside; the page itself never scrolls. */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: var(--side-w) 4px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.side { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.side-head { padding: 10px 10px 6px; }
.filter { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); outline: none; transition: border-color var(--fast); }
.filter:focus { border-color: var(--focus); }
.resize { cursor: col-resize; background: transparent; }
.resize:hover, .resize.drag { background: var(--line-strong); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }

/* ---------- tree (the old look: ► ▼ • and the 📌 pin) ---------- */
.tree { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 4px 12px; outline: none; user-select: none; border-radius: 8px; }
.tree:focus-visible, .tree:focus { outline: 2px solid #0a0; outline-offset: -2px; }
.row { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px calc(8px + var(--depth, 0) * 2rem); border-radius: 4px; cursor: pointer; white-space: nowrap; font-size: 0.875rem; line-height: 1.25rem; color: var(--text-2); }
.row:hover { background: var(--panel-2); color: var(--text); }
.row.focused { background: var(--panel-2); color: var(--text); outline: 1px solid #0a0; outline-offset: -1px; }
.row.current { background: color-mix(in srgb, #0a0 22%, transparent); color: var(--text); font-weight: 600; }
.row .icon { width: 1.25rem; flex: 0 0 1.25rem; text-align: center; font-weight: 700; font-size: inherit; color: var(--text-2); }
.row.pinned { background: rgba(59, 130, 246, .15); font-weight: 600; color: var(--text); }
.row.pinned:hover { background: rgba(59, 130, 246, .25); }
.row.pinned .icon { font-size: 1.08rem; transition: transform .2s ease-in-out; transform: rotate(225deg); }
.row.pinned.open .icon { transform: rotate(315deg); }
.row .icon.arrow { transition: transform .2s ease-in-out; transform: rotate(-90deg); }
.row .icon.dot { font-size: 1.05rem; line-height: 1; }
.row.open .icon.arrow { transform: none; }
.row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row .meta { flex: 0 0 auto; margin-left: auto; padding-left: 8px; font-size: 11px; color: var(--text-3); }
.row.user { color: var(--text); font-weight: 500; }
.row.dim { opacity: .33; }
.row.hidden-item .name { font-style: italic; }
.row.drop { background: rgba(16, 185, 129, .2); outline: 2px dashed #10b981; outline-offset: -2px; }
.row .served { margin-left: 6px; padding: 0 5px; border: 1px solid var(--accent); border-radius: 999px; font-size: 10px; line-height: 14px; color: var(--accent); }
.tree-divider { height: 1px; background: var(--line); margin: 6px 8px; }
.tree-empty { padding: 12px; color: var(--text-3); font-size: 13px; }
.tree-note { height: 20px; line-height: 20px; color: var(--text-3); font-size: 12px; font-style: italic; }
.tree-gap { height: 7px; }

/* Slim scroll bars, as on the old site */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tb { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background var(--fast), color var(--fast); }
.tb:hover { background: var(--panel-2); color: var(--text); }
.tb:active { transform: translateY(1px); }
.tb[aria-disabled="true"] { opacity: .45; cursor: default; }
.tb svg { width: 16px; height: 16px; flex: 0 0 16px; }
.tb.primary { color: var(--accent); }
.tb.pill { border-color: var(--line-strong); border-radius: 999px; padding: 0 10px; font-weight: 600; }
/* The two pills of the front page, small: thick outline, a soft glow, 10% fill of the same color. */
.tb.login-pill, .tb.user-pill { border: 2.5px solid var(--pill); border-radius: 999px; padding: 0 16px; background: color-mix(in srgb, var(--pill) 10%, transparent); box-shadow: 0 0 6px color-mix(in srgb, var(--pill) 70%, transparent), inset 0 0 5px color-mix(in srgb, var(--pill) 35%, transparent); font-weight: 700; }
.tb.login-pill { --pill: #3b82f6; color: #3b82f6; }
.tb.user-pill { --pill: #ef4444; color: var(--text); }
.tb.login-pill:hover, .tb.user-pill:hover { background: color-mix(in srgb, var(--pill) 20%, transparent); box-shadow: 0 0 12px var(--pill), inset 0 0 8px color-mix(in srgb, var(--pill) 50%, transparent); }
.toolbar .spacer { flex: 1; }
/* Theme switch: one big icon when closed (no frame: yellow sun, S in a circle, crescent moon),
   a pill of three on hover or keyboard focus. */
.theme-switch { display: inline-flex; align-items: center; height: 30px; margin: 0 20px; padding: 0; border-radius: 999px; transition: background .15s; }
.theme-switch .opt { display: inline-grid; place-items: center; width: 0; height: 30px; padding: 0; overflow: hidden; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); opacity: 0; cursor: pointer; transition: width .15s ease-out, opacity .15s ease-out, background .15s; }
.theme-switch .opt svg { width: 30px; height: 30px; flex: 0 0 auto; }
.theme-switch .opt.on { width: 30px; opacity: 1; color: var(--text); }
.theme-switch:hover, .theme-switch:focus-within { background: var(--panel-2); }
.theme-switch:hover .opt, .theme-switch:focus-within .opt { width: 34px; opacity: 1; }
.theme-switch:hover .opt.on, .theme-switch:focus-within .opt.on { background: var(--panel); box-shadow: 0 0 0 1px var(--line-strong); }
.theme-switch .opt:hover { color: var(--text); }
/* Narrow windows: toolbar buttons show only their icons; the name / Log in pill always stays. */
@media (max-width: 1180px) { .tb:not(.user-pill):not(.login-pill):has(svg) > span { display: none; } .tb { padding: 0 8px; } }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

/* ---------- tabs ---------- */
.tabs { display: flex; height: 36px; background: var(--panel-2); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tabs:empty { display: none; }
/* Inactive tabs: project color on the bottom edge. Active tab: color on top, bottom open, so it joins the editor. */
.tabs { align-items: stretch; }
.tab { position: relative; display: flex; align-items: center; gap: 8px; max-width: 240px; padding: 0 8px 0 12px; margin-bottom: -1px; border-right: 1px solid var(--line); border-top: 3px solid transparent; border-bottom: 3px solid var(--pc, var(--line)); background: transparent; color: var(--text-2); cursor: pointer; white-space: nowrap; font-size: 13px; }
.tab .label { overflow: hidden; text-overflow: ellipsis; }
.tab .label .proj { color: var(--text-3); }
.tab:hover { color: var(--text); }
.tab.active { background: var(--panel); color: var(--text); font-weight: 600; border-top-color: var(--pc, var(--accent)); border-bottom-color: transparent; border-left: 1px solid var(--line); margin-left: -1px; }
.tab.preview { background: var(--tab-preview); color: var(--tab-preview-text); font-style: italic; font-weight: 400; border-left: 2px solid color-mix(in srgb, var(--tab-preview-text) 45%, transparent); border-right: 2px solid color-mix(in srgb, var(--tab-preview-text) 45%, transparent); }
.tab.dirty { background: var(--tab-dirty); color: var(--tab-dirty-text); }
.tab.saved { background: var(--tab-saved); color: var(--tab-saved-text); }
.tab.active.preview, .tab.active.dirty, .tab.active.saved { filter: saturate(1.25); }
.tab .label .proj { color: inherit; opacity: .7; }
.tab .x { width: 18px; height: 18px; display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: inherit; opacity: .55; cursor: pointer; font-size: 12px; }
.tab .x:hover { opacity: 1; background: color-mix(in srgb, currentColor 15%, transparent); }
.tab.ro .label::after { content: " · read only"; font-weight: 400; opacity: .6; font-style: normal; }

/* ---------- stage ---------- */
.stage { position: relative; flex: 1; min-height: 0; background: var(--panel); }
.pane { position: absolute; inset: 0; }
.viewer-pane { display: flex; align-items: center; justify-content: center; overflow: auto; background: var(--panel-2); }
.viewer-pane img { max-width: 100%; max-height: 100%; object-fit: contain; image-rendering: auto; cursor: zoom-in; }
.viewer-pane img.zoom { max-width: none; max-height: none; cursor: zoom-out; }
.viewer-pane iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-pane video, .viewer-pane audio { max-width: 90%; max-height: 90%; }
.viewer-card { padding: 24px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: center; color: var(--text-2); }
.viewer-card .big { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.viewer-bar { position: absolute; top: 8px; right: 12px; display: flex; gap: 6px; z-index: 2; }

/* welcome + rain: the rain panel stays dark in every theme (brand) */
.welcome-pane { background: #000; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.rain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .85; }
/* Same size and places as the old card: header on top, text scrolls, feedback row at the bottom.
   The card is visible when it appears. When the cursor moves somewhere else, it fades out (2 s), so the
   rain fills the screen; it fades in again when the cursor comes over it. */
.welcome-card { position: relative; z-index: 1; display: flex; flex-direction: column; width: 90%; height: 90%; max-width: 900px; max-height: 800px; padding: 1rem 2rem; border: 1px solid #374151; border-radius: 0.5rem; background: rgba(8, 12, 16, .72); backdrop-filter: blur(4px); color: #d1d5db; font-family: var(--mono); font-size: 1rem; line-height: 1.6; transition: opacity 2s ease; }
.welcome-card.faded:not(:hover):not(:focus-within) { opacity: 0; }
.welcome-card .w-head { flex-shrink: 0; padding-bottom: 1rem; border-bottom: 1px solid #4b5563; }
.welcome-card .w-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 0; }
.welcome-card .w-more { flex-shrink: 0; padding: .5rem 1rem 0 0; border-top: 1px solid #4b5563; text-align: right; font-size: .75rem; color: #0d0; opacity: .6; }
.welcome-card .w-foot { flex-shrink: 0; padding-top: .5rem; }
.welcome-card h1 { margin: 0 0 .25rem; font: 700 2.25rem/1.2 var(--mono); color: #0f0; }
.welcome-card h2 { margin: 1.5rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid #374151; font: 700 1.5rem/1.3 var(--mono); color: #4ade80; }
.welcome-card .w-body h2:first-child { margin-top: 0; }
.welcome-card h3 { margin: 0 0 .5rem; font: 700 1rem var(--mono); color: #4ade80; }
.welcome-card p { margin: 0 0 1rem; color: #c7cbd1; }
.welcome-card ul { list-style: disc; padding-left: 2rem; margin: 0 0 1rem; }
.welcome-card li { margin-bottom: .5rem; color: #c7cbd1; }
.welcome-card code { padding: .1rem .35rem; border-radius: .25rem; background: #0b1220; color: #86efac; }
.welcome-card .sub { color: #9ca3af; font-size: .95rem; }
.welcome-card .row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 1rem; }
.welcome-card .btn { border-color: #14532d; color: #86efac; background: rgba(20, 83, 45, .35); font-family: var(--mono); }
.welcome-card .btn:hover { background: rgba(20, 83, 45, .6); }
.welcome-card a { color: #86efac; }
/* feedback row: [coffee] [text] [message], as before */
.w-feedback { display: flex; gap: .5rem; align-items: stretch; }
.w-feedback textarea { flex: 1; min-height: 120px; padding: .75rem; border: 1px solid #0d0; border-radius: 0; background: #0b1220; color: #d1d5db; font: 1rem var(--mono); resize: vertical; }
.w-feedback textarea:focus { outline: none; box-shadow: 0 0 10px #0d0; }
.w-feedback .fb-btn { flex: 0 0 100px; display: flex; align-items: center; justify-content: center; padding: 1rem .5rem; border: 2px solid #0d0; border-radius: 0; background: transparent; color: #0d0; font: 700 1rem/1.2 var(--mono); text-align: center; text-decoration: none; cursor: pointer; transition: background .2s, color .2s; }
.w-feedback .fb-btn:hover { background: #0d0; color: #000; }

/* ---------- status bar ---------- */
.status { display: flex; align-items: center; gap: 14px; height: 26px; padding: 0 12px; border-top: 1px solid var(--line); background: var(--panel-2); color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; }
.status-path { font-family: var(--mono); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.status-state.dirty { color: var(--danger); }
.status-state.saved { color: var(--accent); }
.status-state.preview { color: var(--warn); }
.status-note { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.status-note.error { color: var(--danger); }
.status-note.ok { color: var(--accent); }
.status-usage.warn { color: var(--warn); }
.status-usage.full { color: var(--danger); font-weight: 600; }

/* ---------- menus ---------- */
.menu { position: fixed; z-index: 50; min-width: 220px; max-width: 320px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.mi { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 30px; padding: 5px 10px; line-height: 1.3; border: 0; border-radius: 5px; background: transparent; text-align: left; cursor: pointer; color: var(--text); }
.mi:hover, .mi.active { background: var(--panel-2); }
.mi .mic { display: inline-flex; flex: none; width: 16px; height: 16px; color: var(--text-2); }
.mi .mic svg { width: 16px; height: 16px; }
.mi.danger .mic { color: var(--danger); }
.mi:hover .mic, .mi.active .mic { color: var(--accent); }
.mi .k { margin-left: auto; font: 11px var(--mono); color: var(--text-3); }
.mi.danger { color: var(--danger); }
.mi[aria-disabled="true"] { opacity: .45; cursor: default; }
.msep { height: 1px; margin: 4px 6px; background: var(--line); }
.mhead { padding: 6px 10px 4px; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- dialogs ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .45); animation: fade var(--fast) ease-out; }
.dialog { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); animation: rise 160ms ease-out; }
.dialog.wide { width: min(640px, 100%); }
.dialog h3 { margin: 0 0 6px; font-size: 16px; }
.dialog p { margin: 6px 0; color: var(--text-2); }
.dialog .warn { padding: 8px 10px; border-left: 3px solid var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--text-2); font-size: 13px; }
.dialog label { display: block; margin: 12px 0 4px; font-size: 12px; color: var(--text-2); }
.dialog input[type=text], .dialog input[type=email], .dialog input[type=password], .dialog input[type=number], .dialog input:not([type]) { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel-2); outline: none; }
.dialog input:focus { border-color: var(--focus); }
.dialog .error { min-height: 18px; margin-top: 6px; color: var(--danger); font-size: 13px; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn { height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); cursor: pointer; }
.btn:hover { background: var(--panel-2); }
.btn.primary { border-color: transparent; background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: transparent; background: var(--danger); color: #fff; }
.seg { display: flex; gap: 4px; padding: 3px; margin-bottom: 12px; border-radius: 8px; background: var(--panel-2); }
.seg button { flex: 1; height: 30px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.code-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; padding: 12px 14px; border: 1px dashed var(--accent); border-radius: 8px; font: 600 20px var(--mono); letter-spacing: .08em; color: var(--accent); }
.code-box .send-to { min-width: 0; font-size: 15px; letter-spacing: 0; overflow-wrap: anywhere; user-select: all; }
.code-box .btn { flex: none; min-width: 92px; }
.code-box .btn.copied { border-color: var(--accent); color: var(--accent); }
.wait { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.spin { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.bar { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin: 4px 0 10px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 100ms linear; }
.usage-list { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; }
.usage-list li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }

/* versions list */
.vlist { max-height: 46vh; overflow: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; }
.vrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.vrow:last-child { border-bottom: 0; }
.vrow.cur { background: var(--accent-soft); }
.vrow .vrel { width: 64px; flex: 0 0 64px; font: 600 12px var(--mono); color: var(--text-2); }
.vrow.cur .vrel { color: var(--accent); }
.vrow .vmain { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.vrow .btn { height: 28px; padding: 0 10px; }
.vrow .btn[disabled] { opacity: .5; cursor: default; }
.sub { color: var(--text-3); font-size: 12px; }

/* command palette */
.palette { width: min(560px, 100%); padding: 0; overflow: hidden; }
.palette input { width: 100%; height: 46px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; outline: none; font-size: 15px; }
.palette .list { max-height: 50vh; overflow: auto; padding: 4px; }
.palette .hint { padding: 8px 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; }

/* ---------- landing (logged out): the old front page, as it was ---------- */
.landing { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; overflow: auto; background: #000; color: #0d0; font-family: "Courier New", Courier, monospace; text-align: center; text-shadow: 0 0 5px #0d0; }
.landing-head { margin-bottom: 3rem; }
.landing h1 { margin: 0 0 1rem; font-size: clamp(2.25rem, 6vw, 3.75rem); font-weight: 700; line-height: 1.1; animation: landing-pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.landing h2 { margin: 0 0 2rem; font-size: 1.125rem; font-weight: 400; color: #9ca3af; text-shadow: none; }
.landing-head p { margin: 0; font-size: 1.25rem; }
.landing-pills { display: flex; gap: 4rem; align-items: flex-start; justify-content: center; max-width: 56rem; }
.landing-choice { display: flex; flex-direction: column; align-items: center; gap: 2rem; width: 22rem; }
.landing-choice p { margin: 0; color: #6b7280; text-shadow: none; font-size: 1rem; line-height: 1.5; }
.pill { padding: 1rem 2rem; border: 2px solid; border-radius: 9999px; background: transparent; font: 700 1.25rem "Courier New", Courier, monospace; cursor: pointer; box-shadow: 0 0 10px, inset 0 0 10px; transition: all .2s ease-in-out; }
/* A pill lights up under the mouse, or when chosen with Left/Right. Never by itself. */
.pill:hover, .pill.lit { transform: scale(1.05); box-shadow: 0 0 20px, inset 0 0 15px; }
.pill:focus { outline: none; }
.pill.blue { color: #3b82f6; border-color: #3b82f6; text-shadow: 0 0 5px #3b82f6; }
.pill.blue:hover, .pill.blue.lit { background: #3b82f6; color: #fff; text-shadow: none; }
.pill.red { color: #ef4444; border-color: #ef4444; text-shadow: 0 0 5px #ef4444; }
.pill.red:hover, .pill.red.lit { background: #ef4444; color: #fff; text-shadow: none; }
@keyframes landing-pulse { 50% { opacity: .5; } }
@media (max-width: 767px) {
  .landing-pills { flex-direction: column; align-items: center; gap: 2.5rem; }
  .landing-choice { width: auto; }
}

/* ---------- mobile launcher ---------- */
.launcher { position: fixed; inset: 0; overflow: auto; padding: 16px; background: #000; color: #d1d5db; font-family: var(--mono); }
.launcher h1 { margin: 8px 0 4px; color: #0f0; font-size: 22px; }
.launcher p { color: #9ca3af; font-size: 13px; }
.launcher input { width: 100%; height: 40px; margin: 10px 0; padding: 0 12px; border: 1px solid #374151; border-radius: 8px; background: #0b0f14; color: #e5e7eb; }
.launcher .u { margin: 8px 0; border: 1px solid #1f2937; border-radius: 10px; overflow: hidden; }
.launcher .u > button { display: flex; justify-content: space-between; width: 100%; padding: 12px 14px; border: 0; background: #0b0f14; color: #e5e7eb; text-align: left; font-size: 15px; }
.launcher .u a { display: block; padding: 10px 14px 10px 24px; border-top: 1px solid #1f2937; color: #86efac; text-decoration: none; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- open on phone (QR code) ---------- */
.qr-dialog { max-width: 400px; }
.qr-box { width: 240px; height: 240px; margin: 12px auto 4px; padding: 6px; border: 3px solid transparent; border-radius: 12px; background: #fff; transition: border-color .15s; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-box.sign-in { border-color: #ef4444; box-shadow: 0 0 18px #ef4444; }
.qr-box.loading { opacity: .4; }
.qr-caption { margin: 4px 0 12px; text-align: center; color: var(--text-2); font: 13px var(--mono); }
.qr-hold { display: block; width: 100%; height: 44px; user-select: none; -webkit-user-select: none; touch-action: none; }
.qr-hold.held { border-color: #ef4444; background: #ef4444; color: #fff; }
.qr-warn { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(239, 68, 68, .12); color: #ef4444; font-size: 13px; font-weight: 600; }

/* ---------- phone: list and sign-in ---------- */
.launcher { padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.ph-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.ph-head h1 { margin: 0; text-shadow: 0 0 6px #0d0; }
.ph-pills { padding: 0; border: 0; background: none; }
.ph-pills img { display: block; width: 40px; height: 40px; }
.ph-msg { padding: 8px 10px; border: 1px solid #14532d; border-radius: 8px; color: #86efac !important; }
.ph-msg.error { border-color: #7f1d1d; color: #fca5a5 !important; }
.ph-msg:empty { display: none; }
.launcher .u.pinned { border-color: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, .35); }
.launcher .u .arrow { transition: transform .15s; }
.launcher .u.open .arrow { transform: rotate(90deg); }
.launcher .u .empty { padding: 10px 24px; color: #6b7280; font-size: 13px; }
.launcher .u a { font-size: 15px; }
.launcher h2 { color: #ef4444; font-size: 18px; }
.ph-foot { margin-top: 24px; color: #6b7280; font-size: 13px; }
.linkish { padding: 0; border: 0; background: none; color: #86efac; font: inherit; text-decoration: underline; }
.ph-login input { display: block; }
.ph-btn { width: 100%; height: 44px; margin-top: 6px; border: 2px solid #ef4444; border-radius: 9999px; background: transparent; color: #ef4444; font: 700 16px var(--mono); box-shadow: 0 0 10px #ef4444; }

/* Phone: big, bold, easy to read and tap. Sizes in rem follow the phone's own text-size setting.
   Long names end in "…" on one line. */
.launcher { font-size: 1.25rem; line-height: 1.35; -webkit-text-size-adjust: 100%; }
.launcher h1 { font-size: 2.1rem; }
.ph-pills img { width: 3.4rem; height: 3.4rem; }
.launcher p, .ph-foot, .ph-msg { font-size: 1.1rem; }
.launcher input { height: 3.6rem; padding: 0 1rem; font-size: 1.35rem; border-radius: 14px; }
.launcher .u { margin: .8rem 0; border-radius: 16px; }
.launcher .u > button { min-height: 4.6rem; padding: .8rem 1.1rem; gap: .8rem; align-items: center; font-size: 1.75rem; font-weight: 700; letter-spacing: -.01em; }
.launcher .nm { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.launcher .u .arrow { flex: none; font-size: 1.6rem; }
.launcher .u a { display: flex; align-items: center; min-height: 4rem; padding: .6rem 1.1rem .6rem 1.8rem; font-size: 1.5rem; font-weight: 600; }
.launcher .u a:active { background: #052e16; }
.launcher .u .empty { font-size: 1.1rem; }
.launcher h2 { font-size: 1.6rem; }
.ph-btn { height: 3.6rem; font-size: 1.3rem; }
.ph-install { display: flex; align-items: center; gap: .8rem; margin: .6rem 0; padding: .8rem; border: 1px solid #1d4ed8; border-radius: 16px; background: #0b1630; color: #dbeafe; font-size: 1.05rem; }
.ph-install:empty { display: none; }
.ph-install img { flex: none; width: 3.4rem; height: 3.4rem; border-radius: 12px; }
.ph-install > div { flex: 1; display: flex; flex-direction: column; gap: .3rem; }
.ph-install b { font-size: 1.2rem; color: #fff; }
.ph-install .ph-btn { height: 3rem; margin: 0; border-color: #3b82f6; color: #fff; background: #3b82f6; box-shadow: 0 0 10px #3b82f6; }
.ph-x { flex: none; align-self: flex-start; width: 2.4rem; height: 2.4rem; border: 0; background: none; color: #93c5fd; font-size: 1.3rem; }
.ios-share { display: inline-flex; vertical-align: -.2em; }
.ios-share svg { width: 1.2em; height: 1.2em; }
/* Phone: the top bar stays put while the list scrolls. */
.launcher { padding-top: 0; }
.ph-top { position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: max(.6rem, env(safe-area-inset-top)) 16px .4rem; background: #000; box-shadow: 0 8px 12px -6px #000, 0 1px 0 #14532d; }
.ph-top .ph-head { margin: 0 0 .2rem; }
.ph-top input[type="search"] { margin: .3rem 0 .2rem; }
/* A pill label never wraps (both pills the same height). Bigger pills on phones only. */
.pill { white-space: nowrap; }
@media (max-width: 767px) { .landing .pill { font-size: 1.2rem; padding: 1rem 1.6rem; } }

/* ---------- phone, sized by screen width (vw): fills any phone the same way ---------- */
/* --z: the text size. 0.9 at the start; the −/+ pills change it (kept on the phone). */
.launcher { --z: .9; }
/* Lists: big bold names, tight rows. A name too long for one line ends in "…". */
.launcher .u { margin: 2vw 0; border-radius: 3.5vw; }
.launcher .u > button { min-height: 0; padding: .22em .5em; gap: .3em; font-size: clamp(calc(1.6rem * var(--z)), calc(7.6vw * var(--z)), calc(3.6rem * var(--z))); font-weight: 800; line-height: 1.15; letter-spacing: 0; }
.launcher .u .arrow { font-size: .6em; color: #6b7280; }
.launcher .u a { min-height: 0; padding: .3em .55em .3em 1.1em; font-size: clamp(calc(1.4rem * var(--z)), calc(6.6vw * var(--z)), calc(3.1rem * var(--z))); font-weight: 700; line-height: 1.15; }
.launcher .u .empty { padding: .4em 1em; font-size: clamp(calc(1rem * var(--z)), calc(4.4vw * var(--z)), calc(2rem * var(--z))); }
.launcher > p, .ph-foot, .ph-msg { font-size: clamp(calc(1rem * var(--z)), calc(4.4vw * var(--z)), calc(2rem * var(--z))); }
/* Top bar: logo, name, search, and the install button until the app is installed. */
.ph-head h1 { font-size: clamp(calc(2rem * var(--z)), calc(9vw * var(--z)), calc(4.2rem * var(--z))); line-height: 1.1; }
.ph-pills img { width: clamp(calc(3rem * var(--z)), calc(12vw * var(--z)), calc(5.6rem * var(--z))); height: clamp(calc(3rem * var(--z)), calc(12vw * var(--z)), calc(5.6rem * var(--z))); }
.ph-top input[type="search"] { height: auto; padding: .35em .5em; font-size: clamp(calc(1.3rem * var(--z)), calc(6vw * var(--z)), calc(2.8rem * var(--z))); }
.ph-install { margin: .4rem 0 .2rem; padding: 0; border: 0; background: none; gap: 2vw; }
.ph-install img, .ph-install b { display: none; }
.ph-install-btn { flex: 1; padding: .3em .5em; border: 0; border-radius: 9999px; background: #3b82f6; color: #fff; font: 800 clamp(calc(1.4rem * var(--z)), calc(7vw * var(--z)), calc(3.2rem * var(--z)))/1.15 var(--mono); box-shadow: 0 0 16px #3b82f6; }
.ph-install-btn:active { transform: scale(.98); }
.ph-install-how { flex: 1; padding: .5em .7em; border: 2px solid #3b82f6; border-radius: 3vw; color: #dbeafe; font-size: clamp(calc(1rem * var(--z)), calc(4.6vw * var(--z)), calc(2rem * var(--z))); }
.ph-install .ph-x { align-self: center; width: auto; height: auto; padding: 0 .2em; font-size: clamp(calc(1.2rem * var(--z)), calc(6vw * var(--z)), calc(2.6rem * var(--z))); color: #6b7280; }

/* Pills screen on phones: fill the screen, large print. */
@media (max-width: 767px) {
  .landing { justify-content: space-evenly; padding: max(4vw, env(safe-area-inset-top)) 4vw max(4vw, env(safe-area-inset-bottom)); }
  .landing-head { margin: 0; }
  .landing h1 { margin: 0 0 4vw; font-size: 10.5vw; }
  .landing h2 { margin: 0 0 6vw; font-size: 5.2vw; line-height: 1.35; }
  .landing-head p { font-size: 5.6vw; line-height: 1.35; }
  .landing-pills { gap: 8vw; width: 100%; }
  .landing-choice { gap: 4vw; width: 100%; }
  .landing .pill { width: 100%; padding: .55em .4em; font-size: 6.2vw; }
  .landing-choice p { font-size: 4.6vw; line-height: 1.4; }
}

/* Phone bottom bar: text size, theme, user. Not scaled by --z (the controls stay the same size). */
.launcher { display: flex; flex-direction: column; padding-bottom: 0; }
.launcher > * { flex: none; }
.ph-grow { flex: 1 !important; }
.ph-foot { flex: 1 0 auto !important; }
.ph-bar { position: sticky; bottom: 0; z-index: 2; display: flex; gap: 2.5vw; margin: 0 -16px; padding: 2.5vw 16px max(2.5vw, env(safe-area-inset-bottom)); background: #000; box-shadow: 0 -8px 12px -6px #000, 0 -1px 0 #14532d; }
.ph-pill { display: flex; align-items: center; justify-content: center; height: clamp(2.6rem, 11vw, 4.4rem); padding: 0 .9em; border: 2px solid #22c55e; border-radius: 9999px; background: transparent; color: #86efac; font: 700 clamp(1.1rem, 5vw, 2rem) var(--mono); box-shadow: 0 0 8px rgba(34, 197, 94, .35); }
.ph-pill svg { width: 1.3em; height: 1.3em; }
.ph-size { gap: 0; padding: 0; overflow: hidden; }
.ph-size button { height: 100%; min-width: 2.2em; padding: 0 .5em; border: 0; background: none; color: inherit; font: inherit; }
.ph-size button + button { border-left: 1px solid #14532d; }
.ph-user { flex: 1; min-width: 0; border-color: #ef4444; color: #fca5a5; box-shadow: 0 0 8px rgba(239, 68, 68, .35); }
.ph-user.armed { background: #ef4444; color: #fff; }

/* Phone light theme. */
.launcher.light { background: #f5f5f4; color: #1c1917; }
.launcher.light .ph-top, .launcher.light .ph-bar { background: #f5f5f4; box-shadow: 0 1px 0 #d6d3d1; }
.launcher.light .ph-bar { box-shadow: 0 -1px 0 #d6d3d1; }
.launcher.light h1 { color: #15803d; text-shadow: none; }
.launcher.light input { border-color: #d6d3d1; background: #fff; color: #1c1917; }
.launcher.light .u { border-color: #d6d3d1; }
.launcher.light .u > button { background: #fff; color: #1c1917; }
.launcher.light .u a { border-top-color: #e7e5e4; background: #fafaf9; color: #15803d; }
.launcher.light .u a:active { background: #dcfce7; }
.launcher.light p, .launcher.light .ph-foot { color: #57534e; }
.launcher.light .ph-pill { color: #15803d; box-shadow: none; }
.launcher.light .ph-user { color: #b91c1c; }
.launcher.light .ph-user.armed { color: #fff; }
.launcher.light .ph-install-how { color: #1e3a8a; }
/* Phone: the pin turns like an arrow (same turn as on the computer). */
.launcher .u .arrow.pin { font-size: .75em; color: inherit; transform: rotate(225deg); transition: transform .2s ease-in-out; }
.launcher .u.open .arrow.pin { transform: rotate(315deg); }
/* Phone: scan the sign-in code with the camera. */
.ph-scan-btn { display: flex; align-items: center; justify-content: center; gap: .5em; width: 100%; margin: .4rem 0; padding: .45em .5em; border: 0; border-radius: 9999px; background: #ef4444; color: #fff; font: 800 clamp(1.3rem, 6vw, 2.6rem)/1.15 var(--mono); box-shadow: 0 0 16px #ef4444; }
.ph-scan-btn svg { width: 1.2em; height: 1.2em; }
.ph-video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; margin: .5rem 0; border: 3px solid #ef4444; border-radius: 16px; background: #111; }
/* Phone rows: arrow (or pin) on the left, bigger; a little more air in each row. */
.launcher .u > button { justify-content: flex-start; padding: .34em .5em .34em .35em; gap: .25em; }
.launcher .u .arrow { flex: none; width: 1em; text-align: center; font-size: 1.2em; line-height: 1; transition: transform .2s ease-in-out; }
.launcher .u.open .arrow { transform: rotate(90deg); }
.launcher .u .arrow.pin { font-size: .85em; width: 1.4em; }
.launcher .u a { padding: .43em .55em .43em 1.75em; }

/* Share sheet: the plain (blue pill) code, big, to scan from this phone or send as a link. */
.ph-share { border-color: #3b82f6; color: #93c5fd; box-shadow: 0 0 8px rgba(59, 130, 246, .4); }
.launcher.light .ph-share { color: #1d4ed8; }
.ph-share-sheet { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4vw; padding: 6vw; background: rgba(0, 0, 0, .92); }
.ph-share-title { margin: 0; color: #93c5fd; font: 700 clamp(1.4rem, 7vw, 2.6rem) var(--mono); text-shadow: 0 0 12px rgba(59, 130, 246, .6); }
.ph-share-qr { width: min(78vw, 60vh); aspect-ratio: 1; padding: 2.5vw; border: 3px solid #3b82f6; border-radius: 16px; background: #fff; box-shadow: 0 0 24px rgba(59, 130, 246, .6); }
.ph-share-qr svg { display: block; width: 100%; height: 100%; }
.ph-share-cap { margin: 0; max-width: 80vw; text-align: center; color: #cbd5e1; font: clamp(.9rem, 4vw, 1.5rem) var(--mono); }
.ph-share-send, .ph-share-close { min-width: 60vw; padding: .6em 1.2em; border-radius: 9999px; font: 700 clamp(1.1rem, 5vw, 2rem) var(--mono); }
.ph-share-send { border: 2px solid #3b82f6; background: #3b82f6; color: #fff; }
.ph-share-close { border: 2px solid #475569; background: none; color: #cbd5e1; }

/* The small pills (share, +/−, theme): all one size. +/− opens wider. */
.ph-small, .ph-size:not(.open) { box-sizing: border-box; flex: none; width: calc(3.1em + 4px); padding: 0; }
.ph-size:not(.open) button { width: 100%; min-width: 0; padding: 0; font-size: .8em; }
