:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c232c; --line: #2a323d; --text: #e6e9ee; --muted: #8b95a3;
  --accent: #6ea8fe; --accent-ink: #08121f; --ok: #5fd08a; --warn: #f0b95b; --bad: #ef6b6b;
  --radius: 12px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
body.plain #root { width: min(420px, 100%); }
body.plain { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
h1 { font-size: 1.3rem; margin: 0 0 .5rem; }
h2 { font-size: 1rem; margin: 1.2rem 0 .4rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.error { color: var(--bad); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; width: min(420px, 100%); }
label { display: grid; gap: 6px; margin: 12px 0; color: var(--muted); font-size: .85rem; }
input, select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 120px; resize: vertical; }
.btn, .btn-ghost, button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 9px 14px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); text-decoration: none; display: inline-block;
}
.btn { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-ghost { background: transparent; }
button.danger { color: var(--bad); border-color: #5a2b2b; }
button:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }

/* layout */
header.top { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
header.top .brand { font-weight: 700; font-size: 1.05rem; }
main.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.pill { font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: #2c5a41; }
.pill.warn { color: var(--warn); border-color: #5e4a22; }
.pill.bad { color: var(--bad); border-color: #5a2b2b; }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); transition: .15s; }
.drop.over { border-color: var(--accent); color: var(--text); background: var(--panel); }
.drop .row { justify-content: center; margin-top: 8px; }
.check { display: inline-flex; gap: 6px; align-items: center; margin: 0; color: var(--text); font-size: .9rem; }
.check input { width: auto; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .82rem; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; text-align: left; padding: 0; color: inherit; }
.tile:hover { border-color: var(--accent); }
.thumb { height: 120px; background: var(--panel2); display: grid; place-items: center; color: var(--muted); font-size: 1.6rem; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .meta { padding: 10px 12px; display: grid; gap: 6px; }
.tile .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: .72rem; background: var(--panel2); border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(720px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dlg { padding: 18px; display: grid; gap: 4px; }
.dlg .preview { max-height: 280px; display: grid; place-items: center; background: var(--panel2); border-radius: 10px; overflow: hidden; }
.dlg .preview img { max-width: 100%; max-height: 280px; }
pre.body { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: .8rem; margin: 0; }
.shareurl { font-family: ui-monospace, monospace; font-size: .8rem; word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.sharerow { display: flex; justify-content: space-between; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); padding: 6px 0; font-size: .85rem; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 50; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); } .thumb { height: 96px; } }
table.facts { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 14px; }
table.facts th, table.facts td { text-align: left; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line, #2a2f38); vertical-align: top; }
table.facts th { font-weight: 500; color: var(--muted); white-space: nowrap; width: 1%; }
table.facts tr.unverified td:first-of-type { color: var(--warn); }
