/* ==========================================================
   2026 九合一即時開票（vote.html 專用）
   header / 選單 / footer 沿用 layout.css、rank.css，這裡只放開票頁的樣式
   檔案分三段：
   1. 頁面共用框架（原預告頁 vote.css，footer 貼底、選單「即時開票」高亮）
   2. 即時開票：頁首、頁籤、六都（長條＋頭像）、其餘縣市（榜單）
   3. 預告頁「即時開票即將登場」（目前 vote.html 未使用，保留備用）
   ========================================================== */

/* ==========================================================
   1. 頁面共用框架
   ========================================================== */
.votePage {
	--vote-red: #D12828;
	--vote-pin: #FF0000;
	--vote-blue: #2639C0;
	--vote-text: #1a1a1a;
	--vote-sub: #8a8a8a;
	--vote-card-border: #8a8a8a;
	--vote-track: #e8e8e8;

	/* 內容不足一屏時，footer 仍貼齊畫面底部 */
	display: flex;
	min-height: 100vh;
	flex-direction: column;
	background: #f4f6fb;
}

.votePage .wrapper {
	display: flex;
	min-height: 0;
	flex: 1 0 auto;
}

.votePage .main {
	display: flex;
	height: auto;
	min-height: 0;
	flex: 1 0 auto;
	flex-direction: column;
}

.votePage .footer {
	flex: 0 0 auto;
	margin-top: auto;
}

/* 選單上的「即時開票」標示為目前頁面 */
.votePage .header .navBtnVote.is-active {
	color: #fac300 !important;
}

/* ==========================================================
   2. 即時開票：頁首、頁籤、六都、其餘縣市、縣市議員
   ========================================================== */

/* ── 頁首 ── */
.voteMain {
	display: block;
	width: 100%; /* .main 是 flex 直排，不設寬度會縮成內容寬 */
	max-width: 1100px;
	margin: 0 auto;
	padding: 56px 20px 110px;
	box-sizing: border-box;
	text-align: left;
	color: var(--vote-text);
	font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
}

.voteIntro {
	text-align: center;
}

/* ── 主標圖檔（img/vote.svg）──
   寬度改 --logo-w：桌機最寬 560px、隨視窗縮放，手機見 640px 斷點；高度依圖檔比例自動算
   動態：進場（淡入＋上浮＋微放大）→ 每隔幾秒一道掃光劃過圖形（只亮在圖案上，不會出現方框） */
.voteIntro-title {
	margin: 0;
	line-height: 0; /* 去掉圖片下方的行高空隙 */
}

.voteIntro-logo {
	--logo-w: clamp(300px, 52vw, 420px);
	position: relative;
	display: inline-block;
	width: var(--logo-w);
	max-width: 100%;
	vertical-align: top;
	animation: voteLogoIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.voteIntro-logo img {
	display: block;
	width: 100%;
	height: auto;
}

/* 掃光：用同一張 vote.svg 當遮罩，光只會出現在圖案筆畫上 */
.voteIntro-shine {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.85) 50%, transparent 62%) no-repeat;
	background-size: 250% 100%;
	background-position: 150% 0;
	-webkit-mask: url("../img/vote.svg") center / 100% 100% no-repeat;
	mask: url("../img/vote.svg") center / 100% 100% no-repeat;
	animation: voteLogoShine 5s ease-in-out 1.1s infinite;
}

@keyframes voteLogoIn {
	0%   { opacity: 0; transform: translateY(18px) scale(0.94); }
	100% { opacity: 1; transform: none; }
}

@keyframes voteLogoShine {
	0%       { background-position: 150% 0; }
	28%, 100% { background-position: -50% 0; }
}

/* ── 重新整理按鈕（標題下方）──
   紅底白字，沿用 --vote-red；圖示 img/icon--reflesh.svg 以遮罩上色（不管 SVG 原本什麼顏色都會變白）
   點選後圖示旋轉，接著頁面重新載入 */
.voteRefresh {
	margin-top: 18px;
}

.voteRefresh-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 22px 10px 18px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: 0.1em;
	color: #fff;
	background: var(--vote-red);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 6px 16px rgba(209, 40, 40, 0.28);
	cursor: pointer;
	transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.voteRefresh-btn:hover {
	background: #b81f1f;
	box-shadow: 0 8px 20px rgba(209, 40, 40, 0.36);
	transform: translateY(-1px);
}

.voteRefresh-btn:active {
	transform: translateY(0) scale(0.97);
}

.voteRefresh-btn:focus-visible {
	outline: 3px solid rgba(209, 40, 40, 0.35);
	outline-offset: 3px;
}

.voteRefresh-icon {
	display: block;
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	background: currentColor;
	-webkit-mask: url("../img/icon--reflesh.svg") center / contain no-repeat;
	mask: url("../img/icon--reflesh.svg") center / contain no-repeat;
	transition: transform 0.4s ease;
}

.voteRefresh-btn:hover .voteRefresh-icon {
	transform: rotate(90deg);
}

/* 點選後：圖示持續旋轉直到頁面重新載入 */
.voteRefresh-btn.is-loading {
	cursor: progress;
	pointer-events: none;
}

.voteRefresh-btn.is-loading .voteRefresh-icon {
	animation: voteRefreshSpin 0.7s linear infinite;
}

@keyframes voteRefreshSpin {
	to { transform: rotate(360deg); }
}

/* ── 頁籤：縣市長／縣市議員 ── */
.voteTabs {
	display: inline-flex;
	gap: 6px;
	margin: 100px 0 0;
	padding: 6px;
	background: #fff;
	border: 1px solid #dfe3ee;
	border-radius: 999px;
	box-shadow: 0 6px 20px rgba(28, 45, 113, 0.08);
}

.voteTabs-tab {
	min-width: 132px;
	padding: 11px 28px;
	font-family: inherit;
	font-size: 18px;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: 0.12em;
	color: #555;
	background: transparent;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: color 0.2s ease, background 0.2s ease;
}

.voteTabs-tab:hover {
	color: var(--vote-blue);
}

.voteTabs-tab.is-active {
	color: #fff;
	background: var(--vote-blue);
}

.voteTabs-tab:focus-visible {
	outline: 3px solid rgba(38, 57, 192, 0.35);
	outline-offset: 2px;
}

.votePanel[hidden] {
	display: none;
}

/* ── 分組標題：六都／北部／中部／南部／東部及離島 ──
   左右細線夾住文字，區隔各組內容 */
.voteGroup-title {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 64px 0 8px;
	font-size: 20px;
	font-weight: 900;
	line-height: 1.4;
	letter-spacing: 0.3em;
	color: var(--vote-red);
}

.voteGroup-title::before,
.voteGroup-title::after {
	content: '';
	flex: 1;
	height: 1px;
	background: #d9dce6;
}

.voteGroup-title span {
	margin-right: -0.3em; /* 抵消字距在最後一字後多出的空白 */
}

/* 區域分組：右側導覽跳轉時扣掉 sticky 選單高度 */
.voteGroup {
	scroll-margin-top: 100px;
}

/* 導覽跳轉後段落會取得焦點（方便鍵盤使用者），不需要顯示外框 */
.voteCity:focus,
.voteGroup:focus {
	outline: none;
}

/* ── 右側段落導覽（縣市長頁籤）──
   寬螢幕（≥1360px）：固定在畫面右側中間的直排清單，放在內容區外側，不壓到卡片
   較窄螢幕：右下角紅色膠囊顯示目前段落，點開後在上方展開清單
   目前段落：.is-active，文字放大並變紅；斷點數字與 vote.js 無關，只需改這裡 */
/* 右側浮動區：包住段落導覽＋浮動重新整理按鈕，一起固定在畫面右側 */
.voteDock {
	position: fixed;
	top: 50%;
	right: 12px;
	z-index: 60;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	transform: translateY(-50%);
	pointer-events: none; /* 空白處不擋住下方內容，按鈕與導覽本身再開回來 */
}

.voteDock > * {
	pointer-events: auto;
}

.voteNav[hidden] {
	display: none !important;
}

/* 浮動重新整理按鈕：寬螢幕是與導覽同寬的紅色膠囊，窄螢幕縮成圓形圖示按鈕
   頁首的重新整理按鈕還在畫面內時隱藏（保留位置，導覽不會跳動），捲出畫面後由 vote.js 加上 .is-refreshShown */
.voteDock-refresh {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	width: 124px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: 0.08em;
	color: #fff;
	background: var(--vote-red);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 6px 16px rgba(209, 40, 40, 0.3);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(8px) scale(0.92);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s, background 0.2s ease;
}

.voteDock.is-refreshShown .voteDock-refresh {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.voteDock-refresh:hover {
	background: #b81f1f;
}

.voteDock-refresh:hover .voteRefresh-icon {
	transform: rotate(90deg);
}

.voteDock-refresh:focus-visible {
	outline: 3px solid rgba(209, 40, 40, 0.35);
	outline-offset: 3px;
}

.voteDock-refresh .voteRefresh-icon {
	width: 16px;
	height: 16px;
}

.voteDock-refresh.is-loading {
	cursor: progress;
	pointer-events: none;
}

.voteDock-refresh.is-loading .voteRefresh-icon {
	animation: voteRefreshSpin 0.7s linear infinite;
}

.voteNav-toggle {
	display: none;
}

.voteNav-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	box-sizing: border-box;
	width: 124px; /* 固定寬度：目前段落文字放大時，整塊不會忽寬忽窄 */
	margin: 0;
	padding: 10px 6px;
	list-style: none;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid #dfe3ee;
	border-radius: 16px;
	box-shadow: 0 8px 24px rgba(28, 45, 113, 0.1);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

/* 六都與區域之間的分隔線 */
.voteNav-item.is-groupStart {
	margin-top: 6px;
	padding-top: 6px;
	border-top: 1px solid #e6e8f0;
}

.voteNav .voteNav-link {
	position: relative;
	display: block;
	padding: 5px 6px 5px 16px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.04em;
	color: var(--vote-sub);
	text-decoration: none;
	white-space: nowrap;
	border-radius: 8px;
	transition: color 0.2s ease, font-size 0.2s ease, background 0.2s ease;
}

/* 左側小圓點，目前段落時拉長成紅色短條 */
.voteNav .voteNav-link::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 6px;
	width: 4px;
	height: 4px;
	border-radius: 2px;
	background: currentColor;
	opacity: 0.45;
	transform: translateY(-50%);
	transition: height 0.2s ease, opacity 0.2s ease;
}

.voteNav .voteNav-link:hover {
	color: var(--vote-text);
	background: #f3f5fc;
}

.voteNav .voteNav-link.is-active {
	font-size: 17px;
	font-weight: 900;
	letter-spacing: 0.02em;
	color: var(--vote-red);
	background: #fff5f5;
}

.voteNav .voteNav-link.is-active::before {
	height: 16px;
	opacity: 1;
}

.voteNav .voteNav-link:focus-visible,
.voteNav-toggle:focus-visible {
	outline: 3px solid rgba(209, 40, 40, 0.35);
	outline-offset: 2px;
}

/* 較窄螢幕：右下角膠囊＋展開清單 */
@media (max-width: 1359px) {
	/* 右下角：[導覽膠囊] [圓形重新整理]，導覽清單往上展開 */
	.voteDock {
		top: auto;
		right: 16px;
		bottom: calc(20px + env(safe-area-inset-bottom, 0px));
		flex-direction: row;
		align-items: flex-end;
		transform: none;
	}

	.voteDock-refresh {
		width: 44px;
		height: 44px;
		padding: 0;
		flex-shrink: 0;
	}

	.voteDock-refresh .voteRefresh-icon {
		width: 18px;
		height: 18px;
	}

	/* 窄螢幕只留圖示，文字給螢幕閱讀器（按鈕本身已有 aria-label） */
	.voteDock-refreshText {
		display: none;
	}

	.voteNav {
		display: flex;
		flex-direction: column-reverse; /* 開關在 DOM 前面（Tab 順序先到），畫面上放在清單下方 */
		align-items: flex-end;
		gap: 10px;
	}

	.voteNav-toggle {
		min-height: 44px; /* 與圓形重新整理按鈕同高 */
	}

	.voteNav-toggle {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		padding: 10px 16px 10px 16px;
		font-family: inherit;
		font-size: 15px;
		font-weight: 800;
		line-height: 1.3;
		letter-spacing: 0.06em;
		color: #fff;
		background: var(--vote-red);
		border: 0;
		border-radius: 999px;
		box-shadow: 0 6px 16px rgba(209, 40, 40, 0.32);
		cursor: pointer;
	}

	.voteNav-toggleHint {
		font-size: 12px;
		font-weight: 600;
		opacity: 0.8;
	}

	/* 向上的箭頭，展開時轉成向下 */
	.voteNav-toggle::after {
		content: '';
		width: 6px;
		height: 6px;
		margin: 3px 0 0 4px;
		border-top: 2px solid currentColor;
		border-left: 2px solid currentColor;
		transform: rotate(45deg);
		transition: transform 0.2s ease, margin 0.2s ease;
	}

	.voteNav.is-open .voteNav-toggle::after {
		margin-top: -3px;
		transform: rotate(-135deg);
	}

	.voteNav-list {
		display: none;
		width: 140px;
	}

	.voteNav.is-open .voteNav-list {
		display: flex;
		animation: voteNavIn 0.2s ease-out;
	}

	.voteNav .voteNav-link {
		padding-top: 7px;
		padding-bottom: 7px; /* 手指好點 */
	}
}

@keyframes voteNavIn {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

.voteStatus {
	margin: 60px 0;
	font-size: 16px;
	text-align: center;
	color: #666;
}

/* ── 單一城市 ── */
.voteCity {
	margin-top: 40px;
	scroll-margin-top: 100px; /* 扣掉 sticky 選單高度 */
}

.voteCity-title {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0 0 16px;
	font-size: 28px;
	font-weight: 900;
	line-height: 1.3;
	letter-spacing: 0.04em;
	color: var(--vote-text);
}

.voteCity-pin {
	display: block;
	width: 0.85em;
	height: 0.85em;
	flex-shrink: 0;
	color: var(--vote-pin);
}

.voteCity-card {
	padding: 34px 48px;
	background: #fff;
	border: 2px solid var(--vote-card-border);
	border-radius: 36px;
	box-sizing: border-box;
}

.voteList {
	display: flex;
	flex-direction: column;
	gap: 22px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* ── 候選人一列：姓名｜得票長條（頭像在長條尾端）｜票數 ──
   --party：政黨代表色（來自 JSON 的 color），--pct：得票率，--r：頭像半徑 */
.voteRow {
	--party: #8E8E8E;
	--pct: 0%;
	--r: 30px;
	display: grid;
	grid-template-columns: 112px 1fr 10.5em;
	grid-template-areas: "name track count";
	align-items: center;
	column-gap: 26px;
	min-height: calc(var(--r) * 2 + 4px);
}

.voteRow-name {
	grid-area: name;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.voteRow-candidate {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--vote-text);
	white-space: nowrap;
}

.voteRow-party {
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--vote-sub);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.voteRow-track {
	grid-area: track;
	position: relative;
	height: 16px;
	border-radius: 999px;
	background: var(--vote-track);
}

.voteRow-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: var(--pct);
	border-radius: inherit;
	background: var(--party);
	transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 頭像固定在長條尾端；得票率太低或太高時，用 clamp 確保頭像不會超出長條兩端 */
.voteRow-photo {
	position: absolute;
	top: 50%;
	left: clamp(var(--r), var(--pct), calc(100% - var(--r)));
	z-index: 1;
	width: calc(var(--r) * 2);
	height: calc(var(--r) * 2);
	box-sizing: border-box;
	overflow: hidden;
	border: 3px solid var(--party);
	border-radius: 50%;
	background: #eef0f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='39' r='17' fill='%23c9ced9'/%3E%3Cpath d='M15 100c0-23 15-37 35-37s35 14 35 37z' fill='%23c9ced9'/%3E%3C/svg%3E") center / cover no-repeat;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
	transform: translate(-50%, -50%);
	transition: left 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.voteRow-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 照片載入失敗時隱藏 img，改顯示底層的人像剪影 */
.voteRow-photo.is-noPhoto img {
	visibility: hidden;
}

/* ── 當選章（img/stamp.svg）──
   蓋在候選人姓名後方（同一行），不壓到頭像。
   大小改 --stamp-size，與姓名的間距改 margin-left */
.voteRow-nameLine {
	display: flex;
	align-items: center;
	min-width: 0;
}

.voteRow-stamp {
	--stamp-size: 34px;
	display: none; /* 未當選時不佔空間 */
	flex-shrink: 0;
	width: var(--stamp-size);
	height: var(--stamp-size);
	margin: -6px 0 -6px 6px; /* 上下負邊距：章比字高，不撐高整列 */
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
	transform: scale(2.2) rotate(-26deg);
}

.voteRow.is-elected .voteRow-stamp {
	display: block;
	visibility: visible;
	animation: voteStampSlam 0.55s cubic-bezier(0.32, 1.85, 0.38, 1) forwards;
}

@keyframes voteStampSlam {
	0%   { opacity: 0; transform: scale(2.2) rotate(-26deg); }
	55%  { opacity: 1; transform: scale(0.92) rotate(-6deg); }
	75%  { transform: scale(1.06) rotate(-10deg); }
	100% { opacity: 1; transform: scale(1) rotate(-8deg); }
}

.voteRow-count {
	grid-area: count;
	display: flex;
	flex-direction: column;
	white-space: nowrap;
}

.voteRow-votes {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--vote-text);
	font-variant-numeric: tabular-nums;
}

.voteRow-unit {
	margin-left: 4px;
}

.voteRow-pct {
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--vote-sub);
	font-variant-numeric: tabular-nums;
}

/* ── 其餘縣市：榜單卡片（無頭像）──
   名次｜姓名＋政黨｜票數＋得票率；當選者整列淡底並在姓名後方蓋章
   桌機 4 欄、窄桌機 3 欄、平板 2 欄、手機 1 欄；同一排卡片等高 */
.voteMiniGrid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
	margin-top: 24px;
}

.voteMini {
	--mini-gutter: 16px;
	display: flex;
	flex-direction: column;
	padding: 16px 0 8px;
	background: #fff;
	border: 1px solid #dfe3ee;
	border-radius: 18px;
	box-shadow: 0 6px 20px rgba(28, 45, 113, 0.06);
	scroll-margin-top: 100px;
}

.voteMini-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	padding: 0 var(--mini-gutter) 12px;
	border-bottom: 2px solid var(--vote-text);
}

.voteMini-title {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	font-size: 20px;
	font-weight: 900;
	line-height: 1.3;
	letter-spacing: 0.04em;
	color: var(--vote-text);
}

.voteMini-count {
	font-size: 13px;
	font-weight: 500;
	color: var(--vote-sub);
	white-space: nowrap;
}

.voteMiniList {
	margin: 0;
	padding: 0;
	list-style: none;
}

.voteMiniRow {
	--party: #8E8E8E;
	display: grid;
	grid-template-columns: 24px minmax(0, 1fr) auto;
	align-items: center;
	column-gap: 10px;
	padding: 12px var(--mini-gutter);
	border-bottom: 1px solid #eef0f5;
}

.voteMiniRow:last-child {
	border-bottom: 0;
}

/* 收合狀態：桌機只顯示前 3 名（手機版前 2 名，見下方 640px 斷點） */
.voteMini.is-collapsed .voteMiniRow:nth-child(n+4) {
	display: none;
}

.voteMini.is-collapsed .voteMiniRow:nth-child(3) {
	border-bottom: 0;
}

/* 桌機版 3 人以下已全部顯示，不需要「顯示全部」按鈕 */
.voteMini[data-total="3"] .voteMini-toggle {
	display: none;
}

/* 當選者：整列淡紅底 */
.voteMiniRow.is-elected {
	background: #fff5f5;
}

.voteMiniRow-rank {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	font-family: 'Ubuntu', 'Noto Sans TC', sans-serif;
	font-size: 13px;
	font-weight: 700;
	color: #8a8fa3;
	background: #f1f3f8;
	border-radius: 50%;
	font-variant-numeric: tabular-nums;
}

.voteMiniRow:first-child .voteMiniRow-rank {
	color: #fff;
	background: var(--vote-text);
}

.voteMiniRow-name {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.voteMiniRow-nameLine {
	display: flex;
	align-items: center;
	min-width: 0;
}

.voteMiniRow-candidate {
	overflow: hidden;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--vote-text);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.voteMiniRow-party {
	display: flex;
	align-items: center;
	gap: 5px;
	overflow: hidden;
	font-size: 12px;
	line-height: 1.5;
	color: var(--vote-sub);
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* 政黨代表色小圓點（來自 JSON 的 color） */
.voteMiniRow-dot {
	display: block;
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--party);
}

.voteMiniRow-stamp {
	--stamp-size: 28px;
	display: none; /* 未當選時不佔空間 */
	flex-shrink: 0;
	width: var(--stamp-size);
	height: var(--stamp-size);
	margin: -6px 0 -6px 4px;
	pointer-events: none;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.voteMiniRow.is-elected .voteMiniRow-stamp {
	display: block;
	animation: voteStampSlam 0.55s cubic-bezier(0.32, 1.85, 0.38, 1) forwards;
}

.voteMiniRow-count {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	white-space: nowrap;
}

.voteMiniRow-votes {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--vote-text);
	font-variant-numeric: tabular-nums;
}

.voteMiniRow-unit {
	margin-left: 3px;
	font-size: 13px;
	font-weight: 500;
}

.voteMiniRow-pct {
	font-size: 12px;
	line-height: 1.5;
	color: var(--vote-sub);
	font-variant-numeric: tabular-nums;
}

/* 顯示全部／收合 */
.voteMini-toggle {
	display: block;
	width: calc(100% - var(--mini-gutter) * 2);
	margin: auto auto 6px; /* margin-top:auto 讓按鈕貼齊卡片底部，同排卡片按鈕對齊 */
	padding: 8px 0;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--vote-blue);
	background: #f3f5fc;
	border: 0;
	border-radius: 10px;
	cursor: pointer;
	transition: background 0.2s ease;
}

.voteMiniList {
	margin-bottom: 4px;
}

.voteMini-toggle:hover {
	background: #e6eaf8;
}

.voteMini-toggle::after {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	margin: 0 0 3px 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	vertical-align: middle;
}

.voteMini-toggle[aria-expanded="true"]::after {
	margin-bottom: -1px;
	transform: rotate(-135deg);
}

.voteMini-toggle:focus-visible {
	outline: 3px solid rgba(38, 57, 192, 0.35);
	outline-offset: 2px;
}

@media (max-width: 1099px) {
	.voteMiniGrid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 860px) {
	.voteMiniGrid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.voteMiniGrid {
		grid-template-columns: 1fr;
		gap: 14px;
		margin-top: 18px;
	}

	.voteMini {
		padding-top: 14px;
		border-radius: 16px;
	}

	/* 手機收合時只顯示前 2 名，頁面不會拉太長 */
	.voteMini.is-collapsed .voteMiniRow:nth-child(n+3) {
		display: none;
	}

	.voteMini.is-collapsed .voteMiniRow:nth-child(2) {
		border-bottom: 0;
	}

	.voteMini[data-total="3"] .voteMini-toggle {
		display: block;
	}

	.voteMini-title {
		font-size: 20px;
	}

	.voteMiniRow {
		column-gap: 10px;
		padding-top: 10px;
		padding-bottom: 10px;
	}

	.voteMiniRow-candidate,
	.voteMiniRow-votes {
		font-size: 16px;
	}
}

/* ── 縣市議員：縣市／選區下拉選單 ── */
.voteFilter {
	display: flex;
	justify-content: center;
	gap: 14px;
	max-width: 760px;
	margin: 44px auto 0;
}

.voteFilter-field {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	text-align: left;
}

.voteFilter-label {
	padding-left: 4px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.1em;
	color: var(--vote-sub);
}

.voteFilter-select {
	width: 100%;
	padding: 12px 44px 12px 18px;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--vote-text);
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232639C0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 18px center / 12px 8px;
	border: 1px solid #dfe3ee;
	border-radius: 12px;
	box-shadow: 0 4px 14px rgba(28, 45, 113, 0.06);
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.voteFilter-select:hover {
	border-color: var(--vote-blue);
}

.voteFilter-select:focus-visible {
	border-color: var(--vote-blue);
	outline: 3px solid rgba(38, 57, 192, 0.25);
	outline-offset: 1px;
}

/* ── 縣市議員榜單：號次｜姓名｜政黨名稱｜票數(得票率) ──
   沿用榜單卡片外觀（.voteMini），單張置中；只公布當選結果，沒有即時動態。
   列數不設上限，高度隨內容撐開（不設 max-height、不出現捲軸） */
.voteCouncil {
	margin-top: 20px;
}

/* 「全部選區」時，每個選區前面的標題列 */
.voteCouncil-table .voteCouncil-district th {
	padding-top: 14px;
	padding-bottom: 8px;
	font-size: 15px;
	font-weight: 900;
	letter-spacing: 0.04em;
	color: var(--vote-blue);
	background: #fff;
	border-bottom: 1px solid #dfe3ee;
}

.voteCouncil-table tbody .voteCouncil-district:not(:first-child) th {
	border-top: 6px solid #f6f7fb; /* 選區之間加一條粗一點的間隔 */
}

.voteCouncil-districtSeats {
	margin-left: 8px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0;
	color: var(--vote-sub);
}

/* 無資料提示：整個範圍沒資料用 .voteCouncil-empty；「全部選區」中個別選區沒資料用 .voteCouncil-emptyRow */
.voteCouncil-empty {
	margin: 0;
	padding: 56px 20px 50px;
	font-size: 17px;
	font-weight: 700;
	text-align: center;
	color: var(--vote-sub);
}

.voteCouncil-table .voteCouncil-emptyRow td {
	padding-top: 14px;
	padding-bottom: 14px;
	font-size: 14px;
	text-align: center;
	color: var(--vote-sub);
}

.voteCouncil-card {
	max-width: 760px;
	margin: 0 auto;
	padding-bottom: 6px;
}

.voteCouncil-card .voteMini-title {
	font-size: 22px;
}

.voteCouncil-table {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.voteCouncil-table th,
.voteCouncil-table td {
	padding: 12px var(--mini-gutter);
	text-align: left;
	vertical-align: middle;
	border-bottom: 1px solid #eef0f5;
}

.voteCouncil-table th {
	padding-top: 10px;
	padding-bottom: 10px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--vote-sub);
	background: #f6f7fb;
}

.voteCouncil-table tbody tr:last-child td {
	border-bottom: 0;
}

.voteCouncil-table tbody tr:hover {
	background: #fafbfd;
}

.voteCouncil-table .is-no {
	width: 72px;
	font-family: 'Ubuntu', 'Noto Sans TC', sans-serif;
	font-weight: 700;
	color: #8a8fa3;
}

.voteCouncil-table td.is-no {
	font-size: 15px;
}

.voteCouncil-table th.is-no {
	font-family: inherit;
}

.voteCouncil-table td.is-name {
	font-size: 16px;
	font-weight: 700;
	color: var(--vote-text);
}

.voteCouncil-table td.is-party {
	font-size: 15px;
	color: #4a4f63;
}

/* 只在手機顯示的元素（姓名欄的「／政黨」標題、姓名下方的政黨） */
.voteCouncil-mOnly {
	display: none;
}

.voteCouncil-table .is-votes {
	text-align: right;
	white-space: nowrap;
}

.voteCouncil-num {
	font-size: 16px;
	font-weight: 700;
	color: var(--vote-text);
}

.voteCouncil-pct {
	display: inline-block;
	min-width: 5.6em; /* 得票率位數不同時，數字仍靠右對齊 */
	margin-left: 6px;
	font-size: 13px;
	color: var(--vote-sub);
	text-align: right;
}

@media (max-width: 640px) {
	/* 手機：兩個下拉選單並排各半 */
	.voteFilter {
		gap: 10px;
		margin-top: 28px;
	}

	.voteFilter-select {
		padding: 11px 34px 11px 14px;
		font-size: 16px; /* 16px 以上，iPhone 點選時不會自動放大畫面 */
		background-position: right 13px center;
	}

	.voteCouncil {
		margin-top: 16px;
	}

	.voteCouncil-empty {
		padding: 44px 16px 40px;
		font-size: 16px;
	}

	.voteCouncil-card .voteMini-title {
		font-size: 20px;
	}

	.voteCouncil-table th,
	.voteCouncil-table td {
		padding-top: 10px;
		padding-bottom: 10px;
	}

	.voteCouncil-table .is-no {
		width: 44px;
		padding-right: 4px;
	}

	.voteCouncil-table td.is-name,
	.voteCouncil-num {
		font-size: 15px;
	}

	/* 手機：政黨欄隱藏，改顯示在姓名下方 */
	.voteCouncil-table .is-party {
		display: none;
	}

	.voteCouncil-mOnly {
		display: inline;
	}

	.voteCouncil-subParty {
		display: block;
		margin-top: 2px;
		font-size: 12px;
		font-weight: 500;
		color: var(--vote-sub);
	}

	/* 手機：得票率換到票數下方，避免欄位太擠 */
	.voteCouncil-pct {
		display: block;
		min-width: 0;
		margin-left: 0;
		font-size: 12px;
	}
}

/* ── 平板 ── */
@media (max-width: 991px) {
	.voteCity-card {
		padding: 36px 32px;
		border-radius: 28px;
	}

	.voteRow {
		--r: 26px;
		grid-template-columns: 104px 1fr 9em;
		column-gap: 18px;
	}
}

/* ── 手機：姓名與票數同一行，長條放到下一行滿版 ── */
@media (max-width: 640px) {
	.voteMain {
		padding: 40px 16px 80px;
	}

	.voteIntro-logo {
		--logo-w: min(86vw, 380px);
	}

	/* 頁籤撐滿寬度，兩顆按鈕各半，手指好點 */
	.voteTabs {
		display: flex;
		width: 100%;
		box-sizing: border-box;
		margin-top: 70px;
	}

	.voteTabs-tab {
		flex: 1;
		min-width: 0;
		padding: 10px 0;
		font-size: 16px;
	}

	.voteGroup-title {
		margin: 44px 0 4px;
		font-size: 18px;
		gap: 12px;
	}

	.voteCity {
		margin-top: 28px;
	}

	.voteCity-title {
		font-size: 24px;
		margin-bottom: 12px;
	}

	.voteCity-card {
		padding: 24px 18px 26px;
		border-radius: 22px;
	}

	.voteList {
		gap: 22px;
	}

	.voteRow {
		--r: 22px;
		grid-template-columns: 1fr auto;
		grid-template-areas:
			"name count"
			"track track";
		row-gap: 14px;
		column-gap: 12px;
		min-height: 0;
	}

	.voteRow-name {
		flex-direction: row;
		align-items: baseline;
		gap: 6px;
	}

	.voteRow-candidate {
		font-size: 17px;
	}

	.voteRow-stamp {
		--stamp-size: 30px;
		margin-right: 2px;
	}

	.voteRow-count {
		align-items: flex-end;
	}

	.voteRow-votes {
		font-size: 17px;
	}

	.voteRow-pct {
		font-size: 12px;
	}

	.voteRow-track {
		height: 12px;
		margin: 0 0 12px; /* 頭像比長條高，下方留空間避免壓到下一位 */
	}
}

@media (prefers-reduced-motion: reduce) {
	.voteIntro-logo {
		animation: none;
	}

	.voteIntro-shine {
		display: none;
	}

	.voteRefresh-btn,
	.voteRefresh-icon {
		transition: none;
	}

	.voteRefresh-btn:hover .voteRefresh-icon {
		transform: none;
	}

	.voteNav .voteNav-link,
	.voteNav .voteNav-link::before,
	.voteNav-toggle::after {
		transition: none;
	}

	.voteNav.is-open .voteNav-list {
		animation: none;
	}

	.voteDock-refresh {
		transition: none;
	}

	.voteDock-refresh:hover .voteRefresh-icon {
		transform: none;
	}

	.voteMiniRow.is-elected .voteMiniRow-stamp {
		animation: none;
		opacity: 1;
		transform: rotate(-8deg);
	}

	.voteRow-fill,
	.voteRow-photo,
	.voteRow-stamp {
		transition: none;
	}

	.voteRow.is-elected .voteRow-stamp {
		animation: none;
		opacity: 1;
		transform: rotate(-8deg);
	}
}

/* ==========================================================
   3. 預告頁「即時開票即將登場」（目前 vote.html 未使用，保留備用）
   要切回預告頁時，把 vote.html 的 <main class="voteMain"> 換回 <main class="voteComingSoon"> 那段即可
   ========================================================== */
.voteComingSoon {
    position: relative;
    display: grid;
    box-sizing: border-box;
    min-height: 0;
    flex: 1 0 auto;
    place-items: center;
    overflow: hidden;
    padding: clamp(44px, 5vw, 72px) 24px clamp(52px, 6vw, 84px);
    background:
        radial-gradient(circle at 12% 15%, rgba(54, 121, 255, 0.18), transparent 30%),
        radial-gradient(circle at 88% 82%, rgba(209, 40, 40, 0.14), transparent 32%),
        linear-gradient(145deg, #f8faff 0%, #edf1fb 52%, #f7f8fc 100%);
}

.voteComingSoon-card {
    position: relative;
    z-index: 1;
    width: min(820px, 100%);
    padding: clamp(52px, 7vw, 88px) clamp(26px, 7vw, 76px);
    border: 1px solid rgba(38, 57, 192, 0.14);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 28px 80px rgba(28, 45, 113, 0.14);
    text-align: center;
    backdrop-filter: blur(8px);
}

.voteComingSoon-kicker {
    margin: 0 0 18px;
    color: #2639c0;
    font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 800;
    letter-spacing: 0.18em;
}

.voteComingSoon h1 {
    margin: 0;
    color: #1d2340;
    font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    font-size: clamp(38px, 6vw, 68px);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.04em;
}

.voteComingSoon-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: min(220px, 60%);
    height: 5px;
    margin: 30px auto;
    border-radius: 999px;
    background: linear-gradient(90deg, #d12828 0 44%, #fac300 44% 56%, #2639c0 56% 100%);
}

.voteComingSoon-description {
    max-width: none;
    margin: 0 auto;
    color: #414863;
    font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    font-size: clamp(18px, 2.5vw, 23px);
    font-weight: 500;
    line-height: 1.8;
}

.voteComingSoon-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 30px 0 0;
    padding: 10px 18px;
    border-radius: 999px;
    background: #eef1ff;
    color: #2639c0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.voteComingSoon-status span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d12828;
    box-shadow: 0 0 0 6px rgba(209, 40, 40, 0.12);
    animation: voteStatusPulse 1.8s ease-in-out infinite;
}

.voteComingSoon-link {
    display: table;
    margin: 32px auto 0;
    padding: 13px 24px;
    border: 2px solid #2639c0;
    border-radius: 999px;
    color: #2639c0;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.04em;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.voteComingSoon-link:hover,
.voteComingSoon-link:focus-visible {
    background: #2639c0;
    color: #fff;
    transform: translateY(-2px);
}

.voteComingSoon-link:focus-visible {
    outline: 3px solid rgba(250, 195, 0, 0.75);
    outline-offset: 4px;
}

.voteComingSoon-decoration {
    position: absolute;
    width: clamp(190px, 26vw, 380px);
    aspect-ratio: 1;
    border: clamp(28px, 4vw, 56px) solid rgba(38, 57, 192, 0.06);
    border-radius: 50%;
}

.voteComingSoon-decoration--left {
    top: -13%;
    left: -9%;
}

.voteComingSoon-decoration--right {
    right: -10%;
    bottom: -20%;
    border-color: rgba(209, 40, 40, 0.055);
}

@keyframes voteStatusPulse {
    0%, 100% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.12); opacity: 1; }
}

@media (min-width: 900px) {
    .voteComingSoon-description {
        white-space: nowrap;
    }
}
@media (prefers-reduced-motion: reduce) {
    .voteComingSoon-status span {
        animation: none;
    }
}

@media (max-width: 767px) {
    .voteComingSoon {
        min-height: 0;
        padding: 64px 18px;
    }

    .voteComingSoon-card {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        padding: 50px 22px;
        border-radius: 22px;
    }

    .voteComingSoon h1 {
        font-size: clamp(28px, 9vw, 35px);
        letter-spacing: 0;
        white-space: nowrap;
    }

    .voteComingSoon-description {
        line-height: 1.7;
    }
}
