/* Palette matches the overlay: GitHub-dark greys with the same accent blue and
   the same green the load ramp starts from, so the two clients feel related. */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2330;
  --border: #30363d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #6bc7ff;
  --green: #3fb950;
  --red: #f85149;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Keeps content clear of the Android gesture bar and any notch. */
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}

main, .setup {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

h1 { font-size: 20px; margin: 0; }

/* ---------- setup ---------- */

.setup { padding-top: 64px; text-align: center; }
.setup h1 { font-size: 28px; margin-bottom: 8px; }
.setup-hint { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }
.setup code { background: var(--surface); padding: 2px 5px; border-radius: 4px; }

#setup-form { display: flex; flex-direction: column; gap: 12px; }

/* ---------- top bar ---------- */

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

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  transition: background 200ms;
}
.dot.offline { background: var(--red); }
.dot.syncing { background: var(--accent); }

/* ---------- forms ---------- */

.add-form { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 20px; }
.add-form textarea {
  flex: 1;
  line-height: 1.45;
  max-height: 40vh;
  min-height: 48px;
  overflow-y: auto;
  resize: none;
}
.add-form button { flex: none; }

input[type="text"], input[type="password"], textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  /* 16px minimum stops iOS/Android from zooming the viewport on focus. */
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
}

input:focus-visible, button:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  padding: 12px 18px;
}
button:hover { background: var(--surface-hover); }

.add-form button, #setup-form button {
  background: var(--accent);
  border-color: var(--accent);
  color: #04121d;
  font-weight: 600;
}
.add-form button:hover, #setup-form button:hover { filter: brightness(1.1); }

.link-button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  padding: 4px;
}
.link-button:hover { background: none; color: var(--text); text-decoration: underline; }
.link-button.danger:hover { color: var(--red); }

/* ---------- lists ---------- */

.list-section { margin-bottom: 28px; }

.section-heading {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.section-toggle {
  background: none;
  border: none;
  padding: 0 0 10px;
  width: 100%;
}
.section-toggle:hover { background: none; color: var(--text); }

.chevron { display: inline-block; transition: transform 150ms; }
.section-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); }

.count { color: var(--text-dim); font-weight: 400; }

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

.task {
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px 14px;
}
.task.pending { opacity: 0.5; }

/* Tap targets stay finger-sized on the phone; the visual box is smaller. */
.task input[type="checkbox"] {
  accent-color: var(--green);
  flex: none;
  height: 20px;
  /* Nudged down so it sits on the title's baseline now that the row is
     top-aligned and the title is larger than body text. */
  margin: 2px 0 0;
  width: 20px;
}

/* Collapsed, the title carries the row on its own, so it is set larger than
   body text. The description is hidden entirely until the task is opened --
   that is what keeps a long list scannable. */
.task-body {
  align-items: baseline;
  cursor: text;
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
}
.task-body:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

.task-title {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.task.done .task-title {
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 400;
  text-decoration: line-through;
}

/* A quiet marker that there is more text behind the title. */
.has-notes {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  flex: none;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 1px 7px;
  text-transform: uppercase;
}

/* Open for editing: one text box, first line is the title. */
.task.editing { border-color: var(--accent); }

.task-editor {
  background: transparent;
  border: none;
  border-radius: 0;
  flex: 1;
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  min-height: 24px;
  overflow: hidden;
  padding: 0;
  resize: none;
  width: 100%;
}
.task-editor:focus-visible { outline: none; }

.star, .delete {
  background: none;
  border: none;
  color: var(--text-dim);
  flex: none;
  font-size: 18px;
  line-height: 1;
  padding: 6px;
}
.star:hover, .delete:hover { background: none; color: var(--text); }
.star.on { color: #e3b341; }
.delete:hover { color: var(--red); }

.empty, .ticker-note {
  color: var(--text-dim);
  font-size: 14px;
}
.ticker-note { border-top: 1px solid var(--border); line-height: 1.7; padding-top: 16px; }

kbd {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  padding: 1px 5px;
}

.error {
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 14px;
  margin: 0 0 16px;
  padding: 10px 14px;
}

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