/* ===== 高齢者向け配色・文字設計 =====
   背景: 目に優しいクリーム色 / 文字: 濃紺（高コントラスト）
   基準文字サイズは html.fs-* クラスで切り替え（既定でもやや大きめ） */
:root{
  --bg:#faf6ec;
  --panel:#ffffff;
  --panel2:#fbf1d9;
  --line:#d8cba6;
  --gold:#b8860b;
  --gold-deep:#8a6508;
  --text:#22201a;
  --muted:#5b5646;
  --green:#1e7d32;
  --green-bg:#e3f3e2;
  --amber:#9a6400;
  --amber-bg:#fbedcf;
  --red:#b3261e;
  --red-bg:#fbe4e2;
  --blue:#1a5fb4;
  --base: 19px;
}
html.fs-m{ --base: 22px; }
html.fs-l{ --base: 26px; }

*{ box-sizing:border-box; }
html{ font-size: var(--base); }
body{
  margin:0; min-height:100vh; background:var(--bg); color:var(--text);
  font-family:"Hiragino Kaku Gothic ProN","Yu Gothic UI","BIZ UDPGothic","Meiryo",system-ui,sans-serif;
  line-height:1.7;
  padding-bottom:40px;
}

/* ---- top bar ---- */
.topbar{
  display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between;
  gap:10px; padding:14px 16px; background:var(--panel); border-bottom:3px solid var(--gold);
  position:sticky; top:0; z-index:5;
}
.brand{ font-size:1.35rem; font-weight:800; color:var(--gold-deep); display:flex; align-items:center; gap:8px; }
.tools{ display:flex; gap:8px; flex-wrap:wrap; }
.tool-btn{
  font-size:0.95rem; font-weight:700; padding:10px 14px; border-radius:10px;
  border:2px solid var(--line); background:var(--panel2); color:var(--text); cursor:pointer;
  min-height:44px;
}
.tool-btn:hover{ background:#f3e6bf; }
.tool-btn:active{ transform:scale(.96); }

/* ---- layout ---- */
.wrap{ max-width:640px; margin:0 auto; padding:16px; }
.story{
  background:var(--panel2); border:2px solid var(--line); border-radius:14px;
  padding:16px 18px; font-size:1.05rem; margin-bottom:18px; color:var(--text);
}

.card{
  background:var(--panel); border:2px solid var(--line); border-radius:16px;
  padding:18px; margin-bottom:18px; box-shadow:0 2px 6px rgba(0,0,0,.04);
}
.card-title{
  font-size:1.15rem; color:var(--gold-deep); font-weight:800; margin-bottom:14px;
  display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px;
}
.legend{ font-size:0.85rem; font-weight:600; color:var(--muted); }
.dot{ font-weight:900; }
.dot.hit{ color:var(--green); }
.dot.blow{ color:var(--amber); }

/* ---- choices (difficulty / mode) ---- */
.choice-row{ display:flex; gap:10px; flex-wrap:wrap; }
.choice-btn{
  flex:1; min-width:110px; background:var(--panel2); border:2px solid var(--line);
  border-radius:12px; padding:12px 10px; cursor:pointer; font-size:1rem; font-weight:700;
  color:var(--text); display:flex; flex-direction:column; align-items:center; gap:4px;
  min-height:64px;
}
.choice-btn span{ font-size:0.82rem; font-weight:600; color:var(--muted); }
.choice-btn.active{ background:var(--gold); border-color:var(--gold-deep); color:#fff; }
.choice-btn.active span{ color:#fff4d9; }
.choice-btn:hover{ border-color:var(--gold-deep); }

/* ---- stats ---- */
.stats{ display:flex; gap:10px; margin-bottom:18px; }
.stat{
  flex:1; background:var(--panel); border:2px solid var(--line); border-radius:14px;
  text-align:center; padding:10px 8px; font-size:0.85rem; color:var(--muted);
}
.stat b{ display:block; font-size:1.5rem; color:var(--text); margin-top:4px; }
.stat.hidden{ display:none; }

/* ---- clues ---- */
.clue{
  display:flex; align-items:center; gap:14px; padding:12px; border-radius:12px;
  background:var(--panel2); margin-bottom:10px; border:2px solid transparent;
}
.clue.player{ border-color:var(--gold); background:#fff8e6; }
.clue .digits{ display:flex; gap:6px; flex-shrink:0; }
.clue .d{
  width:2.1rem; height:2.4rem; display:flex; align-items:center; justify-content:center;
  background:#fff; border:2px solid var(--line); border-radius:8px;
  font-size:1.2rem; font-weight:800; color:var(--text);
}
.clue .fb{ font-size:0.95rem; color:var(--text); line-height:1.6; }
.clue .fb .hit{ color:var(--green); font-weight:800; }
.clue .fb .blow{ color:var(--amber); font-weight:800; }
.clue .fb .none{ color:var(--red); font-weight:800; }
.clue .tag{ font-size:0.78rem; color:var(--gold-deep); font-weight:700; margin-left:6px; }

/* ---- memo board ---- */
.memo-help{ font-size:0.88rem; color:var(--muted); margin-bottom:12px; }
.memo-help .memo-used{ color:var(--red); font-weight:700; }
.memo-help .memo-yes{ color:var(--green); font-weight:700; }
.memo-grid{ display:grid; grid-template-columns:repeat(5,1fr); gap:10px; }
.memo-cell{
  aspect-ratio:1; display:flex; align-items:center; justify-content:center;
  font-size:1.4rem; font-weight:800; border-radius:12px; border:2px solid var(--line);
  background:#fff; color:var(--text); cursor:pointer; user-select:none; position:relative;
}
.memo-cell.no{ background:var(--red-bg); border-color:var(--red); color:var(--red); text-decoration:line-through; }
.memo-cell.yes{ background:var(--green-bg); border-color:var(--green); color:var(--green); }

/* ---- input slots & keypad ---- */
.slots{ display:flex; gap:10px; justify-content:center; margin-bottom:16px; flex-wrap:wrap; }
.slot{
  width:3.2rem; height:3.6rem; background:#fff; border:3px solid var(--line);
  border-radius:12px; display:flex; align-items:center; justify-content:center;
  font-size:1.7rem; font-weight:800; color:var(--gold-deep);
}
.slot.next{ border-color:var(--gold); box-shadow:0 0 0 4px rgba(184,134,11,.15); }
.slots.shake{ animation:shake .4s; }
@keyframes shake{
  0%,100%{ transform:translateX(0); } 25%{ transform:translateX(-6px); }
  50%{ transform:translateX(6px); } 75%{ transform:translateX(-4px); }
}
.keypad{ display:grid; grid-template-columns:repeat(5,1fr); gap:10px; margin-bottom:14px; }
.key{
  padding:16px 0; font-size:1.3rem; font-weight:800; background:var(--panel2);
  color:var(--text); border:2px solid var(--line); border-radius:12px; cursor:pointer;
  min-height:56px;
}
.key:hover{ background:#f3e6bf; }
.key:active{ transform:scale(.94); }
.key:disabled{ opacity:.3; cursor:default; }

.actions{ display:flex; gap:10px; }
.btn{
  flex:1; padding:16px 0; border-radius:12px; border:2px solid var(--line);
  background:var(--panel2); color:var(--text); font-size:1.05rem; font-weight:800; cursor:pointer;
  min-height:56px;
}
.btn.primary{ background:var(--gold); color:#fff; border-color:var(--gold-deep); }
.btn.primary:hover{ background:var(--gold-deep); }
.btn.primary:disabled{ opacity:.4; cursor:default; }
.btn:hover{ background:#f3e6bf; }

/* ---- overlay / modal ---- */
.overlay{
  position:fixed; inset:0; background:rgba(30,25,10,.55); display:flex;
  align-items:center; justify-content:center; z-index:20; padding:16px;
}
.overlay.hidden{ display:none; }
.modal{
  background:var(--panel); border:3px solid var(--gold); border-radius:20px;
  padding:28px 24px; max-width:440px; width:100%; text-align:center;
  max-height:88vh; overflow-y:auto;
}
.modal .big{ font-size:3rem; margin-bottom:10px; }
.modal h3{ font-size:1.4rem; color:var(--gold-deep); margin-bottom:14px; font-weight:800; }
.modal p{ font-size:1rem; color:var(--text); line-height:1.8; margin-bottom:10px; text-align:left; }
.modal .code-reveal{
  font-size:2rem; font-weight:800; letter-spacing:.6rem; color:var(--text);
  margin:14px 0; text-align:center;
}
.modal .stars{ font-size:1.6rem; letter-spacing:.3rem; margin-bottom:10px; text-align:center; }
.modal .btn{ margin-top:16px; width:100%; }
.modal .example{
  background:var(--panel2); border-radius:12px; padding:12px 14px; margin:10px 0; text-align:left;
  font-size:0.95rem;
}
.modal ol, .modal ul{ text-align:left; padding-left:1.4rem; margin-bottom:10px; }
.modal li{ margin-bottom:6px; }
