:root {
  --fg: #111;
  --muted: #666;
  --line: #ccc;
  --bg: #fff;
  --soft: #f4f4f4;
  font-family: "Times New Roman", Times, serif;
}
@media (prefers-color-scheme: dark) {
  :root { --fg: #eee; --muted: #999; --line: #444; --bg: #111; --soft: #1c1c1c; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-size: 17px; line-height: 1.45; }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--fg); flex-wrap: wrap; }
h1 { margin: 0; font-size: 26px; }
.header-actions { display: flex; gap: 8px; }
.header-actions form { margin: 0; }
button, select, input { font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--fg); border-radius: 3px; padding: 6px 10px; }
button { cursor: pointer; }
button:hover { background: var(--soft); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 3px 0 0 3px; margin-left: 0; }
.seg button:last-child { border-radius: 0 3px 3px 0; }
.seg button.on { background: var(--fg); color: var(--bg); }
.check { display: inline-flex; gap: 6px; align-items: center; }
#q { flex: 1; min-width: 160px; }
.stats { margin: 0; padding: 10px 16px; color: var(--muted); }
main { padding: 0 16px 40px; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.card { display: grid; grid-template-columns: 140px 1fr; gap: 14px; border: 1px solid var(--fg); padding: 12px; }
@media (max-width: 560px) { .card { grid-template-columns: 1fr; } }
.thumb img { width: 100%; max-height: 260px; object-fit: cover; border: 1px solid var(--line); display: block; }
.thumb .ph { aspect-ratio: 9 / 16; max-height: 200px; border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.meta { font-size: 14px; color: var(--muted); }
.title { margin: 4px 0 6px; font-size: 20px; }
.summary { margin: 0 0 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tags span { font-size: 13px; border: 1px solid var(--line); padding: 1px 6px; }
.action { border-left: 3px solid var(--fg); padding: 4px 0 4px 10px; margin-bottom: 8px; }
.action-label { font-weight: bold; }
.action-instructions { margin: 4px 0; white-space: pre-wrap; }
.action-command { margin: 4px 0 0; padding: 8px; background: var(--soft); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-all; font-family: inherit; }
.action-command:empty { display: none; }
.more summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.details { font-size: 14px; white-space: pre-wrap; margin-top: 6px; }
.buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.buttons button, .buttons a { font-size: 14px; padding: 4px 8px; }
.buttons a { color: var(--fg); border: 1px solid var(--fg); border-radius: 3px; text-decoration: none; }
.pending .title { color: var(--muted); }
.error-msg { border: 1px solid var(--fg); padding: 6px; font-size: 14px; }
.empty { color: var(--muted); padding: 40px 0; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 3px; }
.connect { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.connect form { border: 1px solid var(--fg); padding: 24px; width: 100%; max-width: 380px; }
.connect h1 { margin: 0 0 16px; }
.connect input, .connect button { width: 100%; margin-top: 8px; }
.hint { color: var(--muted); font-size: 14px; }
.bad { margin-top: 10px; }
[hidden] { display: none !important; }
