:root {
  --bg: #101418; --card: #1a2027; --line: #2a323c; --text: #e8edf2; --muted: #8b97a5;
  --accent: #4f8cff; --accent-t: #fff; --danger: #ff5a5f; --warn: #ffb547; --r: 12px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f3f5f8; --card: #fff; --line: #dde3ea; --text: #141a21; --muted: #5d6b7a; color-scheme: light; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; min-height: 100vh;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 80px); }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px; }
h1 { font-size: 22px; margin: 0 0 8px; } h2 { font-size: 16px; margin: 16px 0 8px; color: var(--muted); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 12px 0; }
.center { text-align: center; } .muted { color: var(--muted); font-size: 14px; } .grow { flex: 1; margin: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn { color: var(--warn); } .err { color: var(--danger); min-height: 1.2em; margin-top: 8px; font-size: 14px; } .hint { color: var(--muted); font-size: 13px; margin: -6px 0 10px; }
.hidden { display: none !important; }
label { display: block; margin: 0 0 12px; font-size: 14px; color: var(--muted); }
input, textarea { display: block; width: 100%; margin-top: 4px; padding: 12px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
input[type=checkbox] { display: inline; width: auto; margin: 0 8px 0 0; } input[type=range] { padding: 0; border: 0; background: none; }
label.check { display: flex; align-items: center; color: var(--text); }
button, .btn { font: inherit; font-size: 15px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button:disabled { opacity: .5; }
.card > button, form > button, .card > .file { display: block; width: 100%; margin: 8px 0 0; text-align: center; }
button.primary { background: var(--accent); color: var(--accent-t); border-color: var(--accent); font-weight: 600; padding: 13px; }
button.ghost { background: none; border: 0; color: var(--muted); }
button.danger { color: var(--danger); border-color: var(--danger); background: none; margin-top: 16px; width: 100%; }
button.icon { background: none; border: 0; font-size: 20px; padding: 8px 10px; }
button.primary-t { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 16px; }
header { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; padding: 8px 0; background: var(--bg); }
header input { margin: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chip { white-space: nowrap; border-radius: 20px; padding: 6px 12px; font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-t); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 0 0 8px; cursor: pointer; display: flex; flex-direction: column; }
.list li span { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li.empty { cursor: default; color: var(--muted); text-align: center; }
.list.small li { cursor: default; } .list.small li button { margin-top: 8px; align-self: flex-start; font-size: 13px; padding: 6px 10px; }
.field { padding: 10px 0; border-bottom: 1px solid var(--line); } .field:last-child { border-bottom: 0; }
.field small { color: var(--muted); font-size: 12px; }
.val { margin: 2px 0 8px; word-break: break-all; } .notes { white-space: pre-wrap; word-break: break-word; font: inherit; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; } .acts button, .acts .btn { padding: 7px 12px; font-size: 14px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
pre.mono { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; white-space: pre-wrap; user-select: all; }
pre.big { font-size: 18px; text-align: center; letter-spacing: 1px; }
.row { display: flex; gap: 8px; } .row input { flex: 1; } .row button { margin-top: 4px; }
.gen { background: var(--bg); border-radius: 10px; padding: 12px; margin: -4px 0 12px; } .gen button { width: 100%; }
.file input { display: none; }
.fab { position: fixed; right: 20px; bottom: calc(env(safe-area-inset-bottom) + 20px); width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent); color: var(--accent-t); border: 0; font-size: 28px; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
details { margin: 0 0 12px; color: var(--muted); font-size: 14px; } summary { cursor: pointer; margin-bottom: 8px; }
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; transition: .2s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translateX(-50%); }
