:root {
  --bg: #f4f5f7; --card: #fff; --text: #16181d; --muted: #6b7280; --line: #e2e5ea;
  --accent: #2a7de1; --accent-text: #fff; --err: #c62828; --ok: #1b7f3b;
  --bubble: #fff; --bubble-bg: #dfe7ef;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --card: #1a1d23; --text: #e8eaed; --muted: #9aa0a6; --line: #2c3038;
    --accent: #4a9bf5; --err: #ff6b6b; --ok: #5cd685;
    --bubble: #212a35; --bubble-bg: #0e1621;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
h1, h2 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }

.bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.bar form { margin: 0; }
.brand { font-weight: 600; }
.chat { font-weight: 400; color: var(--muted); margin-left: 6px; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; max-width: 1040px; margin: 24px auto; padding: 0 16px; align-items: start; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; margin-top: 16px; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.login { width: 100%; max-width: 340px; display: grid; gap: 10px; }
.login h1 { margin-bottom: 4px; }

.drop { display: grid; gap: 4px; place-items: center; text-align: center; padding: 28px 16px; border: 2px dashed var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.drop.has { padding: 14px 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.fileinfo { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }

.field { display: block; margin: 18px 0 6px; font-weight: 500; }
.label-row { display: flex; justify-content: space-between; }
.count { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.over { color: var(--err); font-weight: 600; }
textarea, input[type=password], select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
select { width: auto; padding: 6px 8px; margin-left: 6px; }
textarea { resize: vertical; min-height: 120px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.opts { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-top: 12px; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

.primary { display: block; width: 100%; margin-top: 18px; padding: 12px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer; }
.login .primary { margin-top: 6px; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }

.status { margin: 12px 0 0; min-height: 1.45em; overflow-wrap: anywhere; }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }
.status a { color: inherit; }

.post { background: var(--bubble-bg); border-radius: 10px; padding: 16px; }
.post > * { max-width: 420px; margin-inline: auto; }
.pimg { background: var(--bubble); border-radius: 12px 12px 0 0; overflow: hidden; }
.pimg img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; }
.pimg.empty { display: grid; place-items: center; min-height: 200px; color: var(--muted); border-radius: 12px; }
.pimg.empty:has(+ .pcap:not([hidden])) { border-radius: 12px 12px 0 0; }
.pimg:not(:has(+ .pcap:not([hidden]))) { border-radius: 12px; }
.pcap { background: var(--bubble); border-radius: 0 0 12px 12px; padding: 8px 12px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pcap a { color: var(--accent); }
.pcap code, .pcap pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.pcap pre { margin: 4px 0; padding: 6px 8px; background: color-mix(in srgb, var(--text) 8%, transparent); border-radius: 6px; white-space: pre-wrap; }
.pcap blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--accent); }
.pcap .spoiler { background: color-mix(in srgb, var(--text) 25%, transparent); border-radius: 3px; }
