/* Quiet on purpose — see README.md's tone. No modal chrome, no
   celebration animation on save, no transitions on the check-in controls.
   The one thing allowed to stand out visually is the export button,
   deliberately. */

:root {
  color-scheme: light;
  --ink: #2a2622;
  --paper: #faf8f5;
  --line: #ddd6cc;
  --quiet: #746c60;
  --accent: #5b6e5a;
  --warn: #8a5a2e;
}

/* Dark: follows the device unless the header toggle says otherwise
   (app/lib/theme.js sets data-theme on <html>). Same roles, same quiet. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e2ded7;
    --paper: #15171b;
    --line: #2d3138;
    --quiet: #9a948a;
    --accent: #8fa58d;
    --warn: #d6a06a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e2ded7;
  --paper: #15171b;
  --line: #2d3138;
  --quiet: #9a948a;
  --accent: #8fa58d;
  --warn: #d6a06a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
}

a {
  color: var(--accent);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 1.25rem;
}

.tabs a {
  text-decoration: none;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.45rem 0.7rem;
  color: var(--quiet);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}

.export-btn {
  font-weight: 600;
  background: var(--accent);
  color: var(--paper);
  border: none;
  border-radius: 4px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

.banner {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
  min-height: 1.6rem;
}

.banner-row {
  margin: 0;
  color: var(--quiet);
}

.warn {
  color: var(--warn);
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.quiet {
  color: var(--quiet);
}

/* ---- check-in: sliders, nothing else ---- */

.sliders {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin: 1.25rem 0;
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr 3fr auto;
  align-items: center;
  gap: 0.75rem;
}

.slider-label small {
  display: block;
  color: var(--quiet);
  font-weight: 400;
}

/* On a phone the label sits above its slider, so every slider gets the
   full width and they all line up. */
@media (max-width: 34rem) {
  .slider-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "label value" "input input";
    row-gap: 0.35rem;
  }
  .slider-row > .slider-label { grid-area: label; }
  .slider-row > output { grid-area: value; }
  .slider-row > input,
  .slider-row > span:not(.slider-label) { grid-area: input; }
  .slider-label small { display: inline; margin-left: 0.4rem; }
  .tabs { gap: 0.9rem; }
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  /* A vertical drag that starts on a slider scrolls the page instead of
     moving it; only a sideways drag changes the value. See checkin.js for
     the other half — undoing the jump a touch makes before the browser
     decides it was a scroll. */
  touch-action: pan-y;
}

/* After an action: -2..+2 from where you were, not an absolute level. */
.slider-row.relative > span:not(.slider-label) {
  display: block;
}

.slider-row.relative input[type="range"] {
  accent-color: var(--accent);
}

.scale-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--quiet);
  margin-top: -0.1rem;
}

.slider-row output {
  font-variant-numeric: tabular-nums;
  color: var(--quiet);
  min-width: 3.2em;
  text-align: right;
}

button.primary {
  background: var(--accent);
  color: var(--paper);
  border: none;
  border-radius: 4px;
  padding: 0.65rem 1.1rem;
  font-size: 1rem;
  cursor: pointer;
}

button.secondary {
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  color: var(--ink);
}

/* ---- ranked actions ---- */

.action-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  cursor: pointer;
}

.action-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

/* Settled: a quiet line, not a celebration — see docs/traces.md's
   "Settled" trace and app/views/actions.js's settledPanel(). The list
   stays one plain <details> disclosure away, styled like any other text
   link rather than a call to action. */
.settled-note {
  margin-bottom: 0.5rem;
}

.settled-anyway summary {
  cursor: pointer;
  color: var(--quiet);
  font-size: 0.9rem;
}

.meta {
  margin: 0 0 0.35rem;
  color: var(--quiet);
  font-size: 0.85rem;
}

.change-panel {
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.inference {
  color: var(--quiet);
  font-size: 0.9rem;
}

/* ---- polarization proposal: a question, not an alert ---- */

.polarization-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.polarization-panel p {
  margin: 0 0 0.5rem;
}

.polarization-actions {
  display: flex;
  gap: 0.6rem;
}

/* ---- action detail ---- */

.steps li {
  margin-bottom: 0.4rem;
}

.in-progress {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.arc-context {
  width: 100%;
  margin: 0 0 0.3rem;
}

/* ---- sequences: a path, not one more card in the ranked pile ---- */

.sequences {
  margin-bottom: 1.25rem;
}

.sequence-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sequence-card {
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  cursor: pointer;
}

.sequence-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

/* ---- arc detail: the whole path, and where we are in it ---- */

.arc-steps {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.arc-step {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.arc-step .step-no {
  color: var(--quiet);
  font-size: 0.85rem;
}

.arc-step.current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* The free-text check-in, its conversation, the journal, settings. */
.tabs a.current {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.note,
.journal,
.settings {
  max-width: 40rem;
}

.note h1 small {
  font-size: 0.9rem;
  font-weight: normal;
  margin-left: 0.4rem;
}

.note-field {
  display: block;
  margin: 0 0 1rem;
}

.note-field > span {
  display: block;
  margin-bottom: 0.3rem;
}

.note-field small {
  color: var(--quiet);
  margin-left: 0.3rem;
}

.note textarea,
.settings input[type="password"] {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
  resize: vertical;
}

.turn {
  margin: 0 0 1rem;
  padding: 0.1rem 0.9rem;
  border-left: 3px solid var(--line);
}

.turn.assistant {
  border-left-color: var(--accent);
}

.summary {
  margin: 0 0 1rem;
  padding: 0.6rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: 4px;
}

.summary p {
  margin: 0.3rem 0 0;
}

.row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

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

.note-list li {
  border-bottom: 1px solid var(--line);
}

.note-list a {
  display: block;
  padding: 0.7rem 0;
  color: var(--ink);
  text-decoration: none;
}

.note-list .meta {
  display: block;
  color: var(--quiet);
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.settings h2 {
  font-size: 1.05rem;
  margin: 1.6rem 0 0.4rem;
}

.settings fieldset {
  border: none;
  padding: 0;
  margin: 0.4rem 0;
}

.settings .check,
.settings .inline {
  display: block;
  margin: 0.5rem 0;
}

.settings input[type="number"] {
  width: 4.5rem;
}

.settings input,
.settings select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
}

.settings input[type="checkbox"],
.settings input[type="radio"] {
  padding: 0;
}

button.link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.reminder:empty {
  display: none;
}

.settings legend {
  padding: 0;
  margin-top: 0.6rem;
}

.settings .check small {
  display: block;
  margin-left: 1.6rem;
}

.try {
  margin: -0.4rem 0 1rem 0.9rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.try.done {
  padding: 0.4rem 0.9rem;
}

.try p {
  margin: 0.4rem 0;
}

.try ol {
  margin: 0.5rem 0 0.8rem;
  padding-left: 1.3rem;
}

.sync-code {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  user-select: all;
}
