:root {
  color-scheme: light;
  --bg: #f6f6f4; --surface: #ffffff; --surface-2: #eeeeea; --text: #1c1c1a; --muted: #6b6b66; --line: #deded8;
  --accent: #3b5bdb; --accent-text: #ffffff; --ok: #2b8a3e; --warn: #b35c00; --bad: #c92a2a; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111213; --surface: #1a1b1d; --surface-2: #232427; --text: #e8e8e6; --muted: #9a9a95; --line: #2e2f33;
    --accent: #7c93ff; --accent-text: #0b0c10; --ok: #69db7c; --warn: #ffa94d; --bad: #ff6b6b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111213; --surface: #1a1b1d; --surface-2: #232427; --text: #e8e8e6; --muted: #9a9a95; --line: #2e2f33;
  --accent: #7c93ff; --accent-text: #0b0c10; --ok: #69db7c; --warn: #ffa94d; --bad: #ff6b6b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
h1 { font-size: 18px; margin: 0; }
h1 span { color: var(--muted); font-weight: 500; }
h2 { font-size: 16px; margin: 0 0 8px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
nav { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
nav button { border: 0; background: none; color: var(--muted); padding: 10px 12px; font: inherit; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
nav button.on { color: var(--text); border-bottom-color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.tab { display: none; } .tab.on { display: block; }
form { display: grid; gap: 12px; max-width: 640px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
input, select, textarea { max-width: 100%; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
input, select, textarea, button, .btn { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { resize: vertical; }
button, .btn { cursor: pointer; text-decoration: none; display: inline-block; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: 0.5; cursor: default; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.bad { color: var(--bad); } .ok { color: var(--ok); } .warn { color: var(--warn); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.pic { border: 1px dashed var(--line); border-radius: var(--radius); padding: 8px; display: grid; gap: 6px; background: var(--surface); min-width: 0; }
.pic input[type=file] { width: 100%; min-width: 0; }
.pic img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--surface-2); border-radius: 6px; }
.pic .hint { overflow-wrap: anywhere; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.card .top { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; }
.card .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.card .thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.card .thumbs img, .card .thumbs video { height: 72px; border-radius: 6px; background: var(--surface-2); cursor: pointer; }
.card details { margin-top: 6px; font-size: 13px; color: var(--muted); }
.card details li { overflow-wrap: anywhere; }
.prompt { overflow-wrap: anywhere; white-space: pre-wrap; margin: 6px 0 0; }
#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.tile { position: relative; background: var(--surface-2); border-radius: 8px; overflow: hidden; aspect-ratio: 1; cursor: pointer; border: 0; padding: 0; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tag { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: rgb(0 0 0 / 0.6); color: #fff; padding: 1px 6px; border-radius: 4px; }
#s-more { margin: 12px auto; display: block; }
#viewer { position: fixed; inset: 0; background: rgb(0 0 0 / 0.8); display: grid; place-items: center; padding: 16px; z-index: 10; }
#viewer[hidden] { display: none; }
.v-box { background: var(--surface); border-radius: var(--radius); max-width: min(960px, 100%); max-height: 100%; overflow: auto; padding: 12px; display: grid; gap: 10px; }
#v-media img, #v-media video { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 6px; }
#v-info { font-size: 13px; color: var(--muted); }
.v-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.acc { display: grid; gap: 4px; }
.acc .name { font-weight: 600; overflow-wrap: anywhere; }
#add { margin-bottom: 20px; }
