/* public/css/app.css — 利用者の画面。高齢の方を想定し、文字は大きく、押す場所は広く。
   配色の方針（2026-10 見直し）:
   - はじめ・設定・カード・アンケート・結果（振り返り）は、端末の明暗設定に関係なく「明るい紙」の配色に固定する。
     高齢の方には明るい地に濃い字がいちばん読みやすく、会場の据え置き端末ごとに見え方が変わらず、
     配るチラシ・ポスター（白地）とも揃う。暗い通話画面から明るい振り返りに戻ることで「体験が終わった」ことも伝わる。
   - 通話・着信・待ち受け・インターホンは、本物の端末に近い暗い配色に固定する（明暗モードで変えない）。 */
:root {
  color-scheme: light;
  --bg: #f6f1e7;          /* 紙の地 */
  --frame: #e9e1d2;       /* パソコンで見たときの、体験の外側 */
  --ink: #1d232b;
  --muted: #4f5966;       /* 白・紙の地の上で 6:1 以上 */
  --card: #ffffff;
  --line: #e2d8c6;
  --line-strong: #cfc2ab;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee4;
  --ok: #15803d;
  --ok-soft: #e8f5ec;
  --ng: #b91c1c;
  --ng-soft: #fcecec;
  --safe: #1d4f91;        /* 「聞かずに済んだ」— 良いことなので、灰色にしない */
  --safe-soft: #eaf1fa;
  --gold: #b7791f;
  --silver: #64748b;
  --bronze: #b4530f;
  --call-bg: #0f1720;
  --call-ink: #f3f5f7;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 18px;
  --gutter: 16px;
  font-size: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif; line-height: 1.6; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; background: var(--bg); }
/* パソコン・タブレット：体験をスマホ幅の1枚として中央に置く（UX.md §8） */
@media (min-width: 600px) {
  html, body { background: var(--frame); }
  #app { box-shadow: 0 0 0 1px var(--line), 0 10px 40px rgba(60, 45, 20, .10); }
}

.screen { display: none; min-height: 100vh; min-height: 100dvh; padding: calc(env(safe-area-inset-top) + 20px) var(--gutter) calc(env(safe-area-inset-bottom) + 24px); }
.screen.active { display: flex; flex-direction: column; animation: in .35s ease; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- ボタン ---- */
.btn { display: block; width: 100%; min-height: 56px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); padding: 12px 16px; font-weight: 700; margin: 8px 0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--ng); border-color: var(--ng); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.btn:focus-visible, .chip-btn:focus-visible, .level:focus-visible, .scale button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.light { color: #cfd6de; }
.btn.big { min-height: 68px; font-size: 1.25rem; }
.btn:active { transform: scale(.98); }
.chip-btn { border: 2px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 10px 16px; font-weight: 700; min-height: 48px; }
.fine { font-size: .9rem; color: var(--muted); margin: 6px 0; }

/* ---- はじめの画面 ---- */
.home-head { margin: 8px 0 18px; }
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: .1em; margin: 0; font-size: .9rem; }
.home-head h1 { font-size: 2.3rem; line-height: 1.25; margin: 6px 0 10px; letter-spacing: .02em; }
.lead { margin: 0; color: var(--muted); }
.featured { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.featured .tag { display: inline-block; background: var(--accent); color: #fff; border-radius: 6px; padding: 0 8px; font-size: .8rem; font-weight: 800; }
.featured h2 { margin: 6px 0 2px; font-size: 1.4rem; }
.featured p { margin: 0; color: var(--muted); }
.medals { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.medal { font-size: .85rem; border-radius: 999px; padding: 2px 12px; background: var(--bg); border: 1px solid var(--line-strong); }
.medal.S { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.medal.A { background: #e5e7eb; border-color: #9ca3af; color: #374151; }
.medal.B { background: #fde7d9; border-color: #d97706; color: #7c2d12; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.level { border: 2px solid var(--line-strong); background: var(--card); border-radius: 14px; padding: 10px 6px; text-align: center; min-height: 64px; }
.level b { display: block; font-size: 1.05rem; }
.level small { display: block; font-size: .8rem; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.level[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; background: var(--accent-soft); }
.level[aria-checked="true"] b { color: var(--accent); }
.home-row { display: flex; gap: 8px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.newcases h2 { font-size: 1.05rem; margin: 18px 0 8px; }
.newcases ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.newcases li button { width: 100%; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 56px; }
.newcases li b { display: block; }
.newcases li small { color: var(--muted); }
.newcases li .new { color: var(--accent); font-weight: 800; font-size: .8rem; margin-right: 6px; }
.home-foot { margin-top: auto; padding-top: 20px; text-align: center; font-size: .9rem; color: var(--muted); }
.home-foot a { color: var(--accent); font-weight: 800; }

/* ---- シート（前の1問・カード・設定） ---- */
.sheet h2 { font-size: 1.4rem; margin: 8px 0 12px; }
.sheet-head { display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; text-align: center; }
.sheet-head h2 { margin: 0; }
.back { background: none; border: none; color: var(--accent); font-weight: 700; text-align: left; padding: 8px 0; min-height: 48px; }
.q { font-size: 1.1rem; margin: 18px 0 10px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale button { min-height: 64px; border-radius: 12px; border: 2px solid var(--line-strong); background: var(--card); font-size: .82rem; font-weight: 700; line-height: 1.3; padding: 4px 2px; word-break: keep-all; overflow-wrap: anywhere; }
.scale button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.toggle { display: block; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 14px; margin: 8px 0; font-weight: 700; cursor: pointer; }
.toggle input { width: 24px; height: 24px; vertical-align: -5px; margin-right: 8px; accent-color: var(--accent); }
.toggle small { display: block; font-weight: 400; color: var(--muted); margin-left: 34px; font-size: .88rem; }

/* ---- ロック画面 ---- */
/* .screen を付けて限定する（気づきカードの未取得 .c.lock と衝突し、明るい地で白字になっていた） */
.screen.lock { background: linear-gradient(160deg, #1e3a5f, #0f1720 70%); color: #fff; align-items: center; text-align: center; }
.lock-time { font-size: 5rem; font-weight: 300; margin-top: 12vh; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.lock-date { font-size: 1.1rem; opacity: .9; }
.lock-hint { margin-top: auto; opacity: .75; font-size: .95rem; }

/* ---- 通話 ---- */
.call { background: var(--call-bg); color: var(--call-ink); align-items: center; text-align: center; }
.caller { margin-top: 10vh; }
.caller.small { margin-top: 4vh; }
.avatar { width: 112px; height: 112px; border-radius: 50%; background: #3b4653; margin: 0 auto 18px; display: grid; place-items: center; }
.avatar svg { width: 64px; height: 64px; fill: #8a96a3; }
.caller-name { font-size: 2rem; font-weight: 600; }
.caller-sub { opacity: .75; font-variant-numeric: tabular-nums; }
.incoming .caller { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.03); } }
.incoming-actions { margin-top: auto; display: flex; justify-content: space-around; width: 100%; padding-bottom: 6vh; }
.round { width: 80px; height: 80px; border-radius: 50%; border: none; display: grid; place-items: center; position: relative; }
.round svg { width: 38px; height: 38px; fill: #fff; }
.round span { position: absolute; top: 88px; font-size: .9rem; color: var(--call-ink); white-space: nowrap; }
.round.accept { background: var(--green); animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-5px); } }
.round.decline { background: var(--red); }
.round.end { margin: 18px auto 2vh; }
.talk { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 10px 4px; }
.subtitle { font-size: 1.25rem; line-height: 1.7; margin: 0; min-height: 3.4em; transition: opacity .2s; }
.subtitle.dir { font-size: .95rem; opacity: .7; font-style: normal; }
.subtitle.hidden { opacity: 0; }
.you { font-size: 1rem; color: #9fd7b0; margin: 0; min-height: 1.6em; }
.listen { display: flex; align-items: center; gap: 8px; font-size: .85rem; opacity: .8; min-height: 24px; }
.listen .dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; }
.listen.on .dot { background: var(--green); animation: blink 1s infinite; }
.listen.hear .dot { background: #facc15; transform: scale(1.4); }
@keyframes blink { 50% { opacity: .3; } }
.call-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; width: 100%; max-width: 340px; margin-top: 12px; }
.cbtn { background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .8rem; color: var(--call-ink); }
.cbtn svg { width: 64px; height: 64px; padding: 16px; border-radius: 50%; background: #2a3440; fill: #fff; }
.cbtn[aria-pressed="true"] svg { background: #f3f5f7; fill: #0f1720; }
.answers { position: absolute; left: 0; right: 0; bottom: 0; background: #1b2530; border-radius: 22px 22px 0 0; padding: 14px var(--gutter) calc(env(safe-area-inset-bottom) + 18px); box-shadow: 0 -10px 30px rgba(0,0,0,.4); animation: up .25s ease; z-index: 5; }
@keyframes up { from { transform: translateY(100%); } }
.answers-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; }
.answers-head button { background: none; border: none; font-size: 1.6rem; color: var(--call-ink); width: 44px; height: 44px; }
.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.answers-grid button { min-height: 56px; border-radius: 12px; border: 1px solid #3a4756; background: #263241; color: var(--call-ink); font-weight: 700; padding: 6px; font-size: .95rem; }

/* ---- 玄関 ---- */
.door { background: #111; color: #eee; text-align: center; }
.door-top { font-weight: 700; opacity: .8; }
.door-cam { margin: 14px 0; aspect-ratio: 4/3; border-radius: 14px; background: radial-gradient(ellipse at 50% 30%, #6b7b6b, #2a332a 70%); position: relative; overflow: hidden; filter: saturate(.4) contrast(1.1); }
.door-cam::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 2px, transparent 2px 4px); }
.door-man { position: absolute; left: 50%; bottom: -10%; width: 46%; height: 85%; transform: translateX(-50%); background: radial-gradient(circle at 50% 22%, #c9b8a3 0 16%, transparent 17%), radial-gradient(ellipse at 50% 85%, #1f2937 0 48%, transparent 49%); }
.door-rec { position: absolute; top: 8px; left: 10px; font-size: .75rem; color: #f87171; }
.subtitle.light { color: #eee; }
.door-actions { margin-top: auto; }

/* ---- 切ったあとのホーム画面 ---- */
.phone { background: linear-gradient(170deg, #f9d9a9, #e98f6b 60%, #8f4f6b); color: #fff; }
.status-bar { display: flex; justify-content: space-between; font-weight: 700; font-size: .9rem; }
.apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 10px; margin-top: 8vh; }
.app { background: none; border: none; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .85rem; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.app[disabled] { opacity: .55; cursor: default; }
.app .ic { width: 68px; height: 68px; border-radius: 18px; background: rgba(255,255,255,.3); display: grid; place-items: center; font-size: 2rem; }
.app .ic.green { background: var(--green); }
.contacts { position: absolute; inset: 0; background: var(--card); color: var(--ink); padding: calc(env(safe-area-inset-top) + 16px) var(--gutter); z-index: 4; animation: in .25s; }
.contacts-head { display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; text-align: center; margin-bottom: 8px; }
.contacts-head button { background: none; border: none; color: #2563eb; text-align: left; }
.contacts ul { list-style: none; padding: 0; margin: 0; }
.contacts li button { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: none; border-bottom: 1px solid var(--line); padding: 16px 4px; text-align: left; font-size: 1.1rem; }
.contacts li small { color: var(--muted); font-size: .85rem; }
.end-exp { margin-top: auto; }

/* ---- 結果（振り返り）----
   明るい紙の地。上から「判定（ゲーム）→ 危険サイン → やりとり → 点数のわけ → 覚えること・相談先」。
   判定は祝うが、点数より「どこで気づけたか」が主役になるよう、各カードの見出しを揃えて読みやすくする。 */
.result { gap: 14px; }
.res-hero { text-align: center; padding: 22px 16px 18px; margin-top: 4px; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); position: relative; overflow: hidden; }
.res-hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 96px; background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 16%, var(--card)), var(--card)); }
.res-hero:has(.seal.A)::before { background: linear-gradient(180deg, color-mix(in srgb, var(--silver) 14%, var(--card)), var(--card)); }
.res-hero:has(.seal.B)::before { background: linear-gradient(180deg, color-mix(in srgb, var(--bronze) 14%, var(--card)), var(--card)); }
.res-hero:has(.seal.C)::before { background: linear-gradient(180deg, color-mix(in srgb, var(--ng) 10%, var(--card)), var(--card)); }
.res-hero > * { position: relative; }
.seal { width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; font-size: 3.8rem; font-weight: 900; color: #fff; background: var(--gold); box-shadow: 0 0 0 5px var(--card), 0 0 0 9px color-mix(in srgb, var(--gold) 35%, transparent); animation: stamp .6s cubic-bezier(.2,1.6,.4,1); }
.seal.A { background: var(--silver); box-shadow: 0 0 0 5px var(--card), 0 0 0 9px color-mix(in srgb, var(--silver) 35%, transparent); }
.seal.B { background: var(--bronze); box-shadow: 0 0 0 5px var(--card), 0 0 0 9px color-mix(in srgb, var(--bronze) 35%, transparent); }
.seal.C { background: var(--ng); box-shadow: 0 0 0 5px var(--card), 0 0 0 9px color-mix(in srgb, var(--ng) 30%, transparent); }
@keyframes stamp { from { transform: scale(2.4) rotate(-20deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .seal, .screen.active, .round.accept, .incoming .caller { animation: none; } }
.res-hero h2 { margin: 0; font-size: 1.7rem; }
.res-outcome { margin: 2px 0 0; color: var(--ink); font-weight: 700; }
.res-score { font-size: 2.4rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 6px; }
.res-score small { font-size: 1rem; margin-left: 2px; }
.res-meta { margin: 6px 0 0; font-size: .9rem; color: var(--muted); }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 8px; font-size: 1.2rem; line-height: 1.4; padding-left: 10px; border-left: 5px solid var(--accent); }
.card.ai { border-color: #9cc0f0; background: var(--safe-soft); }
.card.ai h3, .card.ai .ai-label { border-left: 0; padding-left: 0; }
.ai-label { margin: 0 0 4px; font-size: .85rem; font-weight: 800; color: var(--safe); }
.ai-tip { font-weight: 800; margin: 8px 0 0; }
.signs { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.signs li { border-radius: 12px; padding: 10px 12px; border: 2px solid var(--line); background: var(--card); display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: start; }
.signs li b { grid-column: 1; grid-row: 1; line-height: 1.45; }
.signs li small { grid-column: 1 / -1; grid-row: 2; color: var(--muted); font-size: .9rem; line-height: 1.55; margin-top: 2px; }
.signs li.got { border-color: var(--ok); background: var(--ok-soft); }
.signs li.miss { border-color: var(--ng); background: var(--ng-soft); }
.signs li .badge { grid-column: 2; grid-row: 1; white-space: nowrap; margin-top: 1px; font-size: .8rem; font-weight: 800; border-radius: 6px; padding: 1px 8px; color: #fff; }
.signs li.got .badge { background: var(--ok); }
.signs li.miss .badge { background: var(--ng); }
/* 出てこなかったサイン：薄くせず（読めなくなる）、破線の枠で「今回は無かった」ことを示す */
.signs li.unseen { border-style: dashed; border-color: var(--line-strong); background: var(--bg); }
.signs li.unseen .badge { background: var(--safe); }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.timeline li { padding: 8px 12px; border-radius: 12px; background: var(--bg); font-size: 1rem; line-height: 1.6; }
.timeline li.me { background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); margin-left: 16%; }
.timeline li.ev { background: none; color: var(--muted); font-size: .88rem; text-align: center; }
.timeline li.flag { border-left: 5px solid var(--ng); background: var(--ng-soft); }
.timeline .who { font-size: .8rem; color: var(--muted); display: block; font-weight: 700; }
.timeline .flagname, .timeline .noticed { display: inline-block; margin-top: 4px; font-size: .82rem; font-weight: 800; color: #fff; border-radius: 6px; padding: 1px 8px; line-height: 1.5; }
.timeline .flagname { background: var(--ng); }
.timeline .noticed { background: var(--ok); }
.timeline .ai { font-size: .75rem; color: var(--safe); margin-left: 6px; }
.breakdown { list-style: none; padding: 0; margin: 0; }
.breakdown li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line-strong); }
.breakdown li b { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ok); }
.breakdown li .neg { color: var(--ng); }
/* 県警の指定文言・相談先：結果画面でいちばん大事な情報なので、紙の地より一段目立たせる */
.card.rules { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 55%, var(--card)); }
.rules ol { padding-left: 1.4em; margin: 0 0 12px; font-weight: 700; font-size: 1.05rem; }
.rules li { margin: 8px 0; line-height: 1.6; }
.consult { display: grid; gap: 8px; }
.consult a { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 60px; color: var(--ink); text-decoration: none; font-weight: 700; }
.consult a b { color: var(--accent); font-size: 1.4rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.checks label { display: block; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.checks input { width: 24px; height: 24px; vertical-align: -6px; margin-right: 10px; accent-color: var(--accent); }
.res-actions { padding: 4px 0 20px; }

/* ---- カード図鑑 ---- */
.deck { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0 20px; }
.deck .c { aspect-ratio: 3/4; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; border: 2px solid var(--line); background: var(--card); color: var(--ink); text-align: left; }
.deck .c.got { background: linear-gradient(160deg, #fff7e6, #fde3b5); border-color: #e0a84b; color: #3b2a10; box-shadow: 0 2px 0 #e0a84b; }
.deck .c .n { font-size: .8rem; font-weight: 800; opacity: .8; }
.deck .c b { font-size: 1.05rem; line-height: 1.4; }
.deck .c small { font-size: .82rem; line-height: 1.45; }
.deck .c.lock { border-style: dashed; border-color: var(--line-strong); background: var(--bg); align-items: center; text-align: center; }
.deck .c.lock b { color: var(--muted); font-size: 1.4rem; letter-spacing: .1em; }
.deck .c.lock small { color: var(--muted); }
.deck-title { margin: 16px 0 0; font-size: 1.1rem; }

/* ---- その他 ---- */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 20; max-width: min(90vw, 440px); text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.fade { position: fixed; inset: 0; background: #000; color: #fff; display: grid; place-items: center; z-index: 15; animation: in .4s; text-align: center; padding: 20px; }
.fade p { font-size: 1.2rem; }
[hidden] { display: none !important; }
.door .btn:not(.danger):not(.primary) { background: #2a2f36; color: #f1f3f5; border-color: #48505a; }
