:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c1f24;
  --muted: #5d6570;
  --line: #c9ced6;
  --accent: #1a66d9;
  --accent-ink: #ffffff;
  --sent: #dcebff;
  --recv: #eef0f3;
  --warn-bg: #fff5e0;
  --warn: #7a4b00;
  --err: #b3261e;
  --ok: #1d7a3a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --card: #1b1f25; --text: #eceef1; --muted: #a1a9b3; --line: #2d333b;
    --accent: #5b9bff; --accent-ink: #0b1220; --sent: #203656; --recv: #262b33;
    --warn-bg: #3a2e14; --warn: #f3cf8a; --err: #ff8a80; --ok: #7fd49a;
  }
}
* { box-sizing: border-box; }
/* Elements with display rules (e.g. .parts) must still disappear when hidden. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.top { max-width: 760px; margin: 0 auto; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 700; font-size: 18px; }
a { color: var(--accent); }
.lang { color: var(--accent); text-decoration: none; font-weight: 600; }
.hero h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.15; margin: 16px 0 10px; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 8px; }
.privacy { font-size: 15px; margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 0 0 16px; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 34px 16px; text-align: center; display: grid; gap: 8px; cursor: pointer; }
.drop:hover, .drop.over, .drop:focus-visible { border-color: var(--accent); outline: none; }
.drop strong { font-size: 18px; }
.drop span { color: var(--muted); }
.btn { display: inline-block; justify-self: center; border: 0; border-radius: 10px; padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; background: var(--accent); color: var(--accent-ink); }
.drop .btn { color: var(--accent-ink); }
.btn.primary { width: 100%; font-size: 17px; padding: 14px 18px; }
.btn.secondary { width: 100%; background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 6px 4px; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.summary { font-weight: 600; margin: 0 0 8px; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.toolbar input { flex: 1 1 200px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--bg); color: var(--text); }
.list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; border-top: 1px solid var(--line); }
.conv { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.conv input { width: 20px; height: 20px; }
.conv label { display: grid; min-width: 0; cursor: pointer; }
.conv .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .meta { color: var(--muted); font-size: 14px; }
.actions { display: grid; gap: 8px; margin-top: 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; margin: -4px 0 6px; }
.key-box { margin: 2px 0 10px; }
.key-box summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
.key-form { display: grid; gap: 6px; margin-top: 8px; }
.key-row { display: flex; gap: 8px; flex-wrap: wrap; }
.key-row input { flex: 1 1 220px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-family: ui-monospace, Consolas, monospace; background: var(--bg); color: var(--text); }
.row { display: flex; justify-content: space-between; flex-wrap: wrap; }
progress { width: 100%; height: 10px; }
.status { text-align: center; margin: 0 0 16px; font-weight: 600; }
.status.error { color: var(--err); }
.status.ok { color: var(--ok); }
.spinner { width: 36px; height: 36px; margin: 20px auto; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.how, .faq { margin-top: 32px; }
.how h2, .faq h2 { font-size: 22px; }
.how li { margin-bottom: 8px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.faq summary { font-weight: 600; cursor: pointer; }
dialog { width: min(640px, calc(100vw - 24px)); max-height: 86vh; border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dlg-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.thread { padding: 12px 14px; display: grid; gap: 8px; }
.bubble { max-width: 80%; padding: 8px 10px; border-radius: 12px; background: var(--recv); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { justify-self: end; background: var(--sent); }
.bubble .who { font-size: 13px; font-weight: 700; color: var(--muted); }
.bubble img { display: block; max-width: 100%; border-radius: 8px; margin-top: 6px; }
.bubble .time { font-size: 12px; color: var(--muted); text-align: right; margin-top: 2px; }
.more { color: var(--muted); text-align: center; }
.foot { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: 13px; }
.parts { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.parts p { margin: 0 0 4px; }
.parts .btn.done { background: transparent; color: var(--ok); border: 1.5px solid var(--ok); }
.status:empty { margin: 0; } /* stays in the page so screen readers announce changes */
.center { text-align: center; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.foot a { color: var(--muted); }
.legal { max-width: 760px; margin: 0 auto; padding: 0 16px 48px; }
.legal h1 { font-size: 28px; }
