body {
	font-family: "微軟正黑體", sans-serif;
	/* font-family: Noto Sans TC,"微軟正黑體",sans-serif; */
	/*g-font-size:16*/
	font-size: 1.14286rem;
	color: #333333;
	background-image: url("../images/page-bg.png");
}

a {
	color: rgb(51, 51, 51);
	text-decoration: none;
}

html {
	font-size: 16px !important;
	/* base */
}

html,
body {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

ul ul,
ol ul {
	list-style-type: none;
}

.g-min-width-60 {
	min-width: 60px !important;
}

.g-bg-lightred {
	background-color: #cd0000 !important;
}

.g-bg-lightred--hover:hover {
	background-color: #cd0000 !important;
}

.g-bg-gray-2 {
	background-color: #CD0000;
}

.g-bg-line {
	background-color: #00B900;
}

.g-bg-blue-2 {
	background-color: #00389A;
}

.g-bg-blue-2--hover:hover {
	background-color: #316DD6;
}

.g-bg-blue-3 {
	background-color: #316DD6;
}

.g-bg-gray-2 {
	background-color: #989898;
}

.g-bg-gray-3 {
	background-color: #404040;
}

.g-bg-gray-3--hover:hover {
	background-color: #2d2d2d;
}

.only-one-line {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.only-two-line {
	overflow: hidden;
	word-wrap: break-word;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.only-three-line {
	overflow: hidden;
	word-wrap: break-word;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.text-shadow {
	text-shadow: 2px 2px 3px #434a54;
}

.box-shadow {
	box-shadow: 0 2px 10px 2px rgba(0, 0, 0, 0.25);
}

a:hover {
	text-decoration: none;
}

a:focus-visible,
button:focus-visible,
.form-control:focus-visible,
input:focus-visible,
button:focus-visible,
.input-btn:focus-visible,
.scroll-item:focus-visible,
.scroll-picker:focus-visible {
	outline: 4px dashed rgb(212, 35, 0) !important;
	outline-offset: 3px !important;
}

/* 確保顏色對比符合 AA */
.btn-primary {
	color: #ffffff;
	/* 白字 */
	background-color: #0d6efd;
	/* 藍色 */
}

.btn-warning {
	color: #000000;
	/* 黑字 */
	background-color: #ffc107;
	/* 黃色 */
}

.btn-success {
	color: #ffffff;
	/* 白字 */
	background-color: #198754;
	/* 綠色 */
}

/* 適度放大文字 */
.input-btn span {
	display: block;
	padding: 2rem 1rem;
}


.voice-btn {
	/* border-radius: 50%; */
	/* width: 2.5rem; */
	height: 2.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

.voice-btn.active {
	background-color: #dc3545 !important;
	color: #fff;
}


.scroll-picker {
	/* max-height: 150px; */
	height: 54px;
	overflow-y: auto;
	border: 1px solid #dee2e6;
	border-radius: 10px;
	padding: 0.5rem;
	scroll-behavior: smooth;
	text-align: center;
}

.scroll-item {
	height: 44px;
	padding: 0.5rem;
	cursor: pointer;
	border-radius: 6px;
}


.scroll-item.active {
	background: #212529;
	color: white;
}


.btn-option {
	min-width: 80px;
	flex: 1 1 auto;
}

.btn {
	border: 1px solid #dee2e6;
	font-size: 1rem;
}

.btn-option[aria-pressed="true"] {
	background-color: #212529;
	color: #fff;
	border-color: #212529;
}

.btn-option:focus {
	outline: 3px solid #ff8800;
	outline-offset: 2px;
}

.ziwei-grid {
	width: 100%;
	border-collapse: collapse;
	max-width: 100%;
	table-layout: auto;
	word-break: break-word;
}

.palace-cell,
.info-cell {
	border: 1px solid #95531c;
	vertical-align: top;
	padding: 5px;
	position: relative;
}

td:focus-visible,
.palace-cell:focus-visible,
.palace-cell:hover,
.palace-cell:focus,
.info-cell:focus-visible,
.info-cell:hover,
.info-cell:focus {
	outline: 4px dashed rgb(212, 35, 0) !important;
	outline-offset: 3px !important;
	background-color: #ffe741;
	cursor: pointer;
	z-index: 1000;
}


.cell-content {
	width: 100%;
	height: 100%;
	text-align: left;
}

.stars {
	display: flex;
}

.stars span {
	margin-right: 0.5rem;
}

.stars-justify {
	margin-bottom: 10px;
	display: flex;
	justify-content: flex-end;
}

.stars-justify span {
	margin-right: 0.2rem;
}

.two-col {
	float: right !important;
	display: grid;
	grid-template-columns: auto auto;
	/* 左欄寬度依最寬內容，右欄吃剩餘空間 */
	gap: 0.5rem 1rem;
	/* 行距、欄距 */
	width: fit-content;
	/* 不撐滿，依內容寬度 */
	margin-top: 2rem;
	align-items: center;
	justify-items: center
}

.palace-name {
	padding: 0.5rem 1.2rem;
	background: #95531c;
	position: relative;
	top: -2px;
	border-radius: 6px;
	color: #fff;
	white-space: nowrap;
	font-weight: bold;
}

.visually-hidden {
	position: absolute;
	left: -9999px;
}

/* 只隱藏給螢幕閱讀器專用的提示，不要全域隱藏 aria-live */
.sr-only,
.sr-live {
	position: absolute !important;
	left: -9999px !important;
	height: 1px !important;
	overflow: hidden !important;
	width: 1px !important;
	white-space: nowrap;
}


@media (max-width: 920px) {
	.btn-group .btn {
		flex: 1 1 45%;
	}

	.btn {
		border-radius: 0;
	}

	.scroll-picker {
		max-height: 120px;
	}

	.palace-cell,
	.info-cell {
		font-size: 0.8rem;
		padding: 3px;
		height: auto;
	}

	.stars span {
		display: block;
		margin-right: 0;
	}

	.palace-name {
		padding: 0.5rem;
	}

	.ziwei-grid {
		/* transform: scale(0.55); */
		transform-origin: top center;
		width: 100%;
	}

	.two-col {
		gap: 0;
	}

	.container,
	.container-md,
	.container-sm {
		max-width: 100%;
	}

	.ziwei-grid-div {
		width: 1200px;
		max-width: none;
	}
}

@media (min-width: 768px) {
	.d-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

.ziwei-grid-div {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0;
	border: 1px solid #dee2e6;
}

.ziwei-grid-div .palace-cell,
.ziwei-grid-div .info-cell {
	border: 1px solid #dee2e6;
	min-height: 170px;
}

.ziwei-grid-div .info-cell {
	grid-column: 2 / span 2;
	grid-row: 2 / span 2;
}

/* 手機縮排版：用字級/間距縮，iOS 更穩 */
@media (max-width: 576px) {
	.ziwei-grid-div {
		font-size: clamp(10px, 2.6vw, 12px);
	}

	.ziwei-grid-div .palace-cell,
	.ziwei-grid-div .info-cell {
		min-height: 130px;
	}

	.ziwei-grid-div .cell-content {
		padding: .25rem;
	}
}


.ziwei-grid-wrap {
	width: 100%;
	-webkit-overflow-scrolling: touch;
}


.ziwei-grid-wrap {
	scrollbar-width: none;
	/* Firefox */
}

.ziwei-grid-wrap::-webkit-scrollbar {
	display: none;
	/* Chrome/Safari/iOS */
}

.container {
	max-width: 1800px !important;
}

/* ========= 手機：整頁不滾動，全部內容塞進一個畫面 ========= */
@media (max-width: 576px) {

	/* 1) 禁止整頁滑動（避免使用者要滑整個頁面） */
	html,
	body {
		height: 100%;
		overflow: hidden !important;
	}

	/* 2) 讓主要內容用螢幕高度排版 */
	main {
		height: 100vh;
		overflow: hidden;
	}

	/* 3) container 壓縮上下留白 */
	.container.g-pa-30 {
		height: 100vh;
		padding: 12px !important;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
	}

	/* 4) 標題與上方按鈕區縮小 */
	h1.display-6 {
		font-size: 1.25rem !important;
		margin: 8px 0 10px !important;
		line-height: 1.2;
	}

	/* 上方「操作說明」與返回按鈕區塊縮小間距 */
	.container .mb-4 {
		margin-bottom: 8px !important;
	}

	.container .mb-3 {
		margin-bottom: 8px !important;
	}

	.container .mt-3 {
		margin-top: 8px !important;
	}

	.container .my-5 {
		margin-top: 8px !important;
		margin-bottom: 10px !important;
	}

	/* 5) 表單區：把 row 的 gap 壓小 */
	#inputForm.row.g-4 {
		--bs-gutter-x: 8px;
		--bs-gutter-y: 8px;
	}

	/* 6) label 字體縮小 */
	.form-label {
		font-size: .95rem !important;
		margin-bottom: 4px !important;
	}

	/* 7) 名字輸入框縮小高度 */
	#userName.form-control {
		padding: .4rem .6rem !important;
		font-size: 1rem !important;
	}

	/* 8) ✅最關鍵：scroll-picker / scroll-item 取消你原本的超大設定 */
	.scroll-picker {
		height: 44px !important;
		/* 原本你手機設 100px，這會爆 */
		max-height: 44px !important;
		padding: 6px !important;
		font-size: 1rem !important;
		overflow-y: auto !important;
		/* 只讓 picker 自己滾 */
	}

	.scroll-item {
		height: 34px !important;
		padding: 4px 6px !important;
		font-size: 1rem !important;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	/* 9) 送出/重設按鈕縮小，避免占高度 */
	#submitBtn,
	#resetBtn,
	.btn.btn-lg {
		padding: .45rem .9rem !important;
		font-size: 1rem !important;
		margin-top: 10px !important;
	}

	/* 10) 下面那顆「返回」再縮小一點（可選） */
	a.btn.btn-secondary.btn-lg {
		padding: .4rem .8rem !important;
		font-size: .95rem !important;
	}
}