:root {
	color-scheme: light;
	--paper: #f3efe5;
	--paper-deep: #e7e0d1;
	--surface: #fbf9f3;
	--surface-strong: #ffffff;
	--ink: #24211d;
	--ink-soft: #686159;
	--line: #d8d0c1;
	--line-strong: #aaa092;
	--red: #8f2f2c;
	--red-dark: #6f211f;
	--red-soft: #f2dfda;
	--red-label: var(--red);
	--saffron: #b76f25;
	--saffron-soft: #f2e3c8;
	--blue: #315f70;
	--blue-soft: #dce9eb;
	--focus: #166a88;
	--shadow: 0 18px 50px rgba(52, 42, 30, .08);
	--shadow-small: 0 7px 20px rgba(52, 42, 30, .07);
	--radius: 6px;
	--radius-large: 12px;
	--serif: Iowan Old Style, Baskerville, 'Songti SC', SimSun, Georgia, serif;
	--sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Tibetan', 'Microsoft YaHei', sans-serif;
}

:root[data-theme='dark'] {
	color-scheme: dark;
	--paper: #191816;
	--paper-deep: #22201d;
	--surface: #24221f;
	--surface-strong: #2b2925;
	--ink: #f2ede3;
	--ink-soft: #bdb5aa;
	--line: #48433c;
	--line-strong: #746c62;
	--red: #d77a72;
	--red-dark: #ef9a90;
	--red-soft: #4b2926;
	--red-label: #f4aaa2;
	--saffron: #dda25d;
	--saffron-soft: #493720;
	--blue: #82b9c7;
	--blue-soft: #203e46;
	--focus: #71c6df;
	--shadow: 0 18px 50px rgba(0, 0, 0, .25);
	--shadow-small: 0 7px 20px rgba(0, 0, 0, .2);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		color-scheme: dark;
		--paper: #191816;
		--paper-deep: #22201d;
		--surface: #24221f;
		--surface-strong: #2b2925;
		--ink: #f2ede3;
		--ink-soft: #bdb5aa;
		--line: #48433c;
		--line-strong: #746c62;
		--red: #d77a72;
		--red-dark: #ef9a90;
		--red-soft: #4b2926;
		--red-label: #f4aaa2;
		--saffron: #dda25d;
		--saffron-soft: #493720;
		--blue: #82b9c7;
		--blue-soft: #203e46;
		--focus: #71c6df;
		--shadow: 0 18px 50px rgba(0, 0, 0, .25);
		--shadow-small: 0 7px 20px rgba(0, 0, 0, .2);
	}
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
	line-height: 1.55;
	min-height: 100vh;
	overflow-x: hidden;
	overflow-x: clip;
}

button, select, input { font: inherit; }
button, a, select, input { -webkit-tap-highlight-color: transparent; }
button, select { color: inherit; }
a { color: var(--red); text-underline-offset: 3px; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
	outline: 3px solid var(--focus);
	outline-offset: 3px;
}

.skip-link {
	position: fixed;
	top: 8px;
	left: 8px;
	padding: 10px 14px;
	background: var(--ink);
	color: var(--paper);
	z-index: 2000;
	transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.site-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-header {
	min-height: 64px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	border-bottom: 1px solid var(--line);
}
.brand {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: inherit;
	text-decoration: none;
}
.brand-mark {
	width: 38px;
	height: 38px;
	display: grid;
	place-items: center;
	border: 1px solid var(--red);
	color: var(--red);
	font-family: var(--serif);
	font-size: 1.15rem;
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--serif); font-size: 1rem; letter-spacing: .035em; }
.brand small { color: var(--ink-soft); font-size: .73rem; text-transform: uppercase; letter-spacing: .12em; }
.header-actions, .button-group { display: flex; align-items: center; gap: 9px; }
.header-actions { margin-left: auto; flex-wrap: nowrap; }
.header-basis-status { color: var(--ink-soft); font-size: .76rem; white-space: nowrap; }
.header-actions-divider { width: 1px; height: 26px; margin: 0 3px; background: var(--line); }
.settings-icon { display: none; font-size: 1.05rem; line-height: 1; }
.button-group { flex-wrap: wrap; }
.quiet-select, .text-button, .icon-button, .secondary-button, .primary-button, .step-button, .inline-link {
	min-height: 38px;
	border: 1px solid var(--line);
	background: var(--surface);
	border-radius: var(--radius);
	transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}
.quiet-select { padding: 0 34px 0 12px; }
.text-button, .secondary-button, .primary-button { padding: 10px 15px; font-weight: 650; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.icon-button { width: 38px; padding: 0; display: grid; place-items: center; font-size: 1.15rem; }
.primary-button { background: var(--red); color: #fff; border-color: var(--red); }
.primary-button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.secondary-button:hover, .text-button:hover, .icon-button:hover, .step-button:hover { border-color: var(--red); color: var(--red); background: var(--surface-strong); }

main { padding: 20px 0 24px; }
.hero {
	display: grid;
	grid-template-columns: minmax(0, 1.45fr) minmax(290px, .75fr);
	column-gap: clamp(14px, 2vw, 24px);
	align-items: stretch;
	margin-bottom: 10px;
}
.section-kicker, .period-title p {
	margin: 0 0 9px;
	color: var(--red);
	font-size: .75rem;
	font-weight: 800;
	letter-spacing: .13em;
	text-transform: uppercase;
}
.today-card, .next-card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-large);
	padding: 18px;
	box-shadow: var(--shadow-small);
}
.today-card { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: clamp(18px, 2vw, 24px); animation: settle-in .32s ease-out both; }
.next-card { padding: 14px; animation: settle-in .38s .04s ease-out both; }
#selectedDayContent { flex: 1; }
.today-card::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	width: 5px;
	height: 100%;
	background: var(--red);
}
.gregorian-date { margin: 8px 0 0; color: var(--ink-soft); font-size: .9rem; }
.tibetan-date {
	margin: 0;
	color: var(--red);
	font-family: var(--serif);
	font-size: clamp(1.55rem, 2.35vw, 2.3rem);
	font-weight: 600;
	letter-spacing: -.035em;
	line-height: 1.22;
}
.selected-event { margin: 7px 0 0; font-weight: 700; }
.selected-multiplier { margin: 3px 0 0; color: var(--ink-soft); font-size: .88rem; }
.next-card { background: var(--ink); color: #f3efe5; }
:root[data-theme='dark'] .next-card { background: #11110f; }
.next-card .section-kicker { color: #e7a098; }
.next-card h2 { margin: 0 0 4px; font-family: var(--serif); font-size: 1.12rem; font-weight: 560; }
.next-card p { margin: 1px 0; font-size: .8rem; }
.next-card .muted { color: #c7beb2; font-size: .76rem; }
.inline-link { min-height: 30px; margin-top: 1px; padding: 2px 0; border: 0; color: #f5d2cc; background: transparent; font-weight: 700; }
.skeleton-line { width: 70%; height: 16px; background: color-mix(in srgb, currentColor 14%, transparent); }

.calendar-workspace {
	scroll-margin-top: 18px;
	background: var(--surface-strong);
	border: 1px solid var(--line);
	border-radius: var(--radius-large);
	box-shadow: var(--shadow);
	overflow: hidden;
	animation: settle-in .42s .08s ease-out both;
}
.calendar-toolbar {
	min-height: 68px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 20px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--line);
}
.period-controls { display: flex; align-items: center; gap: 8px; }
.period-title { min-width: clamp(130px, 18vw, 210px); text-align: center; }
.period-title p { margin-bottom: 2px; }
.period-title h2 { margin: 0; font-family: var(--serif); font-size: clamp(1.15rem, 1.7vw, 1.55rem); font-weight: 560; }
.step-button { width: 38px; height: 38px; padding: 0; font-size: 1.05rem; }
.secondary-step { color: var(--ink-soft); font-size: .75rem; }
.calendar-scroll { overflow-x: auto; }
.calendar-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar-table th {
	height: 32px;
	padding: 6px 4px;
	border-bottom: 1px solid var(--line-strong);
	color: var(--ink-soft);
	font-size: .72rem;
	font-weight: 750;
	letter-spacing: .06em;
	text-transform: uppercase;
}
.calendar-table td {
	position: relative;
	height: 78px;
	padding: 8px 7px;
	border-right: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
	vertical-align: top;
	background: var(--surface-strong);
	cursor: pointer;
	transition: background-color .14s ease;
}
.calendar-table td:last-child { border-right: 0; }
.calendar-table tr:last-child td { border-bottom: 0; }
.calendar-table td[role='button']:hover { background: var(--paper); }
.calendar-table td[role='button']:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; z-index: 2; }
.calendar-table td.empty-cell { cursor: default; background: color-mix(in srgb, var(--paper) 68%, var(--surface)); }
.calendar-table td.out-of-range { cursor: not-allowed; color: var(--ink-soft); opacity: .42; background: var(--paper); }
.calendar-table td.today { box-shadow: inset 0 0 0 2px var(--red); }
.calendar-table td.today::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	border-top: 14px solid var(--red);
	border-left: 14px solid transparent;
}
.day-number { display: block; font: 620 1.12rem/1 var(--serif); }
.lunar-date { display: block; margin-top: 6px; color: var(--red); font-size: .78rem; font-weight: 720; }
.cell-meta {
	position: absolute;
	left: 7px;
	right: 7px;
	bottom: 5px;
	display: grid;
	gap: 3px;
	pointer-events: none;
}
.cell-event {
	margin: 0;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	overflow: hidden;
	font-size: .68rem;
	line-height: 1.3;
	color: var(--ink-soft);
}
.cell-event:empty, .cell-markers:empty { display: none; }
.cell-markers { display: flex; gap: 4px; min-height: 6px; }
.cell-markers i, .legend-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.festival-marker, .festival-dot { background: var(--red); }
.multiplier-marker, .multiplier-dot { background: var(--saffron); }
.eclipse-marker, .eclipse-dot { background: var(--blue); }
.calendar-legend { display: flex; gap: 18px; margin: 0; padding: 8px 16px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .72rem; }
.calendar-legend span { display: flex; align-items: center; gap: 7px; }

.tools { margin-top: 16px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-large); overflow: hidden; overflow: clip; }
.tool-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tool-tab {
	min-width: 0;
	min-height: 52px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 0 18px;
	border: 0;
	border-right: 1px solid var(--line);
	background: transparent;
	font-weight: 700;
	color: var(--ink-soft);
	white-space: nowrap;
}
.tool-tab:last-child { border-right: 0; }
.tool-tab::after { content: '+'; color: var(--ink-soft); font-size: 1.05rem; font-weight: 450; }
.tool-tab:hover { background: var(--surface-strong); color: var(--ink); }
.tool-tab.active { color: var(--red); background: var(--surface-strong); }
.tool-tab.active::after { content: '−'; color: var(--red); }
.tool-tab:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.tool-panel { padding: 18px; border-top: 1px solid var(--line); animation: tool-reveal .18s ease both; }
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.panel-toolbar select, .reverse-form select {
	min-height: 44px;
	padding: 8px 34px 8px 12px;
	border: 1px solid var(--line-strong);
	background: var(--surface-strong);
	border-radius: var(--radius);
}
.panel-summary, .panel-intro { margin: 0 0 16px; color: var(--ink-soft); }
.panel-summary { scroll-margin-top: 16px; }
.event-list { list-style: none; margin: 0; padding: 0; }
.annual-month {
	position: sticky;
	top: 0;
	z-index: 3;
	padding: 10px 5px 8px;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
	background: color-mix(in srgb, var(--surface) 94%, transparent);
	backdrop-filter: blur(8px);
	color: var(--red);
	font-family: var(--serif);
	font-size: .92rem;
	font-weight: 650;
}
.event-row button {
	width: 100%;
	min-height: 68px;
	display: grid;
	grid-template-columns: minmax(210px, .48fr) minmax(0, 1fr) 20px;
	align-items: center;
	gap: 18px;
	padding: 10px 5px;
	border: 0;
	border-bottom: 1px solid var(--line);
	background: transparent;
	text-align: left;
}
.event-row button:hover { background: color-mix(in srgb, var(--paper) 60%, transparent); }
.event-row time, .event-copy > strong, .event-copy > span { display: block; }
.date-line { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 8px; }
.date-line + .date-line { margin-top: 4px; }
.date-line i, .calendar-system-label { color: var(--ink-soft); font: 700 .64rem/1.2 var(--sans); font-style: normal; letter-spacing: .08em; }
.date-line-gregorian strong { font-size: 1rem; }
.date-line-tibetan { color: var(--red); font-size: .78rem; font-weight: 700; }
.calendar-system-label { display: inline-block; margin-right: 9px; }
.event-copy > strong { font-family: var(--serif); font-size: 1.02rem; }
.type-pill { display: inline-block; margin: 5px 6px 0 0; padding: 2px 7px; border-radius: 999px; font-style: normal; font-size: .66rem; font-weight: 700; }
.type-pill.festival { color: var(--red-label); background: var(--red-soft); }
.type-pill.multiplier { color: var(--saffron); background: var(--saffron-soft); }
.type-pill.eclipse { color: var(--blue); background: var(--blue-soft); }
.type-dot { display: inline-flex; align-items: center; min-height: 20px; margin-top: 4px; }
.annual-range-controls { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 18px; }
.annual-back-button { border-color: transparent; background: transparent; }
.empty-state { padding: 28px 0; color: var(--ink-soft); }

.reverse-form { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)) auto auto; gap: 14px; align-items: end; }
.reverse-form label:not(.check-field) { display: grid; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--ink-soft); }
.check-field { min-height: 44px; display: flex; align-items: center; gap: 8px; }
.check-field input { width: 18px; height: 18px; accent-color: var(--red); }
.reverse-results { margin-top: 22px; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.result-grid button { min-height: 78px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); text-align: left; }
.result-grid button span { display: block; margin-top: 5px; color: var(--ink-soft); font-size: .8rem; }
.result-grid .calendar-system-label { min-width: 2.8em; }
.result-grid button i { display: inline-block; margin-top: 7px; color: var(--red); font-size: .7rem; }
#aboutPanel h2 { margin-top: 0; font: 560 1.6rem/1.2 var(--serif); }
#aboutPanel p { max-width: 850px; }
.source-links { margin-top: 18px; }

.install-card { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.install-card p { margin: 0; }
.install-card .section-kicker { margin-bottom: 5px; }
.install-actions { justify-content: flex-end; }
.widget-link { min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; font-size: .82rem; font-weight: 700; text-decoration-thickness: 1px; }
footer { padding: 20px 0 30px; color: var(--ink-soft); font-size: .75rem; }
.noscript { padding: 18px; border: 1px solid var(--red); }

#detailDialog {
	position: fixed;
	inset: 0;
	width: min(560px, calc(100% - 32px));
	max-height: min(82vh, 760px);
	margin: auto;
	overflow-y: auto;
	padding: 27px;
	transform: translateY(8px) scale(.99);
	opacity: 0;
	background: var(--surface-strong);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: var(--radius-large);
	box-shadow: 0 28px 80px rgba(0, 0, 0, .3);
	z-index: 901;
	transition: opacity .16s ease, transform .16s ease;
}
#detailDialog::backdrop { background: rgba(15, 13, 11, .56); backdrop-filter: blur(3px); }
#detailDialog.active { opacity: 1; transform: translateY(0) scale(1); }
#detailDialog .dialog-header { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 5px; }
#detailDialog h2 { margin: 0 0 20px; padding-right: 38px; font: 560 clamp(1.5rem, 4vw, 2.1rem)/1.15 var(--serif); }
.detail-section { padding: 16px 0; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 8px; color: var(--ink-soft); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.detail-section p { margin: 4px 0; }
.detail-tibetan, .detail-event { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.accent-section { border-top-color: var(--red); }
.accent-section .detail-event { color: var(--red); }
.eclipse-section { border-top-color: var(--blue); }
.status-row { display: flex; gap: 7px; margin-top: 9px; }
.status-row span { padding: 3px 8px; border: 1px solid var(--saffron); color: var(--saffron); font-size: .7rem; }
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.time-grid div { padding: 10px; background: var(--blue-soft); }
.time-grid dt { color: var(--blue); font-size: .7rem; font-weight: 700; }
.time-grid dd { margin: 2px 0 0; font-size: .82rem; }
.fine-print, .source-section { color: var(--ink-soft); font-size: .78rem; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 18px; border-top: 1px solid var(--line); }

.settings-dialog {
	width: min(540px, calc(100% - 32px));
	padding: 25px;
	border: 1px solid var(--line);
	border-radius: var(--radius-large);
	background: var(--surface-strong);
	color: var(--ink);
	box-shadow: 0 28px 80px rgba(0, 0, 0, .3);
}
.settings-dialog::backdrop { background: rgba(15, 13, 11, .56); backdrop-filter: blur(3px); }
.dialog-title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.dialog-title-row h2 { margin: 0; font: 560 1.5rem var(--serif); }
.settings-dialog fieldset { display: grid; gap: 10px; margin: 22px 0; padding: 0; border: 0; }
.settings-date-notice:not([hidden]) {
	display: block;
	margin-top: 18px;
	padding: 11px 13px;
	border-left: 2px solid var(--saffron);
	background: var(--paper);
	color: var(--ink-soft);
	font-size: .8rem;
}
.settings-date-notice:not([hidden]) + fieldset { margin-top: 14px; }
.choice-card { display: flex; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.choice-card input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--red); }
.choice-card strong, .choice-card small { display: block; }
.choice-card small { margin-top: 3px; color: var(--ink-soft); }
.dialog-done { width: 100%; }

.toast {
	position: fixed;
	left: 50%;
	bottom: 22px;
	max-width: calc(100% - 32px);
	padding: 10px 15px;
	transform: translate(-50%, 12px);
	opacity: 0;
	background: var(--ink);
	color: var(--paper);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	z-index: 2200;
	transition: opacity .18s ease, transform .18s ease;
}
.toast.active { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
	.hero { grid-template-columns: 1fr 1fr; }
	.reverse-form { grid-template-columns: repeat(2, 1fr); }
	.reverse-form .primary-button { align-self: end; }
}

@media (max-width: 720px) {
	.site-shell { width: min(calc(100% - 20px), 620px); }
	.site-header { min-height: 62px; }
	.brand small, .header-basis-status, .header-actions-divider { display: none; }
	.header-actions { gap: 6px; }
	.settings-button { width: 38px; min-width: 38px; padding: 0; }
	.settings-text { display: none; }
	.settings-icon { display: inline-block; }
	.quiet-select { max-width: 106px; }
	main { padding-top: 14px; }
	.hero { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
	.today-card, .next-card { padding: 14px; }
	.tibetan-date { font-size: clamp(1.45rem, 6.3vw, 2rem); }
	.next-card h2 { font-size: 1rem; }
	.next-card p { font-size: .78rem; }
	.next-card .muted { display: none; }
	.next-card .inline-link { min-height: 30px; margin-top: 1px; }
	.calendar-toolbar { min-height: 54px; padding: 8px; flex-wrap: nowrap; gap: 7px; }
	.period-controls { width: auto; flex: 1; justify-content: space-between; gap: 5px; }
	.period-title { min-width: 0; flex: 1; }
	.period-title p { display: none; }
	.calendar-toolbar > .primary-button { width: auto; min-width: 56px; padding: 7px 10px; }
	.secondary-step { display: none; }
	.calendar-table td { height: 58px; padding: 5px 4px; }
	.calendar-table th { height: 28px; font-size: .61rem; }
	.day-number { font-size: .9rem; }
	.lunar-date { margin-top: 5px; font-size: .64rem; }
	.cell-event { display: none; }
	.cell-meta { left: 4px; right: 4px; bottom: 3px; }
	.calendar-legend { padding: 7px 10px; gap: 12px; overflow-x: auto; white-space: nowrap; }
	.tool-panel { padding: 14px 10px; }
	.tool-tab { min-height: 58px; padding: 6px 10px; white-space: normal; font-size: .75rem; line-height: 1.25; text-align: left; }
	.panel-toolbar { align-items: stretch; flex-direction: column; }
	.panel-toolbar select { width: 100%; }
	.button-group > * { flex: 1 1 auto; }
	.event-row button { grid-template-columns: 150px minmax(0, 1fr) 15px; gap: 10px; }
	.event-copy > strong { font-size: .93rem; }
	.reverse-form { grid-template-columns: 1fr 1fr; }
	.reverse-form .primary-button { grid-column: 1 / 3; }
	.result-grid { grid-template-columns: 1fr; }
	.install-card { align-items: stretch; flex-direction: column; }
	.install-actions { justify-content: flex-start; }
	.install-actions .widget-link { flex: 0 0 auto; }
	#detailDialog.bottom-sheet {
		inset: auto 0 0;
		width: 100%;
		max-width: none;
		max-height: 88vh;
		margin: 0;
		border-radius: 14px 14px 0 0;
		transform: translateY(100%);
	}
	#detailDialog.bottom-sheet.active { transform: translateY(0); }
	.dialog-footer { position: sticky; bottom: -27px; margin: 0 -27px -27px; padding: 14px 27px calc(14px + env(safe-area-inset-bottom)); background: var(--surface-strong); }
}

@media (max-width: 430px) {
	.brand-mark { width: 36px; height: 36px; }
	.brand strong { font-size: .92rem; letter-spacing: 0; }
	html:lang(zh-CN) .brand strong, html:lang(zh-TW) .brand strong { white-space: nowrap; }
	.calendar-table td { height: 54px; }
	.calendar-table th { font-size: .56rem; letter-spacing: 0; }
	.lunar-date { font-size: .6rem; }
	.calendar-legend { font-size: .68rem; }
	.tool-tab { padding: 5px 7px; font-size: .7rem; }
	.tool-tab::after { font-size: .9rem; }
	.event-row button { grid-template-columns: 122px minmax(0, 1fr) 12px; }
	.date-line { gap: 5px; }
	.annual-range-controls { align-items: stretch; flex-direction: column; }
	.reverse-form { grid-template-columns: 1fr; }
	.reverse-form .primary-button { grid-column: auto; }
	.time-grid { grid-template-columns: 1fr; }
	.dialog-footer { flex-direction: column; }
}

@keyframes settle-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes tool-reveal {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
	.site-header, .next-card, .tools, .install-card, footer, .calendar-toolbar button, .calendar-legend { display: none !important; }
	body, .site-shell, .calendar-workspace { background: white; color: black; width: 100%; box-shadow: none; border: 0; }
	main { padding: 0; }
	.hero { display: block; margin: 0 0 12px; }
	.today-card { box-shadow: none; border: 1px solid #999; }
	.calendar-table td { height: 90px; }
}
