/* Where Was I — one stylesheet, no build step, no framework.
   Palette, type and spacing come from the Claude Design canvas: mono for
   labels and figures, sans for the interface, serif for the sentences you
   wrote yourself. Nothing here is rounded. */

:root {
  --canvas: #08090a;
  --bg: #0e1012;
  --rail: #0b0c0e;
  --field: #131618;

  --line: #1c2023;
  --line-soft: #16191b;
  --line-input: #23282c;
  --line-chip: #2b3134;
  --line-strong: #3a4045;
  --line-frame: #262b2f;

  --ink: #e6e3dd;
  --ink-2: #b9bfc4;
  --ink-3: #a8b0b6;
  --dim: #8c949b;
  --dim-2: #7d858c;
  --faint: #5d666d;
  --faint-2: #4d565c;

  --accent: #f0b429;
  --accent-hi: #ffd06b;
  --accent-bg: #15140f;
  --accent-field: #1d1a12;
  --accent-field-line: #4a4127;
  --accent-ink: #f5efe2;
  --accent-ink-2: #c2b795;

  --teal: #6ea8a1;
  --rust: #c07a72;
  --rust-bg: #1a1011;
  --rust-ink: #e0c4c1;
  --rust-line: #6b3f3b;
  --green: #8fbb7e;
  --violet: #8f9cd4;
  --warm: #e0a877;
  --warm-line: #c4794a;

  /* One colour per status, used identically wherever a status appears. */
  --st-unplayed: #9aa0a8;
  --st-playing: var(--teal);
  --st-dormant: var(--accent);
  --st-finished: var(--green);
  --st-abandoned: var(--rust);
  --st-ongoing: var(--violet);

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;

  --rail-w: 210px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
code { font-family: var(--mono); font-size: 0.9em; color: var(--ink-3); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Mono label: the design's single most repeated element. */
.lab {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim-2);
}
.lab-faint { color: var(--faint); letter-spacing: 0.14em; }
.lab-accent { color: var(--accent); letter-spacing: 0.18em; }

.mono { font-family: var(--mono); }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.serif { font-family: var(--serif); }

/* --- Shell ---------------------------------------------------------------- */

.app { min-height: 100svh; display: flex; flex-direction: column; }

.rail { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

@media (min-width: 900px) {
  .app { flex-direction: row; }

  .rail {
    width: var(--rail-w);
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 22px 18px;
    border-right: 1px solid var(--line);
    background: var(--rail);
    position: sticky;
    top: 0;
    height: 100svh;
    overflow-y: auto;
  }
}

.wordmark {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: var(--ink);
}

.rail-nav { display: flex; flex-direction: column; gap: 2px; }

.rail-link {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  font-size: 14px;
  color: var(--ink-3);
}
.rail-link:hover { color: var(--ink); background: #101316; }
.rail-link .n { font-family: var(--mono); color: var(--faint); }
.rail-link.is-current {
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
}
.rail-link.is-current .n { color: var(--bg); }
.rail-link .n-accent { color: var(--accent); }
.rail-link .n-teal { color: var(--teal); }

.rail-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.rail-foot { margin-top: auto; }
.rail-note { font-size: 13px; line-height: 1.5; color: var(--dim); }
.rail-item { font-size: 13px; color: var(--ink-3); }

.lock {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  align-self: flex-start;
}
.lock:hover { color: var(--rust); }

/* Mobile chrome. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--rail);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .wordmark { font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.topbar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--dim-2);
}
.topbar-tag { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--accent); }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: var(--rail);
  position: sticky;
  bottom: 0;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 62px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dim-2);
}
.tab.is-current { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }

@media (min-width: 900px) {
  .topbar, .tabs { display: none; }
}

/* --- Page furniture ------------------------------------------------------- */

.head {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.head h1 { font-size: 21px; }
.head-sub { font-size: 14px; line-height: 1.5; color: var(--dim); }
.head-note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim-2);
}

@media (min-width: 900px) {
  .head { padding: 24px 32px 18px; }
  .head h1 { font-size: 26px; }
}

.pad { padding: 16px 18px; }
@media (min-width: 900px) { .pad { padding: 22px 32px; } }

.foot {
  margin-top: auto;
  padding: 16px 18px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
@media (min-width: 900px) { .foot { padding: 16px 32px; } }

/* --- Buttons and chips ---------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  padding: 11px 16px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }

.btn-primary {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  padding: 12px 20px;
}
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--bg); }

.btn-teal { border-color: var(--teal); color: var(--teal); }
.btn-teal:hover { border-color: var(--teal); color: var(--accent-hi); }
.btn-quiet { border-color: var(--line-chip); color: var(--ink-3); }
.btn-quiet:hover { border-color: var(--line-strong); }
.btn-danger { border-color: var(--line-chip); color: var(--rust); }
.btn-danger:hover { border-color: var(--rust); color: var(--rust); }
.btn-bare {
  border: 0;
  padding: 4px;
  color: var(--dim-2);
  background: none;
}
.btn-bare:hover { color: var(--accent); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px; font-size: 13px; }

.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line-chip);
  color: var(--ink-3);
  padding: 6px 9px;
  white-space: nowrap;
}
a.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-on { border-color: var(--accent); background: var(--accent); color: var(--bg); }
.chip-on:hover { color: var(--bg); }
.chip-sm { padding: 5px 8px; }
.chip-count { color: var(--faint); }

.chip-status { border-color: currentColor; }
.st-unplayed { color: var(--st-unplayed); }
.st-playing { color: var(--st-playing); }
.st-dormant { color: var(--st-dormant); }
.st-finished { color: var(--st-finished); }
.st-abandoned { color: var(--st-abandoned); }
.st-ongoing { color: var(--st-ongoing); }
.st-untriaged { color: var(--faint); }

/* Only dormant gets the warm outline treatment on a detail header. */
.chip-dormant { border-color: var(--warm-line); color: var(--warm); }

/* --- Fields --------------------------------------------------------------- */

.input {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--line-input);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  padding: 11px 13px;
  outline: none;
}
.input:focus { border-color: var(--line-strong); }
.input::placeholder { color: var(--faint); opacity: 1; }
textarea.input { resize: vertical; }
select.input {
  appearance: none;
  font-family: var(--mono);
  font-size: 14px;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim-2) 50%),
    linear-gradient(135deg, var(--dim-2) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.input-mono { font-family: var(--mono); font-size: 13px; }
.input-notes { font-family: var(--serif); font-size: 16px; line-height: 1.5; }

/* Slot 05 is the one the eye should land on, in the form as in the briefing. */
.input-lead {
  background: var(--accent-field);
  border-color: var(--accent-field-line);
  color: var(--accent-ink);
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field-hint { font-size: 12px; line-height: 1.55; color: var(--dim-2); }

.alert {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 13px;
}
.alert-error { background: var(--rust-bg); box-shadow: inset 3px 0 0 var(--rust); }
.alert-error .alert-title { color: var(--rust); }
.alert-error .alert-body { color: var(--rust-ink); }
.alert-ok { background: #0f1513; box-shadow: inset 3px 0 0 var(--teal); }
.alert-ok .alert-title { color: var(--teal); }
.alert-ok .alert-body { color: var(--ink-2); }
.alert-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.alert-body { font-size: 14px; line-height: 1.45; }

/* --- Rows (dormant + library) --------------------------------------------- */

.rows { display: flex; flex-direction: column; }

.rowhead {
  display: none;
  padding: 11px 32px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  gap: 22px;
}
@media (min-width: 900px) { .rowhead { display: grid; } }

.row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit;
}
.row:hover { background: #111417; color: inherit; }

/* Dormant. Heat cools from rust to teal as a game gets touched. */
.row-dormant { border-left: 3px solid var(--heat, var(--line-chip)); }
.heat-cold { --heat: var(--rust); }
.heat-stale { --heat: var(--accent); }
.heat-fresh { --heat: var(--teal); }

.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row-ident { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.row-title { font-size: 17px; font-weight: 600; line-height: 1.25; }
.row-age { font-family: var(--mono); font-size: 16px; color: var(--heat, var(--dim)); white-space: nowrap; }
.row-meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--dim-2); }
.row-next { font-family: var(--serif); font-size: 15px; line-height: 1.4; color: var(--ink-2); }
.row-next-none { font-family: var(--sans); font-size: 14px; color: var(--rust); }
.row-brief {
  display: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
@media (min-width: 900px) { .row-brief { display: block; } }

@media (min-width: 900px) {
  .rows-dormant .rowhead,
  .rows-dormant .row {
    grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1.5fr) 92px;
    gap: 22px;
  }
  .rows-dormant .row {
    display: grid;
    align-items: center;
    padding: 15px 32px;
  }
  /* The row reads title-then-age on mobile and age-then-title on desktop, from
     one piece of markup: the wrapper dissolves and the cells are placed. */
  .rows-dormant .row-top { display: contents; }
  /* grid-row is explicit on all four: the age is placed before the title it
     follows in the DOM, and auto-placement would otherwise wrap. */
  .rows-dormant .row-age { grid-area: 1 / 1; font-size: 19px; }
  .rows-dormant .row-ident { grid-area: 1 / 2; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .rows-dormant .row-next,
  .rows-dormant .row-next-none { grid-area: 1 / 3; }
  .rows-dormant .row-brief { grid-area: 1 / 4; justify-self: end; }
}

/* Library. */
.rows-library .row-status {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
@media (min-width: 900px) {
  .rows-library .rowhead,
  .rows-library .row {
    grid-template-columns: minmax(0, 1.7fr) 92px 128px 110px 90px;
    gap: 18px;
  }
  .rows-library .row { display: grid; align-items: center; padding: 13px 32px; }
  .rows-library .row-title { font-size: 15px; }
  .rows-library .row-cell { font-family: var(--mono); font-size: 12px; color: var(--dim); }
  .rows-library .row-touched { text-align: right; }
  .rowhead .right { text-align: right; }
}
.rows-library .row { flex-direction: row; align-items: center; justify-content: space-between; }
.rows-library .row-ident { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
@media (max-width: 899px) {
  .rows-library .row-cell-desktop { display: none; }
}

/* --- Briefing ------------------------------------------------------------- */

.brief { display: flex; flex-direction: column; }

.brief-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brief-body { display: flex; flex-direction: column; }
.brief-main { display: flex; flex-direction: column; }
.brief-head-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.brief-title { font-size: 25px; letter-spacing: -0.025em; }
.brief-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.brief-actions-desktop { display: none; }

/* Right rail: the two facts the slots don't carry, and the way out. */
.brief-rail {
  display: none;
  flex-direction: column;
  gap: 20px;
  padding: 22px 24px;
  background: var(--rail);
}

@media (min-width: 900px) {
  .brief-head {
    padding: 22px 32px 18px;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
  }
  .brief-title { font-size: 30px; }
  .brief-actions-desktop { display: flex; flex-direction: column; gap: 8px; flex: none; }
  .brief-body { display: grid; grid-template-columns: minmax(0, 1fr) 296px; align-items: start; }
  .brief-main { border-right: 1px solid var(--line); min-width: 0; }
  .brief-rail { display: flex; min-height: 100%; }
}

/* The five slots. Same order every time, on both the briefing and the form. */
.slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.slot-n { font-family: var(--mono); font-size: 12px; color: var(--faint-2); }
.slot-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim-2);
}
.slot-value { font-size: 16px; line-height: 1.45; }
.slot-value-dim { font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.slot-mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.03em; }
.slot-quote { font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.45; color: var(--ink-2); }
.slot-stack { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

/* Slot 05 — the single next action, and the only thing given colour. */
.slot-lead {
  background: var(--accent-bg);
  box-shadow: inset 3px 0 0 var(--accent);
  border-bottom: 0;
  padding: 14px 18px;
}
.slot-lead .slot-n, .slot-lead .slot-label { color: var(--accent); }
.slot-lead .slot-value { font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--accent-ink); }
.slot-lead .slot-value-dim { font-size: 13px; color: var(--accent-ink-2); }

@media (min-width: 900px) {
  .slot {
    display: grid;
    grid-template-columns: 32px 164px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding: 16px 30px;
  }
  .slot-label { padding-top: 4px; }
  .slot-lead { padding: 20px 30px; }
  .slot-lead .slot-label { padding-top: 5px; }
  .slot-lead .slot-value { font-size: 19px; line-height: 1.4; }
  .slot-lead .slot-value-dim { font-size: 14px; }
  .slot-value { font-size: 17px; }
  .slot-stack { gap: 6px; }
}

/* History, collapsed by default — the briefing is about the latest snapshot. */
.disclosure { border-top: 1px solid var(--line); }
.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { color: var(--ink); }
.disclosure .caret { color: var(--accent); }
@media (min-width: 900px) { .disclosure > summary { padding: 16px 30px; } }

.history-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 18px;
  border-top: 1px solid var(--line-soft);
}
.history-when { font-family: var(--mono); font-size: 11px; color: var(--dim-2); }
.history-line { font-size: 14px; line-height: 1.4; color: var(--ink-2); }
@media (min-width: 900px) {
  .history-item {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 18px;
    padding: 11px 30px;
  }
}

.rail-fact { display: flex; flex-direction: column; gap: 7px; }
.rail-fact + .rail-fact { border-top: 1px solid var(--line); padding-top: 18px; }
.rail-fact-value { font-size: 15px; }
.rail-fact-big { font-family: var(--mono); font-size: 28px; color: var(--teal); }
.rail-fact-note { font-size: 13px; line-height: 1.5; color: var(--dim); }
.rail-out { margin-top: auto; border-top: 1px solid var(--line); padding-top: 18px; display: flex; flex-direction: column; gap: 8px; }

/* Mobile action bar — the same three actions, pinned where the thumb is. */
.actionbar {
  position: sticky;
  bottom: 0;
  z-index: 15;
  padding: 14px 18px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--rail);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.actionbar-split { display: flex; gap: 8px; }
.actionbar-split > * { flex: 1; }
@media (min-width: 900px) { .actionbar { display: none; } }

/* --- Write form ----------------------------------------------------------- */

.write { display: flex; flex-direction: column; }
.write-body { display: flex; flex-direction: column; }
.write-main { display: flex; flex-direction: column; }
.write-rail {
  /* On a phone this flows in after the notes rather than sitting in a rail.
     The design collapses it behind a disclosure there; leaving it open costs a
     little scrolling and keeps status, save slot and re-entry reachable without
     depending on JavaScript to reveal them. */
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--rail);
}

@media (min-width: 900px) {
  .write-body { display: grid; grid-template-columns: minmax(0, 1fr) 296px; align-items: start; }
  .write-main { border-right: 1px solid var(--line); min-width: 0; }
  .write-rail { padding: 20px 24px; border-top: 0; min-height: 100%; }
}

.slot-input { padding: 12px 18px; }
@media (min-width: 900px) {
  .slot-input { align-items: center; padding: 14px 30px; }
  .slot-input .slot-label { padding-top: 0; }
}

.write-notes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px;
  border-top: 1px solid var(--line-soft);
}
@media (min-width: 900px) { .write-notes { padding: 16px 30px; } }

.write-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 18px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--rail);
}
@media (min-width: 900px) { .write-submit { padding: 14px 30px; } }

.rail-group { display: flex; flex-direction: column; gap: 9px; }
.rail-group + .rail-group { border-top: 1px solid var(--line); padding-top: 16px; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

/* Radio chips: status after saving, time to re-entry. */
.pick { position: relative; display: inline-flex; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.pick input:focus-visible + .chip { outline: 2px solid var(--accent); outline-offset: 1px; }
.pick input:checked + .chip { border-color: currentColor; }
.pick input:checked + .chip.chip-fill { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.pick-row { display: flex; gap: 6px; }
.pick-row .pick { flex: 1; }
.pick-row .chip { flex: 1; justify-content: center; padding: 8px 0; }

.rail-prev { font-family: var(--serif); font-size: 15px; line-height: 1.45; color: var(--dim); }

/* --- Settings ------------------------------------------------------------- */

.setting {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.setting:last-child { border-bottom: 0; }
.setting-body { display: flex; flex-direction: column; gap: 12px; }
.setting-label { display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 900px) {
  .setting { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; padding: 22px 30px; }
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.status-on { color: var(--teal); }
.status-off { color: var(--faint); }

.facts { display: grid; gap: 18px; }
@media (min-width: 640px) { .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fact { display: flex; flex-direction: column; gap: 4px; }
.fact-value { font-family: var(--mono); font-size: 14px; }

.download {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line-input);
  padding: 13px 16px;
  color: inherit;
}
.download:hover { border-color: var(--line-strong); color: inherit; }
.download-name { font-family: var(--mono); font-size: 14px; color: var(--accent); }
.download-note { font-size: 13px; color: var(--dim); }
.download-size { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); white-space: nowrap; }
.download-main { display: flex; flex-direction: column; gap: 3px; }

.prose { font-size: 15px; line-height: 1.6; max-width: 640px; }
.prose-warn { color: var(--rust-ink); }

/* --- Login and first run -------------------------------------------------- */

.plain { min-height: 100svh; display: flex; flex-direction: column; background: var(--bg); }
.plain-head {
  padding: 15px 18px;
  padding-top: calc(15px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.plain-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 18px 40px; }
@media (min-width: 900px) { .plain-head { padding: 16px 24px; } .plain-body { padding: 40px; } }

.login-form { width: 100%; max-width: 428px; display: flex; flex-direction: column; gap: 18px; }
.login-intro { display: flex; flex-direction: column; gap: 8px; }
.login-intro h1 { font-size: 22px; }
@media (min-width: 900px) { .login-intro h1 { font-size: 24px; } }
.login-intro p { font-size: 14px; line-height: 1.55; color: var(--dim); }
.input-secret { font-family: var(--mono); font-size: 17px; letter-spacing: 0.1em; padding: 14px; }
.input-secret.is-wrong { border-color: var(--rust-line); }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-3);
  cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.login-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--faint);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.firstrun { display: grid; }
@media (min-width: 900px) { .firstrun { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); } }
.path {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (min-width: 900px) { .path { padding: 22px 28px; } }
.path-a { box-shadow: inset 3px 0 0 var(--accent); border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { .path-a { border-bottom: 0; border-right: 1px solid var(--line); } }
.path-b { background: var(--rail); }
.path-intro { display: flex; flex-direction: column; gap: 5px; }
.path-intro h2 { font-size: 20px; }
.path-intro p { font-size: 13px; line-height: 1.5; color: var(--dim); }
.path-fields { display: flex; flex-direction: column; gap: 12px; }
.path-foot { margin-top: auto; display: flex; flex-direction: column; gap: 9px; border-top: 1px solid var(--line); padding-top: 16px; }

@media (min-width: 900px) {
  .field-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center; }
  .field-row > .lab { padding-top: 0; }
}

/* --- Empty states --------------------------------------------------------- */

.empty {
  padding: 40px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
@media (min-width: 900px) { .empty { padding: 48px 32px; } }
.empty h2 { font-size: 20px; }
.empty p { font-size: 14px; line-height: 1.6; color: var(--dim); max-width: 46ch; }

.banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 18px;
  background: var(--accent-bg);
  box-shadow: inset 3px 0 0 var(--accent);
}
@media (min-width: 900px) { .banner { padding: 12px 32px; } }

.offline-banner { margin-bottom: 10px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* The library row carries its metadata inline on mobile and in columns on
   desktop; each layout hides the other's copy. */
@media (min-width: 900px) { .row-cell-desktop-hide { display: none; } }

/* Mobile briefing: the single next action comes first, where the thumb and the
   eye already are. Desktop keeps the 01–05 reading order, and the write form
   keeps it on both — you fill the slots in the order you'd think of them. */
@media (max-width: 899px) {
  .brief-main .slot-lead { order: -1; }
  .brief-chips { display: none; }
}
.brief-meta-mobile {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dim-2);
}
@media (min-width: 900px) { .brief-meta-mobile { display: none; } }

/* Autogrowing slot fields size themselves; a resize grip would be misleading. */
textarea[data-autogrow] { resize: none; overflow: hidden; }

.die { flex: none; }

/* The save bar follows the thumb on mobile and sits under the form on desktop.
   On a phone the header's ← CANCEL is the discard, so the inline one goes. */
@media (max-width: 899px) {
  .write-submit {
    position: sticky;
    bottom: 0;
    z-index: 15;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .write-submit .btn-bare { display: none; }
  .write-submit .btn-row { flex-direction: column-reverse; gap: 8px; }
  .write-submit .btn { width: 100%; padding: 16px; font-size: 13px; }
  /* The topbar already says "5 LINES · ~40 S". */
  .head-note { display: none; }
}

/* The native file-picker button is light by default and reads as a bug here. */
input[type='file'] { padding: 8px 10px; }
input[type='file']::file-selector-button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--line-chip);
  background: transparent;
  color: var(--ink-3);
  padding: 7px 12px;
  margin-right: 12px;
  cursor: pointer;
}
input[type='file']::file-selector-button:hover { border-color: var(--line-strong); color: var(--ink); }

/* Mobile source order: slots, notes, the rail, then the save bar. The grid on
   desktop places the rail alongside regardless of where it sits in the DOM. */
@media (max-width: 899px) {
  .write-body { display: flex; flex-direction: column; }
  .write-main { display: contents; }
  .write-rail { order: 1; }
  .write-submit { order: 2; }
}
