/* ============================================================
   Spotlight — paper-and-lamplight design system
   Plain CSS, no framework. Two themes swapped on [data-theme].
   ============================================================ */

/* ---------- Tokens · DAY (warm greige) ---------- */
:root {
  --bg: #d9d6c5;
  --panel: #cfcbb7;
  --book: #e6e3d4; /* a shade lighter than --bg */
  --ink: #2e2a22;
  --ink-2: #5c5747;

  --sage: #7c8a66;
  --sage-deep: #5f6c4b;
  --sand: #e3c08d;
  --rose: #d6907c;
  --sky: #9fbbcc;
  --lavender: #b7a6cc;
  --gray: #b3b0a4;

  --hair: color-mix(in srgb, var(--ink) 13%, transparent);
  --card-shadow: 0 22px 48px -20px rgba(30, 24, 12, 0.45), 0 3px 10px rgba(30, 24, 12, 0.12);

  --grain-opacity: 0.18;
  --grain-blend: multiply;

  --mark-bg: color-mix(in srgb, var(--sand) 62%, transparent);
  --mark-blend: multiply;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Tokens · NIGHT ---------- */
:root[data-theme="night"],
body[data-theme="night"] {
  --bg: #1c1912;
  --panel: #14120c;
  --book: #2b2618;
  --ink: #ede6d6;
  --ink-2: #a79c87;

  --sage: #8fa173;
  --sage-deep: #a9bc8c;
  --sand: #d2a868;
  --rose: #c67f6c;
  --sky: #7fa6be;
  --lavender: #9c87b8;
  --gray: #746d5d;

  --hair: color-mix(in srgb, var(--ink) 16%, transparent);
  --card-shadow: 0 26px 54px -22px rgba(0, 0, 0, 0.7), 0 3px 12px rgba(0, 0, 0, 0.4);

  --grain-opacity: 0.16;
  --grain-blend: overlay;

  --mark-bg: color-mix(in srgb, var(--sand) 30%, transparent);
  --mark-blend: screen;
}

* {
  box-sizing: border-box;
}

/* Suppress transitions until the first frame is painted (set page + theme
   without a fade). app.js removes .preload on the next animation frame. */
.preload * {
  transition: none !important;
  animation: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  /* keep a trackpad side-swipe from triggering browser back/forward */
  overscroll-behavior-x: none;
}

[hidden] {
  display: none !important;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

button {
  font-family: inherit;
}

/* ---------- Paper grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 900;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  transition: opacity 0.4s var(--ease);
}

/* ---------- Stage & pages ---------- */
.stage {
  position: fixed;
  inset: 0 0 78px 0;
  overflow: hidden;
}

.page {
  position: absolute;
  inset: 0;
  padding: 28px;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}
.page.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.page[data-accent="sage"] {
  --accentcol: var(--sage-deep);
  --accentraw: var(--sage);
}
.page[data-accent="rose"] {
  --accentcol: var(--rose);
  --accentraw: var(--rose);
}
.page[data-accent="sky"] {
  --accentcol: var(--sky);
  --accentraw: var(--sky);
}
.page[data-accent="lavender"] {
  --accentcol: var(--lavender);
  --accentraw: var(--lavender);
}

.page--stage,
.page--center {
  display: grid;
  place-items: center;
}

/* ============================================================
   PAGE 1 · SPOTLIGHT
   ============================================================ */
.spot-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(760px, 92vw);
  height: 560px;
  transform: translate(-50%, -78%);
  background: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--sand) 42%, transparent) 0%,
    color-mix(in srgb, var(--sand) 16%, transparent) 38%,
    transparent 68%
  );
  filter: blur(14px);
  pointer-events: none;
  animation: flicker 6s ease-in-out infinite;
}
@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.85;
  }
}

/* Room around the book falls off into shadow, so the lit page reads as lit —
   the daytime version of what the dark night background does for free. Sits
   behind the (transparent) book canvas; the warm .spot-glow paints over it. */
.page--stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 82% 72% at 50% 40%,
    transparent 42%,
    rgba(28, 22, 12, 0.3) 100%
  );
}
[data-theme="night"] .page--stage::before {
  background: radial-gradient(
    ellipse 82% 72% at 50% 40%,
    transparent 48%,
    rgba(0, 0, 0, 0.4) 100%
  );
}

/* 2.5-D book canvas — fills the stage; the flat card is the fallback */
.spot3d {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.spot3d__canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.page[data-render="3d"] #bookCard {
  display: none;
}
.page[data-render="dom"] .spot3d {
  display: none;
}

/* "Shuffle from" picker — tucked into the bottom-right corner, dimmed until
   you reach for it, so it stays out of the way of just reading. */
.spot-source {
  position: absolute;
  right: 22px;
  bottom: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0.5;
  transition: opacity 0.25s var(--ease);
}
.spot-source:hover,
.spot-source:focus-within {
  opacity: 1;
}
.spot-source__label {
  font: 600 9.5px var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.spot-source:hover .spot-source__label,
.spot-source:focus-within .spot-source__label {
  opacity: 1;
  transform: none;
}
.spot-source__select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding: 4px 26px 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  font: 500 11.5px var(--font-ui);
  color: var(--ink-2);
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.spot-source:hover .spot-source__select,
.spot-source:focus-within .spot-source__select {
  color: var(--ink);
  border-color: var(--accentcol, var(--sage-deep));
}
.spot-source__select:focus-visible {
  outline: 2px solid var(--accentcol, var(--sage-deep));
  outline-offset: 2px;
}

.book {
  position: relative;
  width: min(560px, calc(100vw - 56px));
  background: var(--book);
  border-radius: 2px;
  padding: 52px 46px 38px;
  transform: rotate(-0.4deg);
  box-shadow: var(--card-shadow);
  transition: background-color 0.4s var(--ease);
}

.book__spine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 26px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0));
  border-radius: 2px 0 0 2px;
  pointer-events: none;
}

.book__ribbon {
  position: absolute;
  top: -12px;
  left: 40px;
  width: 26px;
  height: 46px;
  background: var(--rose);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.22);
}

.book__eyebrow {
  margin: 0 0 18px;
  font: 600 10.5px/1.4 var(--font-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.book__quote {
  margin: 0;
  font: 400 21px/1.5 var(--font-serif);
  color: var(--ink);
}
.book__quote .ctx {
  color: var(--ink-2);
}
.book__quote mark {
  background: var(--mark-bg);
  color: inherit;
  mix-blend-mode: var(--mark-blend);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0.06em 0.16em;
  border-radius: 0.16em;
}

.book__meta {
  margin: 22px 0 0;
  font: 400 12.5px/1.6 var(--font-ui);
  color: var(--ink-2);
}
.book__meta a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
}
.book__meta a:hover {
  border-color: var(--accentcol, var(--sage-deep));
}
.book__meta .sep {
  opacity: 0.5;
  margin: 0 7px;
}

.book--empty .book__quote {
  font-size: 18px;
  color: var(--ink-2);
}

.spot-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  margin: 0;
  text-align: center;
  font: italic 400 14px/1.5 var(--font-display);
  color: var(--ink-2);
  pointer-events: none;
}

/* ============================================================
   PAGE 2 · LIBRARY
   ============================================================ */
.lib {
  width: min(940px, 100%);
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 6px 4px 4px;
}

.lib__head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.seg__btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 999px;
  font: 500 12.5px var(--font-ui);
  color: var(--ink-2);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.seg__btn.is-active {
  background: var(--rose);
  color: #241f17;
}

.lib__filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--rose) 26%, transparent);
  font: 500 12px var(--font-ui);
  color: var(--ink);
}
.lib__filter button {
  border: 0;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
  color: var(--ink);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}

.lib__body {
  flex: 1;
  min-height: 0;
  position: relative;
}

.folders,
.alllist {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  /* scroll stays, the bar is hidden */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* legacy Edge */
}
.folders::-webkit-scrollbar,
.alllist::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Folders grid */
.folders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-content: safe center;
  padding: 8px 4px;
  max-width: 100%;
}

.folder {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 128px;
  padding: 16px;
  border-radius: 12px;
  background: var(--fcol, var(--sage));
  color: #241f17;
  cursor: pointer;
  text-align: left;
  border: 0;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.folder:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -14px rgba(30, 24, 12, 0.5);
}
.folder__icon {
  width: 22px;
  height: 22px;
}
.folder__name {
  font: 600 15px var(--font-display);
  margin-top: auto;
}
.folder__count {
  font: 500 12px var(--font-ui);
  opacity: 0.72;
}

.folder__del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #241f17;
  background: color-mix(in srgb, #241f17 12%, transparent);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s var(--ease), background-color 0.18s var(--ease);
}
.folder__del svg {
  width: 13px;
  height: 13px;
}
.folder:hover .folder__del,
.folder:focus-within .folder__del,
.folder__del:focus-visible {
  opacity: 1;
}
.folder__del:hover {
  background: color-mix(in srgb, #241f17 24%, transparent);
}
@media (hover: none) {
  .folder__del {
    opacity: 0.5;
  }
}

.folder--add {
  background: transparent;
  border: 2px dashed color-mix(in srgb, var(--ink) 26%, transparent);
  color: var(--ink-2);
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
}
.folder--add:hover {
  border-color: var(--accentcol, var(--rose));
  transform: translateY(-3px);
  box-shadow: none;
}
.folder--add .folder__name {
  margin-top: 0;
}

/* All-highlights list — passages shown as they were marked, on paper slips */
.alllist {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 2px 4px 40px;
}
.alllist__count {
  position: sticky;
  top: 0;
  z-index: 3;
  align-self: center;
  width: 100%;
  max-width: 720px;
  margin: 0;
  padding: 4px 2px 12px;
  font: 600 10.5px var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: linear-gradient(var(--bg) 62%, transparent);
}

.alllist__group {
  align-self: center;
  width: 100%;
  max-width: 720px;
  margin: 12px 0 2px;
  padding-left: 2px;
  display: flex;
  align-items: center;
  gap: 12px;
  font: 600 10px var(--font-ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.alllist__group::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hair);
}
.alllist__group:first-of-type {
  margin-top: 0;
}

.slip {
  position: relative;
  flex: none;
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 18px 20px 14px;
  background: var(--book);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20, 16, 8, 0.06), 0 10px 24px -18px rgba(20, 16, 8, 0.4);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), opacity 0.22s var(--ease);
}
/* a slim rule in the folder colour, like a marker tab down the edge */
.slip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--scol, var(--gray));
}
.slip:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 2px rgba(20, 16, 8, 0.08), 0 16px 30px -18px rgba(20, 16, 8, 0.5);
}
.slip--leaving {
  opacity: 0;
  transform: translateX(28px);
}

.slip__quote {
  margin: 0;
  font: 400 16px/1.78 var(--font-serif);
  color: var(--ink-2);
}
.slip__ctx {
  color: var(--ink-2);
}
.slip__quote mark {
  background: var(--mark-bg);
  color: var(--ink);
  mix-blend-mode: var(--mark-blend);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0.08em 0.16em;
  border-radius: 0.16em;
}

.slip__foot {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.slip__src {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font: 400 12px var(--font-ui);
  color: var(--ink-2);
  text-decoration: none;
  overflow: hidden;
}
.slip__dot {
  flex: none;
  align-self: center;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.slip__title {
  flex: 0 1 auto;
  min-width: 2ch;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.slip__src:hover .slip__title {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--scol, var(--gray));
}
.slip__when {
  flex: none;
  white-space: nowrap;
}

.slip__cat {
  flex: none;
  align-self: center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding: 3px 22px 3px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ccol, var(--gray)) 55%, transparent);
  font: 500 11px var(--font-ui);
  color: var(--ink-2);
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.slip:hover .slip__cat,
.slip__cat:focus-visible {
  background-color: var(--ccol, var(--gray));
  border-color: transparent;
  color: #241f17;
}

.lib__empty {
  padding: 48px 6px;
  font: italic 400 15px var(--font-display);
  color: var(--ink-2);
}

/* ============================================================
   PAGE 3 & 4 · TEASERS
   ============================================================ */
.teaser {
  max-width: 460px;
  background: var(--book);
  border-radius: 3px;
  padding: 40px 40px 42px;
  transform: rotate(-0.3deg);
  box-shadow: var(--card-shadow);
}
.teaser__tag {
  margin: 0 0 14px;
  font: 600 10.5px var(--font-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accentcol);
}
.teaser h2 {
  margin: 0 0 14px;
  font: italic 600 28px/1.25 var(--font-display);
  color: var(--ink);
}
.teaser p {
  margin: 0;
  font: 400 16px/1.62 var(--font-serif);
  color: var(--ink-2);
}

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.navbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 78px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  background: var(--panel);
  border-top: 1px solid var(--hair);
  z-index: 800;
  transition: background-color 0.4s var(--ease);
}

.wordmark {
  flex: 0 0 auto;
  font: italic 600 20px var(--font-display);
  color: var(--ink);
  letter-spacing: 0.01em;
}

.tabs {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  align-self: stretch;
  padding-bottom: 15px;
}

.tab {
  border: 0;
  cursor: pointer;
  padding: 6px 15px;
  border-radius: 7px 7px 3px 3px;
  font: 600 12px var(--font-ui);
  color: #241f17;
  background: color-mix(in srgb, var(--tab) 78%, var(--panel));
  transform: translateY(3px);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease),
    background-color 0.28s var(--ease);
}
.tab:hover {
  transform: translateY(0) scale(1.06);
}
.tab.is-active {
  transform: translateY(-3px) scale(1.05);
  background: var(--tab);
  box-shadow: 0 8px 18px -7px rgba(0, 0, 0, 0.5);
}

.nav-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.themeswitch {
  position: relative;
  width: 56px;
  height: 27px;
  border-radius: 999px;
  border: 1px solid var(--gray);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  cursor: pointer;
  padding: 0;
}
.themeswitch__sun,
.themeswitch__moon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  line-height: 1;
  color: var(--ink-2);
}
.themeswitch__sun {
  left: 6px;
}
.themeswitch__moon {
  right: 6px;
}
.themeswitch__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--sand);
  transition: transform 0.35s var(--ease), background-color 0.35s var(--ease);
}
[data-theme="night"] .themeswitch__knob {
  transform: translateX(28px);
  background: var(--sky);
}

.authlink {
  border: 0;
  background: none;
  cursor: pointer;
  font: 500 12.5px var(--font-ui);
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.authlink:hover {
  color: var(--ink);
}

/* ---------- Auth panel ---------- */
.authpanel {
  position: fixed;
  right: 18px;
  bottom: 88px;
  width: 300px;
  padding: 16px;
  border-radius: 10px;
  background: var(--book);
  border: 1px solid var(--hair);
  box-shadow: var(--card-shadow);
  z-index: 850;
}
.authpanel__msg {
  margin: 0 0 12px;
  font: 400 13px/1.55 var(--font-serif);
  color: var(--ink-2);
}
.authpanel__err {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--rose) 26%, transparent);
  border: 1px solid color-mix(in srgb, var(--rose) 50%, transparent);
  font: 400 12px/1.45 var(--font-ui);
  color: var(--ink);
}

.gbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #dadce0;
  background: #fff;
  color: #1f1f1f;
  font: 500 13px var(--font-ui);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.gbtn:hover {
  background: #f7f8f8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}
.gbtn:disabled {
  opacity: 0.6;
  cursor: default;
}
.gbtn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.authpanel__or {
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 10.5px var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.authpanel__or::before,
.authpanel__or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hair);
}

.authpanel__form {
  display: flex;
  gap: 8px;
}
.authpanel__form input {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--hair);
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink);
  font: 400 12.5px var(--font-ui);
}
.pill-btn {
  border: 0;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 7px;
  background: var(--sage);
  color: #241f17;
  font: 600 12px var(--font-ui);
}
.linkbtn {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  font: 500 12.5px var(--font-ui);
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.linkbtn:hover {
  color: var(--ink);
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  /* Still one viewport — just a denser bar. The only scroll is the
     inner Library list, which owns its own overflow. */
  .stage {
    inset: 0 0 62px 0;
  }
  .page {
    padding: 18px;
  }

  .book {
    width: calc(100vw - 32px);
    padding: 40px 26px 28px;
  }
  .book__quote {
    font-size: 18px;
  }
  .book__ribbon {
    left: 26px;
  }
  .spot-glow {
    width: 96vw;
    filter: blur(10px);
  }
  .spot-caption {
    font-size: 12px;
    bottom: 46px;
    padding: 0 16px;
  }
  .spot-source {
    right: 12px;
    bottom: 12px;
    opacity: 1;
  }
  .spot-source__label {
    display: none;
  }

  .teaser {
    padding: 30px 26px 32px;
  }
  .teaser h2 {
    font-size: 23px;
  }

  .lib {
    padding: 4px 0 0;
  }
  .folders {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .folder {
    min-height: 112px;
    padding: 13px;
  }
  .slip {
    padding: 16px 15px 13px;
  }
  .slip__quote {
    font-size: 15px;
  }
  .slip__foot {
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  .slip__title {
    max-width: 100%;
  }
  .slip__cat {
    background-color: var(--ccol, var(--gray));
    border-color: transparent;
    color: #241f17;
  }

  .navbar {
    height: 62px;
    gap: 8px;
    padding: 0 12px;
  }
  .wordmark {
    font-size: 0;
  }
  .wordmark::after {
    content: "✦";
    font-size: 16px;
  }
  .tabs {
    gap: 6px;
    padding-bottom: 10px;
    min-width: 0;
  }
  .tab {
    padding: 5px 8px;
    font-size: 10px;
    white-space: nowrap;
  }
  .nav-right {
    gap: 8px;
  }
  .authlink {
    font-size: 0;
  }
  .authlink::after {
    content: "☁";
    font-size: 15px;
  }
  .themeswitch {
    width: 44px;
    height: 23px;
  }
  [data-theme="night"] .themeswitch__knob {
    transform: translateX(21px);
  }
  .authpanel {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 72px;
  }
}

@media (max-width: 400px) {
  .tab {
    padding: 5px 6px;
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
