/* Havre: plain brutalist. Black on white, one blue for links, yellow when you point at something, 1px rules.
   System fonts only: Times for words, Courier for labels and machinery. No radius, no shadows. */
:root {
  --ink: #000000;
  --paper: #ffffff;
  --link: #0000ee;
  --visited: #551a8b;
  --hi: #ffff00;
  --bad: #c00000;
  --serif: "Times New Roman", Times, "Liberation Serif", "Nimbus Roman", "DejaVu Serif", serif;
  --mono: "Courier New", Courier, "Liberation Mono", "Nimbus Mono PS", "DejaVu Sans Mono", monospace;
  --gut: 24px;
  --dim: #767676;
  --well: #f2f2f2;
  --veil: rgba(255, 255, 255, 0.85);
  color-scheme: light;
}
/* dark: the same brutalism, inverted. Chosen in the nav (theme.js), or the system's when nothing's chosen */
:root[data-theme="dark"] {
  --ink: #f2f2f2; --paper: #0d0d0d; --link: #8cb4ff; --visited: #c9a2ff; --hi: #4d4a00; --bad: #ff7a7a;
  --dim: #8a8a8a; --well: #1c1c1c; --veil: rgba(0, 0, 0, 0.8); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f2f2f2; --paper: #0d0d0d; --link: #8cb4ff; --visited: #c9a2ff; --hi: #4d4a00; --bad: #ff7a7a;
    --dim: #8a8a8a; --well: #1c1c1c; --veil: rgba(0, 0, 0, 0.8); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 19px/1.35 var(--serif);
}
a, a:visited { color: var(--link); }
a:hover, a:focus-visible { color: var(--ink); background: var(--hi); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.mono, .meta, .hint, .status, .keynote, .more, .foot, .nav, .motto { font-family: var(--mono); }
.mono { font-size: 14px; }
.pad { padding: 14px var(--gut); }
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 10; padding: 8px 12px;
  background: var(--ink); color: var(--paper); font: 14px var(--mono);
}
.skip:focus { top: 8px; color: var(--paper); background: var(--ink); }

/* ---------- controls ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  min-height: 40px; padding: 0 12px; border: 1px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink); font: 14px/1 var(--mono); cursor: pointer; white-space: nowrap;
}
.btn:hover, .btn:focus-visible { background: var(--hi); color: var(--ink); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.solid:hover, .btn.solid:focus-visible { background: var(--hi); color: var(--ink); }
.btn.small { min-height: 34px; font-size: 13px; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: var(--paper); }
.btn:disabled, .btn:disabled:hover { cursor: default; background: var(--paper); color: var(--dim); border-color: var(--dim); }
.btn.solid:disabled { background: var(--dim); color: var(--paper); }
.linkish {
  padding: 0; border: 0; background: none; color: var(--link); text-decoration: underline;
  font: inherit; text-align: left; cursor: pointer;
}
.linkish:hover, .linkish:focus-visible { color: var(--ink); background: var(--hi); }
.linkish:disabled { color: var(--dim); text-decoration: none; cursor: default; background: none; }
input:not([type=checkbox]), select, textarea {
  min-height: 40px; padding: 6px 8px; border: 1px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink); width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.35; }
select { padding: 0 6px; }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
input:disabled, textarea:disabled, select:disabled { background: var(--well); color: var(--dim); }
.check { display: flex; align-items: center; gap: 8px; }
.status { font-size: 14px; }
.status.bad, .keystatus.bad { color: var(--bad); }

/* ---------- the masthead ---------- */
.mast {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 32px;
  padding: 18px var(--gut) 14px; border-bottom: 2px solid var(--ink);
}
.mast h1 { font-size: clamp(72px, 12vw, 136px); line-height: 0.78; font-weight: 700; letter-spacing: -0.05em; }
.motto { margin: 0 0 6px; font-size: 15px; line-height: 1.45; }
.nav { margin: 0 0 6px auto; font-size: 15px; line-height: 1.45; }

/* ---------- the key ---------- */
.keybar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px var(--gut);
  background: var(--ink); color: var(--paper); font: 15px/1.4 var(--mono);
}
.keybar a { color: var(--paper); }
/* the reading, folded into one footer */
.about { border-top: 2px solid var(--ink); }
.about > summary { padding: 14px var(--gut); font: 700 15px/1.4 var(--mono); cursor: pointer; }
.about > summary .hint { font-weight: 400; }
.about > summary:hover, .about > summary:focus-visible { background: var(--hi); }
/* with a key saved: one line (where it's kept, the balance, change); change brings the form back */
.keybar:not(.set) .keyset { display: none; }
.keybar.set > :not(.keyset):not(#balance):not(#keystatus) { display: none !important; }
.keybar.set { padding-top: 8px; padding-bottom: 8px; }
.keyset { font: 13px/1.6 var(--mono); }
.keyset .linkish { color: var(--paper); }
.keyset .linkish:hover, .keyset .linkish:focus-visible { color: var(--ink); background: var(--hi); }
.keybar a:hover, .keybar a:focus-visible { color: var(--ink); background: var(--hi); }
.keybar input:not([type=checkbox]) {
  flex: 0 1 320px; width: auto; min-height: 36px; padding: 0 8px; border-color: var(--paper);
  background: var(--ink); color: var(--paper); font: 15px var(--mono);
}
.keybar input::placeholder { color: #bdbdbd; }
.keybar input[type=checkbox] { accent-color: var(--paper); }
.keybar .btn { min-height: 36px; }
.btn.inv { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn.inv:hover, .btn.inv:focus-visible { background: var(--hi); border-color: var(--hi); }
.btn.ghost-inv { background: var(--ink); color: var(--paper); border-color: var(--paper); }
.btn.ghost-inv:hover, .btn.ghost-inv:focus-visible { background: var(--hi); color: var(--ink); border-color: var(--hi); }
.keystatus:empty { display: none; }
.keystatus { margin-left: auto; }
.keystatus:not(:empty) + .keyfine { display: none; }
.keystatus.bad { color: #ff8a8a; }
.keystatus.ok { color: var(--ink); background: var(--hi); padding: 0 4px; }
.keyfine { margin-left: auto; }
.balance { padding: 0 6px; border: 1px solid var(--paper); white-space: nowrap; }
.keybar :focus-visible { outline-color: var(--hi); }

/* ---------- section heads ---------- */
.sechead {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px;
  padding: 12px var(--gut); border-bottom: 1px solid var(--ink);
}
.sechead h2 { font-size: 34px; line-height: 1; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.meta { font-size: 14px; }

/* ---------- the studio: characters | chat ---------- */
.studio { display: flex; flex-wrap: wrap; align-items: flex-start; border-bottom: 2px solid var(--ink); }
.chars { flex: 1.15 1 560px; min-width: 0; align-self: stretch; border-right: 1px solid var(--ink); }
/* the line between the list and the chat, to drag (split.js) */
.splitter { flex: 0 0 7px; align-self: stretch; margin-left: -4px; margin-right: -3px; position: relative; z-index: 2; cursor: col-resize; touch-action: none; }
.splitter:hover, .splitter:focus-visible, .splitting .splitter { background: var(--hi); outline: none; }
body.splitting { cursor: col-resize; user-select: none; }
.splitbtn {
  position: sticky; top: 12px; left: 0; margin: 12px 0 0 -9px; width: 26px; height: 32px; padding: 0;
  border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); font: 700 16px/1 var(--mono); cursor: pointer;
}
.splitbtn:hover, .splitbtn:focus-visible { background: var(--hi); }
/* the list hidden, like a sidebar: the chat takes the width, the line stays to bring it back */
.studio.list-hidden .chars { display: none; }
.studio.list-hidden .splitter { flex-basis: 30px; margin: 0; border-right: 1px solid var(--ink); }
.studio.list-hidden .splitbtn { margin-left: 1px; }
.chat {
  flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column;
  position: sticky; top: 0; max-height: 100vh;
}
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 12px var(--gut); border-bottom: 1px solid var(--ink); font: 14px var(--mono);
}
.filters input[type=search] { flex: 1 1 220px; width: auto; font: 15px var(--mono); }
.pick { display: flex; align-items: center; gap: 6px; }
.pick select { width: auto; font: 14px var(--mono); }
#venstatus { padding: 10px var(--gut); border-bottom: 1px solid var(--ink); }
#venstatus:empty { display: none; }
.tags { padding: 10px var(--gut); border-bottom: 1px solid var(--ink); font: 14px/1.6 var(--mono); }
.tags b { background: var(--ink); color: var(--paper); padding: 0 4px; font-weight: 400; }
.tags b .linkish { color: var(--paper); text-decoration: none; }
.tags b .linkish:hover { color: var(--ink); }

/* the left column's two tabs, set like a heading: CHATS / CHARACTERS */
.lefthead [role=tablist] { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.lefthead [role=tab] {
  padding: 0; border: 0; border-radius: 0; background: none; color: #767676; cursor: pointer;
  font: 700 34px/1 var(--serif); letter-spacing: -0.02em;
}
.lefthead [role=tab][aria-selected="true"] { color: var(--ink); }
.lefthead [role=tab]:hover, .lefthead [role=tab]:focus-visible { color: var(--ink); background: var(--hi); }
.lefthead .sep { font: 700 34px/1 var(--serif); color: var(--dim); }
.lefthead .new {
  display: inline-block; margin-left: 8px; padding: 2px 6px; vertical-align: 6px;
  background: var(--ink); color: var(--paper); font: 700 14px/1.2 var(--mono); letter-spacing: 0;
}
.chars-note, #chats-bar { font-size: 14px; }

/* your chats, the latest first */
.threads { margin: 0; padding: 0; list-style: none; }
.threads > li { border-bottom: 1px solid var(--ink); }
.trow {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 10px var(--gut);
  border: 0; border-radius: 0; background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.trow:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }
.trow:hover .tname { background: var(--hi); color: var(--ink); }
.threads > li[aria-current="true"] .trow { background: var(--ink); color: var(--paper); }
.threads > li[aria-current="true"] .face { border-color: var(--paper); }
.trow .face.small { width: 48px; height: 48px; }
.ttx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tline { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tname { font-size: 18px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.tago { flex: 0 0 auto; font: 12px var(--mono); }
.ttitle { font: 13px/1.4 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsnip { font-size: 15px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsnip.doing { font: 13px/1.5 var(--mono); }
.trow.unread .tsnip { font-weight: 700; }
.tnew {
  flex: 0 0 auto; align-self: center; min-width: 26px; padding: 2px 6px;
  background: var(--ink); color: var(--paper); font: 700 13px/1.4 var(--mono); text-align: center;
}
.threads > li[aria-current="true"] .tnew { background: var(--paper); color: var(--ink); }

.grid {
  margin: 0 -1px 0 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.grid > li { border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); min-width: 0; }
.tile {
  display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0;
  background: var(--paper); color: var(--ink); text-align: left; font: inherit; cursor: pointer;
}
.tile:focus-visible { outline: 3px solid var(--link); outline-offset: -3px; }
.tile .ph { display: block; width: 100%; aspect-ratio: 1; border-bottom: 1px solid var(--ink); overflow: hidden; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; }
.tile .tx { display: block; padding: 8px 10px 10px; }
.tile .nm { display: block; font-size: 18px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.tile .ds {
  display: -webkit-box; margin-top: 4px; font-size: 14px; line-height: 1.3;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.tile .go { display: block; margin-top: 6px; font: 12px var(--mono); color: var(--link); text-decoration: underline; }
.tile:hover .nm { background: var(--hi); }
.tile[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tile[aria-pressed="true"] .go { color: var(--paper); text-decoration: none; }
.tile[aria-pressed="true"]:hover .nm { color: var(--ink); }
.tile .x18 { align-self: flex-start; display: inline-block; margin-top: 4px; padding: 0 4px; border: 1px solid currentColor; font: 11px/1.5 var(--mono); }
.grid > li.ghost .tile { cursor: default; }
.grid > li.ghost .tx { min-height: 64px; }
/* no photo: an empty frame with an X through it */
.noface, .tile .ph.noface {
  background:
    linear-gradient(to top right, transparent calc(50% - 0.6px), var(--ink) 50%, transparent calc(50% + 0.6px)),
    linear-gradient(to bottom right, transparent calc(50% - 0.6px), var(--ink) 50%, transparent calc(50% + 0.6px)),
    var(--paper);
}
.more { padding: 12px var(--gut); font-size: 14px; }

/* the conversation, set like a script */
.chat .sechead h2 { text-transform: uppercase; }
.back { display: none; }
.log {
  flex: 1 1 auto; margin: 0; padding: 16px var(--gut); list-style: none;
  height: max(300px, calc(100vh - 450px)); overflow-y: auto; overscroll-behavior: contain;
}
.line { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 4px 14px; margin-top: 14px; }
.line:first-child { margin-top: 0; }
.line.cont { margin-top: 6px; }
/* the gallery: square tiles, newest first; a tile takes you to it in its chat */
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; padding: 0; list-style: none; max-height: 65vh; overflow: auto; }
.gal button { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.gal img, .gal video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--ink); background: var(--ink); }
.gal button:hover img, .gal button:hover video, .gal button:focus-visible img, .gal button:focus-visible video { outline: 3px solid var(--hi); }
.gal .still { position: relative; display: block; }
.gal .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 6px 10px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); font: 14px/1 var(--mono); }
.gal .cap { display: block; margin-top: 4px; font: 11px/1.4 var(--mono); overflow-wrap: anywhere; }
/* edit / delete under a message: shown on hover or focus; always, faintly, where there's no hover (phones) */
.msgtools { grid-column: 2; font: 12px/1.4 var(--mono); opacity: 0; }
.line:hover .msgtools, .line:focus-within .msgtools { opacity: 1; }
@media (hover: none) { .msgtools { opacity: 0.6; } }
@media (max-width: 640px) { .msgtools { grid-column: 1; } }
.line.cont .who { visibility: hidden; }
.who { font: 700 13px/1.6 var(--mono); text-transform: uppercase; overflow-wrap: anywhere; }
.said { white-space: pre-wrap; overflow-wrap: anywhere; }
.said pre {
  margin: 4px 0; padding: 8px 10px; border: 1px solid var(--ink); overflow-x: auto;
  white-space: pre; font: 14px/1.45 var(--mono);
}
.line.note .said, .line.typing .said { font: 14px/1.6 var(--mono); }
.line.err .said { font: 14px/1.6 var(--mono); color: var(--bad); }
.line.suggest .said { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 14px/1.6 var(--mono); }
.composer { padding: 12px var(--gut) 16px; border-top: 1px solid var(--ink); }
.sayrow { display: flex; gap: 8px; align-items: flex-end; }
.sayrow textarea { flex: 1 1 auto; min-height: 44px; max-height: 150px; padding: 10px; font: 17px/1.3 var(--serif); resize: none; }
.sayrow .btn { min-height: 44px; padding: 0 16px; }
.keynote { margin-top: 10px; font-size: 14px; }
.tools { margin-top: 8px; font: 13px/1.7 var(--mono); }
.tools .rec { color: var(--bad); }
.tools .linkish[aria-pressed="true"] { background: var(--ink); color: var(--paper); text-decoration: none; padding: 0 4px; }

/* a photo or a clip being asked for: the shot, the options, the price. The conversation makes room for it. */
.chat.asking .log { height: max(200px, calc(100vh - 720px)); }
.ask {
  flex: 0 1 auto; min-height: 0; max-height: 52vh; overflow-y: auto; padding: 12px var(--gut);
  border-top: 2px solid var(--ink); display: flex; flex-direction: column; gap: 10px;
}
.askhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; font: 700 13px var(--mono); }
.askhead .x { min-width: 32px; min-height: 32px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); cursor: pointer; font: 16px var(--mono); }
.askhead .x:hover { background: var(--hi); }
.ask label { display: flex; flex-direction: column; gap: 4px; font: 13px var(--mono); }
.ask textarea { font: 16px/1.35 var(--serif); }
.ask .opts { display: flex; flex-wrap: wrap; gap: 8px 16px; font: 13px var(--mono); }
.ask .opts:empty { display: none; }
.ask .opts label { flex-direction: row; align-items: center; gap: 6px; }
.ask .opts select { width: auto; min-height: 34px; font: 13px var(--mono); }
.ask .acts { display: flex; flex-wrap: wrap; gap: 8px; }
/* what venice saw: under a photo or clip that was turned down, the call, the answer and the prompt, to read or copy */
.ask details.saw { border: 1px dashed var(--ink); padding: 0 10px; }
.ask details.saw summary { padding: 8px 0; font: 13px var(--mono); cursor: pointer; }
.ask details.saw .acts { padding: 0 0 10px; }
pre.saw {
  margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--ink); max-height: 40vh; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.45 var(--mono);
}

/* photos, clips and voice notes in the conversation */
.line.media .said { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; white-space: normal; }
.line.media .words { white-space: pre-wrap; }
.pic { margin: 0; border: 1px solid var(--ink); width: min(100%, 340px); }
.pic img { width: 100%; height: auto; max-height: 440px; object-fit: contain; background: var(--well); cursor: zoom-in; }
/* the picture, big: it takes focus when it opens, and the focus ring (link blue) read as a blue background around it */
.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; outline: none; }
.lightbox:focus, .lightbox:focus-visible { outline: none; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.88); }
.lightbox img { max-width: 96vw; max-height: 94vh; object-fit: contain; cursor: zoom-out; }
.newcard label { display: block; margin: 12px 0; font: 14px var(--mono); }
.newcard input, .newcard textarea { display: block; width: 100%; margin-top: 4px; padding: 6px 8px; font: 16px var(--serif);
  border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); }
tr.opens { cursor: pointer; }
#roster tr.newrow .rowname { font-weight: 700; }
#roster tr.newrow[aria-current="true"] { background: var(--ink); color: var(--paper); }
#roster tr.newrow[aria-current="true"] .linkish { color: var(--paper); }
tr.opens:hover { background: var(--hi); }
.rowname { font: inherit; color: inherit; text-decoration: none; }
.rewrite { display: flex; gap: 8px; margin: 6px 0; }
.rewrite input { flex: 1 1 auto; min-width: 0; font: 14px var(--mono); padding: 6px 8px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); }
.line video { display: block; max-width: min(100%, 360px); max-height: 460px; border: 1px solid var(--ink); background: var(--ink); }
.line audio, .status audio { display: block; width: min(100%, 320px); height: 36px; }
.cap { font: 12px/1.5 var(--mono); }
.gone { font: 13px var(--mono); color: var(--dim); }
.hear { margin-left: 4px; font: 12px var(--mono); white-space: nowrap; }
/* a clip they'd like to send, with Venice's price */
.line.offer .said { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 10px; border: 1px dashed var(--ink); }
.line.offer .acts { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- your harbor ---------- */
.block { border-bottom: 2px solid var(--ink); }
.tablewrap { overflow-x: auto; padding: 16px var(--gut) 0; }
.table { width: 100%; border-collapse: collapse; font-size: 17px; }
.table th, .table td { padding: 8px 10px; border: 1px solid var(--ink); text-align: left; vertical-align: top; }
.table thead th { font: 700 13px var(--mono); padding: 6px 10px; }
.table tbody th { font-weight: 700; }
.table td.files { font: 14px var(--mono); white-space: nowrap; }
.table tr[aria-current="true"] { background: var(--ink); color: var(--paper); }
.table tr[aria-current="true"] .linkish { color: var(--paper); }
.table tr[aria-current="true"] .linkish:hover, .table tr[aria-current="true"] .linkish:focus-visible { color: var(--ink); background: var(--hi); }
.table .now { font: 12px var(--mono); margin-left: 6px; }
.table .x18 { display: inline-block; margin-left: 6px; padding: 0 4px; border: 1px solid currentColor; font: 400 11px/1.5 var(--mono); vertical-align: 2px; }
#adult-note { margin-top: -6px; }
.harbor .tablewrap { padding-bottom: 20px; }
#harbor-empty { padding: 16px var(--gut) 20px; }

/* ---------- the card ---------- */
.card .sechead h2 { overflow-wrap: anywhere; }
.tabs { display: flex; flex-wrap: wrap; gap: 0; padding: 16px var(--gut) 0; }
.tabs [role=tab] {
  min-height: 40px; padding: 0 16px; margin-right: -1px; border: 1px solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink); font: 14px var(--mono); cursor: pointer;
}
.tabs [role=tab][aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tabs [role=tab]:hover { background: var(--hi); color: var(--ink); }
.panel { margin: 0 var(--gut) 24px; padding: 18px 20px; border: 1px solid var(--ink); }
.sheet { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 0 32px; }
.sheet .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sheet label:not(.check), .remix label { display: flex; flex-direction: column; gap: 4px; font: 13px var(--mono); }
.sheet label input:not([type=checkbox]), .sheet label textarea, .sheet label select,
.remix label input, .remix textarea { font: 17px var(--serif); }
.sheet .check { font: 14px var(--mono); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.portrait { display: flex; align-items: flex-end; gap: 14px; }
.face { display: block; flex: 0 0 auto; width: 96px; height: 96px; border: 1px solid var(--ink); overflow: hidden; }
.face img { width: 100%; height: 100%; object-fit: cover; }
p.note { padding: 8px 10px; border: 1px solid var(--ink); background: var(--hi); font-size: 16px; }
.hint { font-size: 12px; font-weight: 400; }
.group { border: 1px solid var(--ink); padding: 0 12px; }
.group[open] { padding-bottom: 12px; }
.group summary { padding: 10px 0; font: 13px var(--mono); cursor: pointer; }
.items { margin: 0 0 10px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: it; }
.items > li { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px dashed var(--ink); }
.items > li .rm { align-self: flex-start; }
.refs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.ref { margin: 0; display: flex; flex-direction: column; gap: 4px; font: 12px var(--mono); }
.face.small { width: 72px; height: 72px; }
#look-group label, #speech-group label { margin-top: 10px; }
#speech-group .check { margin-top: 10px; }
#speech-group p.mono { margin-top: 8px; }
#speech-status { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#portrait-status, #look-status { display: block; margin-top: 6px; }
#portrait-status:empty, #look-status:empty { display: none; }
/* what they remember: a list of notes, each with a way to forget it */
#memory-how { margin-bottom: 10px; }
.notes { margin: 0 0 10px; padding-left: 20px; font-size: 16px; }
.notes li + li { margin-top: 4px; }
.notes .linkish { font: 12px var(--mono); }
.notes li.empty { list-style: none; margin-left: -20px; font: 13px var(--mono); }
.notes li.faint { opacity: 0.55; }
#memory-add { font: 17px var(--serif); }
#memory-group p.mono { margin-top: 8px; }
.lineage h3 { font: 700 13px var(--mono); margin-bottom: 4px; }
.lineage-list { margin: 0 0 4px; padding-left: 20px; font-size: 16px; }
.lineage-list:empty::before { content: "nothing yet: written here."; font: 13px var(--mono); margin-left: -20px; }
.why { font: 12px var(--mono); }

.remix { display: flex; flex-direction: column; gap: 14px; max-width: 860px; }
.remix .lede { font-size: 21px; }
.steps { margin: 0; padding-left: 22px; }
.steps li + li { margin-top: 4px; }
.ideas { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--ink); padding-top: 12px; }
.ideas .grp h4 { margin: 0 0 6px; font: 700 13px var(--mono); }
.ideas .grp > input { font: 17px var(--serif); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 6px 6px 0; padding: 2px 4px 2px 8px;
  border: 1px solid var(--ink); font: 14px var(--mono); vertical-align: top;
}
.chip button { min-width: 26px; min-height: 26px; padding: 0; border: 0; background: none; cursor: pointer; font: 16px var(--mono); }
.chip button:hover { background: var(--hi); }
.chip.add { padding: 0; border-style: dashed; }
.chip.add input { min-height: 28px; width: 150px; border: 0; padding: 0 8px; font: 14px var(--mono); }
.draft { border: 2px solid var(--ink); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.draft h4 { margin: 0; font-size: 28px; }
.draft .tagline { font-style: italic; }
.draft .persona { font-size: 17px; }
.verdict { align-self: flex-start; padding: 2px 8px; border: 1px solid var(--ink); font: 700 13px var(--mono); }
.verdict.fresh { background: var(--ink); color: var(--paper); }
.verdict.close { background: var(--hi); }
.verdict.too-close { background: var(--bad); border-color: var(--bad); color: var(--paper); }
.why-list { margin: 0; padding-left: 20px; font: 13px var(--mono); }
.draft .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.draft .edfield { display: flex; flex-direction: column; gap: 3px; }
.draft .edfield input, .draft .edfield textarea { width: 100%; border: 1px solid var(--ink); background: transparent; color: inherit; padding: 6px 8px; font: inherit; border-radius: 0; }
.draft .edfield textarea { resize: vertical; font-size: 17px; line-height: 1.4; overflow: hidden; }
.draft .edfield .ed-name { font-size: 26px; font-weight: 700; }
.draft .edfield .ed-tagline { font-style: italic; }
.draft .rewrite { display: flex; gap: 8px; }
.draft .rewrite input { flex: 1; min-width: 0; border: 1px solid var(--ink); background: transparent; color: inherit; padding: 6px 8px; font: inherit; border-radius: 0; }

.exports { margin: 0 0 12px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0; }
.exports li { margin: 0 -1px -1px 0; }
.out {
  display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; padding: 12px 14px; border: 1px solid var(--ink);
  border-radius: 0; background: var(--paper); color: var(--ink); text-align: left; cursor: pointer;
}
.out b { font: 700 14px var(--mono); }
.out span { font-size: 16px; }
.out:hover, .out:focus-visible { background: var(--hi); }

/* ---------- the rows below ---------- */
.row { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--ink); }
.row.last { border-bottom: 2px solid var(--ink); }
.row > h2 { flex: 0 0 260px; padding: 20px var(--gut); font: 700 14px var(--mono); }
.row > .body { flex: 1 1 480px; min-width: 0; max-width: 880px; padding: 20px var(--gut); display: flex; flex-direction: column; gap: 10px; }
.row ol, .row ul { margin: 0; padding-left: 24px; }
.row li + li { margin-top: 4px; }
.pre {
  margin: 0; padding: 14px; border: 1px solid var(--ink); white-space: pre-wrap; overflow-wrap: anywhere;
  font: 15px/1.5 var(--mono);
}
.prices { border-collapse: collapse; font: 15px var(--mono); }
.prices th { padding: 5px 16px 5px 0; text-align: left; font-weight: 400; vertical-align: top; }
.prices td { padding: 5px 0; }
.foot { padding: 14px var(--gut) 28px; font-size: 14px; }

/* ---------- dialog and toast ---------- */
.dlg {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 2px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink);
}
.dlg::backdrop { background: var(--veil); }
.dlg.wide { width: min(1040px, calc(100vw - 32px)); }
.mtable { max-height: min(58vh, 560px); overflow: auto; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.mfind { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mfind input[type=search] { flex: 1 1 220px; width: auto; }
.models { font-size: 16px; }
.models thead th { position: sticky; top: 0; background: var(--paper); }
.models tbody th .mid { display: block; font: 12px/1.4 var(--mono); font-weight: 400; overflow-wrap: anywhere; }
.models td { font: 13px/1.5 var(--mono); }
.models td.num { white-space: nowrap; }
.models tr[aria-current="true"] .mid { color: var(--paper); }
.tablewrap.flush { padding: 0; }
.abilities tbody th { white-space: nowrap; font: 700 13px var(--mono); }
.abilities td { font-size: 16px; }
.abilities td.how { font: 13px/1.6 var(--mono); }
.abilities .check { font: 14px var(--mono); }
.abilities select { width: auto; min-height: 30px; padding: 0 4px; font: 13px var(--mono); }
.dlg h2 { padding: 10px 16px; background: var(--ink); color: var(--paper); font: 700 15px var(--mono); }
.dlgbody { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.dlgbody label { display: flex; flex-direction: column; gap: 4px; font: 13px var(--mono); }
.dlgbody label.check { flex-direction: row; align-items: center; gap: 8px; }
.dlgbody label.pick { flex-direction: row; align-items: center; gap: 6px; }
.dlgbody textarea { font: 17px var(--serif); }
.drop {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 18px;
  border: 1px dashed var(--ink); cursor: pointer;
}
.drop b { font: 700 15px var(--mono); }
.drop.over, .drop:hover, .drop:focus-visible { background: var(--hi); }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.toast {
  position: fixed; left: 16px; bottom: 16px; z-index: 20; max-width: min(560px, calc(100vw - 32px));
  padding: 10px 14px; background: var(--ink); color: var(--paper); border: 1px solid var(--paper); font: 14px/1.4 var(--mono);
}

/* ---------- narrow screens ---------- */
@media (max-width: 1040px) {
  .splitter { display: none; }
  .chars { border-right: 0; border-bottom: 1px solid var(--ink); }
  /* one at a time, like a phone's messages: the list, or the chat. In the chat the left column's tabs stay above it,
     without their panels, so CHATS / CHARACTERS / HARBOR are always one tap away */
  .studio.pane-list .chat { display: none; }
  .studio.pane-chat .chars [role=tabpanel] { display: none; }
  .studio.pane-list .chars { border-bottom: 0; }
  .chat .back { display: none; }
  .grid { margin-right: 0; }
  .chat { position: static; max-height: none; }
  /* the conversation takes what the screen has left under the tabs and above the composer */
  .log, .chat.asking .log { height: max(360px, calc(100dvh - 300px)); }
  .ask { max-height: none; }
}
@media (max-width: 640px) {
  :root { --gut: 16px; }
  body { font-size: 18px; }
  .mast { gap: 8px; padding-top: 14px; }
  .motto br { display: none; }
  .nav { margin-left: 0; }
  .keybar { gap: 8px 10px; }
  .keybar input:not([type=checkbox]) { flex: 1 1 100%; }
  .keyfine, .keystatus { margin-left: 0; }
  .sechead h2 { font-size: 28px; }
  /* the three tabs on one line: smaller, a dot between them instead of a slash */
  .lefthead [role=tablist] { flex-wrap: nowrap; gap: 0 10px; }
  .lefthead [role=tab] { font-size: 21px; white-space: nowrap; }
  .lefthead .sep { font-size: 0; }
  .lefthead .sep::before { content: "\00b7"; font: 700 21px/1 var(--serif); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid > li:nth-child(2n) { border-right: 0; }
  .line { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .line.cont .who { display: none; }
  .panel { margin: 0 0 16px; padding: 14px var(--gut); border-left: 0; border-right: 0; }
  .tabs { padding-top: 12px; }
  .two { grid-template-columns: 1fr; }
  .row > h2 { flex-basis: 100%; padding-bottom: 0; }
  /* the harbor as a list of entries, not a squeezed table */
  .tablewrap { padding-top: 12px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table th, .table td { display: block; }
  .table tr { border: 1px solid var(--ink); margin-bottom: -1px; padding: 8px 0; }
  .table th, .table td { border: 0; padding: 2px 12px; }
  .table td:nth-of-type(1), .table td:nth-of-type(2) { font: 13px var(--mono); }
  .table td.files { padding-top: 6px; white-space: normal; }
}
/* phones and other touch screens: a field under 16px makes iOS Safari zoom in when it's tapped, and the page stays
   zoomed in, cut off at the sides */
@media (max-width: 640px), (pointer: coarse) {
  .keybar input:not([type=checkbox]), .filters input[type=search], .pick select, .ask .opts select, .abilities select, .rewrite input,
  .chip.add input { font-size: 16px; }
}
/* a small phone (an iPhone SE is 375px wide): the left column's tabs a little smaller, so a count of what's new fits */
@media (max-width: 400px) {
  .lefthead [role=tablist] { gap: 0 8px; }
  .lefthead [role=tab] { font-size: 19px; }
  .lefthead .sep::before { font-size: 19px; }
}
/* a new version is out: a bar at the top to reload (update.js) */
#upd {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 30;
  padding: 9px 16px; border: 1px solid var(--paper); border-radius: 0; background: var(--ink); color: var(--paper);
  font: 700 13px/1 var(--mono); letter-spacing: .12em; white-space: nowrap; cursor: pointer;
}
#upd:hover, #upd:focus-visible { background: var(--hi); color: var(--ink); border-color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
