/* 選挙ナビ — 共通スタイル */
:root {
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #16202f;
  --muted: #5d6878;
  --line: #dde2ea;
  --primary: #1c3f8f;
  --primary-2: #2d5bd0;
  --accent: #e0483e;
  --good: #1a8f5a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .05);
  --font: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c;
    --surface: #171e29;
    --surface-2: #1f2835;
    --text: #e8edf4;
    --muted: #9aa6b6;
    --line: #2a3442;
    --primary: #7aa2ff;
    --primary-2: #9bb8ff;
    --accent: #ff6e63;
    --good: #3ccf8e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.75;
  overflow-x: hidden;
}
a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); font-weight: 900; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 56px; min-height: 60vh; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 99; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 900; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; color: var(--primary); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-weight: 500; font-size: .7rem; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.site-nav a { color: var(--text); padding: 8px 10px; border-radius: 8px; font-size: .92rem; font-weight: 500; }
.site-nav a:hover { background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--primary); background: var(--surface-2); font-weight: 700; }
.profile-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer;
}
.profile-chip .dot { width: 10px; height: 10px; border-radius: 50%; background: #999; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; width: 44px; height: 44px; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; background: var(--text); margin: 6px 10px; border-radius: 2px; }
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 60px; background: var(--surface); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; }
  .profile-chip { margin: 8px 0 0; justify-content: center; padding: 10px; }
}
.announce { background: var(--primary); color: #fff; font-size: .9rem; padding: 8px 0; }
@media (prefers-color-scheme: dark) { .announce { background: #22386b; } }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0 18px; font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.copyright { color: var(--muted); font-size: .78rem; margin-top: 16px; }

/* layout helpers */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 1.1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.section { margin-top: 32px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title h2 { margin: 0; }
.page-head { margin-bottom: 20px; }
.page-head p { color: var(--muted); max-width: 760px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }

/* hero */
.hero { background: linear-gradient(135deg, #1c3f8f, #2d5bd0 60%, #4a78e6); color: #fff; border-radius: 20px; padding: 32px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center; }
.hero h1 { color: #fff; margin-bottom: .3em; }
.hero p { color: rgba(255, 255, 255, .88); }
.hero .btn { background: #fff; color: #1c3f8f; }
.hero .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.hero-count { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); border-radius: 16px; padding: 20px; }
.hero-count .num { font-size: 3rem; font-weight: 900; line-height: 1; }
.hero-count .label { font-size: .85rem; opacity: .9; }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .05em; background: rgba(255,255,255,.18); padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; padding: 24px 20px; } }

/* stat tiles */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.stat .v { font-size: 1.9rem; font-weight: 900; line-height: 1.15; }
.stat .v small { font-size: .9rem; font-weight: 700; margin-left: 2px; }
.stat .k { color: var(--muted); font-size: .85rem; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none !important; background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { background: #3a63d8; } }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: 12px; }
label > input, label > select, label > textarea { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; margin: 0; }
.form-error { color: var(--accent); font-size: .88rem; min-height: 1.2em; margin: 0; }

/* party */
.party-badge { display: inline-block; font-size: .72rem; font-weight: 700; line-height: 1; padding: 4px 7px; border-radius: 6px; background: color-mix(in srgb, var(--pc) 16%, transparent); color: var(--pc); border: 1px solid color-mix(in srgb, var(--pc) 40%, transparent); white-space: nowrap; }
@media (prefers-color-scheme: dark) { .party-badge { color: color-mix(in srgb, var(--pc) 70%, white); } }
.party-card { display: flex; gap: 14px; align-items: center; color: var(--text); }
.party-card:hover { text-decoration: none; border-color: var(--pc); }
.party-dot { width: 46px; height: 46px; border-radius: 50%; background: var(--pc); color: #fff; font-weight: 900; display: grid; place-items: center; flex: none; font-size: 1.1rem; }
.party-card .meta { font-size: .82rem; color: var(--muted); }
.party-hero { border-top: 6px solid var(--pc); }
.pre { white-space: pre-wrap; }

/* list */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); padding: 12px 0; }
.list li:last-child { border-bottom: 0; }
.list .date { color: var(--muted); font-size: .82rem; }
.tag { display: inline-block; font-size: .75rem; background: var(--surface-2); color: var(--muted); padding: 2px 8px; border-radius: 999px; }
.tag.new { background: var(--accent); color: #fff; }

/* chat */
.chat-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; height: calc(100vh - 150px); min-height: 520px; }
.room-list { overflow-y: auto; padding: 8px; }
.room-list h3 { font-size: .8rem; color: var(--muted); margin: 12px 8px 6px; letter-spacing: .05em; }
.room-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; color: var(--text); padding: 10px; border-radius: 10px; cursor: pointer; font: inherit; font-size: .92rem; }
.room-item:hover { background: var(--surface-2); }
.room-item[aria-current="true"] { background: var(--surface-2); font-weight: 700; }
.room-item .swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; background: var(--pc, #999); }
.room-item .count { margin-left: auto; font-size: .75rem; color: var(--muted); }
.room-item.mine { outline: 2px solid color-mix(in srgb, var(--pc) 50%, transparent); }
.chat-pane { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line); border-top: 5px solid var(--pc, var(--primary)); }
.chat-head h2 { margin: 0; font-size: 1.05rem; }
.chat-head p { margin: 0; font-size: .82rem; color: var(--muted); }
.messages { flex: 1; overflow-y: auto; padding: 16px 18px; background: var(--bg); }
.msg { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-start; }
.msg .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--pc, #999); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; }
.msg .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 8px 12px; max-width: min(620px, 80%); white-space: pre-wrap; word-break: break-word; }
.msg .meta { font-size: .75rem; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.msg .actions { font-size: .72rem; }
.msg .actions button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; font: inherit; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--primary); color: #fff; border-color: transparent; border-radius: 14px 4px 14px 14px; }
.msg.mine .body { display: flex; flex-direction: column; align-items: flex-end; }
.chat-notice { text-align: center; font-size: .78rem; color: var(--muted); margin: 4px 0 16px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { min-height: 44px; height: 44px; max-height: 160px; resize: none; }
.chat-back { display: none; }
@media (max-width: 800px) {
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-layout.has-room .room-list { display: none; }
  .chat-layout:not(.has-room) .chat-pane { display: none; }
  .chat-pane { height: calc(100vh - 110px); }
  .chat-back { display: inline-flex; margin-bottom: 6px; }
}

/* issues */
.issue-card { display: flex; gap: 14px; }
.vote-box { flex: none; width: 64px; text-align: center; }
.vote-btn { width: 64px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; padding: 6px 0; font: inherit; }
.vote-btn .n { display: block; font-size: 1.2rem; font-weight: 900; }
.vote-btn .l { font-size: .7rem; color: var(--muted); }
.vote-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.vote-btn.on .l { color: #fff; }
.issue-card h3 { margin: 0 0 4px; font-size: 1.02rem; }
.issue-card h3 a { color: var(--text); }
.issue-meta { font-size: .8rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters select, .filters input { width: auto; }
.pill { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: .88rem; }
.pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

/* explainer */
.prose { max-width: 780px; }
.prose h2 { margin-top: 1.8em; padding-left: 12px; border-left: 5px solid var(--primary); }
.prose ul, .prose ol { padding-left: 1.3em; }
.callout { background: var(--surface-2); border-radius: 12px; padding: 16px 18px; margin: 1.2em 0; }
.compare { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .92rem; }
.compare th, .compare td { border: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
.compare th { background: var(--surface-2); }
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding: 0 0 16px 48px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 900; }
.table-scroll { overflow-x: auto; }

/* charts */
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 420px; }
.bar-list { list-style: none; padding: 0; margin: 0; }
.bar-list li { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) 4.5em; gap: 10px; align-items: center; font-size: .88rem; padding: 4px 0; }
.bar-list .bar { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar-list .bar i { display: block; height: 100%; background: var(--pc); border-radius: 6px; }
.bar-list .num { text-align: right; font-variant-numeric: tabular-nums; }
.bar-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

/* schedule */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line); }
.timeline li { position: relative; padding: 0 0 22px 22px; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: 6px; width: 15px; height: 15px; border-radius: 50%; background: var(--primary); border: 3px solid var(--bg); }
.timeline li.past::before { background: var(--muted); }
.timeline li.tentative::before { background: var(--surface); border-color: var(--primary); }

/* modal & toast */
.modal { border: 0; border-radius: 18px; padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal::backdrop { background: rgba(10, 15, 25, .5); }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #1d2533; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }

.app-banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.composer .btn { flex: none; white-space: nowrap; }
.btn { white-space: nowrap; }
