/*
 * Mobile first, measured at 390x844.
 *
 * The shell is one column of three rows: bar, screen, dock. Only the middle scrolls, and the
 * staged topic scrolls with it — it is the last block inside `#screen`, as tall as its own
 * content, because a card given a share of the viewport and its own scrollbar is a proposal
 * you have to scroll to read.
 *
 * Three screens share those rows. `body[data-view]` is the only switch: home and a
 * conversation both keep the dock; the list of conversations does not, because a list is not
 * a place you write.
 *
 * The palette is v7's, which was right: a deep blue-teal ink for the ground, one accent, and
 * colour that means exactly one thing and never appears without a glyph beside it. Vermilion
 * is rising — what this stretch is for, now. Cyan is falling — something already over, kept
 * for the next time it comes round. Both are the chevrons of the app's own mark.
 */
:root {
  /* The ground and the surfaces above it. Four steps, all the same hue as the mark's plate. */
  --ground: #09181B;
  --low:    #0D2126;
  --raised: #102A30;
  --quiet:  #0C1F23;
  --line:   #1A373D;
  --edge:   #22484F;

  /* Two greys over the ground, and a third only for what is deliberately ghosted. */
  --ink:   #E7EFF0;
  --dim:   #8AA5A9;
  --faint: #5E7F85;

  /* One accent, and its counterpart. Never used without the chevron that says which. */
  --rise: #E84341;
  /* The register between the ordinary text and `--rise`: worth acting on, nothing is wrong. */
  --amber: #E8A33D;
  --fall: #4EC7E8;
  --on-rise: #2A0B0A;

  --gap: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  /*
   * `dvh` handles the iOS URL bar; it does NOT handle the on-screen keyboard, which on
   * Android Chrome overlays the viewport without resizing it — so the line they write on ends
   * up behind the keyboard, which is the one control that must never be out of reach.
   * `--kb` is the keyboard's height, measured from `visualViewport` in app.js, 0 when closed.
   */
  height: calc(100dvh - var(--kb, 0px));
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Never let the phone shrink Hebrew or inflate English on rotation. */
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

/* A list is not a place you write, and neither is the copy screen. */
body[data-view="past"] #dock,
body[data-view="copy"] #dock { display: none; }

/*
 * Before the record is open there is nothing to show and nothing to write on. Nothing here
 * hides the staged topic: it is not in the document until a conversation has one, and it is
 * built in `app.js` rather than declared in `index.html` precisely so there is no such rule
 * to get wrong. Not `display: none` on the bar either: the language toggle has to stay,
 * because the sentence shown while the record opens has to be readable in the reader's own
 * language.
 */

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* Our own small words, wherever they label something of theirs. */
.k {
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--dim);
}

/* ── the bar ─────────────────────────────────────────────────────────────────────────── */
/*
 * Two controls and a name. Three columns rather than flex, so the name stays centred whatever
 * the one control is called — `Conversations` and `Back` are very different widths, and a
 * title that slides sideways as you move between screens reads as a wobble.
 *
 * The columns are assigned by hand rather than left to source order, because before the
 * record is open `#nav` is not in the document at all: with `auto` placement the mark would
 * slide into the first column for that moment and the bar would lurch as the app opened.
 */
#bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--gap);
  padding: max(8px, env(safe-area-inset-top)) var(--gap) 8px;
  border-bottom: 1px solid var(--line);
}

#nav { grid-column: 1; }
#mark { grid-column: 2; }
#lang { grid-column: 3; }

/*
 * The mark, and under it the one fact that has to be true on every screen: when a copy of
 * this record was last saved to a file. Two lines in the centre column, so the bar still
 * has exactly two controls and the copy is a fact rather than a third one.
 */
#mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
}

#name {
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--dim);
}


/* No copy at all, of a record that exists only here. The one place the accent earns itself. */

#nav, #lang {
  font-size: 14px;
  color: var(--dim);
  padding: 6px 2px;
  min-height: 34px;
  white-space: nowrap;
}

#nav { justify-self: start; }
#lang { justify-self: end; }
#nav:active, #lang:active { color: var(--ink); }

/* ── the screen ──────────────────────────────────────────────────────────────────────── */
#screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /*
   * Room for the fixed dock, so the last thing in the transcript is never behind it — the
   * last line said, or the staged topic's two answers. `--dock` is its measured height,
   * published from `app.js`; the fallback is what it measures with a one-row line.
   */
  scroll-padding-bottom: var(--dock, 84px);
  -webkit-overflow-scrolling: touch;
  padding: var(--gap);
  padding-bottom: calc(var(--dock, 84px) + var(--gap));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── the chevron, which is the mark's own ────────────────────────────────────────────── */
/*
 * One path, four rotations. Up is rising and vermilion, down is falling and cyan — those two
 * are the only coloured things in the app. Left and right are the same glyph turned on its
 * side to move the carousel, and they are grey, because moving between topics is not a
 * judgement about any of them.
 */
/* `height: auto` keeps the viewBox ratio: a width is the only thing ever set on one. */
.chev { display: block; flex: 0 0 auto; height: auto; fill: currentColor; overflow: visible; }
.chev.left  { transform: rotate(-90deg); }
.chev.right { transform: rotate(90deg); }
.chev.down  { transform: rotate(180deg); }

/*
 * The check mark, which is the only glyph here that is not the chevron: the one outcome a
 * waiting thing can have, asked for by name. Stroked rather than filled, at the chevron's
 * own weight, and it carries no colour of its own — vermilion and cyan mean rising and
 * falling, and a thing sorting itself out is neither.
 */
.tick {
  display: block;
  flex: 0 0 auto;
  width: 20px;
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── home: the carousel of topics ────────────────────────────────────────────────────── */
/*
 * One topic on screen at a time. The rail holds them all side by side and is moved by a
 * transform: the chevrons set the index, a drag adds an offset to it, and both land in the
 * same place. `overflow: clip` rather than `hidden` so the rail does not become a scroll
 * container and steal the page's vertical scroll.
 */
#deck {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Cancel the screen's padding: a topic slides in from the true edge of the phone. */
  margin: 2px calc(-1 * var(--gap)) 0;
}

/*
 * The clip runs to the true edge of the phone and the gutter lives on each topic instead, so
 * one topic is exactly one rail-width from the next: a slide is `100%` and nothing of the
 * neighbour shows in the margin. `overflow: clip` rather than `hidden` so the rail does not
 * become a scroll container and steal the page's vertical scroll.
 */
.rail-clip {
  overflow: clip;
  /* Set from JS to the live topic's height; animated so a swipe between a short topic and a
     tall one does not jump the page under the finger. */
  transition: height 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.rail {
  display: flex;
  align-items: flex-start;
  /* The finger owns the horizontal; the browser keeps the vertical scroll it always had. */
  touch-action: pan-y;
  will-change: transform;
}

.rail.settling { transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1); }

.topic {
  flex: 0 0 calc(100% - 2 * var(--gap));
  margin: 0 var(--gap);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
  /*
   * No hairline. The fill is what raises it: `--raised` is two steps above `--ground`, which
   * is a difference the eye reads as depth without a line it has to resolve first. The one
   * drawn edge a topic still has is the `box-shadow` below, which is not decoration — it is
   * the only thing that says now from next.
   */
  border: 0;
  border-radius: 16px;
  background: var(--raised);
  padding: 15px 16px 14px;
  /* Never let a drag select the name instead of moving the carousel. */
  user-select: none;
}

/* A topic is one of two kinds, and the kind is a hairline at its head, never a word. */
.topic[data-mode="now"]  { box-shadow: inset 0 2px 0 -1px var(--rise); }
.topic[data-mode="next"] { box-shadow: inset 0 2px 0 -1px var(--fall); }

/* ── the crown: which topic this is, and when it last moved ──────────────────────────── */
/*
 * The name and the time on one row. The time is set in the same small grey as the name and
 * separated by space rather than by a rule, so it reads as part of the title rather than as a
 * stamp applied to it.
 */
.crown {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.crown .chev { width: 13px; }
.topic[data-mode="now"]  .crown .chev { color: var(--rise); }
.topic[data-mode="next"] .crown .chev { color: var(--fall); }

.crown .name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--dim);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crown .since {
  margin-inline-start: auto;
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ── the one thing ───────────────────────────────────────────────────────────────────── */
/*
 * The most prominent thing on the screen, and everything else defers to it. Nothing else in
 * the app is set above 17px.
 */
.one {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.one p { margin: 0; overflow-wrap: anywhere; }

.one .matters {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.one .how {
  font-size: 16px;
  line-height: 1.5;
  color: var(--dim);
  margin-top: 2px;
}

/* Where a one thing came from, on the few that came from a re-run rather than from the
 * conversation itself. Quieter than `how`, which is theirs; this is the record explaining
 * itself, and it must never compete with the thing it is a footnote to. */
.one .fromrun {
  font-size: 13px;
  line-height: 1.5;
  color: var(--faint);
  margin-top: 6px;
}

/* A topic with no focus yet: an open space that says what it is for, not an error. */
.one .waitingfor {
  font-size: 17px;
  line-height: 1.5;
  color: var(--faint);
}

/* ── how the one thing ended ─────────────────────────────────────────────────────────── */
/*
 * Two answers, one tap each, under the thing they are about and above what the card is
 * holding. A hairline over them, so they read as something asked of the one thing rather
 * than as two more lines of it.
 *
 * **No accent colour on either.** Vermilion and cyan mean rising and falling here and never
 * appear without a chevron beside them, and neither of these is that: "it never happened" is
 * not a fall, it is an evening where something else took the stretch.
 *
 * The difference between them is weight and distance, which is how every other pair of
 * controls in this app is separated. `well` is in ink because it is the answer somebody
 * reaches for; `missed` is one step down and at the far end, where a stray thumb cannot take
 * it — but it is `--dim` and not `--faint`, because a control set in the grey reserved for
 * things that are barely there would read as the wrong answer, and it is not one.
 */
.topic .ended {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.topic .ended button {
  min-height: 40px;
  padding: 8px 0;
  font-size: 14px;
  white-space: nowrap;
}

.topic .ended .well   { color: var(--ink); }
.topic .ended .missed { margin-inline-start: auto; font-size: 13px; color: var(--dim); }
.topic .ended button:active   { opacity: 0.6; }
.topic .ended button:disabled { opacity: 0.4; }

/* ── what a card is holding ──────────────────────────────────────────────────────────── */
/*
 * On a real topic this is one faint line and a count. The rows themselves live in the card
 * below, once: the same things were listed here *and* there, so everything set aside stood on
 * home twice. The line stays because a card that says nothing about what it holds has lost
 * the promise — focus on this, and three things are held for you.
 *
 * A proposal is the other case and keeps the list, editable, because the things it would
 * shelve are most of what is being agreed to. `.shelf` and `.held` are that card only now.
 */
.topic .holding {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 11px;
  font-size: 13px;
  color: var(--faint);
}

.shelf {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

.held {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
  /* One row, one height, whatever is in it. */
  min-height: 28px;
}

.held .pip {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  background: var(--faint);
  transform: rotate(45deg);
  translate: 0 -2px;
}

.held .what {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--faint);
  overflow-wrap: anywhere;
}

.held .until {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--faint);
  opacity: 0.85;
}

/* Finishing with a whole topic. Quieter than anything on it. */
.topic .retire {
  align-self: flex-end;
  margin-top: -4px;
  font-size: 12px;
  color: var(--faint);
  padding: 6px 2px;
  min-height: 32px;
}

.topic .retire[data-sure="1"] { color: var(--rise); }
.topic .retire:disabled { opacity: 0.4; }

/* ── moving between topics ───────────────────────────────────────────────────────────── */
/*
 * Two chevrons and a dot for each topic. They and the swipe are the same control: both set
 * the index, and the rail is painted from it. The row is laid out in the interface direction,
 * so `previous` is on the right in Hebrew, and each chevron points the way it will move.
 */
.steer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 var(--gap);
}

.steer .go {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  color: var(--faint);
}

.steer .go .chev { width: 15px; }
.steer .go:active { color: var(--ink); }
.steer .go:disabled { opacity: 0.3; cursor: default; }

.steer .dots { display: flex; gap: 6px; padding: 0 4px; }

.steer .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line);
}

.steer .dot.on { background: var(--dim); }

/* The offer, when there is no topic at all. The only thing on the screen, so it carries it. */
.offer {
  margin: 18px 0 4px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}

/* ── home: the card of what waits ────────────────────────────────────────────────────── */
/*
 * Everything waiting, across every topic, in one card under the carousel — shut when home
 * is painted and opening on a tap of its head. This is the only place a waiting thing is
 * written down and the only place it can be acted on, so there is never a live control and a
 * stale one for the same row.
 *
 * A row is a grid rather than a flex line because its controls must be whole tap targets on
 * a 390px screen with Hebrew or English in front of them. Squeezed onto the line beside the
 * words they would either wrap under a long thing or shrink under a short one, and a control
 * whose width depends on a sentence is a control that goes missing.
 */
.stack {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/*
 * The head is the whole control, so opening the card is a thumb anywhere along the row and
 * not a 13px chevron. With nothing waiting it is a `div` and not a button, and carries
 * neither count nor chevron: a zero is a score, and a control that opens nothing is a lie.
 */
.stack .head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  text-align: start;
}

.stack .tally { font-size: 13px; color: var(--faint); }
.stack .head .chev { width: 13px; margin-inline-start: auto; color: var(--faint); }
.stack .head:active .k, .stack .head:active .tally, .stack .head:active .chev {
  color: var(--ink);
}

/* Shut is the state home is painted in. `display: none`, so nothing in it is tabbable. */
.stack[data-open="0"] .waiting { display: none; }

.waiting {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.waits {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: var(--gap);
  row-gap: 3px;
  padding: 9px 0;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.waiting .waits:last-child { border-bottom: 0; }

.waits .what {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

/* Which topic, and when it was set aside. The topic's name is the louder of the two. */
.waits .from { justify-self: start; font-size: 12px; color: var(--dim); }
.waits .when { justify-self: end; font-size: 12px; color: var(--faint); }

/*
 * The three things that can happen to a row, in three weights, on their own line so each is
 * a whole 40px target whatever the words are.
 *
 * No accent colour on any of them until one is armed: vermilion and cyan mean rising and
 * falling here and never appear without a chevron, and none of these is a judgement about
 * the thing. So the difference is weight. The check mark is the outcome, in ink; coming back
 * for something is a quiet line, because it was one of two equal buttons and the owner's
 * word was that there should be one; taking a thing off is the faintest, at the far end,
 * where a stray thumb costs a question rather than a row.
 */
.waits .moves {
  grid-row: 3;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.waits .pick {
  min-height: 40px;
  padding: 8px 0;
  font-size: 14px;
  white-space: nowrap;
  color: var(--dim);
}

.waits .settled {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 40px;
  color: var(--ink);
}

.waits .drop {
  min-height: 40px;
  padding: 8px 0;
  font-size: 13px;
  white-space: nowrap;
  color: var(--faint);
}

/* Armed, and the one place on this row colour is allowed: it is about to take something. */
.waits .drop[data-sure="1"] { color: var(--rise); }
.waits .pick:active, .waits .settled:active, .waits .drop:active { opacity: 0.6; }
.waits .pick:disabled, .waits .settled:disabled, .waits .drop:disabled { opacity: 0.4; }

/* Nothing waiting is the good outcome, so it is a plain sentence and not an empty frame. */
.stack .none { margin: 0; font-size: 15px; color: var(--faint); }

/* ── home: a few recent conversations ────────────────────────────────────────────────── */
.lately {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.lately .opener {
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 0;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.lately .opener:last-child { border-bottom: 0; }
.lately .when { font-size: 12px; color: var(--faint); }

.lately .line {
  margin: 0;
  color: var(--dim);
  /* One line here. The full text is one tap away and this is a pointer, not a preview. */
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── the transcript ──────────────────────────────────────────────────────────────────── */
.said {
  margin: 0;
  max-width: 88%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.said.user {
  align-self: flex-end;
  /*
   * Their own words, filled rather than outlined. This is the one bubble in the thread —
   * harpu's reply is plain text on the ground — so the fill is what distinguishes it, and
   * `--low` is a step up from the ground without becoming a card.
   */
  background: var(--low);
  border: 0;
  border-radius: 14px 14px 4px 14px;
  padding: 9px 12px;
}

.said.harpu {
  align-self: flex-start;
  max-width: 100%;
}

.note {
  margin: 0;
  align-self: center;
  font-size: 14px;
  color: var(--dim);
  text-align: center;
}

/*
 * Over the screen and then gone.
 *
 * Sits above the dock rather than inside it, and tracks the keyboard the same way the dock
 * does — measured at 390x844 the dock is 113px tall once the two closing buttons are in it,
 * so a toast pinned to the viewport bottom would cover the very control it is acknowledging.
 * `pointer-events: none` because it must never eat a tap meant for what is underneath.
 */
.toast {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--kb, 0px) + var(--dock, 84px) + 10px);
  z-index: 4;
  margin: 0 auto;
  width: fit-content;
  max-width: calc(100% - 2 * var(--gap));
  pointer-events: none;
  padding: 9px 14px;
  border: 0;
  border-radius: 14px;
  /*
   * A step higher than the cards, because this one floats over them: `--edge` as a fill
   * rather than as a line. It is the one surface in the app that overlaps another, so it is
   * the one that has to separate itself by tone rather than by sitting in the flow.
   */
  background: var(--edge);
  font-size: 14px;
  text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 160ms ease-out; }
  @keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
  }
}

.none { color: var(--dim); margin: 0; }

/* ── the staged topic, inside the conversation ───────────────────────────────────────── */
/*
 * The same component as home, in the conversation, so what is being agreed to looks exactly
 * like what it will become. Every line of it is editable until the tap: wording a model
 * invented is catchable by nobody but the person who said the thing.
 *
 * It is the last block inside `#screen`, in document order after the exchange that produced
 * it, and it is exactly as tall as its content. Four layouts are named here so none of them
 * comes back. As a content-sized flex sibling of the transcript it ran under the fixed dock
 * and 49px of both answers were untappable. Allowed to shrink (`0 1 auto`) flexbox squeezed
 * it below the height of its own answer row, which then hung 8px past its edge. Stopped from
 * shrinking under a `calc()` ceiling it overflowed the shell. Out of flow — `position: fixed`
 * above the dock, `max-height: min(56dvh, …)` — nothing collided any more, but 56dvh is 472px
 * of an 844px phone, and a topic with twenty things waiting got its own scrollbar inside that
 * window: a proposal you have to scroll to read. So there is no ceiling and no internal
 * scroll. The transcript already scrolls; this rides in it like anything else said.
 *
 * `flex: 0 0 auto` is the one load-bearing declaration. `#screen` is an overflowing flex
 * column, and a shrinkable child in one is squeezed toward its min-content height — for a
 * card of textareas that is a single line each, which is bug two above, from the inside.
 */
#draft {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

/*
 * Inside the conversation it is already framed by the region, so it drops its own frame —
 * and the carousel's gutter with it: here the region's padding is the margin.
 */
#draft .topic {
  flex: 0 0 auto;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: var(--raised);
  user-select: auto;
}

/*
 * Every field is a textarea wearing the type it will have on home. No boxes: a bordered field
 * would make this a form, and it is a preview of a topic.
 */
#draft textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  resize: none;
  overflow: hidden;
  display: block;
}

#draft textarea:focus {
  outline: none;
  /* Only once they are in it: the one hairline that says this can be changed. */
  box-shadow: 0 1px 0 0 var(--edge);
}

#draft .name     { font: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0.02em; color: var(--dim); white-space: normal; }
#draft .matters  { font-size: 30px; font-weight: 600; line-height: 1.22; letter-spacing: -0.015em; }
#draft .how      { font-size: 16px; line-height: 1.5; color: var(--dim); }
#draft .what     { font-size: 15px; line-height: 1.45; color: var(--faint); }
#draft .until-in { font-size: 12px; color: var(--faint); }

/*
 * Directly under the topic it answers, in the conversation's own scroll.
 *
 * It was `position: sticky; bottom: 0` with the card's background under it, because the card
 * had an internal scroll box and these two controls had to survive it. The card has no such
 * box now, so this is simply the last thing in the transcript, and `#screen`'s reserved
 * bottom padding is what keeps it clear of the fixed dock.
 */
.answer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 0;
}

.answer .yes {
  flex: 1;
  min-height: 46px;
  border-radius: 12px;
  background: var(--rise);
  color: var(--on-rise);
  font-weight: 600;
}

.answer .yes:disabled { opacity: 0.55; }

/* Saying no is an answer, not a failure: same weight of type, no alarm colour. */
.answer .no {
  min-height: 46px;
  padding: 0 14px;
  color: var(--dim);
}

.answer .no:disabled { opacity: 0.55; }

/* ── what was put up to keep ─────────────────────────────────────────────────────────── */
/*
 * Not `#draft`, and deliberately nothing like it when it is a sentence. A staged topic is the
 * hero card at full size because it is about to become home; a line somebody can keep or walk
 * away from is the size of a sentence, in the transcript's own scroll, at the end of the
 * exchange that produced it.
 *
 * One panel in two places, because it is one idea. `#offer` is the follow-up's slot under the
 * transcript; a run's offers are appended straight into `#screen` beside the version that
 * made them. `.offered` is the panel itself and carries everything that is about the offer;
 * the two containers only say where it sits.
 *
 * A sentence wears the two lines the memory screen uses for a claim — who it is about, then
 * what was said about them — so that the row they meet under `זכרון` next month is
 * recognisably the one they agreed to here. A card wears the topic card, because what is
 * being agreed to should look like what it becomes.
 */
#offer,
#screen > .offered {
  margin-top: 6px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

#screen > .offered { align-self: stretch; }

.offered .reading { min-width: 0; }
.offered .who   { margin: 0; font-size: 13px; font-weight: 600; color: var(--dim); overflow-wrap: anywhere; }
.offered .reads { margin: 0; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }

/*
 * The one question that is his, and the two answers to it.
 *
 * The question is a line of its own above the row rather than a label on either button: at
 * 23:00 the thing that has to be readable in a second is what is being asked, and two buttons
 * reading "for now" and "to that day" with nothing over them are a puzzle. Same weight as the
 * rest of the panel's prose — this is not a warning and must not wear one.
 */
.offered .when {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--dim);
}

.offered .answer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px;
  margin-top: 6px;
}

.offered .keep,
.offered .no {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 0;
  font-size: 14px;
  white-space: nowrap;
  color: var(--ink);
}

/* The one that writes nothing is the quieter of the three, in the same grey every other
 * walk-away control in this app wears. */
.offered .no { color: var(--faint); }

.offered .keep:active,
.offered .no:active   { opacity: 0.6; }
.offered .keep:disabled,
.offered .no:disabled { opacity: 0.4; }

/* One offer, the follow-up's, with its single control beside the sentence rather than under
 * it: there is one thing to read and one thing to do, and a row of its own would be a beat. */
#offer .offered { display: flex; align-items: baseline; gap: 12px; }
#offer .offered .reading { flex: 1 1 auto; }
#offer .offered .answer { margin-top: 0; }

/*
 * Nothing came of it, which is the ordinary outcome and is said rather than left as a gap.
 * One plain line, in the same grey as "nothing is waiting" on home, for the same reason: it
 * is not an error and must not wear one.
 */
#offer .none { margin: 0; font-size: 14px; line-height: 1.5; color: var(--faint); }

/* ── the line they write on ──────────────────────────────────────────────────────────── */
/*
 * Fixed to the bottom of the visual viewport, not merely last in a flex column.
 *
 * As a flex child it depended on the shell being exactly as tall as the visible area, and on
 * a phone it is not: the URL bar comes and goes, and the on-screen keyboard overlays without
 * resizing. Either one pushed the line off the bottom. The one control that must always be
 * reachable cannot be the one that depends on the layout being right, so it is pinned and
 * `--kb` lifts it over the keyboard. #screen carries matching bottom padding so the last
 * thing written is never underneath it.
 */
#dock {
  position: fixed;
  inset-inline: 0;
  bottom: var(--kb, 0px);
  z-index: 3;
  border-top: 1px solid var(--line);
  padding: 8px var(--gap) max(8px, env(safe-area-inset-bottom));
  background: var(--ground);
}

#held {
  font-size: 13px;
  color: var(--dim);
  padding: 0 2px 6px;
}

#held[hidden] { display: none; }

#line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#in {
  flex: 1;
  font: inherit;
  /* 16px or iOS zooms the whole page on focus and never zooms back. */
  font-size: 16px;
  color: var(--ink);
  background: var(--low);
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}

#in:focus { outline: none; border-color: var(--edge); }

#send {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--low);
  border: 0;
  font-size: 15px;
}

#send:active { background: var(--line); }

/* ── the end of a thread ─────────────────────────────────────────────────────────────── */
/*
 * When it is done there is nothing left to write, so the line goes and the only two answers
 * to "that's everything" take its place at the same height, in the same reach.
 */
#shut {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

#shut[hidden] { display: none; }

#done, #more {
  flex: 1;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 15px;
}

#done {
  background: var(--rise);
  color: var(--on-rise);
  font-weight: 600;
}

#more {
  background: var(--low);
  border: 0;
  color: var(--dim);
}

#more:active { background: var(--line); }

/* ── how it went ─────────────────────────────────────────────────────────────────────── */
/*
 * Above the two answers, in the same fixed dock, and quieter than them: this is an aside at
 * the end of a conversation, not the thing the conversation was for.
 *
 * No colour on either, for the reason the two moves on home carry none — vermilion is
 * rising and cyan is falling, both of them about a topic, and neither is a judgement about
 * a conversation. The chevron is the glyph that says which way this one is.
 */
#felt {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-bottom: 8px;
}

#felt[hidden] { display: none; }

#felt button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--dim);
}

#felt .chev { width: 12px; }
#felt button:active { color: var(--ink); background: var(--quiet); }

/* ── the two panels: what it was like, and the question on the way in ────────────────── */
/*
 * One box, twice. Both are real `<dialog>`s because a view with no route out shipped once:
 * `#feel` closes on Escape, on the × in its corner, on the word beside send and on the
 * ground around it. `#asked` closes on its two answers and on nothing else, which is the
 * one thing it does differently and is argued where it is built — a dismissal is not an
 * answer to a question asked once. `showModal` is what makes the ground inert in both, so
 * nothing behind can be tapped by mistake while one is open.
 *
 * `[open]` on every rule that shows it: an author `display` with no `[open]` would beat the
 * browser's own `dialog:not([open]) { display: none }` and put the panel on screen in the
 * moment between being built and being opened.
 *
 * Pinned above the keyboard the way the dock is. One has two things to write in and the
 * other has a name field; both are exactly where a keyboard opens, and `dvh` does not
 * account for one.
 */
#feel,
#asked {
  position: fixed;
  inset: 0;
  bottom: var(--kb, 0px);
  margin: auto;
  width: min(340px, calc(100vw - 2 * var(--gap)));
  max-height: calc(100dvh - var(--kb, 0px) - 2 * var(--gap));
  /* The panel inside carries the padding: see `.panel`. */
  padding: 0;
  border: 0;
  border-radius: 16px;
  /*
   * A dialog over a dimmed page, so it is raised by fill like everything else and by the
   * backdrop behind it — not by a hairline that has to compete with both.
   */
  background: var(--raised);
  color: var(--ink);
}

#feel[open],
#asked[open] { display: flex; flex-direction: column; }

#feel::backdrop,
#asked::backdrop { background: rgba(4, 12, 14, 0.74); }

/*
 * Every pixel of the dialog's own box, so a click whose target is the dialog element can
 * only have landed on the ground around it — which is how tapping outside dismisses. A
 * padded dialog would make its own padding a dismiss target.
 */
#feel .panel,
#asked .panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}

#feel .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#feel h2 { margin: 0; font-size: 17px; font-weight: 600; }

/* A visible way out, at a size a thumb hits without aiming. */
#feel .x {
  min-width: 44px;
  min-height: 44px;
  margin: -10px -10px -10px 0;
  font-size: 22px;
  line-height: 1;
  color: var(--dim);
}

#feel .x:active { color: var(--ink); }

#feel .k { display: block; }

#feel textarea {
  font: inherit;
  /* 16px or iOS zooms the whole page on focus and never zooms back. */
  font-size: 16px;
  color: var(--ink);
  background: var(--low);
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  resize: none;
}

#feel textarea:focus { outline: none; border-color: var(--edge); }

/*
 * The one control in the app that sends anything anybody wrote to a server, so it is the
 * full sentence rather than a word, and the box is as big as a thumb.
 */
#feel .consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.45;
}

#feel .consent input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  /* Not vermilion: that means rising, and a tick is not a topic. */
  accent-color: var(--ink);
}

#feel .plain { margin: 0; font-size: 13px; line-height: 1.5; color: var(--faint); }

#feel .row { display: flex; align-items: stretch; gap: 8px; }

#feel .row button {
  flex: 1;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 15px;
}

#feel .row .go { background: var(--rise); color: var(--on-rise); font-weight: 600; }

#feel .row button:not(.go) {
  background: var(--low);
  border: 0;
  color: var(--dim);
}

/*
 * The two sentences, and then the two answers.
 *
 * Where this parts company with `#feel` on purpose: there the loud control sends and the
 * quiet one is a way out, which is honest, because they are not alternatives. Here they are
 * two answers to the same question, so they are **the same button twice** — one fill, one
 * weight, one size, neither of them vermilion. A bright yes beside a dim no is a consent
 * that was easier to give than to refuse, and this screen decides whether the owner gets
 * honest testers or compliant ones.
 *
 * The refusal is first in the DOM, so it is first in the reading order in both languages
 * and always the one a thumb meets first.
 */
#asked .what { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); }

/*
 * Focus lands on the panel so a phone does not open its keyboard over the question before
 * anybody has read it — see `askShare()`. Chrome draws its ring on a programmatically
 * focused `tabindex="-1"` container, which put a bright cyan outline around the whole box
 * on first run. Nothing here is operable, so there is nothing for a ring to point at.
 */
#asked .panel:focus, #asked .panel:focus-visible { outline: none; }

#asked .pair { display: flex; align-items: stretch; gap: 8px; margin-top: 4px; }

#asked .pair button {
  flex: 1;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  background: var(--low);
  border: 0;
  color: var(--ink);
}

#asked .pair button:active { background: var(--quiet); }

/*
 * Dimmed only while the answer is in flight, and then both of them are: a tap mid-request
 * is a second answer to a question that has one. Never a resting state — a dim answer
 * beside a live one is the screen deciding on somebody's behalf, and the first rendering
 * of this did exactly that with a yes greyed out until a name was typed.
 */
#asked .pair button:disabled { opacity: 0.55; }

#asked .pair button:focus-visible { outline: 2px solid var(--fall); outline-offset: 2px; }

#line[hidden], #dock[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  #draft .topic { animation: land 220ms ease-out; }
  /* They arrive together and are one thing: the end of a conversation. */
  #shut, #felt { animation: land 220ms ease-out; }
  @keyframes land {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail.settling { transition: none; }
}

/* ── the conversations ───────────────────────────────────────────────────────────────── */
/*
 * One row per conversation: when, the line that opened it, and two ways to act on it — run
 * it again, and be rid of it. The opener takes the whole width it can so the tap target is
 * the text, not a chevron; the two controls are quiet and at the end, because what the row
 * is for is the line in the middle of it.
 */
.row.session {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px var(--gap);
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.row.session .when { grid-column: 1 / -1; font-size: 12px; color: var(--faint); }

.row.session .opener {
  text-align: start;
  padding: 0;
  display: block;
  min-width: 0;
}

.row.session .line {
  margin: 0;
  /* Two lines. A long entry identifies itself in its first sentence. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row.session .marks { font-size: 12px; color: var(--faint); }

.row.session .drop {
  font-size: 13px;
  color: var(--dim);
  padding: 4px 2px;
  min-height: 34px;
  white-space: nowrap;
}

/* The second tap is the confirmation, so the button itself has to look like a warning. */
.row.session .drop[data-sure="1"] { color: var(--rise); font-weight: 600; }
.row.session .drop:disabled { opacity: 0.4; }

/* ── running a conversation again ────────────────────────────────────────────────────── */
/*
 * The whole of what makes a re-run unmistakable, and it is three things rather than one,
 * because any one of them is a thing somebody can miss at a glance.
 *
 * The band at the head of the thread says in a sentence that none of what is marked below
 * was ever said to them. Every re-run reply is set inside its own outlined block, so it is
 * not a bubble in the conversation but a quotation from somewhere else. And the label above
 * the words names the version, the day, the model and the money — which is also the answer
 * to "which run am I reading".
 *
 * The outline is dashed and `--faint`, and dashed is doing real work here: every other
 * border in this app is solid, so a dashed frame is the one shape on the screen that
 * belongs to nothing anybody said. No colour, because colour in this app means rising or
 * falling and a re-run is neither.
 */
.reruns { align-self: stretch; }
.reruns .plain { margin: 0; font-size: 13px; line-height: 1.55; color: var(--dim); }
.reruns .runat { margin: 0; font-size: 13px; color: var(--amber); }

.reruns .rerun {
  align-self: start;
  font-size: 13px;
  color: var(--dim);
  padding: 4px 2px;
  min-height: 34px;
  white-space: nowrap;
}

.said.harpu.rerun {
  align-self: stretch;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px dashed var(--faint);
  border-radius: 10px;
  background: var(--quiet);
}

.vtag {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--faint);
}

.vtag .vnum { font-weight: 600; color: var(--dim); }

/* The original's own label, over the reply they were actually given. No frame: this one is
 * the conversation, and it only needs a name once there is something beside it. */
.vtag.first { align-self: flex-start; margin: 4px 0 -4px; }

.vsaid { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.vsaid.vmissing { color: var(--faint); font-style: italic; }

/* The second tap is the confirmation, so the button itself has to look like a warning. */
.row.session .rerun[data-sure="1"],
.reruns .rerun[data-sure="1"] { color: var(--amber); font-weight: 600; }
.reruns .rerun:disabled { opacity: 0.4; }

/*
 * The empty state wears the topic's own card, so the first screen shows the shape of the
 * thing rather than the absence of it. Dimmer than a real topic, and its one line is set at
 * reading size instead of the elevated size a real focus gets — it is an invitation, not a
 * decision anybody made.
 *
 * It said so with a dashed outline and no fill, which stopped saying anything when the
 * outlines went: a dashed border of zero width over a transparent background is not a card,
 * it is nothing, and the first screen anybody sees was a heading floating on the ground.
 * `--low` is one step under a real topic's `--raised` — still a surface, visibly not yet
 * one of theirs, and said in the same language as every other card here.
 */
.topic.first {
  /* `#screen` is a flex column, so without this the card stretches to the whole page. */
  flex: 0 0 auto;
  background: var(--low);
}
.topic.first .name { color: var(--dim); }
.topic.first .matters { font-size: 17px; font-weight: 400; color: var(--dim); line-height: 1.5; }
.topic.first .crown .chev { color: var(--dim); }

/* ── while the record opens ──────────────────────────────────────────────────────────── */
/*
 * Before the record is open this is the whole app: what it is for, and — if it will not
 * open — the one sentence about why. No topics, no line to write on, no control of any
 * kind, because nothing saved on this device has been read yet and none of those things
 * exists in the document to be un-hidden.
 *
 * Centred rather than top-aligned: there is nothing to do here, and a sentence halfway up
 * the screen reads as a moment passing rather than as an error page.
 */
.opening {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  max-width: 34rem;
  width: 100%;
  margin: 0 auto;
  padding-bottom: 8dvh;
}

.opening .what {
  margin: 0;
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.opening .trouble { margin: 0; font-size: 14px; color: var(--rise); }

/*
 * A refusal with something to do on it.
 *
 * This screen used to be one sentence and a dead end, and the owner met it twice on his
 * phone. So the shape here is deliberately the shape of the copy screen's two controls —
 * the loud full-width one is the thing to try, the quiet underlined one is the bigger
 * hammer — because those are already the two weights this app says "do this" in, and a
 * screen somebody reaches while overwhelmed is the last place to invent a third.
 *
 * `.offer + .doit` is the same control on the other refusal: the record taken over by a
 * newer tab, mid-conversation, where a reload is the one honest way back.
 */
.opening .doit,
.offer + .doit {
  align-self: stretch;
  background: var(--rise);
  color: var(--on-rise);
  border-radius: 999px;
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 600;
  min-height: 48px;
}

/* Disabled is what "trying" looks like, and it is the whole of the busy state. */
.opening .doit:disabled { opacity: 0.55; }

.opening .undo {
  align-self: center;
  font-size: 14px;
  color: var(--dim);
  padding: 8px 4px;
  min-height: 40px;
  border-bottom: 1px solid var(--line);
}

/*
 * ── the password, which is the first screen anybody sees ─────────────────────────────
 *
 * The same panel as everything else in this view: `.what` says what this is, `.doit` is the
 * one loud control, `.trouble` is what went wrong. What it needs on top is room.
 *
 * **Nothing in this view reserves space for the dock, because there is no dock.** `#screen`
 * pads its bottom by `--dock` (84px until `app.js` measures one) so the last thing in a
 * transcript is never behind the fixed input bar — and before the record is open `raise()`
 * has not run, so that bar does not exist in the document at all. Measured at 390×844 with
 * a 420px keyboard: the panel is 306px and the screen's content box was 257px, so it
 * overflowed and scrolled to reach a control, against 84px of padding held for nothing.
 * With this it is 341px and the whole gate is on screen. `tests/entry.test.ts` pins it.
 *
 * `padding-bottom: 0` for the same reason: 8dvh of breathing room under a sentence is worth
 * having and under a keyboard is not.
 *
 * `safe center` is cheap insurance rather than something measured. A centred flex item
 * taller than its box overflows *both* ways and the top half then sits above the scroll
 * origin, unreachable; nothing here is tall enough for that today, and the keyword falls
 * back to the plain `center` above it where it is unknown, so it costs a word.
 */
body[data-view="opening"] #screen { padding-bottom: var(--gap); }

.opening.gate {
  justify-content: safe center;
  padding-bottom: 0;
}

.opening.gate .ask {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/*
 * `font: inherit` is not tidiness. An `<input>` wears the UA's own font at ~13px, and mobile
 * Safari zooms the page into any focused field set below 16px — and does not zoom back out,
 * leaving the whole app one and a half times too big with no control on screen to undo it.
 * Inheriting lands on the body's 16px, which is exactly the threshold.
 */
.opening.gate .pass {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--low);
  border: 0;
  border-radius: 12px;
}

.opening.gate .pass:focus-visible { outline: 2px solid var(--rise); outline-offset: 1px; }
.opening.gate .plain { margin: 0; font-size: 13px; line-height: 1.6; color: var(--faint); }

/* ── install it, said in one line ────────────────────────────────────────────────────── */
/*
 * A banner now, which the panel it replaced was deliberately not.
 *
 * That was right while it was a card with buttons: a dismissible panel that keeps returning
 * is nagging, so it was shown once. This is one line asking for one thing, and it is honest
 * to leave it up — a record that a browser can evict is a standing condition, not an event,
 * and it ends the moment the app is installed rather than the moment it is tapped.
 *
 * Orange, not `--rise`. Red is what this product says "a save failed" in, two screens away;
 * amber is the register between that and the ordinary text, which is exactly where "nothing
 * is lost yet, and here is how to keep it that way" sits. Tinted background rather than a
 * filled bar so it reads as a note on the screen and not as an error bar over it.
 */
.risk {
  flex: 0 0 auto;
  margin: 0 0 4px;
  padding: 10px 13px;
  border: 0;
  border-radius: 12px;
  /*
   * Tinted fill and no outline, like every other surface. The amber is strong enough at 14%
   * over this ground to read as its own thing; the hairline was doing the separating twice.
   */
  background: color-mix(in srgb, var(--amber) 14%, var(--ground));
  color: var(--amber);
  font-size: 13px;
  line-height: 1.5;
}

/* ── the four sections of the memory screen ──────────────────────────────────────────── */
/*
 * One rule for all of them, and the reason is that they were not one rule.
 *
 * The memory card had a dim normal-weight head, the other two a bold letterspaced one; the
 * body sentences were 15px in one and 14px in another; and the gaps between head and body
 * differed by four pixels. Nothing chose any of that — it accumulated, three agents wrote
 * three cards, and the owner saw them stacked and said so.
 *
 * Solid, and no border. A hairline in a colour near the background is a shape the eye has to
 * resolve before it can read what is inside; a surface a shade lighter than the page reads as
 * raised without drawing anything. `--raise` exists for exactly this and nothing else.
 */
.block,
.knows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
  margin-bottom: 14px;
  padding: 16px;
  border: 0;
  border-radius: 16px;
  background: var(--raised);
}

/* The one head style. Every section names itself the same way or the stack looks assembled. */
.blockhead,
.knows .head .k {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--dim);
}

/* And the one body sentence: the same size and the same colour in all four. */
.block .none,
.knows .none { margin: 0; font-size: 14px; line-height: 1.55; color: var(--faint); }
.block .row.session:last-child { border-bottom: 0; }

/* ── the switch ──────────────────────────────────────────────────────────────────────── */
/*
 * A real checkbox, drawn as a switch. `appearance: none` takes the box away and leaves the
 * element — so the label still toggles it, the keyboard still reaches it, and a screen reader
 * still calls it a checkbox. The knob is `::after`, moved by `:checked`.
 */
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  position: relative;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  transition: background 140ms ease;
  cursor: pointer;
}

.switch::after {
  content: '';
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 140ms ease;
}

.switch:checked { background: var(--fall); }
.switch:checked::after { transform: translateX(18px); }
[dir="rtl"] .switch:checked::after { transform: translateX(-18px); }
.switch:disabled { opacity: 0.5; }
.switch:focus-visible { outline: 2px solid var(--fall); outline-offset: 2px; }

.share .consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

.share .much { margin: 8px 0 0; font-size: 13px; color: var(--dim); }
.share .plain { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--faint); }
.share .said,
#asked .said { margin: 6px 0 0; font-size: 13px; color: var(--dim); }
.share .said.bad,
#asked .said.bad { color: var(--rise); }

/*
 * Who this is: above the switch it gates on one screen, above the two answers on the other,
 * and the same field in both because it is the same name.
 *
 * Filled like every other control here, and read-only rather than disabled once sharing is
 * on: disabled greys it out, and what it says is the answer to "whose record is this" —
 * worth still being able to read at a glance.
 */
.share .naming,
#asked .naming {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--dim);
}

.share .who,
#asked .who {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--low);
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
}

.share .who:read-only { color: var(--dim); }
.share .who:focus-visible,
#asked .who:focus-visible { outline: 2px solid var(--fall); outline-offset: 2px; }

/* ── the file controls, in the corner ────────────────────────────────────────────────── */
/*
 * Two quiet links side by side, aligned to the end of the row, and no card.
 *
 * They had the screen's loudest control and its top position, for the thing somebody does
 * least often. What matters about them is that they are reachable, not that they are seen —
 * so they read as text, they sit where a footer sits, and the caution about the file being
 * unencrypted is the row's `title` rather than a paragraph nobody needed yet.
 *
 * Putting a copy back replaces the record, so it stays two taps and the second tap turns it
 * the alarm colour. That is unchanged; it is the only destructive control here.
 */
.copy { display: block; margin: 0 2px 10px; }

.copy .pair {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
}

.copy .pair button {
  font-size: 13px;
  color: var(--faint);
  padding: 6px 2px;
  min-height: 36px;
}

.copy .pair button:active { color: var(--ink); }
.copy .doit:disabled,
.copy .undo:disabled { opacity: 0.4; }
.copy .undo[data-sure="1"] { color: var(--rise); font-weight: 600; }
.copy .said { margin: 6px 0 0; text-align: end; font-size: 13px; color: var(--dim); }
.copy .said.bad { color: var(--rise); }

/*
 * The share section's own rules live with the switch above, where the control they dress is
 * defined. What was here — a rule across the top, a 20px tick box, and margins indenting the
 * numbers to the width of that box in each direction — all described the checkbox it no
 * longer uses, and the card it now sits in draws its own edge.
 */

/* ── what is noted about him ─────────────────────────────────────────────────────────── */
/*
 * First of the four sections. Its card, its head and its empty sentence are all the shared
 * rules above — what is left here is only what is true of this section and no other: a head
 * that is a control, a body that collapses, and the shape of a subject inside it.
 */

/*
 * A whole-width target. 44px because this is the one control that has to be hit on the way
 * to fixing something wrong, and the `#nav` 34px above it is a control somebody taps on
 * purpose from a bar they are already looking at.
 */
/*
 * The two folds share one head: the memory card and the intake card below it. A second set
 * of rules for the same shape is how two cards on one screen drift apart by four pixels.
 */
.knows .head,
.intake .head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: start;
  min-height: 44px;
  padding: 6px 0;
}

.knows .head .k,
.intake .head .k { flex: 1 1 auto; }
.knows .head .chev,
.intake .head .chev { width: 14px; color: var(--dim); }
.knows button.head:active .k,
.intake button.head:active .k { color: var(--ink); }
.knows[data-open="0"] .body,
.intake[data-open="0"] .body { display: none; }

.knows .body { display: flex; flex-direction: column; gap: 18px; }
.intake .body { display: flex; flex-direction: column; gap: 10px; }
.knows .plain { margin: 0; font-size: 13px; line-height: 1.6; color: var(--faint); }
/* Nothing noted yet is an honest state, so it is a sentence and not an empty frame. */

/* One band per kind of thing, one panel per subject inside it. */
.knows .band { display: flex; flex-direction: column; gap: 12px; }
.knows .about { display: flex; flex-direction: column; gap: 2px; }
.knows .who { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }

.knows .claims {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/*
 * A claim is two columns and not a grid of three rows: what is said and what it rests on grow
 * to however many lines they need, and the one control stays beside them at a fixed size. A
 * row grid put the second support line — the one that only exists on a doubted fact — into
 * the button's column.
 */
.knows .claim {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--gap);
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.knows .claims .claim:last-child { border-bottom: 0; }
.knows .lines { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/*
 * A claim is a triple, and it now looks like one: the relation and the thing as two raised
 * chips with a join between them, under the subject that heads the band.
 *
 * It was one line of words — `נרגעת כשאני נשאר בחדר` — so a column of facts about one person
 * read as a run of half-sentences. Chips give each part an edge, which is the whole of what
 * was missing; the join says they belong to each other, which a gap does not.
 *
 * `--low` rather than `--raised`: the card these sit in is already `--raised`, and a chip
 * the same tone as its surface is not a chip. Wrapping happens inside a chip rather than
 * across the row — an object is often a clause (`כשאני נשאר בחדר איתה עד שהיא נרדמת`) and a
 * chip that breaks across a line stops reading as one thing.
 */
.knows .reads {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 15px;
  line-height: 1.45;
}


/* The join and the thing are one wrapping unit; see the comment at `tail` in `app.js`. */
.knows .tail {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 0;
}
.knows .chip {
  display: inline-block;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--low);
  overflow-wrap: anywhere;
}

/* The relation is the quieter half: what is being said, not the thing it is said about. */
.knows .chip.rel { color: var(--dim); }
.knows .chip.thing { color: var(--ink); }

/*
 * The join. A drawn line rather than a dash character, so it cannot be read aloud, cannot be
 * selected into a copied sentence, and keeps its length when the text around it wraps.
 */
.knows .join {
  flex: 0 0 auto;
  width: 10px;
  height: 1px;
  background: var(--line);
}

.knows .lean { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: var(--faint); }

/*
 * Something of his speaks against this and nothing has replaced it. Quieter than what the
 * record stands behind, and still here: dropping it would be the record going silent about a
 * thing it is unsure of, which is the opposite of what this screen is for. No colour —
 * vermilion and cyan mean rising and falling, and being unsure is neither.
 */
.knows .claim[data-standing="doubted"] .reads { color: var(--dim); }

.knows .drop {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--faint);
  padding: 8px 2px;
  min-height: 44px;
  white-space: nowrap;
}

/* Armed. The one place colour is allowed on this row: it is about to take something away. */
.knows .drop[data-sure="1"] { color: var(--rise); font-weight: 600; }
.knows .drop:active { opacity: 0.6; }
.knows .drop:disabled { opacity: 0.4; }

/*
 * What it used to think, one line behind what it thinks now. Underlined like the copy
 * screen's quiet control, because it is the same weight of thing: there, but not the reason
 * anybody came.
 */
.knows .was {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 13px;
  color: var(--dim);
  padding: 8px 2px;
  min-height: 40px;
  border-bottom: 1px solid var(--line);
}

.knows .was:active { color: var(--ink); }
.knows .gone .reads { color: var(--dim); }
.knows .gone[hidden] { display: none; }

/* ── writing from before ─────────────────────────────────────────────────────────────── */
/*
 * The card under the memory. It borrows `.block` for its frame and head, so it sits in the
 * same stack as the conversations and the two consent panels without a second grammar for
 * what a card is; everything below is only what it has that they do not.
 *
 * `.plain` and `.plain.small` are the two sentence weights: what this is for, then the
 * three quieter lines about the cap, the export option and what leaves the device. Quieter
 * and not hidden — they are what somebody needs *before* choosing a file, and a disclosure
 * they have to open is one nobody opens.
 */
.intake .plain { margin: 0; font-size: 14px; line-height: 1.55; color: var(--dim); }
.intake .plain.small { font-size: 12px; line-height: 1.5; color: var(--faint); }

.intake .take { display: flex; flex-direction: column; gap: 8px; }
/* The real input is off-screen rather than `display: none`, which takes it out of the
 * accessibility tree along with its label. The label is the control. */
.intake input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.intake .paste {
  width: 100%;
  box-sizing: border-box;
  min-height: 76px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}

/* One control shape for every tap in this card: full width, one line, 44px of thumb. */
.intake .wide {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.intake .wide:active { opacity: 0.6; }
.intake .wide:disabled { opacity: 0.4; }

/* The names in the file, and which of them is theirs. Nothing is preselected, so the "on"
 * state has to be legible at a glance rather than inferred from which one is not dimmed. */
.intake .voices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.intake .pick {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.intake .pick[data-on="1"] { color: var(--ink); border-color: var(--ink); }
.intake .pick:active { opacity: 0.6; }
.intake .pick .name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.intake .pick .marks { font-size: 12px; color: var(--faint); }

/*
 * A proposal, before it is anything. The same row shape as a claim on the memory card
 * above, because it is the same object one tap earlier — and the quoted line under it is
 * the part that makes it judgeable, so it is in the row and never behind a disclosure.
 */
.intake .proposals { list-style: none; margin: 0; padding: 0; }

.intake .proposed {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.intake .proposals .proposed:last-child { border-bottom: 0; }
.intake .proposed .lines { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.intake .proposed .reads { margin: 0; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }

.intake .quoted {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--faint);
  overflow-wrap: anywhere;
}

.intake .quoted .k { font-weight: 600; }

.intake .drop {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 0;
  font: inherit;
  font-size: 13px;
  color: var(--faint);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.intake .drop:active { opacity: 0.6; }
