:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #14213d;
  --muted: #5f6b7f;
  --line: #e1dfd8;
  --brand: #14213d;
  --on-brand: #ffffff;
  --accent: #b86e00;
  --ok: #1a7f4b;
  --error: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1626;
    --surface: #172238;
    --text: #edf0f5;
    --muted: #9aa6ba;
    --line: #26334d;
    --brand: #fca311;
    --on-brand: #14213d;
    --accent: #fca311;
    --ok: #5fd39a;
    --error: #ff8a80;
  }
}

* { box-sizing: border-box; }

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

a { color: inherit; }

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.bar form { margin: 0; }

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

input, button, .button {
  font: inherit;
  border-radius: 0.6rem;
  padding: 0.65rem 0.9rem;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

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

button, .button {
  display: inline-block;
  border: 0;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

button.plain {
  padding: 0;
  background: none;
  color: inherit;
  font-weight: 400;
  text-decoration: underline;
}

.muted { color: var(--muted); }
.error { color: var(--error); }

.center {
  padding-top: 12vh;
  text-align: center;
}

.center h1 { margin: 0 0 0.5rem; }

.saved {
  font-size: 2.2rem;
  color: var(--ok);
}

.saved-title {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.stack {
  display: grid;
  gap: 0.9rem;
  max-width: 20rem;
  margin: 1.5rem auto 0;
  text-align: left;
}

.stack label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.add {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
}

.timeline li {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem 0.9rem;
}

.timeline li + li { border-top: 1px solid var(--line); }

.link-title {
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-title:hover { text-decoration: underline; }

.meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.empty {
  padding: 2rem 0;
  text-align: center;
}

.pages {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0.25rem;
}

.prose h1 { font-size: 1.4rem; }

.bookmarklet { cursor: grab; }
