:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --text: #1c2026;
  --muted: #5f6b7a;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --danger: #c8312b;
  --ok: #1a7f37;
  --warn: #9a6700;
  --radius: 8px;
  /* Faces, and the face of each kind of text (see fonts.js; theme.js applies saved choices). */
  --font-sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-charter: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif;
  --font-ui-meta: var(--font-sans);
  --font-ui-title: var(--font-sans);
  --font-text-small: var(--font-serif);
  --font-text-large: var(--font-serif);
  --font-text-quotes: var(--font-serif);
  --font-text-headings: var(--font-serif);
  --font: var(--font-ui-title);
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  accent-color: var(--accent);

  /* The reader page, shared with the apps (see Terrarium/DESIGN.md). */
  --reader-bg: var(--bg);
  --reader-fg: #1c1c1e;
  --reader-muted: #8e8e93;
  --reader-link: #0a84ff;

  /* Highlight colors, shared with the apps and the share page. */
  --hl-yellow: #ffd60a;
  --hl-yellow-alpha: 40%;
  --hl-green: #34c759;
  --hl-green-alpha: 32%;
  --hl-blue: #0a84ff;
  --hl-blue-alpha: 28%;
  --hl-pink: #ff3787;
  --hl-pink-alpha: 28%;
  --hl-purple: #af52de;
  --hl-purple-alpha: 30%;
  --hl-orange: #ff9500;
  --hl-orange-alpha: 35%;
}

/* Theme: "System" follows the OS; the Account page can force Light, Dark or High contrast. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light'], [data-theme='contrast']) {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1f242c;
    --border: #2d343e;
    --text: #e6e9ee;
    --muted: #97a1ae;
    --accent: #4c8dff;
    --accent-text: #0b1220;
    --danger: #ff6b63;
    --ok: #3fb950;
    --warn: #d29922;
    --reader-bg: #111113;
    --reader-fg: #f2f2f7;
    --reader-link: #409cff;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1216;
  --surface: #171b21;
  --surface-2: #1f242c;
  --border: #2d343e;
  --text: #e6e9ee;
  --muted: #97a1ae;
  --accent: #4c8dff;
  --accent-text: #0b1220;
  --danger: #ff6b63;
  --ok: #3fb950;
  --warn: #d29922;
  --reader-bg: #111113;
  --reader-fg: #f2f2f7;
  --reader-link: #409cff;
  --reader-muted: #8e8e93;
}
:root[data-theme='light'] {
  color-scheme: light;
}
:root[data-theme='contrast'] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: #000000;
  --text: #000000;
  --muted: #1a1a1a;
  --accent: #0000cc;
  --accent-text: #ffffff;
  --danger: #a00000;
  --ok: #006400;
  --warn: #6b4400;
  --reader-bg: #ffffff;
  --reader-fg: #000000;
  --reader-muted: #1a1a1a;
  --reader-link: #0000cc;
  --radius: 4px;
}
@media (prefers-contrast: more) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --border: #000000;
    --text: #000000;
    --muted: #1a1a1a;
    --accent: #0000cc;
    --accent-text: #ffffff;
    --danger: #a00000;
    --ok: #006400;
    --warn: #6b4400;
    --reader-bg: #ffffff;
    --reader-fg: #000000;
    --reader-muted: #1a1a1a;
    --reader-link: #0000cc;
    --radius: 4px;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
}

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

h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  margin: 0;
}
h1 .icon {
  width: 22px;
  height: 22px;
  color: var(--muted);
}
h2 {
  font-size: 15px;
  margin: 0 0 12px;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 12px;
}

/* Layout */

.shell {
  --sidebar-width: 200px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-areas: 'sidebar main';
  height: 100vh;
}
.shell.collapsed {
  --sidebar-width: 56px;
}

.sidebar {
  grid-area: sidebar;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 0 12px 8px;
}
.brand {
  font-weight: 700;
  font-size: 16px;
  padding: 4px 0;
}
.sidebar-head .brand {
  padding: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 6px;
}
.sidebar a:hover {
  background: var(--surface-2);
}
.sidebar a[aria-current='page'] {
  background: var(--surface-2);
  font-weight: 600;
}
.sidebar .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .me {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.sidebar .me .link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 0;
}

/* Collapsed to icons: labels go (they show as tooltips), and the rest centers on the icon. */
.shell.collapsed .sidebar-head {
  flex-direction: column;
  padding: 0 0 12px;
}
.shell.collapsed .sidebar-head .brand,
.shell.collapsed .sidebar .label,
.shell.collapsed .sidebar .who {
  display: none;
}
.shell.collapsed .sidebar a {
  justify-content: center;
  padding: 9px 0;
}
.shell.collapsed .sidebar .me {
  padding: 12px 0 0;
}
.shell.collapsed .sidebar .me .link {
  justify-content: center;
}

main {
  grid-area: main;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px 48px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
}
.stat .value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 2px;
}
.stat .sub {
  color: var(--muted);
  font-size: 12px;
}

.muted {
  color: var(--muted);
}
.danger-text {
  color: var(--danger);
}

@media (max-width: 760px) {
  /* Phones: one column, and the page itself scrolls. The sidebar becomes a row of sections, so it never collapses. */
  .shell,
  .shell.collapsed {
    --sidebar-width: auto;
    display: block;
    height: auto;
  }
  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-head {
    width: 100%;
    padding-bottom: 4px;
  }
  .sidebar-head .icon-button {
    display: none;
  }
  .shell.collapsed .sidebar-head {
    flex-direction: row;
  }
  .shell.collapsed .sidebar-head .brand,
  .shell.collapsed .sidebar .label,
  .shell.collapsed .sidebar .who {
    display: revert;
  }
  .shell.collapsed .sidebar a {
    justify-content: flex-start;
    padding: 7px 10px;
  }
  .sidebar .me {
    margin: 0;
    border: 0;
    width: 100%;
  }
  main {
    overflow: visible;
    padding: 16px;
  }
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: 0;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
td.actions {
  white-space: nowrap;
  text-align: right;
}
td.actions .row {
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.title-cell {
  max-width: 420px;
}
.title-cell .sub {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.reading-pie {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 6px;
  vertical-align: -1px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: conic-gradient(currentColor var(--fill), transparent 0);
}
.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

/* Controls */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover,
.button:hover {
  background: var(--surface-2);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
button.danger {
  color: var(--danger);
}
button.small,
.button.small {
  padding: 2px 8px;
  font-size: 12px;
  gap: 4px;
}
button.small .icon,
.button.small .icon {
  width: 14px;
  height: 14px;
}
button:not(.small) .icon,
.button:not(.small) .icon {
  width: 16px;
  height: 16px;
}
button.link {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  min-width: 0;
}
input[type='checkbox'] {
  width: auto;
}

form.fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
label.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
label.field input,
label.field select {
  font-size: 14px;
  color: var(--text);
}
label.check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  padding: 8px 12px;
}
.tabs button[aria-selected='true'] {
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok {
  color: var(--ok);
}
.badge.warn {
  color: var(--warn);
}
.badge.danger {
  color: var(--danger);
}
.badge.accent {
  color: var(--accent);
}
.badge.tag {
  color: var(--text);
}
.row.tags {
  gap: 4px;
  margin-top: 4px;
}
.error-text {
  color: var(--danger);
}

.error-box {
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 6px;
  padding: 8px 12px;
}

/* Dialog */

dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 20px;
  width: min(440px, calc(100vw - 32px));
}
dialog::backdrop {
  background: rgb(0 0 0 / 0.4);
}
dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* Login */

.login {
  max-width: 360px;
  margin: 12vh auto;
}
.login .brand {
  text-align: center;
  font-size: 22px;
}

/* Toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 8px;
  max-width: 360px;
}
.toast button {
  margin-left: 10px;
}
.toast.error {
  background: var(--danger);
  color: #fff;
}

pre.output {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--danger);
  max-width: 480px;
}

.flush {
  margin: 0;
}

/* Snapshot view */

.snapshot {
  color: var(--reader-fg);
  max-width: 46em;
  padding: 24px 32px;
  font: 17px/1.65 var(--font-text-small);
  overflow-wrap: break-word;
}
.snapshot img,
.snapshot video {
  max-width: 100%;
  height: auto;
}
.snapshot pre {
  overflow-x: auto;
}
.snapshot h1,
.snapshot h2,
.snapshot h3 {
  line-height: 1.25;
}

/* Item page: the text, with the inspector beside it */

.item-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.item-main {
  min-width: 0;
  max-width: 46em;
}
.item-main .reader-article-head {
  padding-top: 0;
}
.reader-article-head .sub a {
  color: inherit;
}
.inspector {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.inspector h2 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inspector .item-details {
  font-size: 13px;
}
.inspector .fields textarea {
  width: 100%;
}
@media (max-width: 1100px) {
  .item-page {
    grid-template-columns: 1fr;
  }
  .inspector {
    position: static;
    max-height: none;
  }
}

/* Highlights and notes */

.fields textarea {
  resize: vertical;
}
.dialog-quote {
  margin: 0;
  padding-left: 10px;
  border-left: 3px solid var(--border);
  max-height: 8em;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.item-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
}
.item-details dt {
  color: var(--muted);
}
.item-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.highlight {
  border-left: 4px solid var(--hl);
}
.highlight blockquote {
  margin: 0;
  font: 16px/1.6 var(--font-text-quotes);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.highlight-note {
  margin: 8px 0 0;
  color: var(--muted);
}
.highlight .tags {
  margin-top: 8px;
}
.highlight-source {
  margin-top: 10px;
  justify-content: space-between;
}
.highlight-source .sub {
  color: var(--muted);
  font-size: 13px;
}
.hl-yellow {
  --hl: var(--hl-yellow);
  --hl-alpha: var(--hl-yellow-alpha);
}
.hl-green {
  --hl: var(--hl-green);
  --hl-alpha: var(--hl-green-alpha);
}
.hl-blue {
  --hl: var(--hl-blue);
  --hl-alpha: var(--hl-blue-alpha);
}
.hl-pink {
  --hl: var(--hl-pink);
  --hl-alpha: var(--hl-pink-alpha);
}
.hl-purple {
  --hl: var(--hl-purple);
  --hl-alpha: var(--hl-purple-alpha);
}
.hl-orange {
  --hl: var(--hl-orange);
  --hl-alpha: var(--hl-orange-alpha);
}

/* Reader */

main.full-bleed {
  padding: 0;
  overflow: hidden;
}

.reader {
  display: grid;
  grid-template-columns: 220px minmax(280px, 360px) 1fr;
  height: 100%;
}
.reader > * {
  min-height: 0;
  overflow-y: auto;
}

.reader-nav {
  border-right: 1px solid var(--border);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.reader-nav a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 6px;
}
.reader-nav a:hover {
  background: var(--surface-2);
}
.reader-nav a[aria-current='page'] {
  background: var(--surface-2);
  font-weight: 600;
}
.reader-nav a {
  align-items: center;
}
.reader-nav .name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.reader-nav .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reader-nav .folder {
  font-weight: 600;
}
.reader-nav .failing .label {
  color: var(--danger);
}
.reader-nav .depth-1 {
  padding-left: 22px;
}
.reader-nav .depth-2 {
  padding-left: 36px;
}
.reader-nav .depth-3 {
  padding-left: 50px;
}
.reader-nav .count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.reader-nav-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 16px 8px 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.reader-nav-head .small-link {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}
.reader-nav .sub {
  padding: 0 8px;
  font-size: 12px;
}

.reader-list {
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.reader-list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reader-title {
  font-size: 17px;
  overflow-wrap: anywhere;
}
.reader-list-head select {
  font-size: 12px;
  padding: 2px 6px;
}
.scope-picker {
  display: none;
}

.reader-items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.reader-item {
  display: block;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  position: relative;
}
.reader-item.with-image {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: 10px;
}
.reader-item-image {
  width: 56px;
  height: 56px;
  margin-top: 2px;
}
.reader-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-2);
}
.reader-item-extras {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.reader-group {
  padding: 14px 14px 4px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.reader-item:hover {
  background: var(--surface-2);
}
.reader-item.selected {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--accent);
}
.reader-item.unread::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.reader-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.reader-item-meta .feed {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reader-item-meta span:last-child {
  white-space: nowrap;
}
.reader-item-meta .star {
  color: var(--warn);
  margin-right: 4px;
}
.reader-item-title {
  margin-top: 2px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.reader-item.read .reader-item-title {
  font-weight: 400;
  color: var(--muted);
}
.reader-item-excerpt {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.reader-more {
  padding: 12px 14px;
}

.reader-empty {
  padding: 32px 20px;
  text-align: center;
}
.reader-empty .sub {
  font-size: 12px;
}
kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}

.reader-pane {
  background: var(--reader-bg);
  color: var(--reader-fg);
  scrollbar-gutter: stable;
}
/* Reserve the scrollbar's space so short and long items don't shift the text. */
:root:has(.item-page) {
  scrollbar-gutter: stable;
}
@media (max-width: 760px) {
  :root:has(.reader.has-item) {
    scrollbar-gutter: stable;
  }
}
/* E-ink pages instead of scrolling, so no gutter. */
:root[data-theme='contrast'],
:root[data-theme='contrast']:has(.reader.has-item),
:root[data-theme='contrast'] .reader-pane {
  scrollbar-gutter: auto;
}
@media (prefers-contrast: more) {
  :root:not([data-theme]),
  :root:not([data-theme]):has(.reader.has-item),
  :root:not([data-theme]) .reader-pane {
    scrollbar-gutter: auto;
  }
}
.reader-article {
  --reader-size: 17px;
  --reader-width: 720px;
  --reader-leading: 1.6;
  --reader-font: var(--font-text-small);
  max-width: calc(var(--reader-width) + 64px);
  margin: 0 auto;
  padding: 0 32px 64px;
}
.reader-text-settings {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.reader-text-settings select {
  font-size: 12px;
  padding: 2px 6px;
}
.reader-actions {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.reader-actions .back {
  display: none;
}
.reader-article-head {
  padding: 24px 0 8px;
}
.reader-article-head h1 {
  font-family: var(--font-text-large);
  font-size: 26px;
  line-height: 1.25;
  margin: 4px 0 8px;
  overflow-wrap: anywhere;
}
.reader-article-head h1 a {
  color: inherit;
  text-decoration: none;
}
.reader-article-head h1 a:hover {
  text-decoration: underline;
}
.reader-article-head .sub {
  color: var(--reader-muted);
  font-size: 13px;
}
.reader-article a {
  color: var(--reader-link);
}
.reader-article-head h1 a {
  color: inherit;
}
.reader-body.snapshot {
  max-width: none;
  padding: 8px 0 0;
  font-family: var(--reader-font);
  font-size: var(--reader-size);
  line-height: var(--reader-leading);
  color: var(--reader-fg);
}
.reader-body.snapshot img {
  cursor: zoom-in;
}
:root[data-theme='contrast'] .reader-article a,
:root[data-theme='contrast'] a {
  text-decoration: underline;
}
:root[data-theme='contrast'] :is(button, select, input, textarea, .card, dialog) {
  border-width: 1.5px;
  border-color: #000;
}
@media (prefers-contrast: more) {
  :root:not([data-theme]) a {
    text-decoration: underline;
  }
  :root:not([data-theme]) :is(button, select, input, textarea, .card, dialog) {
    border-width: 1.5px;
    border-color: #000;
  }
}

.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
}
.lightbox::backdrop {
  background: rgb(0 0 0 / 0.85);
}
.lightbox img {
  display: block;
  max-width: 96vw;
  max-height: 96vh;
  cursor: zoom-out;
}
.reader-search {
  width: 100%;
}
.more-menu {
  position: relative;
}
.more-menu > div {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 3;
  min-width: 220px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.18);
}
.more-menu hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}
.more-menu :is(button, a.button) {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.more-menu a.button {
  color: var(--text);
  text-decoration: none;
}
.more-menu :is(button, a.button):hover {
  background: var(--surface-2);
}
.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
}
.shortcut-list dd {
  margin: 0;
}
.reader-body blockquote {
  font-family: var(--font-text-quotes);
  margin: 1em 0;
  padding-left: 1em;
  border-left: 3px solid var(--border);
}

@media (max-width: 1100px) {
  .reader {
    grid-template-columns: minmax(260px, 340px) 1fr;
  }
  .reader-nav {
    display: none;
  }
  .scope-picker {
    display: block;
  }
  .reader-title {
    display: none;
  }
}

@media (max-width: 760px) {
  main.full-bleed {
    overflow: visible;
  }
  .reader {
    display: block;
    height: auto;
  }
  .reader > * {
    overflow: visible;
  }
  .reader-list {
    border-right: 0;
  }
  .reader.has-item .reader-list,
  .reader:not(.has-item) .reader-pane {
    display: none;
  }
  .reader-actions .back {
    display: inline-block;
  }
  .reader-article {
    padding: 0 16px 48px;
  }
}

/* Highlighting */

mark.fr-hl {
  color: inherit;
  background: color-mix(in srgb, var(--hl) var(--hl-alpha), transparent);
  border-radius: 2px;
  cursor: pointer;
}
mark.fr-hl[data-fr-color='yellow'] {
  --hl: var(--hl-yellow);
  --hl-alpha: var(--hl-yellow-alpha);
}
mark.fr-hl[data-fr-color='green'] {
  --hl: var(--hl-green);
  --hl-alpha: var(--hl-green-alpha);
}
mark.fr-hl[data-fr-color='blue'] {
  --hl: var(--hl-blue);
  --hl-alpha: var(--hl-blue-alpha);
}
mark.fr-hl[data-fr-color='pink'] {
  --hl: var(--hl-pink);
  --hl-alpha: var(--hl-pink-alpha);
}
mark.fr-hl[data-fr-color='purple'] {
  --hl: var(--hl-purple);
  --hl-alpha: var(--hl-purple-alpha);
}
mark.fr-hl[data-fr-color='orange'] {
  --hl: var(--hl-orange);
  --hl-alpha: var(--hl-orange-alpha);
}
:root[data-theme='contrast'] mark.fr-hl {
  background: none;
  text-decoration-color: var(--hl);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
:root[data-theme='contrast'] mark.fr-hl[data-fr-color='yellow'] {
  text-decoration-line: underline;
  text-decoration-thickness: 4px;
}
:root[data-theme='contrast'] mark.fr-hl[data-fr-color='green'] {
  text-decoration-line: underline;
  text-decoration-style: double;
}
:root[data-theme='contrast'] mark.fr-hl[data-fr-color='blue'] {
  text-decoration-line: underline;
  text-decoration-style: dashed;
}
:root[data-theme='contrast'] mark.fr-hl[data-fr-color='pink'] {
  text-decoration-line: underline;
  text-decoration-style: wavy;
}
:root[data-theme='contrast'] mark.fr-hl[data-fr-color='purple'] {
  text-decoration-line: underline;
  text-decoration-style: dotted;
}
:root[data-theme='contrast'] mark.fr-hl[data-fr-color='orange'] {
  text-decoration: none;
  outline: 2px solid var(--hl);
  outline-offset: 1px;
}
@media (prefers-contrast: more) {
  :root:not([data-theme]) mark.fr-hl {
    background: none;
    text-decoration-color: var(--hl);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
  }
  :root:not([data-theme]) mark.fr-hl[data-fr-color='yellow'] {
    text-decoration-line: underline;
    text-decoration-thickness: 4px;
  }
  :root:not([data-theme]) mark.fr-hl[data-fr-color='green'] {
    text-decoration-line: underline;
    text-decoration-style: double;
  }
  :root:not([data-theme]) mark.fr-hl[data-fr-color='blue'] {
    text-decoration-line: underline;
    text-decoration-style: dashed;
  }
  :root:not([data-theme]) mark.fr-hl[data-fr-color='pink'] {
    text-decoration-line: underline;
    text-decoration-style: wavy;
  }
  :root:not([data-theme]) mark.fr-hl[data-fr-color='purple'] {
    text-decoration-line: underline;
    text-decoration-style: dotted;
  }
  :root:not([data-theme]) mark.fr-hl[data-fr-color='orange'] {
    text-decoration: none;
    outline: 2px solid var(--hl);
    outline-offset: 1px;
  }
}
mark.fr-hl-focus {
  outline: 2px solid var(--hl);
}

.hl-floating {
  position: fixed;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.18);
  font: 14px/1.45 var(--font);
}
.swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--hl);
}
.swatch:hover {
  background: var(--hl);
  border-color: var(--text);
}
.swatch.current {
  border-color: var(--text);
}

/* Share dialog */

.share-link {
  display: flex;
  gap: 6px;
}
.share-link input {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
}

.date-filter {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.reader-list-head .date-filter input[type='date'] {
  font-size: 12px;
  padding: 2px 6px;
}

/* Fonts by kind of text (see fonts.js). */
.snapshot :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-text-headings);
}
.highlight-note,
.note-body {
  font-family: var(--font-text-small);
}
.sub,
.stat .label,
.badge,
.inspector .item-details,
.reader-nav .count,
.reader-item-meta,
.reader-item-extras {
  font-family: var(--font-ui-meta);
}

/* View transitions (transitions.js), timed as in the apps. Only the elements named here are captured, so the
   rest of the page stays live and clickable while they animate. */
:root {
  view-transition-name: none;
}
::view-transition {
  pointer-events: none;
}

/* The reader crossfades from one article to the next. On phones the article replaces the list, so both fade. */
.vt-article .reader-pane {
  view-transition-name: reader-pane;
  view-transition-class: reader;
}
@media (max-width: 760px) {
  .vt-article .reader-list {
    view-transition-name: reader-list;
    view-transition-class: reader;
  }
}
::view-transition-group(.reader),
::view-transition-old(.reader),
::view-transition-new(.reader) {
  animation-duration: 0.2s;
  animation-timing-function: ease-in-out;
}

/* Toasts rise in from the bottom edge and fade; the ones still up slide into place. */
.toast {
  view-transition-class: toast;
}
::view-transition-group(.toast) {
  animation-duration: 0.2s;
  animation-timing-function: ease-in-out;
}
::view-transition-new(.toast):only-child {
  --vt-rise: calc(100% + 16px);
  animation: vt-rise-in 0.2s ease-in-out both;
}
::view-transition-old(.toast):only-child {
  --vt-rise: calc(100% + 16px);
  animation: vt-rise-out 0.2s ease-in-out both;
}

/* The highlight toolbar and popover fade in and out with a small rise. */
.hl-toolbar {
  view-transition-name: hl-toolbar;
  view-transition-class: hl-floating;
}
.hl-popover {
  view-transition-name: hl-popover;
  view-transition-class: hl-floating;
}
::view-transition-group(.hl-floating) {
  animation-duration: 0.15s;
  animation-timing-function: ease-out;
}
::view-transition-new(.hl-floating):only-child {
  animation: vt-rise-in 0.15s ease-out both;
}
::view-transition-old(.hl-floating):only-child {
  animation: vt-rise-out 0.15s ease-out both;
}

@keyframes vt-rise-in {
  from {
    opacity: 0;
    translate: 0 var(--vt-rise, 8px);
  }
}
@keyframes vt-rise-out {
  to {
    opacity: 0;
    translate: 0 var(--vt-rise, 8px);
  }
}
