:root {
  --bg: #fff7f9; --surface: #ffffff; --text: #22161b; --muted: #7a6870; --line: #f0dfe5;
  --accent: #d6336c; --accent-ink: #ffffff; --accent-soft: #fde6ee;
  --green: #1f8a4c; --red: #c0392b; --warn: #fff3cd; --warn-ink: #7a5a00;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17111a; --surface: #221a25; --text: #f3e9ee; --muted: #a8949e; --line: #3a2e3d;
    --accent: #ff6b9a; --accent-ink: #1a0c12; --accent-soft: #3a2030;
    --green: #5fd68e; --red: #ff7b6b; --warn: #3a3014; --warn-ink: #f5d77a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.veil #app { filter: blur(24px); }
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 96px; }
h1 { font-size: 1.15rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h2 { font-size: 1.05rem; margin: 8px 0 0; }
h3 { font-size: .95rem; margin: 18px 0 6px; }
h3.green { color: var(--green); } h3.red { color: var(--red); }
p { margin: 6px 0; }
ul { margin: 4px 0; padding-left: 20px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.pre { white-space: pre-wrap; }

.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font-size: 1.3rem; padding: 0 4px; }
.actions { display: flex; gap: 4px; }
.icon { background: none; border: 0; color: var(--text); font-size: 1.5rem; min-width: 44px; min-height: 44px; cursor: pointer; }

.lock { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 12vh; }
.lock h1 { flex: none; font-size: 1.6rem; }
.lock form { width: 100%; max-width: 360px; margin-top: 16px; }
.logo { font-size: 3.5rem; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.section { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row.gap { margin-top: 8px; } .row.gap input { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 600; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 44px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
label.check input { width: auto; min-height: 0; margin-top: 4px; }

.btn {
  font: inherit; font-weight: 600; min-height: 44px; padding: 10px 16px; border-radius: 12px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--red); border-color: var(--red); background: transparent; }
.btn.tiny { min-height: 32px; padding: 4px 10px; font-size: .8rem; }
.btn:disabled { opacity: .6; }
.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 6px 20px rgb(0 0 0 / .18);
}

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; cursor: pointer;
}
.empty { text-align: center; padding: 40px 0; }
.chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }

.tabs { display: flex; gap: 4px; padding: 8px 12px 0; max-width: 640px; margin: 0 auto; }
.tab { flex: 1; font: inherit; font-size: .88rem; white-space: nowrap; font-weight: 600; padding: 10px 2px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

.file { flex-direction: row; justify-content: center; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; }
.thumb img { width: 72px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.x { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); cursor: pointer; }
.x.inline { position: static; width: 22px; height: 22px; margin-left: 4px; background: var(--line); color: var(--text); }

.alert { padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin: 12px 0; }
.alert.err { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.alert.ok { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.alert.warn { background: var(--warn); color: var(--warn-ink); border: 0; font: inherit; font-size: .9rem; text-align: left; width: 100%; cursor: pointer; }

.result { margin-top: 20px; }
.meter-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.lvl { color: var(--accent); font-size: 1.2rem; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 99px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); }
.sugg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.say { font-size: 1.02rem; margin: 8px 0 4px; padding: 10px 12px; border-radius: 14px 14px 4px 14px; background: var(--accent-soft); }
.facts li, .hist li { margin-bottom: 6px; }

.stamp { margin-top: 20px; }
.stamp + .result { margin-top: 6px; }
.followups { margin-top: 24px; padding-top: 8px; border-top: 1px solid var(--line); }
.fu { margin-bottom: 14px; }
.fu .q { font-weight: 600; margin-left: auto; max-width: 85%; width: fit-content; padding: 8px 12px; border-radius: 14px 14px 4px 14px; background: var(--accent); color: var(--accent-ink); }

.hrow { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 0; }
.hopen { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: inherit; background: none; border: 0; padding: 14px; cursor: pointer; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spark { margin: 4px 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 6px; }
.spark svg { display: block; width: 100%; height: auto; }
.spark-mid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.spark figcaption { margin-top: 4px; }

.probe summary { cursor: pointer; color: var(--muted); }
.probe ul { list-style: none; padding-left: 4px; margin-top: 6px; }
.probe li { margin-bottom: 2px; overflow-wrap: anywhere; }
