:root {
  --bg: #f6f7fb; --card: #fff; --text: #1b1f2a; --muted: #5d6475; --line: #e3e6ee;
  --accent: #4f46e5; --accent-soft: #eef0ff; --ok: #15803d; --err: #b91c1c;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11131a; --card: #1a1d27; --text: #e8eaf0; --muted: #9aa1b2; --line: #2b2f3c;
    --accent: #8b85ff; --accent-soft: #232547; --ok: #4ade80; --err: #f87171; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
header { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
header nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
header nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
header nav a:hover { color: var(--accent); }
.logo { font-weight: 800; font-size: 1.25rem; text-decoration: none; letter-spacing: -.02em; }
main { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.15; margin: 8px 0; letter-spacing: -.02em; }
h2 { margin-top: 40px; font-size: 1.35rem; }
.lead { color: var(--muted); font-size: 1.1rem; margin-top: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 0; }
.crumbs a { color: var(--muted); }

#cv { background: var(--card); border: 2px dashed var(--line); border-radius: 16px; padding: 20px; margin-top: 20px; transition: border-color .15s, background .15s; }
#cv.over { border-color: var(--accent); background: var(--accent-soft); }
.drop { display: block; text-align: center; padding: 28px 12px; cursor: pointer; color: var(--muted); }
.drop b { display: inline-block; background: var(--accent); color: #fff; padding: 12px 26px; border-radius: 10px; margin-right: 6px; font-size: 1.05rem; }
.drop:hover b { filter: brightness(1.1); }
#cv ul { list-style: none; padding: 0; margin: 0; }
#cv li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
#cv .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
@media (max-width: 520px) { #cv .name { grid-column: 1 / -1; } }
#cv .size { color: var(--muted); font-size: .85rem; }
#cv .status, #cv .result { grid-column: 1 / -1; font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
#cv .status a, #cv .result a, #cv .all a { display: block; font-weight: 600; color: var(--ok); margin: 2px 0; }
#cv .status details a, #cv .result details a { font-weight: 400; }
#cv select, #cv input:not([type=checkbox]) { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-width: 0; }
#cv .ctl button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 2px 6px; }
#cv .ctl button:hover { color: var(--accent); }
#cv .ctl button[hidden] { display: none; }
#cv .go { display: block; width: 100%; margin-top: 14px; padding: 14px; font: inherit; font-weight: 700; border: 0; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer; }
#cv .go[hidden], #cv [hidden] { display: none; }
#cv .go:disabled { opacity: .6; cursor: progress; }
.opts { margin-top: 12px; }
.opts summary { color: var(--accent); font-weight: 600; }
.opts details { border: 0; padding: 4px 0; margin: 0; background: none; }
.opts fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0 0; padding: 8px 14px 14px; }
.opts legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.opts fieldset, .opts.tool { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 14px; }
.opts fieldset[hidden] { display: none; }
.opts label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.opts label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.preview { width: 100%; font: .9rem/1.5 ui-monospace, monospace; padding: 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); margin: 6px 0; }
table.meta { width: 100%; border-collapse: collapse; font-size: .85rem; margin: 6px 0; color: var(--text); }
table.meta td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.meta td:first-child { color: var(--muted); white-space: nowrap; }
.private { font-size: .9rem; color: var(--muted); text-align: center; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.cards section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: block; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); text-decoration: none; font-size: .9rem; }
.chips a:hover { border-color: var(--accent); }
details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; }
footer { border-top: 1px solid var(--line); padding: 24px 16px; text-align: center; font-size: .9rem; color: var(--muted); }
footer a { margin: 0 10px; color: var(--muted); }
