@charset "utf-8";
/* Layout: one reading column; a sticky filter bar above a stream of quote slips, each slip = dialogue + attribution footer */
:root {
  --bg: #eef0f4;
  --paper: #ffffff;
  --ink: #1b1d2a;
  --muted: #646a80;
  --line: #d9dce6;
  --accent: #4b3fd1;
  --accent-soft: #e6e3fb;
  --mark: #ffe58a;
  --mark-ink: #1b1d2a;

  --f-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --f-quote: "Literata", "PT Serif", Georgia, serif;
  --f-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12131c; --paper: #1b1d29; --ink: #e9eaf2; --muted: #9a9fb8; --line: #2d3042;
    --accent: #a59bff; --accent-soft: #2a2752; --mark: #6b5a12; --mark-ink: #fff6cf;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12131c; --paper: #1b1d29; --ink: #e9eaf2; --muted: #9a9fb8; --line: #2d3042;
  --accent: #a59bff; --accent-soft: #2a2752; --mark: #6b5a12; --mark-ink: #fff6cf;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body {
  margin: 0;
  background: var(--bg); color: var(--ink);
  font-family: var(--f-ui); font-size: 15px; line-height: 1.5;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--bg);
}
.wrap {
  max-width: 760px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 40px 64px;
}

header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 24px; }
h1 {
  font-family: var(--f-display); font-weight: 700; font-size: clamp(28px, 6vw, 40px);
  letter-spacing: -0.02em; line-height: 1.05; margin: 0; text-wrap: balance;
}
h1 span { color: var(--accent); }
.tally { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* filters */
.filters {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--bg); padding-block: 12px; margin-bottom: 8px;
  display: grid; gap: 12px; border-bottom: 1px solid var(--line);
}
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
input, select, button { font: inherit; color: inherit; }
#q {
  width: 100%; padding: 12px 40px 12px 42px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); font-size: 16px;
}
#q:focus-visible, input[type="date"]:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.clear-q {
  position: absolute; right: 8px; top: 50%; translate: 0 -50%;
  border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 6px; font-size: 18px; line-height: 1;
}

.row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.dates { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input[type="date"], select {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 14px;
}
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.spacer { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 4px 12px; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline;
}
.chip small { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .8; }
.chip:hover { border-color: var(--accent); }
.chips:not(.open) .chip.extra:not([aria-pressed="true"]) { display: none; }
.chip.more { border-style: dashed; color: var(--accent); }
.reset { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 14px; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; }

/* quotes */
.list { display: grid; gap: 14px; margin-top: 16px; }
.quote {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px 16px; min-width: 0;
}
.lines { font-family: var(--f-quote); font-size: 18px; line-height: 1.55; display: grid; gap: 4px; overflow-wrap: anywhere; }
.lines p { margin: 0; }
.lines p.dlg { padding-left: 1.3em; text-indent: -1.3em; }
.lines p.dlg::before { content: "— "; color: var(--accent); }
.foot {
  display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; align-items: baseline;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 14px;
}
.by { color: var(--ink); font-weight: 500; }
.by .c { color: var(--accent); font-weight: 600; margin-right: 4px; }
.by button {
  border: 0; background: none; padding: 0; cursor: pointer; font-weight: 500; color: inherit;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px;
}
.by button:hover { text-decoration-color: var(--accent); }
.when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.when.none { font-style: italic; }
mark { background: var(--mark); color: var(--mark-ink); border-radius: 3px; padding: 0 1px; }

.pics { display: flex; flex-wrap: wrap; gap: 8px; }
.pics + .lines { margin-top: 14px; }
.pics button { border: 0; padding: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; max-width: 100%; }
.pics img { display: block; max-width: 100%; max-height: 320px; width: auto; height: auto; border-radius: 10px; }
.pics .missing {
  display: grid; place-items: center; min-height: 120px; padding: 16px; width: 100%;
  border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; text-align: center; overflow-wrap: anywhere;
}
.viewer {
  position: fixed; inset: 0; z-index: 20; background: rgba(10, 11, 18, .88);
  display: grid; place-items: center; cursor: zoom-out;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.loadbox { display: grid; gap: 12px; justify-items: center; }
.loadbox label {
  display: inline-block; padding: 8px 16px; border-radius: 8px; background: var(--accent); color: var(--paper);
  font-weight: 500; cursor: pointer;
}
.loadbox input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.loadbox label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty strong { display: block; font-family: var(--f-display); font-weight: 500; color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.note { margin-top: 32px; font-size: 13px; color: var(--muted); }

@media (max-width: 480px) {
  .quote { padding: 16px 16px 12px; }
  .lines { font-size: 17px; }
}
@media (prefers-reduced-motion: no-preference) {
  .quote { animation: in .25s ease both; }
  @keyframes in { from { transform: translateY(4px); } to { transform: none; } }
}
