/* 海老名 地図マスター
   紙の地図の色づかいを土台に、家族で遊べるよう文字を大きめ・当たり判定を広めに取る。 */

:root {
  --paper: #F4F1E8;
  --card: #FFFDF7;
  --ink: #1F2419;
  --ink-soft: #5E6553;
  --line: #D8D3C2;
  --green: #2E6B52;
  --green-soft: #E3EDE5;
  --river: #7FB3C8;
  --rail: #6B6559;
  --road: #C9A227;
  --gold: #C08A2E;
  --wrong: #C6402F;
  --right: #2E6B52;
  --shadow: 0 1px 2px rgba(31, 36, 25, .06), 0 6px 18px rgba(31, 36, 25, .07);
  --r: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- ヘッダ ---------- */

.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px clamp(12px, 3vw, 24px);
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: var(--green); color: #fff;
  border-radius: 10px;
  font-size: 21px; font-weight: 800; letter-spacing: 0;
}
.masthead h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.tagline { margin: 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.3; }

.who { display: flex; align-items: center; gap: 7px; }
select, button { font: inherit; }
#profile {
  font-size: 14px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink); max-width: 9rem;
}
.ghost {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 9px; padding: 7px 11px; font-size: 13px; cursor: pointer;
  min-height: 38px;
}
.ghost:hover { border-color: var(--green); color: var(--green); }
.toggle[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }

/* ---------- モードタブ ---------- */

.modes {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px clamp(12px, 3vw, 24px);
  background: var(--card); border-bottom: 1px solid var(--line);
}
.modes::-webkit-scrollbar { display: none; }
.modes button {
  flex: none; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 100px; padding: 9px 16px; font-size: 14px; font-weight: 600;
  min-height: 40px;
}
.modes button:hover { border-color: var(--green); color: var(--green); }
.modes button[aria-current="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.modes .emoji { margin-right: 5px; font-size: 15px; }

/* ---------- 本体 ---------- */

main {
  flex: 1; display: grid; gap: 0;
  grid-template-columns: minmax(0, 1fr) 370px;
  min-height: 0;
}
.stage { position: relative; min-height: 380px; }
#map { position: absolute; inset: 0; background: #E8E4D6; }
#map.quiz { background: var(--paper); cursor: crosshair; }

.panel {
  border-left: 1px solid var(--line);
  background: var(--card);
  overflow-y: auto;
  padding: 16px clamp(14px, 2vw, 20px) 28px;
  min-height: 0;
}

/* 縦長のスマホでは地図とパネルを上下に積み、ページ全体でスクロールさせる。
   main を伸び縮みさせたままだとパネルがつぶれて中身が見えなくなる。 */
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; flex: 0 0 auto; }
  .stage { min-height: 0; height: 44vh; }
  .panel {
    border-left: none; border-top: 1px solid var(--line);
    overflow: visible; padding-bottom: 34px;
  }
  .banner { top: 8px; padding: 10px 14px; }
  .banner .a { font-size: 22px; }
  .masthead { padding: 10px 14px; }
  .masthead h1 { font-size: 17px; }

  /* 地図と選択肢を同時に見せたいので、縦を少しずつ詰める */
  .stage { height: 40vh; }
  .panel { padding-top: 12px; }
  .panel h2 { font-size: 20px; }
  .panel h3 { margin-top: 16px; }
  .scoreline { padding: 8px 12px; }
  .choices { gap: 8px; margin-top: 10px; }
  .choices button { min-height: 50px; padding: 12px 14px; font-size: 16px; }
}

/* ---------- バナー（クイズの出題・正誤） ---------- */

.banner {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  z-index: 620; max-width: min(92%, 460px);
  background: rgba(255, 253, 247, .96);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 12px 18px; text-align: center;
  backdrop-filter: blur(6px);
}
.banner .q { font-size: 13px; color: var(--ink-soft); margin: 0 0 2px; }
.banner .a { font-size: 25px; font-weight: 800; margin: 0; line-height: 1.25; letter-spacing: -.01em; }
.banner .a rt { font-size: .42em; font-weight: 600; color: var(--ink-soft); }
.banner.right { border-color: var(--right); background: #EAF3ED; }
.banner.wrong { border-color: var(--wrong); background: #FBEDEA; }
.banner .verdict { font-size: 15px; font-weight: 700; margin: 6px 0 0; }
.banner.right .verdict { color: var(--right); }
.banner.wrong .verdict { color: var(--wrong); }

/* ---------- パネルの中身 ---------- */

.panel h2 {
  margin: 0 0 3px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2;
}
.panel h2 .kana { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); letter-spacing: .04em; }
.panel h3 {
  margin: 22px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .09em;
  color: var(--ink-soft); text-transform: uppercase;
}
.panel p { margin: 0 0 10px; }
.hint { color: var(--ink-soft); font-size: 14px; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin: 14px 0 4px; }
.facts div { background: var(--card); padding: 9px 10px; }
.facts dt { margin: 0; font-size: 11px; color: var(--ink-soft); }
.facts dd { margin: 1px 0 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.facts dd small { font-size: 11px; font-weight: 600; color: var(--ink-soft); margin-left: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 100px; padding: 6px 13px; font-size: 14px; cursor: pointer; min-height: 34px;
}
.chip:hover { border-color: var(--green); color: var(--green); }
/* 複数えらぶチップ。幅が変わらないよう、印ではなく色で選択を示す */
.chip.pick.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.chip.pick.on:hover { color: #fff; }
.chip.flat { cursor: default; }
.chip.flat:hover { border-color: var(--line); color: var(--ink); }

.bars { display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: 6.2rem 1fr auto; gap: 9px; align-items: center; font-size: 14px; }
.bar .track { height: 9px; background: var(--green-soft); border-radius: 100px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--green); border-radius: 100px; }
.bar .pct { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.places { list-style: none; margin: 0; padding: 0; }
.places li {
  display: flex; gap: 9px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px dotted var(--line); font-size: 14.5px;
}
.places li:last-child { border-bottom: none; }
.places .ic { font-size: 15px; width: 1.4em; flex: none; text-align: center; }
.places .where { margin-left: auto; font-size: 12px; color: var(--ink-soft); flex: none; }

/* ヒートマップの凡例 */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 13px; height: 13px; border-radius: 3px; border: 1px solid rgba(31,36,25,.15); }

/* 選択肢ボタン（4択など） */
.choices { display: grid; gap: 9px; margin-top: 12px; }
.choices button {
  width: 100%; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: var(--r); padding: 14px 16px; font-size: 17px; font-weight: 700;
  min-height: 54px; transition: border-color .12s, background .12s;
}
.choices button .kana { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.choices button:hover:not(:disabled) { border-color: var(--green); background: var(--green-soft); }
.choices button:disabled { cursor: default; opacity: .55; }
.choices button.right { border-color: var(--right); background: #E4F0E8; opacity: 1; }
.choices button.wrong { border-color: var(--wrong); background: #FBEDEA; opacity: 1; }

.primary {
  width: 100%; cursor: pointer; margin-top: 14px;
  border: none; background: var(--green); color: #fff;
  border-radius: var(--r); padding: 14px; font-size: 16px; font-weight: 800; min-height: 52px;
}
.primary:hover { background: #26583F; }
.primary.ghosty { background: #fff; color: var(--green); border: 1.5px solid var(--green); }

.scoreline {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 4px;
  background: var(--green-soft); border-radius: var(--r);
}
.scoreline b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.scoreline span { font-size: 13px; color: var(--ink-soft); }

/* ---------- 地図の中の描画 ---------- */

.town-label {
  background: none; border: none; box-shadow: none; padding: 0;
  font-size: 12px; font-weight: 700; color: #33402C;
  text-shadow: 0 0 3px #F4F1E8, 0 0 3px #F4F1E8, 0 0 6px #F4F1E8;
  white-space: nowrap;
}
.town-label::before { display: none; }
.leaflet-container { font: inherit; background: var(--paper); }

/* ---------- フッタ ---------- */

footer {
  padding: 14px clamp(12px, 3vw, 24px) 22px;
  border-top: 1px solid var(--line); background: var(--card);
  font-size: 11.5px; color: var(--ink-soft); line-height: 1.6;
}
footer p { margin: 0 0 3px; }
footer a { color: var(--ink-soft); }
footer .fine { opacity: .8; }

/* ---------- 子ども向け: ふりがなオフのとき読みを隠す ---------- */

body.no-kana rt, body.no-kana .kana { display: none !important; }
