:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #0b0c0e;
  --line: #1e2126;
  --line-hover: #343a42;
  --text: #c8ccd2;
  --muted: #7a808a;
  --accent: #6fa8ff;
  --pebble: #ffb066;
  --you: #8fb8ff;
  --bad: #ff7a7a;
  --good: #7fe0a0;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 14px 60px;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--line-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button.small {
  padding: 3px 9px;
  font-size: 12px;
}

button.icon {
  padding: 6px 8px;
  line-height: 0;
}

button.icon svg {
  width: 16px;
  height: 16px;
}

input,
select {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}

input[type='number'] {
  width: 5.5em;
}

input[aria-invalid='true'] {
  border-color: var(--bad);
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
}

.why {
  min-height: 1.2em;
  color: var(--muted);
  margin: 6px 0 0;
}

.why.bad {
  color: var(--bad);
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

/* a time, and who it was, in the lists */
.when {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.who {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* its words of its own accord: a quiet mark */
.own {
  margin-left: 2px;
  color: var(--muted);
  font-size: 11.5px;
  font-style: italic;
  white-space: nowrap;
}

/* --- the gate ---------------------------------------------------------------------- */

.gate {
  max-width: 420px;
  margin: 12vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gate form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- the top ----------------------------------------------------------------------- */

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.dot.linked {
  background: var(--good);
  box-shadow: 0 0 10px rgba(127, 224, 160, 0.6);
}

.dot.standby {
  background: #3f6b50;
}

.status {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  gap: 4px;
}

.status li {
  display: grid;
  grid-template-columns: 6.4em 1fr;
  gap: 8px;
  align-items: baseline;
}

.status b {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pebble);
}

.status .body b {
  color: var(--muted);
}

/* --- the conversation going on --------------------------------------------------------- */

.encounter {
  border: 1px solid #3a2a18;
  background: #0f0b07;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.encounter h2 {
  color: var(--pebble);
}

.encounter .about {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-left: 6px;
}

.lines {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  max-height: 260px;
  overflow: auto;
}

.lines li {
  display: grid;
  grid-template-columns: 3.6em 1fr;
  gap: 8px;
  padding: 1px 0;
}

.lines .s {
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.lines .words {
  color: var(--you);
}

.lines .pebble {
  color: var(--pebble);
}

.lines .pebble > :last-child {
  padding-left: 1.2em;
}

/* --- tabs -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  overflow-x: auto;
}

.tabs button {
  flex: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  padding: 8px 10px;
}

.tabs button[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* a day, or how far back, above a list */
.pick {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

/* --- what was said ------------------------------------------------------------------- */

/* the day, and what it remembers with the button that resets it */
.talk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 10px;
}

.talk-bar .pick {
  margin-bottom: 0;
}

.talk-bar .memory {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.talk-bar .memory button {
  flex: none;
  white-space: nowrap;
}

/* where its memory starts: what's above it was forgotten */
.talk li.forgot {
  display: block;
  margin: 12px 0 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-hover);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.talk {
  list-style: none;
  padding: 0;
  margin: 0;
}

.talk li {
  display: grid;
  grid-template-columns: 3.2em 3.8em 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 3px 0;
}

.talk li.gap {
  margin-top: 14px;
}

.talk li.empty {
  display: block;
}

.talk .you .who {
  color: var(--you);
}

.talk .pebble .who {
  color: var(--pebble);
}

/* --- the timeline ------------------------------------------------------------------ */

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}

.timeline .day {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 12px 0 4px;
}

.timeline .day:first-child {
  padding-top: 0;
}

.item {
  display: grid;
  grid-template-columns: 3.4em 1fr;
  gap: 8px;
  padding: 3px 10px;
}

.item .when {
  padding-top: 1px;
}

.item .who {
  margin-right: 4px;
  color: var(--pebble);
}

.item.heard .who {
  color: var(--you);
}

.item.quiet,
.item.quiet .who {
  color: var(--muted);
  font-size: 12.5px;
}

.item.quiet .who {
  font-size: 11px;
}

.item.card {
  margin: 4px 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.item.error .what,
.item.error .who {
  color: var(--bad);
}

.item .facts {
  color: var(--muted);
  font-size: 12.5px;
}

details {
  margin-top: 4px;
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
}

details .lines {
  max-height: none;
  margin-top: 4px;
}

/* --- its face ----------------------------------------------------------------------- */

.looks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

/* --- the prompts --------------------------------------------------------------------- */

textarea {
  font: 13px/1.45 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  resize: vertical;
}

textarea:focus {
  border-color: var(--line-hover);
  outline: none;
}

.part {
  margin: 0 0 18px;
}

.part h2 .about {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}

.part .hint {
  margin: 0 0 6px;
}

.part-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.part-actions .why {
  margin: 0;
}

pre.prompt {
  max-height: 60vh;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
}

.tools {
  margin: 0;
  padding-left: 1.2em;
}

.tools b {
  color: var(--pebble);
  margin-right: 6px;
}

/* --- settings ---------------------------------------------------------------------- */

.settings fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 12px;
  padding: 8px 12px 10px;
}

.settings legend {
  padding: 0 6px;
  font-weight: 600;
}

.settings .row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.settings .row > span:first-child {
  min-width: 9em;
}

.settings label.row {
  cursor: pointer;
}

/* options under each other, and an input that stays with its unit: a phone wraps around them */
.settings .choices {
  display: grid;
  gap: 4px;
}

.settings .field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.settings fieldset > p.hint {
  margin: 6px 0 0;
}

.settings input[type='range'] {
  accent-color: var(--accent);
  width: 12em;
}
