@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2"); }

:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --ink: #1b1a17;
  --muted: #6b675e;
  --rule: #ddd7ca;
  --accent: #c2410c;
  --accent-ink: #fff;
  --chip: #ebe6da;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.06);
  --good: #3f8f1f;
  --mixed: #c99700;
  --bad: #d12f1f;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110f;
    --surface: #1c1b18;
    --ink: #eeeae1;
    --muted: #9c978b;
    --rule: #33302a;
    --accent: #f97316;
    --accent-ink: #12110f;
    --chip: #2a2824;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--sans); }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 14px; }
.brand { font-weight: 600; font-size: 1.1rem; text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 400; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { padding: 5px 11px; border-radius: 7px; text-decoration: none; font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.site-nav a:hover { color: var(--ink); background: var(--chip); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--chip); }

.intro { padding: 40px 0 8px; max-width: 46rem; }
.intro h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 12px; }
.intro p { color: var(--muted); margin: 0; font-size: 1.05rem; }
.notice { margin: 4px 0 18px; padding: 12px 16px; border-left: 4px solid var(--accent); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.notice-label { display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.intro .notice p { color: var(--ink); font-size: 1rem; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 22px 0 18px; }
.search { flex: 0 1 260px; min-width: 0; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.pick { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.pick select { padding: 7px 28px 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); }
.count { color: var(--muted); font-size: 0.85rem; margin: 10px 0 14px; min-height: 1.2em; }
.kinds { display: inline-flex; margin: 0 0 10px; border: 1px solid var(--rule); border-radius: 9px; overflow: hidden; background: var(--surface); }
.kinds:empty { display: none; }
.kinds button { border: 0; background: none; padding: 6px 14px; font-size: 0.88rem; font-weight: 500; cursor: pointer; color: var(--muted); }
.kinds button + button { border-left: 1px solid var(--rule); }
.kinds button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.kind { align-self: flex-start; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; }
.kind-series { background: color-mix(in srgb, #3b82f6 16%, transparent); color: color-mix(in srgb, #3b82f6 80%, var(--ink)); }
.kind-anime { background: color-mix(in srgb, #ec4899 16%, transparent); color: color-mix(in srgb, #ec4899 80%, var(--ink)); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid transparent; background: var(--chip); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
/* genres: ticked = shown, unticked = left out */
.chip.tick { display: inline-flex; align-items: center; gap: 6px; padding-left: 8px; }
.chip.tick .box { width: 13px; height: 13px; border-radius: 3px; border: 1.5px solid currentColor; display: inline-grid; place-items: center; font-size: 10px; line-height: 1; }
.chip.tick[aria-pressed="true"] { background: var(--chip); color: var(--ink); }
.chip.tick[aria-pressed="true"] .box::after { content: "✓"; font-weight: 700; }
.chip.tick[aria-pressed="false"] { background: transparent; color: var(--muted); border-color: var(--rule); text-decoration: line-through; }
.chip.all:disabled { opacity: 0.45; cursor: default; }
.genre-hint { margin: 8px 0 0; font-size: 0.82rem; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 28px 22px; padding-bottom: 48px; }
/* the title a shared link points at: marked for as long as the address points at it */
.card { position: relative; }
.card.linked { outline: 3px solid var(--accent); outline-offset: 3px; }
.linked-label { position: absolute; z-index: 2; top: 10px; left: 10px; padding: 4px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; box-shadow: 0 2px 8px rgb(0 0 0 / 0.3); }
@keyframes arrived { 0%, 100% { outline-offset: 3px; } 50% { outline-offset: 9px; } }
.card.arrived { animation: arrived 0.6s ease-in-out 0.2s 2; }
.btn.share.done { color: var(--good); border-color: var(--good); }
.card { scroll-margin: 24px; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.poster { position: relative; aspect-ratio: 2 / 3; background: var(--chip); }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .no-poster { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); font-weight: 600; }
.score { position: absolute; top: 10px; right: 10px; min-width: 40px; padding: 6px 7px; border-radius: 6px; font: 600 1rem/1 var(--mono); text-align: center; color: #fff; text-decoration: none; box-shadow: 0 2px 8px rgb(0 0 0 / 0.35); }
.score small { display: block; font: 500 0.55rem/1.2 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.9; }
.mine { position: absolute; top: 10px; right: 10px; padding: 6px 8px; border-radius: 6px; background: rgb(18 17 15 / 0.88); color: #fff; font: 600 1rem/1 var(--mono); text-align: center; box-shadow: 0 2px 8px rgb(0 0 0 / 0.35); }
.mine small { display: block; font: 500 0.55rem/1.2 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: #fdba74; }
.mine span { font-size: 0.7rem; opacity: 0.7; }
.scores { display: flex; flex-wrap: wrap; gap: 6px; }
.sc { display: inline-flex; align-items: center; gap: 6px; padding: 2px 3px 2px 8px; border: 1px solid var(--rule); border-radius: 6px; text-decoration: none; font-size: 0.75rem; color: var(--muted); }
.sc:hover { border-color: var(--muted); }
.sc b { min-width: 28px; padding: 2px 5px; border-radius: 4px; font: 600 0.82rem/1.2 var(--mono); text-align: center; color: #fff; background: var(--muted); }
.sc.good b { background: var(--good); }
.sc.mixed b { background: var(--mixed); color: #1b1a17; }
.sc.bad b { background: var(--bad); }
.sc.imdb b { background: #f5c518; color: #000; }
.score.good { background: var(--good); }
.score.mixed { background: var(--mixed); color: #1b1a17; }
.score.bad { background: var(--bad); }

.body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.title { margin: 0; font-size: 1.12rem; line-height: 1.25; letter-spacing: -0.01em; }
.title .year { color: var(--muted); font-weight: 400; }
.meta { color: var(--muted); font-size: 0.86rem; margin: 0; }
.genres { display: flex; flex-wrap: wrap; gap: 4px; }
.genres span { background: var(--chip); border-radius: 4px; padding: 1px 7px; font-size: 0.78rem; }
.note { margin: 2px 0 0; padding-left: 10px; border-left: 3px solid var(--accent); }
.note-label { display: block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.note .rich { margin-top: 2px; font-size: 0.93rem; }

/* Markdown texts (my statement): rendered by the server, see server/src/rich.js */
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p, .rich ul, .rich ol, .rich blockquote, .rich table, .rich pre { margin: 0 0 0.6em; }
.rich ul, .rich ol { padding-left: 1.3em; }
.rich h1, .rich h2, .rich h3, .rich h4, .rich h5, .rich h6 { font-size: 1em; margin: 0.8em 0 0.3em; }
.rich h1, .rich h2 { font-size: 1.08em; }
.rich a { color: var(--accent); }
.rich a.movie-link { text-decoration-style: dotted; text-underline-offset: 2px; }
.rich .missing { color: var(--muted); text-decoration: underline dotted; }
.rich mark { background: color-mix(in srgb, #facc15 55%, transparent); color: inherit; padding: 0 2px; border-radius: 2px; }
.rich code { font-family: var(--mono); font-size: 0.88em; background: var(--chip); padding: 1px 4px; border-radius: 3px; }
.rich pre { background: var(--chip); padding: 8px 10px; border-radius: 6px; overflow-x: auto; }
.rich pre code { background: none; padding: 0; }
.rich hr { border: 0; border-top: 1px solid var(--rule); margin: 0.8em 0; }
.rich blockquote { padding-left: 10px; border-left: 3px solid var(--rule); color: var(--muted); }
.rich table { border-collapse: collapse; font-size: 0.92em; display: block; overflow-x: auto; }
.rich th, .rich td { border: 1px solid var(--rule); padding: 3px 7px; }
.rich li.task { list-style: none; margin-left: -1.2em; }
.rich li.task-done { color: var(--muted); text-decoration: line-through; }
.rich .task-box { text-decoration: none; display: inline-block; }
.spoiler { border-radius: 3px; cursor: pointer; transition: color 0.15s, background 0.15s; }
.spoiler:not(.shown) { color: transparent; background: var(--ink); user-select: none; }
.spoiler:not(.shown) img { visibility: hidden; }
.callout { --c: #3b82f6; color: var(--ink) !important; border: 1px solid color-mix(in srgb, var(--c) 35%, transparent) !important; border-left: 4px solid var(--c) !important; border-radius: 6px; padding: 8px 10px !important; background: color-mix(in srgb, var(--c) 9%, transparent); }
.callout-title { font-weight: 600; color: var(--c); margin-bottom: 2px !important; }
.callout-tip, .callout-example { --c: #16a34a; }
.callout-warning, .callout-important { --c: #ea580c; }
.callout-question, .callout-todo { --c: #a855f7; }
.callout-quote { --c: #78716c; }
img.emote { display: inline-block; height: 1.75em; width: auto; vertical-align: middle; margin: -0.3em 0.05em; }
.emote-tip { position: fixed; z-index: 50; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); font: 500 0.75rem/1 var(--mono); color: var(--muted); }
.emote-tip img { max-width: 112px; max-height: 112px; width: auto; height: auto; }
.overview summary { cursor: pointer; color: var(--muted); font-size: 0.86rem; }
.overview p { margin: 6px 0 0; font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 500; font-size: 0.92rem; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.small { padding: 5px 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--rule); }

.empty, .status { color: var(--muted); padding: 32px 0; }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / 0.35); }
dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { margin: 0; font-size: 1.2rem; }
.dialog-body p { margin: 0; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.9rem; }
.field input, .field textarea, .field select { padding: 9px 11px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); width: 100%; }
.msg { font-size: 0.9rem; margin: 0; }
.msg.bad { color: var(--bad); }
.msg.ok { color: var(--good); }
dialog.trailer { width: min(960px, calc(100vw - 32px)); background: #000; color: #eee; }
.trailer-head { display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 16px; }
.trailer-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trailer-head a { color: #bbb; font-size: 0.85rem; white-space: nowrap; }
.trailer .close { border: 0; background: none; color: #eee; font-size: 1.6rem; line-height: 1; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; }
.trailer .close:hover { background: #222; }
.player { aspect-ratio: 16 / 9; background: #000; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 520px) { .trailer-head a { display: none; } }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.site-foot { border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.85rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding-top: 18px; padding-bottom: 28px; }

.prose { max-width: 46rem; padding-bottom: 48px; }
.prose h1 { font-size: 2rem; letter-spacing: -0.02em; margin: 36px 0 4px; }
.prose h2 { font-size: 1.1rem; margin: 28px 0 6px; }
.prose .updated { color: var(--muted); margin-top: 0; }
.table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; font-size: 0.9rem; width: 100%; }
.prose th, .prose td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); padding: 8px 10px 8px 0; }

/* wide screens: the filter panel is just part of the row; the toggle and the short labels are for phones */
.filter-panel, .genre-area { display: contents; }
.filter-toggle, .sc-short, .note .more { display: none; }
.filter-badge { color: var(--accent); }

/* ---------- phones: tidy and compact ---------- */
@media (max-width: 600px) {
  .site-head .wrap { padding-top: 12px; padding-bottom: 10px; align-items: center; }
  .site-nav a { padding: 4px 9px; font-size: 0.85rem; }

  .intro { padding: 18px 0 2px; }
  .intro h1 { font-size: 1.6rem; margin-bottom: 10px; }
  .notice { padding: 8px 12px; margin: 0 0 10px; border-left-width: 3px; }
  .notice-label { font-size: 0.64rem; }
  .intro .notice p { font-size: 0.86rem; line-height: 1.45; }
  .intro p { font-size: 0.9rem; }

  /* search and "Sort & filter" in one row; the rest opens below */
  .filters { flex-wrap: wrap; gap: 8px; padding: 14px 0 10px; }
  .search { flex: 1 1 0; }
  .filter-toggle { display: inline-flex; flex: none; padding: 8px 12px; }
  .filter-panel, .genre-area { display: none; }
  .filters-open .filter-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; flex-basis: 100%; }
  .filters-open .genre-area { display: block; margin-bottom: 4px; }
  .pick { flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; font-size: 0.78rem; }
  .pick select { min-width: 0; width: 100%; padding: 6px 24px 6px 8px; }
  #reset { grid-column: 1 / -1; justify-self: start; }
  .kinds { margin-bottom: 8px; }
  .kinds button { padding: 5px 11px; font-size: 0.82rem; }
  .chips { gap: 5px; }
  .chip { font-size: 0.78rem; padding: 3px 9px; }
  .count { margin: 4px 0 10px; }

  /* cards: two columns, less text */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .body { padding: 9px 10px 11px; gap: 6px; }
  .title { font-size: 0.95rem; }
  .kind { font-size: 0.6rem; }
  .scores { gap: 4px; }
  .sc { gap: 4px; padding: 1px 2px 1px 6px; font-size: 0.68rem; }
  .sc b { min-width: 0; padding: 1px 4px; font-size: 0.75rem; }
  .sc-label { display: none; }
  .sc-short { display: inline; }
  .genres span { font-size: 0.7rem; padding: 0 5px; }
  .meta { font-size: 0.78rem; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .note { padding-left: 8px; }
  .note .rich { font-size: 0.84rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
  .note.open .rich { display: block; -webkit-line-clamp: unset; overflow: visible; }
  .note .more { display: inline; margin-top: 2px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 0.78rem; font-weight: 600; cursor: pointer; }
  .overview summary { font-size: 0.78rem; }
  /* the main button across, trailer and share side by side under it */
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 4px; }
  .actions .btn { padding: 6px 6px; font-size: 0.78rem; line-height: 1.25; text-align: center; }
  .actions .btn:not(.ghost) { grid-column: 1 / -1; order: -1; }
  .linked-label { top: 6px; left: 6px; font-size: 0.6rem; padding: 3px 6px; }
  .mine { top: 6px; right: 6px; padding: 4px 6px; font-size: 0.85rem; }
  .mine small { font-size: 0.5rem; }

  dialog .dialog-body { padding: 18px; gap: 12px; }
  .site-foot .wrap { font-size: 0.78rem; }
  .prose h1 { font-size: 1.6rem; margin-top: 22px; }
}
