/* 缘起 — 纸墨风格 · 移动端优先 */

:root {
	--bg: #f4f1ea;
	--bg-deep: #ebe6dc;
	--surface: #fffcf7;
	--ink: #1c1b19;
	--ink-soft: #4a4744;
	--muted: #8a847c;
	--line: #ddd8ce;
	--line-strong: #c9c2b4;
	--accent: #a83f32;
	--accent-soft: rgba(168, 63, 50, 0.1);
	--accent-hover: #8f3429;
	--ok: #3d6b4f;
	--err-bg: #faf0ee;
	--err-text: #9e3b32;
	--radius: 12px;
	--radius-sm: 8px;
	--shadow: 0 1px 2px rgba(28, 27, 25, 0.06), 0 8px 24px rgba(28, 27, 25, 0.05);
	--font-serif: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
	--font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
	--header-h: 48px;
	--tabbar-h: 54px;
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-t: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html {
	height: 100%;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100%;
	min-height: 100dvh;
	font-family: var(--font-sans);
	font-size: 15px;
	line-height: 1.55;
	color: var(--ink);
	background: var(--bg);
	background-image: radial-gradient(circle at 20% 0%, rgba(168, 63, 50, 0.04), transparent 42%);
	overflow-x: hidden;
}

button,
input {
	font: inherit;
	color: inherit;
}

.app {
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
	max-width: 480px;
	margin: 0 auto;
	background: var(--bg);
}

/* —— 顶栏 —— */
.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-height: calc(var(--header-h) + var(--safe-t));
	padding: calc(var(--safe-t) + 6px) 12px 6px;
	background: rgba(244, 241, 234, 0.94);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}

.brand-title {
	font-family: var(--font-serif);
	font-size: 1.125rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	margin: 0;
	color: var(--ink);
}

.brand-sub {
	font-size: 10px;
	color: var(--muted);
	letter-spacing: 0.04em;
	margin: 0;
}

.topbar-date {
	display: none;
}

@media (min-width: 380px) {
	.topbar-date {
		display: block;
		flex-shrink: 0;
		font-size: 11px;
		color: var(--muted);
		text-align: right;
		line-height: 1.35;
		white-space: nowrap;
	}
}

/* —— 主内容 —— */
.main {
	flex: 1;
	padding: 12px 14px calc(var(--tabbar-h) + var(--safe-b) + 28px);
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
}

.stack {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.section-head {
	margin: 0 0 12px;
}

.section-head h2 {
	font-family: var(--font-serif);
	font-size: 1.05rem;
	font-weight: 600;
	margin: 0 0 2px;
	color: var(--ink);
}

.section-head p {
	margin: 0;
	font-size: 12px;
	color: var(--muted);
	line-height: 1.45;
}

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px;
	box-shadow: var(--shadow);
}

.card + .card,
.stack + .result-block,
.result-block + .card {
	margin-top: 10px;
}

/* flex 容器内用 gap，避免与 margin 叠加 */
.home-stack > .card + .card,
.home-stack > .home-daily-row + .card,
.home-stack > .card + .home-daily-row,
.home-stack > .home-daily-row + .home-daily-row,
.stack > .card + .card {
	margin-top: 0;
}

.page-actions {
	margin-top: 0;
}

.spinner-sm {
	width: 20px;
	height: 20px;
	border-width: 2px;
}

.field {
	margin-bottom: 12px;
}

.field-last {
	margin-bottom: 0;
}

.spaced {
	margin-bottom: 10px;
}

.block-gap {
	margin-top: 12px;
}

.mt-3 {
	margin-top: 12px;
}

.mb-3 {
	margin-bottom: 12px;
}

.mb-2 {
	margin-bottom: 8px;
}

.result-block {
	display: flex;
	flex-direction: column;
	margin-top: 10px;
	scroll-margin-top: calc(var(--header-h) + 12px);
}

.result-block > .card.result {
	padding: 0;
	overflow: hidden;
}

.result-body {
	padding: 14px;
}

.result-footer {
	padding: 10px 14px 14px;
	border-top: 1px solid var(--line);
	background: var(--bg);
}

.result-footer-actions {
	display: flex;
	gap: 10px;
}

.result-footer-actions .btn-copy {
	flex: 1;
}

.btn-share {
	color: var(--text);
}

.btn-copy {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 44px;
	padding: 0 16px;
	font-size: 14px;
	font-weight: 500;
	color: var(--accent);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	cursor: pointer;
	touch-action: manipulation;
	transition: background 0.15s, border-color 0.15s;
}

.btn-copy svg {
	width: 16px;
	height: 16px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.75;
	flex-shrink: 0;
}

.btn-copy:active {
	background: var(--accent-soft);
	border-color: rgba(168, 63, 50, 0.35);
}

/* 可滚动但不显示滚动条 */
.no-scrollbar {
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	overscroll-behavior: contain;
}

.no-scrollbar::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
	background: transparent;
}

.sheet-zodiac {
	margin-bottom: 12px;
}

.subnav {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 6px;
}

.subnav-4 {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.subnav-3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subnav-3 .subnav-btn,
.subnav-4 .subnav-btn {
	padding: 8px 4px;
	font-size: 12px;
}

.subnav-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.subnav-wrap .subnav-btn {
	flex: 1 1 calc(33.333% - 4px);
	min-width: calc(33.333% - 4px);
	padding: 8px 4px;
	font-size: 12px;
}

.pair-gender-row {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.score-duo {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.score-duo.score-trio {
	grid-template-columns: repeat(3, 1fr);
}

.tip-list {
	margin: 0;
	padding-left: 1.1rem;
	font-size: 14px;
	line-height: 1.55;
	color: var(--ink-soft);
}

.tip-list li + li {
	margin-top: 6px;
}

.score-duo-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 12px;
	background: var(--bg);
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	font-size: 12px;
	color: var(--muted);
}

.score-duo-item strong {
	font-family: var(--font-serif);
	font-size: 1.25rem;
	color: var(--accent);
}

.subnav-btn {
	min-height: 40px;
	padding: 8px 6px;
	font-size: 13px;
	font-weight: 500;
	color: var(--muted);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	cursor: pointer;
	touch-action: manipulation;
}

.subnav-btn.is-active {
	color: var(--accent);
	border-color: var(--accent);
	background: var(--accent-soft);
}

.home-head {
	margin-bottom: 4px;
}

.home-title {
	font-family: var(--font-serif);
	font-size: 1.05rem;
	font-weight: 600;
	margin: 0 0 2px;
}

.home-desc {
	margin: 0;
	font-size: 12px;
	color: var(--muted);
}

/* —— 星座 —— */
.zodiac-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.zodiac-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	min-height: 68px;
	padding: 8px 4px;
	background: var(--bg);
	border: 1.5px solid transparent;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
	touch-action: manipulation;
}

.zodiac-item:active {
	transform: scale(0.98);
}

.zodiac-item.is-active {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.zodiac-char {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	font-family: var(--font-serif);
	font-size: 1rem;
	font-weight: 600;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 50%;
}

.zodiac-item.is-active .zodiac-char {
	border-color: var(--accent);
	color: var(--accent);
}

.zodiac-name {
	font-size: 12px;
	color: var(--ink-soft);
	line-height: 1.2;
	text-align: center;
}

.zodiac-range {
	font-size: 10px;
	color: var(--muted);
	line-height: 1.2;
}

/* —— 表单 —— */
.field-label {
	display: block;
	font-size: 12px;
	font-weight: 500;
	color: var(--muted);
	margin-bottom: 6px;
}

.field-input {
	display: block;
	width: 100%;
	min-height: 48px;
	padding: 12px 14px;
	font-size: 16px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	transition: border-color 0.15s;
}

.field-input:focus {
	outline: none;
	border-color: var(--line-strong);
	background: var(--surface);
}

.field-input::placeholder {
	color: #b5afa6;
}

/* —— 牌阵选择 —— */
.segmented {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	padding: 4px;
	background: var(--bg);
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
}

.segmented-btn {
	min-height: 44px;
	padding: 10px 12px;
	font-size: 14px;
	font-weight: 500;
	color: var(--muted);
	background: transparent;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	touch-action: manipulation;
}

.segmented-btn.is-active {
	color: var(--ink);
	background: var(--surface);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* —— 底栏 Tab —— */
.tabbar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 40;
	max-width: 480px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	height: calc(var(--tabbar-h) + var(--safe-b));
	padding-bottom: var(--safe-b);
	background: rgba(255, 252, 247, 0.98);
	border-top: 1px solid var(--line);
	backdrop-filter: blur(12px);
}

.tab-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	padding: 4px 2px;
	font-size: 10px;
	font-weight: 500;
	color: var(--muted);
	background: none;
	border: none;
	cursor: pointer;
	touch-action: manipulation;
	min-width: 0;
}

.tab-item span:last-child {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

.tab-item svg {
	width: 20px;
	height: 20px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
	opacity: 0.75;
}

.tab-item.is-active {
	color: var(--accent);
}

.tab-item.is-active svg {
	opacity: 1;
	stroke-width: 2;
}

.btn-primary {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 48px;
	padding: 0 20px;
	font-size: 15px;
	font-weight: 600;
	font-family: var(--font-serif);
	letter-spacing: 0.06em;
	color: #fff;
	background: var(--accent);
	border: none;
	border-radius: var(--radius-sm);
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(168, 63, 50, 0.22);
	transition: background 0.15s, transform 0.1s;
	touch-action: manipulation;
}

.btn-primary:active:not(:disabled) {
	transform: scale(0.985);
	background: var(--accent-hover);
}

.btn-primary:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	box-shadow: none;
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.brand {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}

.icon-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 50%;
	color: var(--ink-soft);
	cursor: pointer;
	touch-action: manipulation;
}

.icon-btn svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.75;
}

/* —— 提示 / 加载 —— */
.toast-err {
	padding: 12px 14px;
	margin-bottom: 12px;
	font-size: 13px;
	color: var(--err-text);
	background: var(--err-bg);
	border: 1px solid rgba(168, 63, 50, 0.2);
	border-radius: var(--radius-sm);
}

.loading-block {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-top: 10px;
	padding: 24px 16px;
	color: var(--muted);
	font-size: 13px;
}

.spinner {
	width: 28px;
	height: 28px;
	border: 2px solid var(--line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: spin 0.7s linear infinite;
}

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

/* —— 结果区 —— */
.result-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 12px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--line);
}

.home-stack .card .result-header {
	margin-bottom: 10px;
	padding-bottom: 8px;
}

.result-title {
	font-family: var(--font-serif);
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0;
}

.result-meta {
	font-size: 12px;
	color: var(--muted);
}

.seal {
	display: inline-block;
	padding: 3px 10px;
	font-family: var(--font-serif);
	font-size: 12px;
	font-weight: 600;
	color: var(--accent);
	background: var(--accent-soft);
	border: 1px solid rgba(168, 63, 50, 0.25);
	border-radius: 4px;
	letter-spacing: 0.06em;
}

.summary-lead {
	font-family: var(--font-serif);
	font-size: 1rem;
	line-height: 1.65;
	color: var(--ink);
	margin: 0 0 10px;
}

.meter {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 14px;
	font-size: 12px;
	color: var(--muted);
}

.meter-dots {
	display: flex;
	gap: 4px;
}

.meter-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--line);
}

.meter-dot.is-on {
	background: var(--accent);
}

.kv-list {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.kv-row {
	display: grid;
	grid-template-columns: 56px 1fr;
	gap: 10px;
	padding: 11px 0;
	border-bottom: 1px solid var(--line);
	font-size: 14px;
}

.kv-row:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.kv-key {
	color: var(--muted);
	font-size: 13px;
}

.kv-val {
	color: var(--ink-soft);
	line-height: 1.5;
	word-break: break-word;
}

.poem {
	margin: 12px 0;
	padding: 14px 0 14px 14px;
	font-family: var(--font-serif);
	font-size: 15px;
	line-height: 1.9;
	color: var(--ink);
	white-space: pre-line;
	border-left: 3px solid var(--accent);
	background: linear-gradient(90deg, var(--accent-soft), transparent 80%);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.body-text {
	margin: 0;
	font-size: 14px;
	line-height: 1.75;
	color: var(--ink-soft);
}

.question-tag {
	display: inline-block;
	max-width: 100%;
	margin-bottom: 12px;
	padding: 6px 10px;
	font-size: 12px;
	color: var(--muted);
	background: var(--bg);
	border-radius: 6px;
	word-break: break-word;
}

.tarot-stack {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.tarot-entry {
	padding-top: 14px;
	border-top: 1px solid var(--line);
}

.tarot-entry:first-child {
	padding-top: 0;
	border-top: none;
}

.tarot-entry-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 10px;
	margin-bottom: 8px;
}

.tarot-entry-name {
	font-family: var(--font-serif);
	font-size: 1rem;
	font-weight: 600;
	margin: 0;
}

.tarot-entry-en {
	font-size: 12px;
	color: var(--muted);
	font-weight: 400;
}

.tag {
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 4px;
	background: var(--bg);
	color: var(--muted);
}

.tag.is-reversed {
	color: var(--accent);
	background: var(--accent-soft);
}

.date-nav {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 10px;
}

.date-nav-btn {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	font-size: 1.25rem;
	line-height: 1;
	color: var(--ink-soft);
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	cursor: pointer;
	touch-action: manipulation;
}

.date-nav-input {
	flex: 1;
	min-width: 0;
	min-height: 40px;
	padding: 8px 10px;
	font-size: 14px;
}

.date-nav-today {
	flex-shrink: 0;
	min-height: 40px;
	padding: 8px 10px;
	font-size: 12px;
}

.profile-fill-btn {
	width: 100%;
	margin-bottom: 10px;
}

.grid-table.pillars-4 {
	grid-template-columns: repeat(2, 1fr);
}

.footer-fine {
	position: fixed;
	left: 0;
	right: 0;
	bottom: calc(var(--tabbar-h) + var(--safe-b));
	z-index: 35;
	max-width: 480px;
	margin: 0 auto;
	padding: 5px 14px 4px;
	text-align: center;
	font-size: 11px;
	line-height: 1.4;
	color: var(--muted);
	background: rgba(244, 241, 234, 0.92);
	border-top: 1px solid var(--line);
	letter-spacing: 0.06em;
	user-select: none;
	pointer-events: none;
}

.footer-note {
	margin-top: 16px;
	padding: 0 4px 4px;
	text-align: center;
	font-size: 11px;
	line-height: 1.65;
	color: var(--muted);
}

.result-block + .footer-note {
	margin-top: 12px;
}

.hint {
	margin: 0;
	font-size: 12px;
	line-height: 1.55;
	color: var(--muted);
}

.segmented-3 {
	grid-template-columns: repeat(3, 1fr);
}

.segmented-sm {
	margin-bottom: 12px;
}

.segmented-sm:last-child {
	margin-bottom: 0;
}

.chip-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.chip {
	padding: 8px 12px;
	font-size: 13px;
	color: var(--ink-soft);
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: 999px;
	cursor: pointer;
	touch-action: manipulation;
}

.chip.is-active {
	color: var(--accent);
	border-color: var(--accent);
	background: var(--accent-soft);
}

.zodiac-compact .zodiac-item {
	min-height: 60px;
}

.zodiac-compact .zodiac-range {
	display: none;
}

/* card 内独立标签（如合婚「方 A / 方 B」） */
.card > .field-label {
	display: block;
	margin: 0 0 6px;
}

.card > .field-label ~ .field-label {
	margin-top: 14px;
}

.card > .hint:first-child {
	margin-bottom: 10px;
}

.date-grid {
	display: grid;
	grid-template-columns: 1.2fr 1fr 1fr;
	gap: 10px;
	margin-top: 0;
}

.card .zodiac-grid + .date-grid,
.card .zodiac-compact + .date-grid {
	margin-top: 12px;
}

.date-grid .field {
	margin-bottom: 0;
}

.match-sub-meta {
	margin: 8px 0 0;
}

.result-title-follow {
	margin-top: 8px;
}

.result-header-flush {
	border: none;
	padding-bottom: 0;
	margin-bottom: 10px;
}

.char-big {
	font-family: var(--font-serif);
	font-size: 2rem;
	text-align: center;
	letter-spacing: 0.5em;
	padding-left: 0.5em;
}

.char-display {
	font-family: var(--font-serif);
	font-size: 4rem;
	text-align: center;
	line-height: 1;
	margin-bottom: 12px;
	color: var(--ink);
}


.btn-ghost {
	padding: 8px 14px;
	font-size: 13px;
	color: var(--accent);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	cursor: pointer;
	touch-action: manipulation;
}

.toast-ok {
	position: fixed;
	top: calc(var(--header-h) + var(--safe-t) + 8px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 50;
	padding: 10px 18px;
	font-size: 13px;
	color: var(--ok);
	background: #edf5f0;
	border: 1px solid rgba(61, 107, 79, 0.25);
	border-radius: 999px;
	box-shadow: var(--shadow);
}

.dim-bars {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
}

.dim-row {
	display: grid;
	grid-template-columns: 52px 1fr;
	gap: 8px;
	align-items: center;
}

.dim-label {
	font-size: 12px;
	color: var(--muted);
}

.dim-track {
	height: 6px;
	background: var(--bg);
	border-radius: 999px;
	overflow: hidden;
}

.dim-fill {
	height: 100%;
	background: var(--accent);
	border-radius: 999px;
}

.score-ring {
	font-size: 13px;
	color: var(--muted);
	margin-top: 4px;
}

.guidance-box {
	margin-top: 0;
	padding: 12px;
	font-size: 13px;
	line-height: 1.65;
	color: var(--ink-soft);
	background: var(--bg);
	border-radius: var(--radius-sm);
}

.kv-list + .guidance-box,
.meter + .guidance-box,
.poem + .guidance-box,
.body-text + .guidance-box,
.dim-bars + .guidance-box {
	margin-top: 12px;
}

.guidance-box + .guidance-box {
	margin-top: 10px;
}

.guidance-box strong {
	color: var(--ink);
	font-weight: 600;
}

.synthesis {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--line);
	font-family: var(--font-serif);
	font-size: 14px;
	line-height: 1.7;
	color: var(--ink-soft);
}

.match-score {
	margin: 10px 0;
}

.result-header + .match-score {
	margin-top: 0;
}

.result-header + .summary-lead {
	margin-top: 0;
}

.match-num {
	font-family: var(--font-serif);
	font-size: 2.5rem;
	font-weight: 700;
	color: var(--accent);
	line-height: 1;
}

.match-num span {
	font-size: 1rem;
	font-weight: 500;
}

.match-bar {
	height: 8px;
	margin-top: 10px;
	background: var(--bg);
	border-radius: 999px;
	overflow: hidden;
}

.match-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--accent), #c9725f);
	border-radius: 999px;
}

.chip-section {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin-bottom: 8px;
}

.chip-section:last-child {
	margin-bottom: 0;
}

.chip-label {
	font-size: 12px;
	font-weight: 600;
	padding: 4px 8px;
	border-radius: 4px;
}

.chip-label.yi {
	color: var(--ok);
	background: #edf5f0;
}

.chip-label.ji {
	color: var(--accent);
	background: var(--accent-soft);
}

.chip-static {
	font-size: 13px;
	padding: 4px 10px;
	background: var(--bg);
	border-radius: 6px;
	color: var(--ink-soft);
}

.chip-static.ji {
	opacity: 0.85;
}

.advice-list {
	margin: 14px 0 0;
	padding-left: 1.1em;
	font-size: 14px;
	line-height: 1.75;
	color: var(--ink-soft);
}

.advice-list li + li {
	margin-top: 6px;
}

.sheet-mask {
	position: fixed;
	inset: 0;
	z-index: 100;
	background: rgba(28, 27, 25, 0.35);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	overflow: hidden;
}

.sheet {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 480px;
	max-height: 70dvh;
	padding: 16px 16px calc(12px + var(--safe-b));
	background: var(--surface);
	border-radius: 16px 16px 0 0;
	overflow: hidden;
}

.sheet-body {
	flex: 1;
	min-height: 0;
	padding-bottom: 4px;
}

.sheet-body .date-grid {
	margin-bottom: 0;
}

.sheet-body .field.field-last {
	margin-top: 12px;
}

.sheet-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	margin-bottom: 12px;
}

.sheet-head h3 {
	margin: 0;
	font-family: var(--font-serif);
	font-size: 1.1rem;
}

.sheet-clear {
	width: 100%;
	margin-bottom: 12px;
}

.sheet-empty {
	text-align: center;
	padding: 24px 0;
}

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

.history-item {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	width: 100%;
	padding: 14px 0;
	text-align: left;
	background: none;
	border: none;
	border-bottom: 1px solid var(--line);
	cursor: pointer;
	touch-action: manipulation;
}

.history-title {
	font-size: 15px;
	color: var(--ink);
}

.history-time {
	font-size: 11px;
	color: var(--muted);
}

/* —— 今日首页 —— */
.home-stack {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.quote-card {
	text-align: center;
	padding: 16px 14px;
}

.quote-text {
	margin: 0;
	font-family: var(--font-serif);
	font-size: 1.05rem;
	line-height: 1.75;
	color: var(--ink);
}

.quote-from {
	margin: 10px 0 0;
	font-size: 13px;
	color: var(--muted);
}

.home-daily-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.home-daily-row .card {
	margin-top: 0;
}

.home-daily-card .result-header {
	margin-bottom: 8px;
	padding-bottom: 6px;
}

.home-daily-title {
	font-size: 1rem;
}

@media (min-width: 480px) {
	.home-daily-row {
		grid-template-columns: 1fr 1fr;
	}
}

.home-daily-meta {
	margin: 0 0 6px;
	font-size: 12px;
	color: var(--muted);
}

.home-daily-teaser {
	font-size: 13px;
	line-height: 1.5;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.seal.is-reversed {
	color: var(--accent);
	border-color: rgba(168, 63, 50, 0.35);
}

.card-hint-top {
	margin-bottom: 10px;
}

.card-hint-block {
	margin: 0 0 12px;
}

.card-block-gap {
	margin-top: 12px;
}

.card-block-gap:first-child,
.card > .segmented:first-child.card-block-gap {
	margin-top: 0;
}

.card > .segmented:first-child {
	margin-bottom: 0;
}

.card > .segmented + .profile-sign-banner,
.card > .segmented + .hint,
.card > .segmented + .card-hint-top,
.card > .profile-sign-banner.card-block-gap {
	margin-top: 12px;
}

.sign-section {
	margin-bottom: 16px;
}

.sign-section-last {
	margin-bottom: 12px;
}

.sign-section .field-label {
	margin-bottom: 8px;
}

.sign-section .profile-fill-btn {
	margin-top: 8px;
	margin-bottom: 0;
}

.profile-sign-banner {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 10px 12px;
	padding: 12px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
}

.sign-banner-char {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	font-family: var(--font-serif);
	font-size: 17px;
	font-weight: 600;
	line-height: 1;
	background: var(--accent-soft);
	border: none;
	border-radius: 50%;
	color: var(--accent);
}

.sign-banner-body {
	grid-column: 2;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.sign-banner-body strong {
	font-size: 15px;
	line-height: 1.3;
	color: var(--ink);
}

.sign-banner-body .hint {
	line-height: 1.4;
}

.sign-banner-action {
	grid-column: 3;
	white-space: nowrap;
}

.profile-sign-readout {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 12px;
	padding: 10px 12px;
	background: var(--accent-soft);
	border-radius: var(--radius-sm);
	font-size: 14px;
}

.btn-ghost-sm {
	min-height: 36px;
	padding: 0 12px;
	font-size: 13px;
}

@media (max-width: 380px) {
	.profile-sign-banner {
		grid-template-columns: auto 1fr;
	}

	.sign-banner-action {
		grid-column: 1 / -1;
		width: 100%;
		margin-top: 2px;
	}
}

.home-link {
	width: 100%;
	margin-top: 10px;
}

.quick-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.quick-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	min-height: 72px;
	padding: 10px 6px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	cursor: pointer;
	touch-action: manipulation;
}

.quick-item svg {
	width: 22px;
	height: 22px;
	stroke: var(--ink-soft);
	fill: none;
	stroke-width: 1.6;
}

.quick-item span:last-child {
	font-size: 12px;
	color: var(--ink-soft);
}

.field-textarea {
	min-height: 120px;
	resize: vertical;
	line-height: 1.6;
}

.sheet-tall {
	max-height: 85dvh;
}

.sheet-save {
	flex-shrink: 0;
	width: 100%;
	margin-top: 8px;
}

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

.name-item {
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
}

.name-item:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.name-item-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}

.name-item-full {
	font-family: var(--font-serif);
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--ink);
}

.name-item .body-text {
	margin-bottom: 4px;
}

.section-label {
	margin: 0 0 8px;
	font-family: var(--font-serif);
	font-size: 14px;
	font-weight: 600;
	color: var(--ink);
}

.section-label:not(:first-child) {
	margin-top: 4px;
}

.grid-table {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}

.grid-cell {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 10px;
	background: var(--bg);
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
}

.grid-cell-label {
	font-size: 11px;
	color: var(--muted);
}

.grid-cell-num {
	font-family: var(--font-serif);
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--ink);
}

.tag.is-good {
	color: var(--ok);
	background: #edf5f0;
}

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

.char-detail-item {
	display: flex;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
}

.char-detail-item:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.char-detail-char {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-serif);
	font-size: 1.25rem;
	font-weight: 600;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
}

.char-detail-body {
	flex: 1;
	min-width: 0;
}

.char-detail-body .body-text {
	margin-top: 6px;
}

.char-parts {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.char-part {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	min-width: 52px;
	padding: 8px 10px;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
}

.char-part-char {
	font-family: var(--font-serif);
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1;
}

.char-part-role {
	font-size: 11px;
	color: var(--muted);
}

.caution-list {
	color: var(--ink-soft);
}

/* —— 占卜仪式 —— */
.ritual-mask {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(244, 241, 234, 0.88);
	backdrop-filter: blur(6px);
}

.ritual-box {
	text-align: center;
}

.ritual-box p {
	margin: 16px 0 0;
	font-family: var(--font-serif);
	font-size: 1rem;
	color: var(--ink-soft);
}

.ritual-icon {
	width: 72px;
	height: 72px;
	margin: 0 auto;
	border-radius: 12px;
	background: var(--surface);
	border: 1px solid var(--line-strong);
	box-shadow: var(--shadow);
}

.ritual-icon.is-lot {
	animation: ritual-shake 0.45s ease-in-out infinite;
}

.ritual-icon.is-tarot {
	animation: ritual-flip 1.2s ease-in-out infinite;
}

@keyframes ritual-shake {
	0%, 100% { transform: rotate(-4deg); }
	50% { transform: rotate(4deg); }
}

@keyframes ritual-flip {
	0%, 100% { transform: perspective(200px) rotateY(0deg); }
	50% { transform: perspective(200px) rotateY(180deg); }
}

/* —— 小屏微调 —— */
@media (max-width: 360px) {
	.subnav-4 {
		grid-template-columns: repeat(2, 1fr);
	}

	.zodiac-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 6px;
	}

	.zodiac-item {
		min-height: 64px;
	}

	.kv-row {
		grid-template-columns: 48px 1fr;
	}

	.main {
		padding-left: 12px;
		padding-right: 12px;
	}

	.score-duo.score-trio {
		grid-template-columns: 1fr;
	}
}

@media (min-width: 481px) {
	.app {
		border-left: 1px solid var(--line);
		border-right: 1px solid var(--line);
		box-shadow: 0 0 40px rgba(0, 0, 0, 0.04);
	}
}
