:root {
  --bg: #0E0A1F; --surface: #1A1340; --surface2: #241B4D; --text: #F3F1FF;
  --muted: #B6AEE0; --border: #322A5E; --accent: #7C5CFF; --accent2: #00E0C6;
  --danger: #FF6B8A; --card: #1E1640;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #F6F5FC; --surface: #FFFFFF; --surface2: #F0EDFB; --text: #16122E;
    --muted: #5B5680; --border: #E3DFF4; --accent: #6A44FF; --accent2: #0C9C8A;
    --danger: #D6336C; --card: #FFFFFF;
  }
}
/* Viewer theme toggle (stamps data-theme on :root) must win over the media query
   in both directions. */
:root[data-theme="dark"] {
  --bg: #0E0A1F; --surface: #1A1340; --surface2: #241B4D; --text: #F3F1FF;
  --muted: #B6AEE0; --border: #322A5E; --accent: #7C5CFF; --accent2: #00E0C6;
  --danger: #FF6B8A; --card: #1E1640;
}
:root[data-theme="light"] {
  --bg: #F6F5FC; --surface: #FFFFFF; --surface2: #F0EDFB; --text: #16122E;
  --muted: #5B5680; --border: #E3DFF4; --accent: #6A44FF; --accent2: #0C9C8A;
  --danger: #D6336C; --card: #FFFFFF;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5; }
.wrap { max-width: 640px; margin: 0 auto; padding: 14px 14px 88px; }
.hd { display: flex; align-items: center; gap: 10px; padding: 8px 2px 14px; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.hd h1 { font-size: 18px; margin: 0; font-weight: 800; }
.hd .tagline { color: var(--muted); font-size: 12px; margin-left: auto; }
h2 { font-size: 18px; margin: 14px 0 8px; }
.label { color: var(--muted); font-size: 13px; margin: 10px 0 4px; }
.muted { color: var(--muted); font-size: 13px; }
.input { width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 12px; font-size: 16px; font-family: inherit; margin-bottom: 4px; }
textarea.input { resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { background: var(--surface2); color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.chip.sel { background: var(--accent); color: #fff; border-color: transparent; }
.btn { display: block; width: 100%; background: var(--accent); color: #fff; border: none;
  border-radius: 12px; padding: 13px; font-size: 16px; font-weight: 600; margin: 12px 0; cursor: pointer; }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; margin: 0; }
.btn.danger { background: var(--danger); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin: 10px 0;
  display: flex; flex-direction: column; gap: 10px; }
.card.warn { border-color: var(--danger); }
.card.note { border-style: dashed; }
.cardtext { font-size: 16px; }
.meta { gap: 6px; }
.tag { background: var(--surface2); color: var(--muted); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.dial { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--border); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
.navbtn { background: none; border: none; color: var(--muted); font-size: 14px; font-weight: 600; padding: 8px 18px; cursor: pointer; }
.navbtn.sel { color: var(--accent); }
.results { margin-top: 8px; }
