:root {
    color-scheme: light;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
    color: #243441;
    background: #eef4f7;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; }

.page { width: min(860px, 100%); margin: 0 auto; padding: 40px 20px 64px; }
.page--narrow { width: min(760px, 100%); }
.page-header { margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: #24718f; font-size: .82rem; font-weight: 700; letter-spacing: .12em; }
h1 { margin: 0; color: #153f55; font-size: clamp(1.65rem, 5vw, 2.5rem); line-height: 1.35; }
h2 { margin: 0 0 8px; color: #183f52; font-size: 1.35rem; }
.election-type { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; color: #405b69; font-size: 1.08rem; font-weight: 600; }
.election-phase { display: inline-block; padding: 7px 14px; color: #fff; background: #167596; border-radius: 999px; box-shadow: 0 3px 8px rgba(22, 117, 150, .2); font-size: 1.18rem; font-weight: 600; letter-spacing: .04em; }
.instruction { margin: 0 0 20px; line-height: 1.8; }
.candidate-route-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: -8px 0 20px; padding: 12px 16px; color: #405b69; background: #f5f8fa; border: 1px solid #d7e3e9; border-radius: 8px; font-size: .92rem; }

.action-bar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 -8px 22px; padding: 14px 16px; background: rgba(255, 255, 255, .96); border: 1px solid #d7e3e9; border-radius: 12px; box-shadow: 0 8px 24px rgba(26, 67, 87, .12); backdrop-filter: blur(10px); }
.selection-count { color: #526975; }
.selection-count strong { color: #126b8c; font-size: 1.25rem; }
.primary-button { display: inline-block; padding: 12px 22px; color: #fff; background: #167596; border: 0; border-radius: 8px; box-shadow: 0 5px 12px rgba(22, 117, 150, .22); cursor: pointer; font: inherit; font-weight: 700; text-decoration: none; }
.primary-button:hover { background: #105d78; }
.secondary-button { display: inline-block; padding: 12px 18px; color: #315d70; background: #fff; border: 1px solid #b9ccd5; border-radius: 8px; text-decoration: none; font-weight: 600; }
.secondary-button:hover { background: #f5f9fa; }

.candidate-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.candidate { display: flex; align-items: flex-start; gap: 13px; min-height: 86px; padding: 17px 18px; background: #fff; border: 1px solid #d7e3e9; border-radius: 10px; box-shadow: 0 3px 10px rgba(28, 66, 84, .05); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.candidate:hover { border-color: #69a8bd; box-shadow: 0 7px 18px rgba(28, 66, 84, .1); transform: translateY(-1px); }
.candidate.selected { background: #f1f9fb; border-color: #2583a2; box-shadow: 0 0 0 2px rgba(37, 131, 162, .12); }
.candidate input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; accent-color: #167596; }
.candidate-name { display: block; color: #183f52; font-size: 1.08rem; font-weight: 700; }
.affiliation { display: block; margin-top: 6px; color: #687b86; font-size: .9rem; line-height: 1.45; }
.candidate-manifesto { display: block; margin-top: 10px; padding: 12px 14px; color: #405b69; background: #f5fafc; border-radius: 8px; font-size: .94rem; font-weight: 400; line-height: 1.7; }
.empty { grid-column: 1 / -1; padding: 30px; text-align: center; background: #fff; border-radius: 10px; }

.confirm-panel { overflow: hidden; background: #fff; border: 1px solid #d7e3e9; border-radius: 14px; box-shadow: 0 12px 32px rgba(26, 67, 87, .1); }
.panel-header { padding: 22px 24px; border-bottom: 1px solid #e1eaee; }
.panel-header p { margin: 0; color: #617581; line-height: 1.7; }
.confirm-panel .candidate-list { grid-template-columns: 1fr; gap: 10px; padding: 20px 24px; }
.confirm-panel .candidate { align-items: center; min-height: 0; padding: 15px 17px; background: #f5fafc; border-color: #d7e7ed; border-radius: 9px; cursor: default; box-shadow: none; }
.confirm-panel .candidate:hover { border-color: #d7e7ed; box-shadow: none; transform: none; }
.candidate-number { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto; color: #fff; background: #3888a3; border-radius: 50%; font-size: .84rem; font-weight: 700; }
.summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px 24px; background: #f0f7fa; border-top: 1px solid #dbe8ed; }
.summary p { margin: 0; color: #526975; }
.summary strong { color: #126b8c; font-size: 1.3rem; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.notice { margin: 18px 0 0; color: #687b86; font-size: .9rem; text-align: right; }

.centered-page { display: grid; place-items: center; padding: 24px; }
.status-card { width: min(620px, 100%); overflow: hidden; background: #fff; border: 1px solid #d7e3e9; border-radius: 16px; box-shadow: 0 16px 42px rgba(26, 67, 87, .12); text-align: center; }
.status-main { padding: clamp(32px, 7vw, 54px) 28px 34px; }
.status-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 24px; color: #fff; background: #648090; border-radius: 50%; box-shadow: 0 8px 20px rgba(70, 101, 118, .23); font-size: 2rem; font-weight: 700; line-height: 1; }
.status-icon--success { background: #23866f; box-shadow: 0 8px 20px rgba(35, 134, 111, .25); }
.status-icon--warning { background: #c17a21; box-shadow: 0 8px 20px rgba(193, 122, 33, .23); }
.status-icon--error { background: #b55252; box-shadow: 0 8px 20px rgba(181, 82, 82, .22); }
.status-card h1 { font-size: clamp(1.55rem, 5vw, 2.15rem); line-height: 1.4; }
.election-name { margin: 20px 0 0; color: #405b69; font-size: 1.08rem; font-weight: 600; }
.status-election-type { margin: 8px 0 0; color: #687c87; }
.status-note { padding: 21px 28px; color: #586d78; background: #f5f8fa; border-top: 1px solid #e1eaee; line-height: 1.75; }
.status-note p { margin: 0; }
.status-note p + p { margin-top: 5px; }
.status-note .secondary-button { margin-top: 14px; }
.receipt { margin: 30px auto 0; padding: 17px 20px; background: #f1f8f6; border: 1px solid #d2e8e2; border-radius: 10px; }
.receipt-label { display: block; margin-bottom: 5px; color: #61766f; font-size: .85rem; }
.receipt-time { color: #235f50; font-size: 1.05rem; font-weight: 700; }
.error-message { margin: 24px 0 0; padding: 16px 18px; color: #7e3838; background: #fff4f4; border: 1px solid #efd0d0; border-radius: 9px; line-height: 1.7; }

.home-card { width: min(680px, 100%); padding: clamp(32px, 7vw, 64px); background: #fff; border-top: 5px solid #246b8f; border-radius: 8px; box-shadow: 0 16px 40px rgba(27, 55, 72, .12); }
.home-card h1 { margin-bottom: 24px; }
.home-card p { margin: 0 0 16px; line-height: 1.85; }
.home-notice { margin: 28px 0; padding: 18px 20px; background: #f2f7fa; border-left: 4px solid #4e91b3; }
.home-notice p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
    .page { padding: 28px 14px 48px; }
    .candidate-list { grid-template-columns: 1fr; }
    .action-bar { margin-inline: -4px; }
    .primary-button { padding-inline: 16px; }
}

@media (max-width: 560px) {
    .panel-header, .confirm-panel .candidate-list, .summary { padding-inline: 17px; }
    .actions { flex-direction: column-reverse; align-items: stretch; }
    .actions form, .actions .primary-button, .actions .secondary-button { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
    .centered-page { padding: 14px; }
    .status-main, .status-note { padding-inline: 20px; }
}
