/* 같이 정하기 화면(vote.html)에서만 불러와요. 색·글자·간격은 css/style.css 의 :root 변수를 그대로 쓰고, 여기서는 선 아이콘 두 개만 더해요. */
:root {
	--icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
	--icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

.vote-page {
	padding-bottom: 32px;
}

.vote-card {
	max-width: 560px;
	margin: 0 auto 20px;
	padding: 20px;
	border-radius: var(--radius-lg);
	background: var(--canvas);
	box-shadow: var(--shadow-card);
}

/* 제목 줄이 없는 상태는 관리자 화면처럼 탭 아래 28px(컨테이너 8px + 20px)에서 시작해요 */
#loadingView,
.vote-notice {
	margin-top: 20px;
	text-align: center;
}

#pollView .headline {
	margin-bottom: 8px;
}

.vote-deadline {
	margin: 0 0 20px;
	color: var(--ash);
	font-size: 13px;
	font-weight: 600;
	text-align: center;
}

.vote-deadline:empty {
	display: none;
}

.vote-label {
	margin: 0 0 8px;
	color: var(--ash);
	font-size: 14px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

/* 후보 줄: 메뉴 이름과 ×가 한 줄, 그 아래에 붙은 식당 이름·'식당 떼기' 또는 '식당 붙이기' 글자 단추가 와요 */
.vote-candidates {
	display: grid;
	gap: 8px;
	margin: 0 0 12px;
	padding: 0;
	list-style: none;
}

.vote-candidates:empty {
	display: none;
}

.vote-candidate {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	padding: 4px 4px 4px 16px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius-md);
	background: var(--canvas);
}

.vote-candidate-name {
	display: flex;
	align-items: center;
	min-height: 44px;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.02em;
	overflow-wrap: anywhere;
}

/* 식당 줄은 이름 칸 아래에만 둬요(× 아래로 들어가면 위로 당긴 6px 이 ×의 누르는 곳을 가려요). 글자 단추의 안쪽 여백 12px 만큼 왼쪽으로 당겨 메뉴 이름과 글자 시작을 맞춰요 */
.vote-candidate-place {
	grid-column: 1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 4px;
	margin: -6px 0 0;
	padding-right: 12px;
}

.vote-candidate-place > .text-button:first-child {
	margin-left: -12px;
}

.vote-candidate-restaurant {
	min-width: 0;
	color: var(--ink);
	font-size: 14px;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.vote-chip-remove {
	--icon: var(--icon-close);
	display: inline-flex;
	justify-content: center;
	align-items: center;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: var(--radius-full);
	background: transparent;
	color: var(--ash);
	cursor: pointer;
	transition: color 0.15s ease-out;
}

.vote-chip-remove::before {
	content: "";
	flex: none;
	width: 14px;
	height: 14px;
	background: currentColor;
	-webkit-mask: var(--icon) center / contain no-repeat;
	mask: var(--icon) center / contain no-repeat;
}

.vote-chip-remove:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: -2px;
}

.vote-add {
	display: flex;
	gap: 8px;
	margin: 0 0 20px;
}

#optionInput {
	flex: 1;
	min-width: 0;
	height: 48px;
	padding: 0 14px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius-md);
	background: var(--canvas);
	color: var(--ink);
	font: inherit;
	font-size: 15px;
	transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

#optionInput::placeholder {
	color: var(--ash);
	opacity: 1;
}

#optionInput:focus {
	outline: none;
	border-color: var(--ink);
	box-shadow: 0 0 0 1px var(--ink);
}

#optionInput:disabled {
	background: var(--cloud);
	color: var(--ash);
}

.vote-add-button {
	flex: none;
	height: 48px;
	padding: 0 18px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius-md);
	background: var(--canvas);
	color: var(--ink);
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease-out, transform 0.1s ease-out;
}

.vote-add-button:active:not(:disabled) {
	transform: scale(0.97);
}

.vote-add-button:disabled {
	color: var(--ash);
	cursor: not-allowed;
}

.vote-add-button:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.vote-create {
	width: min(100%, 320px);
	height: 56px;
}

/* 안내가 나타나도 버튼이 밀리지 않게 한 줄 자리를 남겨 둬요 */
.vote-message {
	min-height: 1lh;
	margin: 12px 0 0;
	color: var(--ash);
	font-size: 13px;
	line-height: 1.5;
	text-align: center;
	text-wrap: balance;
}

.vote-message[data-state="error"] {
	color: var(--error);
	font-weight: 600;
}

.vote-options {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* 모일 곳 칸은 메뉴 추천의 위치 칸(.nearby-form)을 그대로 쓰고 카드 폭에 맞춰요 */
.vote-place {
	width: 100%;
	margin: 0 0 20px;
}

.vote-area {
	margin: 0 0 16px;
	color: var(--ash);
	font-size: 14px;
	font-weight: 600;
	text-align: center;
}

.vote-answer fieldset {
	margin: 0;
	padding: 0;
	border: 0;
}

.vote-checks {
	display: grid;
	gap: 8px;
	margin: 0 0 16px;
}

.vote-check {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 0 16px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius-md);
	background: var(--canvas);
	font-size: 17px;
	font-weight: 700;
	overflow-wrap: anywhere;
	cursor: pointer;
	transition: border-color 0.15s ease-out, background-color 0.15s ease-out;
}

.vote-check input {
	flex: none;
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--ink);
}

/* 식당이 붙은 줄은 여러 줄이라, 체크 상자를 메뉴 이름 줄에 맞춰요 */
.vote-check.has-restaurant {
	align-items: flex-start;
	padding-top: 14px;
	padding-bottom: 14px;
}

.vote-check.has-restaurant input {
	margin-top: 1px;
}

.vote-check-body {
	display: grid;
	flex: 1;
	gap: 6px;
	min-width: 0;
}

/* 답하기 줄의 식당 칸: 식당 이름(15px 700), 도보 시간·거리와 주소(13px --ash), 지도 링크 */
.vote-check-place {
	display: grid;
	gap: 2px;
	justify-items: start;
	color: var(--ash);
	font-size: 13px;
	font-weight: 600;
}

.vote-check-place strong {
	color: var(--ink);
	font-size: 15px;
	font-weight: 700;
}

.vote-map-link {
	margin-top: 4px;
}

.vote-check:has(input:checked) {
	border-color: var(--ink);
	background: var(--cloud);
}

.vote-check:has(input:focus-visible) {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.vote-answer .vote-create,
.vote-go {
	display: flex;
	justify-content: center;
	align-items: center;
	margin: 0 auto;
	text-decoration: none;
}

.vote-result {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	min-height: 52px;
	padding: 8px 16px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius-md);
}

.vote-option-name {
	display: flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.02em;
	overflow-wrap: anywhere;
}

.vote-option-count {
	color: var(--ash);
	font-size: 13px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* 결과 줄의 메뉴 이름 아래에 붙은 식당 이름이 와요 */
.vote-option-text {
	display: grid;
	flex: 1;
	gap: 2px;
	min-width: 0;
}

.vote-option-restaurant {
	color: var(--ash);
	font-size: 13px;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.vote-result.is-common .vote-option-name::before {
	content: "";
	flex: none;
	width: 17px;
	height: 17px;
	background: currentColor;
	-webkit-mask: var(--icon-check) center / contain no-repeat;
	mask: var(--icon-check) center / contain no-repeat;
}

.vote-result.is-common .vote-option-count {
	color: var(--ink);
	font-weight: 700;
}

.vote-confirm {
	flex: none;
	justify-content: center;
}

.vote-confirmed {
	text-align: center;
}

/* 정한 뒤에는 마감 줄이 없어서, 그 자리만큼 제목 아래를 띄워요 */
#pollView .headline:has(+ .vote-deadline:empty) {
	margin-bottom: 20px;
}

#resultNote:empty {
	display: none;
}

.vote-confirmed .vote-label {
	margin-bottom: 0;
}

.vote-confirmed .menu-name {
	margin-bottom: 16px;
}

/* 정한 뒤 식당 상자는 메뉴 추천의 추천 식당 상자(.restaurant-card)를 그대로 써요. 식당이 없으면 자리도 없어요 */
.vote-confirmed-restaurant:empty {
	display: none;
}

.vote-confirmed .restaurant-card {
	margin: 0 0 4px;
}

/* 식당 고르는 창: 위치 찾기 창과 같은 모양이고, 지도·번호 대신 제목 줄과 식당 줄(이름·도보 시간·주소)만 있어요. 목록이 짧으면 창도 짧아요 */
.restaurant-picker {
	height: auto;
	max-height: min(720px, calc(100dvh - 32px));
}

.restaurant-picker .place-picker-head {
	align-items: center;
}

.restaurant-picker-title {
	flex: 1;
	min-width: 0;
	margin: 0;
	padding: 0 4px;
	font-size: 16px;
	font-weight: 800;
	overflow-wrap: anywhere;
}

/* 창을 열 때 초점만 받는 제목이라 테두리를 그리지 않아요. Tab 을 누르면 '닫기'·식당 줄로 가요 */
.restaurant-picker-title:focus {
	outline: none;
}

.restaurant-picker .place-picker-results button {
	grid-template-columns: minmax(0, 1fr);
	gap: 2px;
	min-height: 44px;
}

.restaurant-picker .place-pick-address {
	grid-column: 1;
}

.place-pick-walk {
	color: var(--ash);
	font-size: 13px;
	font-weight: 600;
}

.vote-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin: 8px 0 0;
}

.vote-actions .text-button:disabled {
	cursor: wait;
}

/* 정한 뒤 식당 상자의 길찾기·지도·공유 단추는 style.css 가 #nearbyResult 안에서만 그려서, 여기서 같은 모양으로 그려요 */
.vote-share,
.vote-link-button,
.vote-map-link,
.vote-confirmed .restaurant-links a,
.vote-confirmed .restaurant-links button {
	display: inline-flex;
	align-items: center;
	height: 40px;
	padding: 0 14px;
	border: 1px solid var(--hairline);
	border-radius: var(--radius-sm);
	background: var(--canvas);
	color: var(--ink);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: border-color 0.15s ease-out;
}

.vote-share:focus-visible,
.vote-link-button:focus-visible,
.vote-map-link:focus-visible,
.vote-confirmed .restaurant-links a:focus-visible,
.vote-confirmed .restaurant-links button:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.vote-notice-text {
	margin: 0 0 16px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.5;
	text-wrap: balance;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

@media (hover: hover) {
	.vote-chip-remove:hover {
		color: var(--ink);
	}

	.vote-add-button:hover:not(:disabled) {
		background: var(--cloud);
	}

	.vote-check:hover {
		border-color: var(--ink);
	}

	.vote-share:hover,
	.vote-link-button:hover,
	.vote-map-link:hover,
	.vote-confirmed .restaurant-links a:hover,
	.vote-confirmed .restaurant-links button:hover {
		border-color: var(--ink);
	}
}

@media (max-width: 600px) {
	.restaurant-picker {
		height: 100dvh;
		max-height: 100dvh;
	}
}

@media (max-width: 480px) {
	.vote-card {
		padding: 16px;
	}

	.vote-check,
	.vote-result {
		padding-right: 14px;
		padding-left: 14px;
		font-size: 16px;
	}

	.vote-candidate {
		padding-left: 14px;
	}

	.vote-candidate-name {
		font-size: 16px;
	}

	/* 식당 상자 단추는 추천 화면처럼 좌우 여백을 10px 로 줄여 360px 폭에서도 길찾기·지도가 한 줄에 들어가요 */
	.vote-confirmed .restaurant-links a,
	.vote-confirmed .restaurant-links button {
		padding: 0 10px;
	}

	/* 40px 테두리 단추(지도 링크·공유·이걸로 정하기·식당 상자 단추): 보이는 높이는 그대로, 누르는 곳은 위아래 2px씩 넓혀 44px(추천 화면과 같은 방식) */
	.vote-share,
	.vote-map-link,
	.vote-confirmed .restaurant-links a,
	.vote-confirmed .restaurant-links button {
		position: relative;
	}

	.vote-share::after,
	.vote-map-link::after,
	.vote-confirmed .restaurant-links a::after,
	.vote-confirmed .restaurant-links button::after {
		content: "";
		position: absolute;
		/* ::after 는 테두리 안쪽에서 재서 1px 테두리만큼 더 빼요 */
		inset: -3px -1px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vote-add-button:active:not(:disabled) {
		transform: none;
	}
}
