/**
 * 传统排盘样式（参考热卜：细线表格、灰底、红点缀）
 * 与时间 / 手动 / 卦象 / 自动摇卦 各模式共用
 */

.divination-time-page,
.divination-manual-page,
.divination-coin-page,
.divination-trigram-page {
	--div-bg: #eef3f7;
	--div-border: #c8d6e2;
	--div-label: #0f4c5c;
	--div-text: #0f172a;
	--div-muted: #5f7082;
	--div-red: #b4232f;
	--div-green: #1f6f6e;
	--div-accent: #1e3a8a;
	background: var(--div-bg);
	min-height: 60vh;
	padding-bottom: 2rem;
}

.divination-time-page .div-time-wrap,
.divination-manual-page .div-time-wrap,
.divination-coin-page .div-time-wrap,
.divination-trigram-page .div-time-wrap {
	max-width: 720px;
	margin: 0 auto;
	padding: 1rem 0.75rem 2rem;
}

.div-mode-switch {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.4rem;
	margin-bottom: 0.9rem;
}

.div-mode-switch__item {
	display: block;
	text-align: center;
	padding: 0.52rem 0.2rem;
	font-size: 0.8rem;
	color: #143b53;
	background: #e4ecf4;
	border: 1px solid #b9cddd;
	border-radius: 3px;
	text-decoration: none;
}

.div-mode-switch__item.is-active {
	color: #fff;
	background: #1e3a8a;
	border-color: #183468;
	font-weight: 600;
}

.divination-time-page .div-time-hero,
.divination-manual-page .div-time-hero,
.divination-coin-page .div-time-hero,
.divination-trigram-page .div-time-hero {
	text-align: center;
	margin-bottom: 1.25rem;
}

.divination-time-page .div-time-hero h1,
.divination-manual-page .div-time-hero h1,
.divination-coin-page .div-time-hero h1,
.divination-trigram-page .div-time-hero h1 {
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--div-text);
	margin: 0 0 0.35rem;
}

.divination-time-page .div-time-hero p,
.divination-manual-page .div-time-hero p,
.divination-coin-page .div-time-hero p,
.divination-trigram-page .div-time-hero p {
	margin: 0;
	font-size: 0.85rem;
	color: var(--div-muted);
}

/* ---------- 输入区 ---------- */

.div-time-form {
	background: #fff;
	border: 1px solid var(--div-border);
	border-radius: 2px;
	padding: 1rem 0.85rem 1.1rem;
	margin-bottom: 1rem;
}

.div-time-form__grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 0.5rem 0.35rem;
	align-items: end;
}

@media (max-width: 600px) {
	.div-time-form__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.div-time-field {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
}

.div-time-field label {
	font-size: 0.72rem;
	color: var(--div-muted);
	white-space: nowrap;
}

.div-time-field select,
.div-time-field input[type='text'] {
	width: 100%;
	font-size: 0.85rem;
	padding: 0.45rem 0.35rem;
	border: 1px solid var(--div-border);
	border-radius: 2px;
	background: #fafafa;
	color: var(--div-text);
	box-sizing: border-box;
}

.div-time-field--note {
	grid-column: 1 / -1;
}

/* ---------- manual 六爻输入 ---------- */
.manual-lines-panel {
	background: #fff;
	border: 1px solid var(--div-border);
	margin-bottom: 0.7rem;
}

.manual-line-row {
	display: grid;
	grid-template-columns: 3rem 1fr 4.5rem;
	align-items: center;
	gap: 0.4rem;
	padding: 0.45rem 0.5rem;
	border-bottom: 1px solid #e6edf4;
}

.manual-line-row:last-child {
	border-bottom: none;
}

.manual-line-label {
	font-size: 0.8rem;
	color: var(--div-label);
	font-weight: 600;
}

.manual-line-select {
	font-size: 0.84rem;
	padding: 0.4rem 0.35rem;
	border: 1px solid var(--div-border);
	background: #f7fafc;
	color: var(--div-text);
}

.manual-line-graph {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 0.25rem;
}

.manual-moving-badge {
	font-size: 0.68rem;
	font-weight: 700;
	color: var(--div-red);
	border: 1px solid rgba(180, 35, 47, 0.5);
	padding: 0.02rem 0.2rem;
	line-height: 1.2;
	border-radius: 2px;
}

/* ---------- coin 自动摇卦 ---------- */
.coin-toss-panel {
	background: #fff;
	border: 1px solid var(--div-border);
	margin-bottom: 0.7rem;
	padding: 0.8rem 0.65rem;
}

.coin-toss-stage {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.7rem;
	align-items: center;
	max-width: 19rem;
	margin: 0 auto 0.75rem;
}

.coin-toss-img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: 50%;
	border: 1px solid #c7b16e;
	background: #f8f4e8;
	box-shadow: 0 2px 7px rgba(15, 23, 42, 0.18);
}

.coin-line-status {
	display: flex;
	justify-content: center;
	gap: 0.35rem;
	margin-bottom: 0.75rem;
	font-size: 0.84rem;
	color: var(--div-muted);
}

.coin-line-status strong {
	color: var(--div-label);
}

.coin-lines-panel {
	border: 1px solid #e6edf4;
}

.coin-line-row {
	display: grid;
	grid-template-columns: 3rem 1fr 4.5rem;
	align-items: center;
	gap: 0.4rem;
	padding: 0.45rem 0.5rem;
	border-bottom: 1px solid #e6edf4;
}

.coin-line-row:last-child {
	border-bottom: none;
}

.coin-line-row.is-complete {
	background: #fbfdff;
}

.coin-line-label {
	font-size: 0.8rem;
	color: var(--div-label);
	font-weight: 600;
}

.coin-line-result {
	font-size: 0.82rem;
	color: var(--div-muted);
}

.coin-line-row.is-complete .coin-line-result {
	color: var(--div-text);
	font-weight: 600;
}

.coin-line-graph {
	display: flex;
	justify-content: flex-end;
	align-items: center;
}

.div-coin-submit {
	background: #1e3a8a;
}

/* ---------- trigram 选卦 ---------- */
.trigram-panels {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.7rem;
	margin-bottom: 0.7rem;
}

@media (min-width: 860px) {
	.trigram-panels {
		grid-template-columns: 1fr 1fr;
	}
}

.trigram-panel {
	background: #fff;
	border: 1px solid var(--div-border);
	padding: 0.75rem 0.65rem;
}

.trigram-panel--primary {
	background: #f1f7fc;
	border-color: #b5d7ef;
}

.trigram-panel--transformed {
	background: #f7f3fa;
	border-color: #d9c8e8;
}

.trigram-panel__title {
	margin: 0 0 0.55rem;
	font-size: 0.95rem;
	color: var(--div-label);
	font-weight: 700;
}

.trigram-select-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.5rem;
}

@media (max-width: 520px) {
	.trigram-select-grid {
		grid-template-columns: 1fr;
	}
}

.trigram-select {
	width: 100%;
	font-size: 0.85rem;
	padding: 0.45rem 0.35rem;
	border: 1px solid var(--div-border);
	border-radius: 2px;
	background: #fafafa;
	color: var(--div-text);
	box-sizing: border-box;
}

.trigram-preview {
	margin-top: 0.65rem;
	min-height: 4.7rem;
}

.trigram-preview-hint {
	padding: 0.45rem 0.5rem;
	font-size: 0.76rem;
	color: var(--div-muted);
	border: 1px dashed #c8d6e2;
	background: #f9fbfe;
}

.trigram-preview-card {
	display: grid;
	grid-template-columns: 1fr auto;
	grid-template-areas:
		"title lines"
		"code lines";
	gap: 0.15rem 0.7rem;
	align-items: center;
	padding: 0.55rem 0.6rem;
	background: #fbfdff;
	border: 1px solid #e6edf4;
}

.trigram-preview-title {
	grid-area: title;
	font-size: 0.9rem;
	color: var(--div-text);
	font-weight: 700;
}

.trigram-preview-code {
	grid-area: code;
	font-size: 0.78rem;
	color: var(--div-muted);
}

.trigram-preview-lines {
	grid-area: lines;
	display: flex;
	flex-direction: column;
	gap: 0.22rem;
	width: 4rem;
}

.trigram-preview-line {
	display: flex;
	justify-content: center;
}

.div-time-actions {
	margin-top: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.div-time-submit {
	display: block;
	width: 100%;
	padding: 0.75rem 1rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: #0f4c5c;
	border: 1px solid #1b355f;
	border-radius: 2px;
	cursor: pointer;
}

.div-time-submit:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.div-time-hint {
	font-size: 0.8rem;
	color: var(--div-muted);
	text-align: center;
}

/* ---------- 状态区 ---------- */

.div-state {
	min-height: 2.5rem;
	font-size: 0.88rem;
	text-align: center;
	color: var(--div-muted);
	padding: 0.5rem 0;
}

.div-state--error {
	color: #b71c1c;
}

.div-state--loading {
	color: var(--div-label);
}

/* ---------- 结果板 ---------- */

.div-result-board {
	font-size: 0.82rem;
	color: var(--div-text);
	line-height: 1.45;
}

.div-board-share-bar {
	display: flex;
	justify-content: flex-end;
	margin: 0 0 0.35rem;
}

.div-board-share-btn {
	font-size: 0.78rem;
	padding: 0.35rem 0.65rem;
	color: #fff;
	background: #1e3a8a;
	border: 1px solid #183468;
	border-radius: 3px;
	cursor: pointer;
}

.div-board-meta {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid var(--div-border);
}

.div-board-note-section {
	margin-top: 0.5rem;
	padding: 0.5rem 0.55rem;
	background: #fbfdff;
	border: 1px solid var(--div-border);
}

.div-board-note-title {
	margin: 0 0 0.25rem;
	font-size: 0.8rem;
	color: var(--div-label);
}

.div-board-note-line {
	margin: 0;
	font-size: 0.78rem;
	line-height: 1.5;
	color: var(--div-text);
	word-break: break-word;
}

.div-board-note-line + .div-board-note-line {
	margin-top: 0.18rem;
}

.div-board-note-k {
	color: var(--div-label);
	font-weight: 600;
}

.div-board-td {
	border: 1px solid var(--div-border);
	padding: 0.35rem 0.4rem;
	vertical-align: top;
	word-break: break-word;
}

.div-board-td--label {
	width: 3.2rem;
	background: #edf3f8;
	color: var(--div-label);
	font-weight: 600;
	white-space: nowrap;
}

.div-board-td--val {
	color: var(--div-text);
}

.div-board-td--span4 {
	text-align: left;
}

.div-board-td--shensha {
	line-height: 1.65;
}

.shen-sha-item {
	display: inline-block;
	margin: 0 0.4rem 0.2rem 0;
	white-space: nowrap;
}

.div-board-tr--muted .div-board-td--val {
	color: var(--div-muted);
	font-size: 0.78rem;
}

.ganzhi-pillar--day {
	color: var(--div-red);
	font-weight: 600;
}

/* 卦名标题 */
.div-board-hex-titles {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0.65rem 0 0.35rem;
	padding: 0 0.15rem;
}

.div-board-hex-title {
	flex: 1;
	min-width: 0;
	font-size: 0.95rem;
	text-align: center;
}

.div-board-hex-title--left {
	text-align: left;
}

.div-board-hex-title--right {
	text-align: right;
}

.div-result-board--single .div-board-hex-titles {
	justify-content: center;
}

.div-result-board--single .div-board-hex-title--left {
	text-align: center;
}

.div-board-hex-sub {
	display: block;
	font-size: 0.72rem;
	color: var(--div-muted);
	font-weight: 400;
	margin-top: 0.15rem;
	word-break: break-word;
}

/* 六爻区 */
.div-board-section--hex {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin-top: 0.25rem;
	background: #fdfefe;
	border: 1px solid var(--div-border);
	padding: 0.35rem 0.25rem 0.5rem;
}

.hex-lines-board {
	min-width: 280px;
}

.hex-lines-board--single {
	max-width: 560px;
	margin: 0 auto;
}

.hex-lines-row {
	display: grid;
	grid-template-columns: 0.55fr 1.2fr 1fr 0.8fr 1fr 1.2fr;
	align-items: center;
	gap: 0.15rem 0.1rem;
	padding: 0.28rem 0;
	border-bottom: 1px solid #eee;
}

.hex-lines-row:last-child {
	border-bottom: none;
}

.hex-lines-board--single .hex-lines-row {
	grid-template-columns: 0.7fr 1.8fr 1fr;
}

.hex-cell {
	min-width: 0;
	font-size: 0.78rem;
	text-align: center;
}

.hex-cell--god {
	color: var(--div-red);
	font-weight: 600;
}

.hex-line-no {
	display: inline-block;
	font-size: 0.68rem;
	color: var(--div-muted);
	font-weight: 600;
}

.hex-cell--meta {
	text-align: left;
	padding-left: 0.1rem;
}

.hex-cell--meta-right {
	text-align: right;
	padding-right: 0.1rem;
}

.hex-meta-wrap {
	display: inline-flex;
	flex-direction: column;
	gap: 0.08rem;
}

.hex-meta-main {
	font-size: 0.78rem;
	color: var(--div-text);
}

.hex-meta-detail {
	font-size: 0.68rem;
	color: var(--div-muted);
	line-height: 1.35;
}

.hex-cell--yao {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.15rem;
}

.hex-cell--yao-right {
	justify-content: flex-start;
	flex-direction: row;
}

.hex-cell--yao-single {
	justify-content: center;
}

.hex-cell--center {
	display: flex;
	align-items: center;
	justify-content: center;
}

/* 阴阳爻（CSS 绘制） */
.yao-graph {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 3.4rem;
	vertical-align: middle;
}

.yao-graph__solid {
	display: block;
	width: 100%;
	height: 5px;
	background: #111;
	border-radius: 1px;
}

.yao-graph--yin {
	gap: 3px;
	width: 100%;
	max-width: 3.4rem;
}

.yao-graph--yin .yao-graph__part {
	flex: 1;
	height: 5px;
	background: #111;
	border-radius: 1px;
}

.shi-ying-tag {
	font-size: 0.65rem;
	color: var(--div-red);
	font-weight: 700;
	min-width: 0.85rem;
	text-align: center;
}

.shi-ying-tag--empty {
	visibility: hidden;
}

.yao-move-mark {
	display: inline-flex;
	align-items: center;
	gap: 0.05rem;
	font-weight: 700;
	color: var(--div-red);
	font-size: 0.85rem;
	white-space: nowrap;
}

.yao-move-x {
	font-size: 0.95rem;
	line-height: 1;
}

.yao-move-arr {
	font-size: 0.8rem;
}

.yao-move-mark--empty {
	visibility: hidden;
}

/* 底部说明 */
.div-board-hex-foot {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 0.5rem;
	margin-top: 0.5rem;
	padding: 0.35rem 0.2rem 0;
	font-size: 0.78rem;
}

.div-board-foot-left {
	color: var(--div-green);
	font-weight: 600;
	text-align: left;
	flex: 1;
}

.div-board-foot-right {
	color: var(--div-green);
	font-weight: 600;
	text-align: right;
	flex: 1;
}

.div-result-board--single .div-board-hex-foot {
	justify-content: center;
}

.div-result-board--single .div-board-foot-left {
	text-align: center;
}

.div-board-muted {
	color: var(--div-muted);
}

/* 主卦/变卦解释 */
.hex-exp-section {
	margin-top: 0.65rem;
}

.hex-exp-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.55rem;
}

.hex-exp-grid--single {
	grid-template-columns: 1fr;
	max-width: 560px;
	margin: 0 auto;
}

@media (max-width: 640px) {
	.hex-exp-grid {
		grid-template-columns: 1fr;
	}
}

.hex-exp-card {
	background: #fbfdff;
	border: 1px solid var(--div-border);
	padding: 0.55rem 0.55rem 0.45rem;
}

.hex-exp-title {
	margin: 0 0 0.35rem;
	font-size: 0.86rem;
	color: var(--div-accent);
}

.hex-exp-line {
	margin: 0 0 0.26rem;
	font-size: 0.76rem;
	line-height: 1.45;
	color: var(--div-text);
}

.hex-exp-k {
	color: var(--div-label);
	font-weight: 600;
}

/* 分享弹层 */
.div-share-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 9999;
}

.div-share-modal.is-open {
	display: block;
}

.div-share-mask {
	position: absolute;
	inset: 0;
	background: rgba(7, 20, 39, 0.55);
}

.div-share-panel {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(92vw, 540px);
	max-height: 84vh;
	display: flex;
	flex-direction: column;
	background: #fafdff;
	border: 1px solid var(--div-border);
	border-radius: 6px;
	box-shadow: 0 8px 24px rgba(10, 35, 64, 0.25);
}

.div-share-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--div-border);
	color: var(--div-accent);
}

.div-share-close {
	border: 1px solid var(--div-border);
	background: #fff;
	color: #12395b;
	font-size: 1rem;
	line-height: 1;
	width: 1.65rem;
	height: 1.65rem;
	border-radius: 4px;
	cursor: pointer;
}

.div-share-preview-wrap {
	padding: 0.65rem;
	overflow: auto;
	max-height: calc(84vh - 7.5rem);
	background: #eef4fa;
}

.div-share-loading {
	color: var(--div-muted);
	font-size: 0.86rem;
	text-align: center;
	padding: 1rem 0.5rem;
}

.div-share-preview {
	display: none;
	width: 100%;
	height: auto;
	border: 1px solid var(--div-border);
	background: #fff;
}

.div-share-actions {
	padding: 0.65rem;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.55rem;
	border-top: 1px solid var(--div-border);
}

.div-share-action-btn {
	padding: 0.62rem 0.5rem;
	border-radius: 4px;
	font-size: 0.86rem;
	cursor: pointer;
	color: #fff;
	border: 1px solid #1b355f;
	background: #1e3a8a;
}
