/* 皆で作る もしもの函館 — 市長室・選挙・候補者・討論・投票の共通スタイル
   地図画面（game.css）と同じ配色：霧の紙色・港の藍・市電の深緑・赤レンガ */
@font-face { font-family: 'ZenKakuGothic'; src: url('./assets/fonts/ZenKakuGothicNew-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'ZenKakuGothic'; src: url('./assets/fonts/ZenKakuGothicNew-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'ShipporiMincho'; src: url('./assets/fonts/ShipporiMincho-subset.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'BebasNeue'; src: url('./assets/fonts/BebasNeue-Regular.ttf') format('truetype'); font-display: swap; }

:root {
  --bg: #F2EFE8; --surface: #FBFAF6; --surface-soft: #F4F1EA; --ink: #14232E; --navy: #1B3443; --muted: #5B6A72;
  --line: #E2DCCF; --line-strong: #CBC3B3; --accent: #A8553A; --accent-hover: #8E4430; --accent-soft: #F5E8E1;
  --teal: #2E6B5E; --teal-soft: #E5EEEA; --amber: #B07A1E; --amber-soft: #F8EFDC; --sea: #4E7A8C; --sea-soft: #E3ECEF;
  --serif: 'ShipporiMincho', 'Hiragino Mincho ProN', 'Yu Mincho', 'Noto Serif CJK JP', serif;
  --sans: 'ZenKakuGothic', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Noto Sans CJK JP', 'Meiryo', sans-serif;
  --num: 'BebasNeue', 'ZenKakuGothic', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.7; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--accent-hover); }
button { font: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; font-feature-settings: 'palt'; letter-spacing: 0.03em; }

/* ---- ヘッダー ---- */
.el-bar { position: sticky; top: 0; z-index: 20; background: var(--ink); color: #EFEBE2; }
.el-bar-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 54px; }
.el-home { display: inline-flex; align-items: center; gap: 8px; color: #FBF8F1; text-decoration: none; min-width: 0; }
.el-home svg { width: 32px; height: 32px; flex: none; }
.el-home b { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: 0.05em; white-space: nowrap; }
.el-home b span { color: #F2C5B2; }
.el-tag { font-size: 10.5px; font-weight: 700; color: #9FB0B6; border: 1px solid rgba(255,255,255,0.2); padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.el-nav { margin-left: auto; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.el-nav::-webkit-scrollbar { display: none; }
.el-nav a { color: #C9D2D4; text-decoration: none; font-size: 13px; font-weight: 700; padding: 8px 11px; border-radius: 8px; white-space: nowrap; }
.el-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.el-nav a[aria-current="page"] { background: #FBFAF6; color: var(--ink); }
@media (max-width: 640px) { .el-tag { display: none; } .el-home b { font-size: 15px; } .el-nav a { padding: 7px 8px; font-size: 12.5px; } .el-bar-in { gap: 8px; padding: 6px 10px; } }

.el-main { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }
.el-fiction { font-size: 12px; color: var(--muted); background: var(--surface-soft); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 8px 12px; margin: 0 0 18px; }
.el-kicker { font-family: var(--num); font-size: 16px; letter-spacing: 0.12em; color: var(--accent); margin: 0; }
.el-h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.3; margin: 2px 0 8px; }
.el-lead { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }
.el-section { margin: 34px 0 0; }
.el-section > h2 { font-size: 22px; margin: 0 0 12px; display: flex; align-items: center; gap: 12px; }
.el-section > h2::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.el-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.el-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.el-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.el-chips li { font-size: 12px; font-weight: 700; color: var(--teal); background: var(--teal-soft); border-radius: 999px; padding: 3px 10px; }
.el-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 14.5px; text-decoration: none; }
.el-btn-primary { background: var(--accent); color: #fff; }
.el-btn-primary:hover { background: var(--accent-hover); }
.el-btn-primary:disabled { background: #C9B8AF; cursor: not-allowed; }
.el-btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.el-btn-ghost:hover { border-color: var(--ink); }
.el-btn-dark { background: var(--ink); color: #FBF8F1; }
.el-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.el-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--sea-soft); color: var(--sea); }
.el-status[data-phase="voting"] { background: var(--accent); color: #fff; }
.el-status[data-phase="announced"] { background: var(--amber-soft); color: #7A520E; }
.el-status[data-phase="counting"] { background: var(--amber); color: #fff; }
.el-status[data-phase="finalized"] { background: var(--teal); color: #fff; }
.el-status[data-phase="cancelled"] { background: #E9E4DA; color: var(--muted); }
.el-note { font-size: 12.5px; color: var(--muted); }
.el-empty { padding: 24px; text-align: center; color: var(--muted); }
.el-error { background: #F8E7E4; border: 1px solid #E8BDB4; color: #7E2A1C; border-radius: 12px; padding: 12px 14px; font-weight: 700; font-size: 14px; }
.el-footer { max-width: 1120px; margin: 0 auto; padding: 18px 16px 34px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---- 人物 ---- */
.pf-photo { position: relative; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; background: #DCD6C9; }
.pf-photo img { width: 100%; height: 100%; object-fit: cover; }
.pf-photo .pf-ph-note { position: absolute; left: 8px; bottom: 8px; font-size: 10px; font-weight: 700; color: #fff; background: rgba(20,35,46,0.6); padding: 1px 7px; border-radius: 6px; }
.pf-name { font-size: 24px; margin: 0; line-height: 1.3; }
.pf-kana { font-size: 12px; color: var(--muted); letter-spacing: 0.12em; }
.pf-meta { font-size: 13px; color: var(--muted); }
.pf-type { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent-hover); background: var(--accent-soft); padding: 2px 10px; border-radius: 999px; }
.pf-appeal { font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.5; margin: 8px 0; }
dl.pf-dl { display: grid; grid-template-columns: 7em 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
dl.pf-dl dt { color: var(--muted); font-weight: 700; font-size: 12.5px; }
dl.pf-dl dd { margin: 0; }

/* ---- 公約 ---- */
.pl { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px 16px; }
.pl h3 { font-size: 17px; margin: 0 0 8px; line-height: 1.45; }
.pl-grid { display: grid; grid-template-columns: 5.5em 1fr; gap: 4px 10px; font-size: 13.5px; margin: 0; }
.pl-grid dt { font-weight: 700; color: var(--teal); font-size: 12px; padding-top: 2px; }
.pl-grid dd { margin: 0; }
.pl-progress { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-size: 13px; }
.pl-badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #E9E4DA; color: var(--muted); }
.pl-badge[data-s="preparing"] { background: var(--amber-soft); color: #7A520E; }
.pl-badge[data-s="in_progress"] { background: var(--sea-soft); color: var(--sea); }
.pl-badge[data-s="done"] { background: var(--teal); color: #fff; }
.pl-badge[data-s="struggling"] { background: #F8E7E4; color: #7E2A1C; }
.pl-badge[data-s="withdrawn"] { background: #DDD6CA; color: #4A4A4A; }
.pl-links { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.pl-links a { font-size: 12.5px; font-weight: 700; }

/* ---- 選挙の告知帯 ---- */
.el-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; background: var(--ink); color: #EFEBE2; border-radius: 16px; padding: 16px 18px; }
.el-banner h2 { margin: 0; font-size: 19px; color: #FBF8F1; }
.el-banner p { margin: 0; font-size: 13px; color: #C9D2D4; }
.el-banner .el-actions { margin-left: auto; }
.el-banner .el-btn-ghost { background: transparent; color: #FBF8F1; border-color: rgba(255,255,255,0.3); }
.el-banner.is-cancelled { background: #E9E4DA; color: var(--ink); }
.el-banner.is-cancelled h2 { color: var(--ink); }
.el-banner.is-cancelled p { color: var(--muted); }

/* ---- 日程 ---- */
.el-sched { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.el-sched div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.el-sched span { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.el-sched b { font-size: 14px; }
.el-sched div.is-now { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
@media (max-width: 640px) { .el-sched { grid-template-columns: 1fr; } }

/* ---- 結果 ---- */
.rs-row { display: grid; grid-template-columns: 9em 1fr 4em; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.rs-bar { height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; }
.rs-bar i { display: block; height: 100%; background: var(--sea); }
.rs-row.is-win .rs-bar i { background: var(--accent); }
.rs-row b { font-family: var(--num); font-size: 20px; text-align: right; }

/* ---- 候補者の比較（横に並べ、同じ項目を同じ高さに） ---- */
.cmp-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
.cmp { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); grid-template-rows: auto auto auto auto auto auto; gap: 0 12px; min-width: min-content; }
.cmp-col { display: grid; grid-row: span 6; grid-template-rows: subgrid; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; gap: 10px; }
.cmp-col .pf-photo { aspect-ratio: 1 / 1; }
.cmp-sec { font-size: 13px; }
.cmp-sec h4 { margin: 0 0 3px; font-size: 11.5px; color: var(--muted); font-family: var(--sans); letter-spacing: 0.06em; }
.cmp-sec ul { margin: 0; padding-left: 1.1em; }

/* ---- 討論 ---- */
.db-issues { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 54px; z-index: 10; background: var(--bg); padding: 8px 0; }
.db-issues::-webkit-scrollbar { display: none; }
.db-issues button { flex: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700; }
.db-issues button[aria-selected="true"] { background: var(--ink); color: #FBF8F1; border-color: var(--ink); }
.db-q { background: var(--sea-soft); border: 1px solid #CFDDE2; border-radius: 14px; padding: 14px 16px; margin: 12px 0; }
.db-q .who { font-size: 12px; font-weight: 700; color: var(--sea); }
.db-q p { margin: 4px 0 0; font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.55; }
.db-answers { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.db-turn { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.db-turn header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.db-turn header img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #DCD6C9; }
.db-turn header b { font-size: 14px; }
.db-turn header small { display: block; font-size: 11px; color: var(--muted); }
.db-kind { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); white-space: nowrap; }
.db-turn[data-kind="rebuttal"] { border-left: 4px solid var(--accent); }
.db-turn[data-kind="rebuttal"] .db-kind { background: var(--accent-soft); color: var(--accent-hover); }
.db-turn[data-kind="reply"] { border-left: 4px solid var(--teal); }
.db-turn[data-kind="reply"] .db-kind { background: var(--teal-soft); color: var(--teal); }
.db-turn p { margin: 0; font-size: 14px; white-space: pre-line; }
.db-src { display: block; margin-top: 6px; font-size: 11.5px; }
.db-exchange { margin-top: 16px; display: grid; gap: 10px; }
.db-exchange h3 { font-size: 15px; margin: 0; color: var(--muted); }
.db-pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.db-revised { font-size: 12.5px; background: var(--amber-soft); border: 1px solid #E8D3A6; color: #6E4A0C; border-radius: 10px; padding: 8px 12px; }

/* ---- 投票 ---- */
.vt-choose { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.vt-choose button { text-align: left; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 16px; padding: 18px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; }
.vt-choose button:hover { border-color: var(--ink); }
.vt-choose button b { font-family: var(--serif); font-weight: 600; font-size: 20px; }
.vt-choose button span { font-size: 13px; color: var(--muted); }
.vt-choose button.is-3d { background: var(--ink); color: #FBF8F1; border-color: var(--ink); }
.vt-choose button.is-3d span { color: #C9D2D4; }
@media (max-width: 560px) { .vt-choose { grid-template-columns: 1fr; } .vt-choose button { min-height: 96px; } }
.vt-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin: 0; padding: 0; border: 0; }
.vt-opt { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; }
.vt-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.vt-opt:has(input:focus-visible) { outline: 3px solid var(--sea); outline-offset: 2px; }
.vt-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.vt-opt img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: #DCD6C9; }
.vt-opt b { display: block; font-size: 16px; }
.vt-opt small { font-size: 11.5px; color: var(--muted); }
.vt-confirm { text-align: center; padding: 26px 18px; }
.vt-confirm img { width: 140px; height: 140px; margin: 0 auto 10px; border-radius: 18px; object-fit: cover; }
.vt-confirm h2 { font-size: 26px; margin: 0; }
.vt-receipt { text-align: center; }
.vt-receipt .big { font-family: var(--serif); font-weight: 600; font-size: 28px; margin: 6px 0; }
.vt-receipt code { font-size: 12px; background: var(--surface-soft); padding: 2px 8px; border-radius: 6px; }
.vt-sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 10px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---- 3D投票所 ---- */
.v3d { position: fixed; inset: 0; z-index: 50; background: #1A1F24; }
.v3d canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.v3d-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(rgba(10,16,22,0.75), transparent); color: #fff; z-index: 2; }
.v3d-top b { font-size: 14px; }
.v3d-top .v3d-fic { font-size: 10.5px; color: #E8C98E; border: 1px solid rgba(232,201,142,0.5); border-radius: 999px; padding: 1px 8px; }
.v3d-top button { margin-left: auto; white-space: nowrap; }
.v3d-top b, .v3d-top .v3d-fic { white-space: nowrap; }
@media (max-width: 420px) {
  .v3d-top { gap: 6px; padding: 8px 8px; }
  .v3d-top .v3d-fic { font-size: 9.5px; padding: 1px 6px; }
  .v3d-top button { padding: 8px 10px; font-size: 12px; }
  .v3d-top .v3d-exit-long { display: none; }
  .v3d-steps { padding: 12px; bottom: 10px; }
  .v3d-steps .vt-list { max-height: 34vh; }
}
.v3d-steps { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(640px, calc(100% - 24px)); background: rgba(251,250,246,0.96); border-radius: 18px; padding: 14px 16px; box-shadow: 0 12px 40px rgba(0,0,0,0.35); z-index: 2; }
.v3d-steps h3 { margin: 0 0 4px; font-size: 17px; }
.v3d-steps p { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.v3d-steps .vt-list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); max-height: 38vh; overflow: auto; }
.v3d-steps .vt-opt { grid-template-columns: 44px 1fr; padding: 8px; }
.v3d-steps .vt-opt img { width: 44px; height: 44px; }
.v3d-progress { display: flex; gap: 4px; margin-bottom: 8px; }
.v3d-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.v3d-progress i.on { background: var(--accent); }
.v3d-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; z-index: 3; background: #1A1F24; }
.v3d-loading p { margin: 6px 0; }
.v3d-hint { position: absolute; z-index: 2; pointer-events: none; transform: translate(-50%, -100%); background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.v3d-hint::after { content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--accent); }
.vt-switch:empty { display: none; }
.vt-switch { background: #FBF1E4; border: 1px solid #E8C9A0; border-radius: 10px; padding: 8px 12px; color: #6B4A2B; }
/* スマホでは人物写真を大きくしすぎない（見出しと公約を先に見せる） */
@media (max-width: 640px) {
  .office-hero .pf-photo, .cand-hero .pf-photo { max-width: 200px; margin: 0 auto; }
}
