:root {
  color-scheme: light dark;
  --bg: #eef1f2;
  --surface: #ffffff;
  --ink: #15191b;
  --muted: #5f6b70;
  --line: #d3dade;
  --accent: #0b5d63;
  --accent-soft: #dcebed;
  --font: "Adwaita Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.t-film { --type: #3f51b5; }
.t-series { --type: #0f766e; }
.t-product { --type: #a16207; }
.t-software { --type: #1d4ed8; }
.t-video { --type: #b91c1c; }
.t-person { --type: #6d28d9; }
.t-place { --type: #0e7490; }
.t-article { --type: #475569; }
.t-other { --type: #4b5563; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111518;
    --surface: #181e21;
    --ink: #e7edee;
    --muted: #9aa8ac;
    --line: #2a3438;
    --accent: #5ec8c4;
    --accent-soft: #173033;
  }
  .t-film { --type: #9fa8da; }
  .t-series { --type: #5eead4; }
  .t-product { --type: #fbbf24; }
  .t-software { --type: #93c5fd; }
  .t-video { --type: #fca5a5; }
  .t-person { --type: #c4b5fd; }
  .t-place { --type: #67e8f9; }
  .t-article { --type: #cbd5e1; }
  .t-other { --type: #9ca3af; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img { display: block; max-width: 100%; }
button, input { font: inherit; }
.shell { width: min(1040px, calc(100% - 48px)); margin: 0 auto; }

.top { border-bottom: 1px solid var(--line); background: var(--bg); }
.top-inner { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }
.brand:hover { color: var(--ink); }
.top-right { display: flex; align-items: baseline; gap: 16px; color: var(--muted); font-size: 12px; }
.top-right a { color: var(--muted); text-decoration: none; }
.top-right a:hover { color: var(--accent); }

.filters { padding: 28px 0 18px; border-bottom: 1px solid var(--line); }
.search-row { display: flex; align-items: center; gap: 16px; }
.search {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}
.search::placeholder { color: var(--muted); }
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.type-tabs { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; align-items: baseline; }
.type-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 3px 0 4px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}
.type-tab:hover { color: var(--ink); }
.type-tab[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.type-tab span { color: var(--muted); margin-left: 4px; font-size: 12px; }
.tag-clear { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.tag-clear strong { color: var(--ink); font-weight: 500; }
.tag-clear button { border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }

.notes { list-style: none; margin: 0; padding: 0; }
.note-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0 14px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--type);
}
.note-row:hover { background: var(--surface); }
.thumb { display: block; width: 88px; height: 66px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.type-label { color: var(--type); font-weight: 600; }
.note-row h2 { margin: 0 0 3px; font-size: 19px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.note-row h2 a { text-decoration: none; }
.note-row h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.dek { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.row-tags { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 12px; }
.row-tags a { color: var(--muted); text-decoration: none; }
.row-tags a:hover { color: var(--accent); text-decoration: underline; }
.note-row.no-thumb { grid-template-columns: minmax(0, 1fr); }
.note-row.no-thumb .thumb { display: none; }
.empty { padding: 48px 0; color: var(--muted); font-size: 15px; }

/* Note page */
.note-shell { width: min(720px, calc(100% - 48px)); margin: 0 auto; }
.note-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 28px;
  align-items: start;
  padding: 32px 0 20px 18px;
  border-left: 3px solid var(--type);
  border-bottom: 1px solid var(--line);
}
.note-head h1 { margin: 2px 0 10px; font-size: clamp(28px, 4vw, 36px); line-height: 1.14; font-weight: 600; letter-spacing: -0.02em; }
.note-head .row-tags { margin-top: 0; }
.note-thumb { margin: 0; border: 1px solid var(--line); background: var(--surface); }
.note-thumb img { width: 100%; height: 150px; object-fit: cover; }
.source { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 14px 0 28px; color: var(--muted); font-size: 12px; }
.source a { color: var(--accent); }
.content { padding-bottom: 24px; }
.content h2 { margin: 32px 0 10px; font-size: 22px; line-height: 1.25; font-weight: 600; }
.content h3 { margin: 24px 0 8px; font-size: 17px; font-weight: 600; }
.content p { margin: 10px 0; }
.content blockquote { margin: 20px 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--type); color: var(--muted); }
.content blockquote p { margin: 6px 0; }
.content table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 13px; }
.content th, .content td { border-bottom: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.content th { color: var(--muted); font-weight: 500; background: var(--surface); }
.content code { padding: 1px 4px; border-radius: 3px; background: var(--surface); font-size: .9em; }
.content pre { overflow-x: auto; padding: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; }
.content pre code { padding: 0; background: none; }
.content ul, .content ol { padding-left: 20px; }
.content li { margin: 3px 0; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.back { display: inline-block; margin: 6px 0 40px; color: var(--accent); font-size: 13px; text-decoration: none; }
.back:hover { text-decoration: underline; }

/* Tags page */
.tag-page { padding: 36px 0 8px; }
.tag-page h1 { margin: 0 0 4px; font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.tag-page .count { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.tag-group { margin: 28px 0 0; }
.tag-group h2 { margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600; }
.tag-index { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
.tag-index a { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; text-decoration: none; }
.tag-index a:hover { color: var(--accent); }
.tag-index a span { color: var(--muted); }
.tag-details summary { cursor: pointer; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600; }
.tag-details summary:hover { color: var(--accent); }
.tag-details .tag-index { margin-top: 8px; }

.site-footer { margin-top: 48px; padding: 16px 0 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

@media (max-width: 720px) {
  .shell, .note-shell { width: calc(100% - 32px); }
  .filters { padding: 20px 0 14px; }
  .type-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 16px; padding-bottom: 4px; }
  .type-tab { white-space: nowrap; }
  .note-row { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 12px 0 12px 10px; }
  .thumb { width: 64px; height: 48px; }
  .note-row h2 { font-size: 17px; }
  .dek { -webkit-line-clamp: 2; }
  .note-head { grid-template-columns: 1fr; gap: 16px; padding: 24px 0 18px 14px; }
  .note-thumb { order: 2; }
  .note-thumb img { height: 200px; }
  .note-head h1 { font-size: 28px; }
  .tag-index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content table { display: block; overflow-x: auto; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
