:root {
  color-scheme: light dark;
  --bg: #f2f2f7; --surface: #ffffff; --text: #1c1c1e; --muted: #6c6c70; --line: #d8d8de;
  --blue: #1868a8; --blue-text: #ffffff; --danger: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --surface: #1c1c1e; --text: #f2f2f7; --muted: #9a9aa0; --line: #38383a;
    --blue: #4a9fe0; --blue-text: #04121f; --danger: #ff8a80;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: Canvas; color: var(--text);
  -webkit-text-size-adjust: 100%;
}
body.unlocked { background: var(--bg); }
/* Locked screen: invisible full-viewport input only */
#gate {
  position: fixed; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; padding: 0; margin: 0; background: transparent;
  color: transparent; caret-color: transparent; font-size: 16px; outline: none;
}
body.unlocked #gate { display: none; }
#app { max-width: 680px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom)); }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0; font-weight: 700; }
.bar { display: flex; align-items: center; gap: 12px; }
#status { color: var(--muted); font-size: 15px; }
#status.offline { color: var(--danger); }
button {
  font: inherit; min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 10px; border: 0;
  background: var(--blue); color: var(--blue-text); font-weight: 600; cursor: pointer;
}
button.plain { background: transparent; color: var(--blue); }
button.danger { background: transparent; color: var(--danger); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
textarea {
  display: block; width: 100%; font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; resize: none; min-height: 44px;
}
.composer { display: grid; gap: 8px; margin-bottom: 20px; }
.composer .row { display: flex; justify-content: flex-end; }
ul { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 12px; overflow: hidden; }
li { padding: 8px 8px 4px 14px; border-top: 1px solid var(--line); }
li:first-child { border-top: 0; }
li textarea { border: 0; padding: 8px 0; background: transparent; border-radius: 0; }
li textarea:focus-visible { outline-offset: 0; border-radius: 6px; }
li .meta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
@media (prefers-reduced-motion: no-preference) { button { transition: opacity .15s; } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.downloads { margin: 0 0 20px; border-bottom: 1px solid var(--line); }
.downloads summary { min-height: 44px; padding: 10px 0; font-weight: 600; cursor: pointer; }
.download { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: 12px 0; color: var(--blue); text-decoration: none; }
.download + .download { border-top: 1px solid var(--line); }
.download small { display: block; color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 4px; }
.download:hover > span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.version { flex-shrink: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.install-help { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 4px 0 16px; max-width: 65ch; }
@media (max-width: 380px) { .download { gap: 8px; } .bar { gap: 4px; } }
