:root {
  color-scheme: light dark;
  --bg: #f5f6f8; --card: #fff; --ink: #1f2a37; --muted: #5b6676; --line: #d5dae1;
  --accent: #1f6feb; --danger: #c62828; --ok: #2e7d32; --warn: #b26a00;
  font: 17px/1.5 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f141a; --card: #18202a; --ink: #e8edf3; --muted: #9aa6b5; --line: #2c3746; --accent: #4c8dff; --danger: #ef5350; --ok: #66bb6a; --warn: #ffb74d; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
header, main, footer { max-width: 640px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 24px; margin: 16px 0 8px; }
h1 { margin-bottom: 0; }
h1 .tag { font-size: 18px; font-weight: 600; margin-left: 4px; }
h1 .tag::before { content: '— '; color: var(--muted); }
.brand { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
h2 { font-size: 19px; margin: 18px 0 8px; }
section, .tab { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; }
.tab { border: 0; padding: 12px 0 0; margin: 0; }
label { display: block; color: var(--muted); font-size: 15px; margin: 12px 0 4px; }
label.toggle { display: flex; gap: 8px; align-items: center; color: var(--ink); }
input, select, textarea, button { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; min-height: 48px; padding: 10px 12px; }
input, select, textarea { width: 100%; }
textarea { font: 13px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; }
button { cursor: pointer; margin: 8px 8px 0 0; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
button.danger { border-color: var(--danger); color: var(--danger); }
button.lv3 { background: var(--danger); color: #fff; border-color: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 8px; }
.grid button { width: 100%; }
.row { display: flex; gap: 8px; align-items: end; }
.row button { flex: none; }
nav { display: flex; gap: 4px; overflow-x: auto; }
nav button { flex: 1; margin: 0; font-size: 15px; white-space: nowrap; }
nav button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.rule0 { border-left: 4px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--card)); padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.note { color: var(--muted); font-size: 14px; }
.code { font: 700 34px/1.2 ui-monospace, Menlo, monospace; letter-spacing: 4px; margin: 8px 0; }
.out:empty { display: none; }
.out { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; margin-top: 12px; }
.badge.ok { color: var(--ok); } .badge.bad { color: var(--danger); } .badge.warn { color: var(--warn); }
.history { list-style: none; padding: 0; }
.history li { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 8px 0; }
.history li.lv3 { border-color: var(--danger); border-width: 2px; }
.history li.mine { opacity: .75; }
.history .title { font-weight: 700; }
.members { list-style: none; padding: 0; }
.members li { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 8px 0; }
.card-levels > div { border-top: 1px solid var(--line); padding: 8px 0; }
[hidden] { display: none !important; }

.badge.duress, .history li.duress { color: #fff; background: var(--danger); border-color: var(--danger); padding: 10px 12px; border-radius: 10px; font-weight: 700; }
.history li.duress .note { color: #fff; }
.members .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.members button { margin: 0; min-height: 40px; }
.answerBox { display: flex; gap: 8px; align-items: end; margin-top: 8px; }
.answerBox button { margin: 0; flex: none; }

/* ---------- kid-friendly layout (docs/design/mockups, docs/content/KIDS-CONTENT.md) ---------- */
:root { --safe: #2e7d4f; --help: #c2410c; --here: #1d5fa8; --lv0: #2e7d4f; --lv1: #a16207; --lv2: #c2410c; --lv3: #b91c1c; --lv4: #6d28d9; }
#vMain { padding-bottom: 96px; }
.topbar { display: flex; justify-content: flex-end; gap: 8px; }
.topnav { flex: none; }
.iconbtn { display: inline-flex; align-items: center; gap: 6px; border-radius: 24px; min-height: 48px; margin: 0; }
.iconbtn svg, .bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  background: var(--card); border-top: 2px solid var(--line); padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); max-width: none; }
.bottomnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; font-size: 13px; font-weight: 700; color: var(--muted); min-height: 56px; }
.bottomnav button svg { width: 28px; height: 28px; }
.bottomnav button[aria-selected="true"] { background: none; color: var(--here); }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--line); border-radius: 16px; padding: 4px; margin: 12px 0 0; }
.seg button { margin: 0; border: 0; border-radius: 12px; background: none; font-weight: 700; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--safe); }

.big { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 76px; margin: 10px 0 0; border: 0; border-radius: 22px;
  color: #fff; font-size: 24px; font-weight: 800; }
.big.safe { background: var(--safe); } .big.help { background: var(--help); } .big.here { background: var(--here); } .big.calls { background: #1f2a37; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.quick .big { font-size: 17px; min-height: 64px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tiles .big { min-height: 150px; font-size: 22px; }

.levelcard { border-radius: 22px; padding: 16px 18px; margin: 12px 0 0; border: 3px solid var(--lv0); background: color-mix(in srgb, var(--lv0) 12%, var(--card)); }
.levelcard .small { font-size: 14px; font-weight: 700; }
.levelcard .lvname { font-size: 28px; font-weight: 800; line-height: 1.2; }
.levelcard .childline { font-size: 18px; font-weight: 700; margin-top: 4px; }
.levelcard.banner .childline { font-size: 15px; }
.levelcard.alert { color: #fff; }
.mission { background: var(--card); border: 2px solid var(--line); border-radius: 18px 18px 18px 4px; padding: 10px 14px; font-weight: 700; }
.drillbanner { border: 4px dashed var(--lv1); border-radius: 12px; padding: 8px 12px; font-weight: 800; text-align: center; }
.alertcard .note { margin-top: 8px; }
.lv-0 { --lv: var(--lv0); } .lv-1 { --lv: var(--lv1); } .lv-2 { --lv: var(--lv2); } .lv-3 { --lv: var(--lv3); } .lv-4 { --lv: var(--lv4); }
.levelcard[class*="lv-"] { border-color: var(--lv); background: color-mix(in srgb, var(--lv) 12%, var(--card)); }
.levelcard.alert[class*="lv-"] { background: var(--lv); }

.circle { position: relative; width: min(100%, 360px); aspect-ratio: 1; margin: 8px auto 0; }
.circle .centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 40%; aspect-ratio: 1; border-radius: 50%;
  border: 8px solid var(--lv, var(--lv0)); background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.circle .centre .num { font-size: 40px; font-weight: 800; line-height: 1; }
.circle .centre .small { font-size: 12px; font-weight: 700; }
.circle .who { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; width: 96px; text-align: center; }
.circle .face { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800;
  background: var(--card); border: 3px solid var(--line); }
.circle .face.st-safe { border-color: var(--safe); } .circle .face.st-help { border-color: var(--help); background: color-mix(in srgb, var(--help) 15%, var(--card)); }
.circle .face.st-me { border-style: dashed; border-color: var(--here); }
.circle .whoname { font-size: 12px; font-weight: 700; line-height: 1.3; }

.places, .missions, .levellearn { list-style: none; padding: 0; }
.places li { border: 2px solid var(--line); border-radius: 16px; padding: 12px; margin: 8px 0; }
.places li.rally { border-color: var(--safe); }
.missions li { display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); padding: 6px 0; }
.missions input { width: 28px; min-height: 28px; height: 28px; flex: none; }
.missions label { margin: 0; color: var(--ink); font-size: 17px; }
.levellearn li { border-left: 8px solid var(--lv); border-radius: 8px; padding: 8px 12px; margin: 8px 0; background: var(--card); }

.callgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.call { display: flex; flex-direction: column; gap: 2px; border-radius: 18px; padding: 12px; color: #fff; text-decoration: none; font-size: 13px; }
.call strong { font-size: 30px; line-height: 1.1; }
.call.c110 { background: #1e3a8a; } .call.c119 { background: #b91c1c; } .call.c171 { background: #1f2a37; align-items: center; font-size: 18px; font-weight: 800; }
.box171 { border: 3px solid var(--ink); border-radius: 20px; padding: 12px 14px; margin-top: 10px; }
.box171 .n171 { font-size: 30px; }
.box171 .steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-size: 14px; margin: 8px 0; }
.box171 .steps div { background: var(--bg); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; }

.looks { display: grid; gap: 8px; }
.lookopt { display: flex; flex-direction: column; align-items: flex-start; text-align: left; margin: 0; border: 3px solid var(--line); border-radius: 18px; }
.lookopt.on { border-color: var(--here); }

/* ---------- sign-up introduction ---------- */
.intro .lead { font-size: 18px; font-weight: 600; line-height: 1.6; }
.introcard { border: 2px solid var(--line); border-radius: 18px; padding: 12px 14px; margin: 10px 0; background: var(--card); }
.introcard h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 18px; }
.introcard h3 svg { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.introcard ul, .introcard ol { margin: 0; padding-left: 22px; }
.introcard li { margin: 4px 0; line-height: 1.55; }
.introcard.emergency { border-color: var(--help); } .introcard.emergency h3 { color: var(--help); }
.introcard.everyday { border-color: var(--safe); } .introcard.everyday h3 { color: var(--safe); }
.introcard.safe { border-color: var(--here); } .introcard.safe h3 { color: var(--here); }
.introcard.start { border-style: dashed; }
.introdetails { border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; margin: 8px 0; }
.introdetails summary { font-weight: 800; cursor: pointer; }
