:root {
  color-scheme: light dark;
  --surface: light-dark(#f9f9ff, #12141a);
  --card: light-dark(#ffffff, #1b1e26);
  --row: light-dark(#fbf8f3, #181b22);
  --soft: light-dark(#f0f3ff, #20232c);
  --bar: light-dark(#efe6d8, #2a2d37);
  --ink: light-dark(#151c27, #eceff7);
  --muted: light-dark(#6b5d4d, #a9a193);
  --line: light-dark(#ebe3d8, #2c2f39);
  --primary: light-dark(#f59e0b, #f5b13d);
  --on-primary: light-dark(#613b00, #2a1700);
  --primary-soft: light-dark(#fff1d6, #3a2f1a);
  --primary-ink: light-dark(#855300, #f5c46b);
  --link: light-dark(#0058be, #7aa8ff);
  --error: light-dark(#ba1a1a, #ff8a80);
  --shadow: light-dark(0 2px 6px rgba(21,28,39,.05), 0 2px 6px rgba(0,0,0,.3)),
            light-dark(0 14px 30px -14px rgba(133,83,0,.18), 0 14px 30px -14px rgba(0,0,0,.5));
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 400 15px/1.55 "Plus Jakarta Sans", system-ui, sans-serif; word-spacing: .08em; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
button, input, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 5; background: var(--surface); padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 12px 16px 8px; display: flex; align-items: center; gap: 12px; }
.brand { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; height: 44px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 0 16px; }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 20px; line-height: 1; cursor: pointer; }
.chips { max-width: 1120px; margin: 0 auto; padding: 4px 16px 12px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.chip[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary-ink); border-color: var(--primary); }

.list { max-width: 1120px; margin: 0 auto; padding: 16px; columns: 1; column-gap: 16px; }
@media (min-width: 720px) { .list { columns: 2; } }
@media (min-width: 1000px) { .list { columns: 3; } }
.card { break-inside: avoid; display: block; width: 100%; text-align: left; margin: 0 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; padding: 0; }
.card:hover { border-color: var(--primary); }
.card img { display: block; width: 100%; max-height: 360px; object-fit: cover; background: var(--soft); }
.card-b { padding: 16px 20px 18px; }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.card p { margin: 0 0 8px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.src { font-size: 12px; font-weight: 700; color: var(--link); margin-bottom: 8px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { background: var(--primary-soft); color: var(--primary-ink); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.date { margin-left: auto; font-size: 12px; color: var(--muted); }
.empty { max-width: 460px; margin: 48px auto; padding: 0 24px; text-align: center; color: var(--muted); }

.fab { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 999px; border: 0; background: var(--primary); color: var(--on-primary); font-size: 32px; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 10px 24px -8px rgba(133,83,0,.5); }
.fab:hover { filter: brightness(.95); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer; font-size: 15px; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.danger { background: var(--card); color: var(--error); border-color: var(--error); }
.btn:hover { filter: brightness(.96); }

dialog.sheet { border: 0; padding: 24px; width: min(560px, calc(100vw - 24px)); max-height: 90dvh; border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
dialog.sheet.small { width: min(400px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10,12,18,.5); }
dialog h2 { margin: 0 0 16px; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 16px; resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.stack { display: grid; gap: 8px; }
.err { color: var(--error); font-weight: 700; font-size: 13px; margin: 0 0 8px; }
.add-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.add-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }

.d-img { width: 100%; max-height: 32dvh; object-fit: contain; border-radius: 16px; background: var(--soft); margin-bottom: 12px; }
.d-link { display: block; margin-bottom: 12px; color: var(--link); font-weight: 700; overflow-wrap: anywhere; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.tag-x { border: 0; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tag-x::after { content: "×"; font-size: 14px; }
.muted { color: var(--muted); font-size: 13px; }

.toast { position: fixed; inset: auto 16px calc(92px + env(safe-area-inset-bottom)) 16px; margin: 0 auto; width: fit-content; max-width: calc(100vw - 32px); border: 0; border-radius: 12px; padding: 12px 18px; background: var(--ink); color: var(--surface); font-weight: 700; box-shadow: var(--shadow); }
