/* ==========================================================================
   Read the Bible — app styles
   ========================================================================== */

:root {
	--bg: #f7f7f8;
	--surface: #ffffff;
	--surface-2: #f1f1f3;
	--surface-3: #e9e9ec;
	--ink: #121214;
	--ink-2: #5d5f66;
	--ink-3: #8e9097;
	--line: #e7e7ea;
	--line-strong: #d6d6db;
	--accent: #f7b500;
	--accent-soft: #fff3cc;
	--accent-ink: #121214;
	--primary: #121214;
	--primary-ink: #ffffff;
	--night: #1b1c1f;
	--ok: #2f9e6a;
	--today: #fff6d6;
	--scrim: rgba(17, 18, 22, 0.36);
	--shadow-sm: 0 1px 2px rgba(17, 18, 22, 0.06);
	--shadow: 0 1px 2px rgba(17, 18, 22, 0.05), 0 6px 18px rgba(17, 18, 22, 0.06);
	--shadow-lg: 0 2px 6px rgba(17, 18, 22, 0.06), 0 18px 44px rgba(17, 18, 22, 0.12);
	--shadow-pop: 0 10px 40px rgba(17, 18, 22, 0.16), 0 2px 8px rgba(17, 18, 22, 0.06);
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);

	--font-ui: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
	--font-display: var(--font-ui);

	--r-xl: 20px;
	--r-lg: 14px;
	--r-md: 14px;
	--r-sm: 10px;
	--tabbar-h: 0px;
	--gutter: 32px;
	color-scheme: light;
}

:root[data-theme="dark"] {
	--bg: #0d0d0f;
	--surface: #17171a;
	--surface-2: #202024;
	--surface-3: #2a2a2f;
	--ink: #f2f2f4;
	--ink-2: #a6a7ad;
	--ink-3: #74757c;
	--line: #26262b;
	--line-strong: #35353b;
	--accent-soft: #3a2f0c;
	--accent-ink: #121214;
	--primary: #f2f2f4;
	--primary-ink: #0d0d0f;
	--night: #18181b;
	--ok: #4cc38a;
	--today: #2e2610;
	--scrim: rgba(0, 0, 0, 0.6);
	--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.35);
	--shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.4), 0 18px 44px rgba(0, 0, 0, 0.5);
	--shadow-pop: 0 10px 40px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
	color-scheme: dark;
}

@media (max-width: 720px) {
	:root { --gutter: 16px; }
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-rendering: optimizeLegibility;
	background: var(--bg);
	scroll-padding-top: 80px;
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-ui);
	font-size: 15px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: clip;
	transition: background-color .25s var(--ease);
}

::selection { background: rgba(247, 181, 0, 0.35); }

h1, h2, h3, h4 {
	margin: 0;
	font-weight: 680;
	letter-spacing: -0.022em;
	line-height: 1.12;
	text-wrap: balance;
}

p { margin: 0; }

a { color: inherit; }

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

button { cursor: pointer; }

:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 2px;
	border-radius: 8px;
}

.sprite { display: none; }

.icon {
	width: 20px;
	height: 20px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.muted { color: var(--ink-2); }
.fine { font-size: 12.5px; color: var(--ink-3); }
.print-only { display: none; }

[hidden] { display: none !important; }

/* Logo: the traced mark is used as a mask so it takes the text color */
.logo {
	display: block;
	aspect-ratio: 1552 / 1324;
	background: currentColor;
	-webkit-mask: url('assets/logo.svg') center / contain no-repeat;
	mask: url('assets/logo.svg') center / contain no-repeat;
}

/* ---------- Buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 16px;
	border: 0;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--ink);
	font-weight: 600;
	font-size: 14px;
	letter-spacing: -0.01em;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease), scale .2s var(--ease);
}
.btn:active { scale: 0.97; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 86%, var(--bg)); }
.btn-ghost { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 12px; }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.is-done { background: var(--ok); color: #fff; box-shadow: none; }

.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--ink-2);
	transition: background-color .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.js-theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .js-theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .js-theme-toggle .icon-moon { display: block; }

.link-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink-2);
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	transition: color .2s var(--ease);
}
.link-btn:hover { color: var(--ink); }
.link-btn .icon { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.link-btn:hover .icon { transform: translateX(3px); }

/* ---------- App shell ---------- */

main {
	min-width: 0;
	padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.appbar {
	position: sticky;
	top: 0;
	z-index: 40;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 16px;
	padding: calc(18px + env(safe-area-inset-top)) var(--gutter) 14px;
}

/* Progressive blur: six stacked backdrop blurs, each masked to a band, so content is
   heavily blurred at the very top and eases back to sharp just below the bar. */
.appbar-blur {
	position: absolute;
	inset: 0 0 -40px;
	z-index: -1;
	pointer-events: none;
}
.appbar-blur::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(to bottom,
		color-mix(in srgb, var(--bg) 88%, transparent) 0%,
		color-mix(in srgb, var(--bg) 64%, transparent) 55%,
		color-mix(in srgb, var(--bg) 0%, transparent) 100%);
}
.appbar-blur > i {
	position: absolute;
	inset: 0;
	--b: 1px;
	--m: linear-gradient(to top, transparent 0%, #000 16%, #000 33%, transparent 50%);
	backdrop-filter: blur(var(--b));
	-webkit-backdrop-filter: blur(var(--b));
	-webkit-mask-image: var(--m);
	mask-image: var(--m);
}
.appbar-blur > i:nth-child(2) { --b: 2px; --m: linear-gradient(to top, transparent 16%, #000 33%, #000 50%, transparent 66%); }
.appbar-blur > i:nth-child(3) { --b: 4px; --m: linear-gradient(to top, transparent 33%, #000 50%, #000 66%, transparent 83%); }
.appbar-blur > i:nth-child(4) { --b: 8px; --m: linear-gradient(to top, transparent 50%, #000 66%, #000 83%, transparent 100%); }
.appbar-blur > i:nth-child(5) { --b: 16px; --m: linear-gradient(to top, transparent 66%, #000 83%, #000 100%); }
.appbar-blur > i:nth-child(6) { --b: 28px; --m: linear-gradient(to top, transparent 83%, #000 100%); }

.brand { justify-self: start; color: var(--ink); text-decoration: none; }
.brand .logo { height: 44px; }

.appbar .js-theme-toggle {
	justify-self: end;
	width: 42px;
	height: 42px;
	background: var(--surface);
	box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
	color: var(--ink);
	transition: box-shadow .2s var(--ease), scale .2s var(--ease);
}
.appbar .js-theme-toggle:hover { background: var(--surface); box-shadow: var(--shadow), inset 0 0 0 1px var(--line-strong); }
.appbar .js-theme-toggle:active { scale: 0.96; }

/* Center pill navigation with a "lens" that springs between tabs (see shell.js) */
.tabbar {
	position: relative;
	isolation: isolate;
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 5px;
	border-radius: 999px;
	background: var(--surface);
	box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}

.tab {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	padding: 10px 22px;
	border-radius: 999px;
	color: var(--ink);
	font-size: 16px;
	font-weight: 500;
	letter-spacing: -0.01em;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .2s var(--ease), color .2s var(--ease);
}
.tab .icon { width: 18px; height: 18px; stroke-width: 1.9; color: var(--ink-2); transition: color .2s var(--ease); }
.tabbar > .tab:hover { background: var(--surface-2); }

/* Before the lens is measured, the active tab carries the selection itself */
.tabbar:not([data-ready]) > .tab[aria-current="page"] { background: var(--primary); color: var(--primary-ink); }
.tabbar:not([data-ready]) > .tab[aria-current="page"] .icon { color: var(--primary-ink); }

.lens-wrap {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
	transition: opacity .2s var(--ease);
}
.tabbar:not([data-ready]) .lens-wrap { visibility: hidden; }

.lens {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 5px;
	border-radius: 999px;
	background: var(--primary);
	clip-path: inset(0 100% 0 0 round 999px);
	will-change: clip-path;
}
.lens .tab,
.lens .tab .icon { color: var(--primary-ink); }

@media (max-width: 1180px) {
	.tab { padding: 10px 16px; }
}

@media (max-width: 980px) {
	.appbar {
		grid-template-columns: 1fr auto;
		row-gap: 12px;
		padding-top: calc(14px + env(safe-area-inset-top));
	}
	.tabbar {
		grid-row: 2;
		grid-column: 1 / -1;
		justify-self: stretch;
	}
	.tab { flex: 1; }
}

@media (max-width: 520px) {
	.tab { gap: 6px; padding: 9px 10px; font-size: 14px; }
	.tab .icon { display: none; }
	.brand .logo { height: 38px; }
	.appbar .js-theme-toggle { width: 38px; height: 38px; }
}

/* ---------- Views ---------- */

.view {
	max-width: 1180px;
	margin: 0 auto;
	padding: 12px var(--gutter) 0;
}

@media (min-width: 760px) {
	.view { padding-top: 24px; }
}

.view-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
}

.view-head h1,
.plan-head h1 {
	font-size: clamp(28px, 4vw, 40px);
	letter-spacing: -0.03em;
}

.eyebrow {
	display: block;
	margin-bottom: 8px;
	color: var(--ink-3);
	font-size: 13px;
	font-weight: 600;
}

.section {
	margin-top: 40px;
}

.section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 14px;
}

.section-head h2 {
	font-size: 22px;
	letter-spacing: -0.025em;
}

/* ---------- Home ---------- */

.greeting h1 {
	font-size: clamp(32px, 5vw, 48px);
	letter-spacing: -0.035em;
}

.today-card {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 20px 24px;
	margin-top: 24px;
	padding: clamp(22px, 4vw, 36px);
	border-radius: var(--r-xl);
	background: var(--night);
	color: #fff;
	box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
	overflow: hidden;
}

.today-card .muted { color: rgba(255, 255, 255, 0.62); }

.today-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	grid-column: 1 / -1;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 28px;
	padding: 0 12px;
	border-radius: 999px;
	background: color-mix(in srgb, currentColor 12%, transparent);
	font-size: 13px;
	font-weight: 600;
}

.chip-accent { background: var(--accent); color: #121214; text-decoration: none; }

.today-ref {
	font-size: clamp(30px, 5.5vw, 52px);
	line-height: 1.05;
	overflow-wrap: anywhere;
}

.today-meta {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	font-size: 14px;
}
.today-meta .icon { width: 16px; height: 16px; }

.today-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	grid-column: 1 / -1;
}

.today-card .btn-primary { background: #fff; color: #121214; }
.today-card .btn-primary:hover { background: #ececee; }
.today-card .btn-ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }
.today-card .btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.today-card .btn.is-done { background: var(--ok); color: #fff; box-shadow: none; }

.ring {
	position: relative;
	width: 96px;
	height: 96px;
	align-self: start;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .ring-track { stroke: rgba(255, 255, 255, 0.14); }
.ring .ring-fill { stroke: var(--accent); stroke-linecap: round; }
.ring-label {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	text-align: center;
	font-weight: 680;
	letter-spacing: -0.02em;
	font-size: 22px;
	line-height: 1;
}
.ring-label small {
	display: block;
	margin-top: 3px;
	font-family: var(--font-ui);
	font-size: 11px;
	color: rgba(255, 255, 255, 0.6);
}

.start-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 14px;
}

.start-card {
	display: flex;
	flex-direction: column;
	gap: 28px;
	min-height: 168px;
	padding: 22px;
	border: 0;
	border-radius: var(--r-lg);
	background: var(--surface);
	box-shadow: var(--shadow);
	color: var(--ink);
	text-align: left;
	text-decoration: none;
	transition: translate .28s var(--ease), box-shadow .28s var(--ease);
}
.start-card:hover { translate: 0 -3px; box-shadow: var(--shadow-lg); }
.start-card .start-icon {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 14px;
	background: var(--surface-2);
}
.start-card strong { display: block; font-weight: 680; letter-spacing: -0.02em; font-size: 21px; }
.start-card small { display: block; margin-top: 4px; color: var(--ink-2); font-size: 14px; }
.start-card .start-text { margin-top: auto; }
.start-card.is-featured { background: var(--night); color: #fff; }
.start-card.is-featured small { color: rgba(255, 255, 255, .82); }
.start-card.is-featured .start-icon { background: rgba(255, 255, 255, .12); color: var(--accent); }

.quick-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
}
.quick-row .btn { background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.quick-row .btn:hover { background: var(--surface-2); }

/* Horizontal shelf */
.shelf {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(200px, 240px);
	gap: 14px;
	margin: 0 calc(var(--gutter) * -1);
	padding: 4px var(--gutter) 18px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: var(--gutter);
	scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; }

/* ---------- Plan cards ---------- */

.chips {
	display: flex;
	gap: 8px;
	margin: 0 calc(var(--gutter) * -1) 22px;
	padding: 0 var(--gutter) 4px;
	overflow-x: auto;
	scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.filter {
	flex: none;
	height: 36px;
	padding: 0 16px;
	border: 0;
	border-radius: 999px;
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
	color: var(--ink-2);
	font-size: 14px;
	font-weight: 600;
	transition: background-color .2s, color .2s;
}
.filter:hover { color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); box-shadow: none; }

.plan-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
	gap: 18px;
}

@media (max-width: 520px) {
	.plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

.plan-card {
	display: flex;
	flex-direction: column;
	padding: 0;
	border: 0;
	border-radius: var(--r-lg);
	background: var(--surface);
	box-shadow: var(--shadow);
	color: var(--ink);
	text-align: left;
	overflow: hidden;
	transition: translate .28s var(--ease), box-shadow .28s var(--ease);
}
.plan-card:hover { translate: 0 -3px; box-shadow: var(--shadow-lg); }
.plan-card:hover .cover svg { transform: scale(1.035); }

.cover {
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}
.cover svg {
	display: block;
	width: 100%;
	height: 100%;
	transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}

.plan-card-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px 18px 20px;
}
.plan-card-body strong {
	font-weight: 680;
	letter-spacing: -0.02em;
	font-size: 18px;
	line-height: 1.15;
}
.plan-card-body .meta { color: var(--ink-2); font-size: 13.5px; }
.plan-card .badge {
	align-self: flex-start;
	margin-top: 6px;
	padding: 3px 9px;
	border-radius: 999px;
	background: var(--accent-soft);
	color: var(--ink);
	font-size: 12px;
	font-weight: 700;
}

@media (max-width: 520px) {
	.plan-card-body { padding: 12px 14px 16px; }
	.plan-card-body strong { font-size: 16px; }
}

/* ---------- Builder ---------- */

.builder {
	max-width: 760px;
	margin: 0 auto;
}

.stepper {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 6px;
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}
.stepper button {
	display: grid;
	gap: 8px;
	width: 100%;
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--ink-3);
	font-size: 12.5px;
	font-weight: 600;
	text-align: left;
	transition: color .2s var(--ease);
}
.stepper button:hover,
.stepper button[aria-current="step"] { color: var(--ink); }
.stepper .bar {
	display: block;
	height: 4px;
	border-radius: 4px;
	background: var(--surface-3);
	overflow: hidden;
}
.stepper .bar span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: var(--ink);
}
@media (max-width: 520px) {
	.stepper .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

.layout-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
	gap: 10px;
}
.layout-choice {
	display: grid;
	justify-items: center;
	gap: 8px;
	padding: 16px 10px 14px;
	border: 0;
	border-radius: var(--r-md);
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
	color: var(--ink-2);
	font-size: 13.5px;
	font-weight: 600;
	transition: box-shadow .2s var(--ease), color .2s var(--ease), scale .2s var(--ease);
}
.layout-choice:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.layout-choice:active { scale: .98; }
.layout-choice svg {
	width: 56px;
	height: 48px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.layout-choice[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.layout-choice[aria-pressed="true"] svg { stroke: var(--ink); }

.step .field-label + .rows { margin-top: 0; }
.step > .field-label { margin-top: 6px; }
.step .fine { margin-top: -6px; }

.step {
	padding: 28px 0 8px;
}
.step h2 {
	font-size: clamp(26px, 4vw, 34px);
	margin-bottom: 22px;
}

.field { margin-bottom: 26px; }
.field-label {
	display: block;
	margin-bottom: 10px;
	color: var(--ink-2);
	font-size: 13px;
	font-weight: 600;
}

.choice-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
	gap: 10px;
}

.choice {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	min-height: 84px;
	padding: 16px;
	border: 0;
	border-radius: var(--r-md);
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
	text-align: left;
	transition: box-shadow .2s, background-color .2s, scale .2s;
}
.choice:active { scale: 0.98; }
.choice strong { font-size: 15px; }
.choice small { color: var(--ink-2); font-size: 13px; }
.choice[aria-pressed="true"] {
	box-shadow: inset 0 0 0 2px var(--ink);
}
.choice:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.choice[aria-pressed="true"]:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.choice[aria-pressed="true"] strong::after {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-left: 8px;
	border-radius: 50%;
	background: var(--accent);
	vertical-align: middle;
}
.choice[disabled] { opacity: .35; pointer-events: none; }

.segmented {
	display: inline-flex;
	gap: 2px;
	max-width: 100%;
	padding: 4px;
	border-radius: 999px;
	background: var(--surface-2);
	overflow-x: auto;
	scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
	flex: none;
	height: 36px;
	padding: 0 16px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--ink-2);
	font-size: 14px;
	font-weight: 600;
	transition: background-color .2s, color .2s, box-shadow .2s;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-checked="true"] {
	background: var(--surface);
	color: var(--ink);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.pill-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.pill {
	height: 40px;
	padding: 0 16px;
	border: 0;
	border-radius: 999px;
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
	font-size: 14px;
	font-weight: 600;
	transition: background-color .2s, color .2s, box-shadow .2s;
}
.pill[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); box-shadow: none; }

.input {
	height: 44px;
	padding: 0 14px;
	border: 0;
	border-radius: var(--r-sm);
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
	color: var(--ink);
}
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.input-days { width: 110px; }
.input-name { width: 100%; max-width: 420px; font-size: 16px; font-weight: 600; }
.input-name::placeholder { color: var(--ink-3); font-weight: 500; }
.inline-field { display: inline-flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--ink-2); font-size: 14px; }

.weekdays {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}
.weekday {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
	font-weight: 700;
	transition: background-color .2s, color .2s, box-shadow .2s;
}
.weekday[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); box-shadow: none; }

.book-picker { display: grid; gap: 18px; }
.book-group-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}
.book-group-head strong { font-size: 14px; }
.book-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.book-chip {
	height: 34px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px;
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
	color: var(--ink-2);
	font-size: 13px;
	font-weight: 600;
	transition: background-color .15s, color .15s;
}
.book-chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); box-shadow: none; }

.rows {
	display: flex;
	flex-direction: column;
	margin-bottom: 18px;
	border-radius: var(--r-md);
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
	overflow: hidden;
}
.row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 56px;
	padding: 8px 16px;
	cursor: pointer;
}
.row + .row { border-top: 1px solid var(--line); }
.row > span:first-child { font-weight: 600; }
.row small { display: block; color: var(--ink-2); font-size: 13px; font-weight: 400; }

.switch {
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	flex: none;
	width: 46px;
	height: 28px;
	margin: 0;
	border-radius: 999px;
	background: var(--surface-3);
	cursor: pointer;
	transition: background-color .25s;
}
.switch::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
	transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
}
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(18px); }

.row > [data-slot] {
	display: flex;
	flex: none;
	justify-content: flex-end;
	min-width: 0;
}

.rows select {
	flex: none;
	width: 184px;
	max-width: 55vw;
	margin-left: auto;
	text-overflow: ellipsis;
	height: 38px;
	padding: 0 32px 0 12px;
	border: 0;
	border-radius: 10px;
	background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c877e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") right 8px center / 18px no-repeat;
	appearance: none;
	-webkit-appearance: none;
	font-size: 14px;
	font-weight: 600;
}

.builder-bar {
	position: sticky;
	bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 28px;
	padding: 12px 12px 12px 20px;
	border-radius: var(--r-lg);
	background: var(--surface);
	box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
}
@media (min-width: 760px) {
	.builder-bar { bottom: 20px; }
}
.summary { flex: 1; min-width: 0; }
.summary strong {
	display: block;
	overflow: hidden;
	font-size: 15px;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.summary span { color: var(--ink-2); font-size: 13px; }
.builder-bar .btn-quiet { padding: 0 10px; }

@media (max-width: 520px) {
	.builder-bar { padding-left: 14px; }
	.builder-bar #step-back span { display: none; }
}

/* ---------- My plan ---------- */

.plan-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}
.plan-head-text { min-width: 0; }
.plan-head p { margin-top: 8px; }
.plan-actions { display: flex; gap: 2px; margin-right: -12px; }

@media (max-width: 520px) {
	.plan-actions { width: 100%; margin: 0 -12px; }
}

.progress-card {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 18px;
	margin: 24px 0 20px;
	padding: 16px 20px;
	border-radius: var(--r-md);
	background: var(--surface);
	box-shadow: var(--shadow);
}
.progress-text { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.progress-text strong { font-weight: 680; letter-spacing: -0.02em; font-size: 24px; }
.progress-track {
	height: 8px;
	border-radius: 8px;
	background: var(--surface-2);
	overflow: hidden;
}
.progress-fill {
	display: block;
	height: 100%;
	width: 0;
	border-radius: inherit;
	background: var(--accent);
}

@media (max-width: 600px) {
	.progress-card { grid-template-columns: 1fr auto; }
	.progress-track { grid-column: 1 / -1; grid-row: 2; }
}

.layout-switch { margin-bottom: 18px; }
.seg-sep { flex: none; width: 1px; margin: 8px 4px; background: var(--line-strong); }

.plan-empty {
	display: grid;
	justify-items: center;
	gap: 12px;
	max-width: 420px;
	margin: 12vh auto 0;
	text-align: center;
}
.plan-empty .empty-icon {
	display: grid;
	place-items: center;
	width: 72px;
	height: 72px;
	margin-bottom: 8px;
	border-radius: 24px;
	background: var(--surface);
	box-shadow: var(--shadow);
}
.plan-empty .empty-icon .icon { width: 30px; height: 30px; }
.plan-empty h1 { font-size: 32px; }
.plan-empty .pill-row { justify-content: center; margin-top: 10px; }

/* ---------- Plan output (renderers) ---------- */

#output {
	container-type: inline-size;
	padding: clamp(14px, 3vw, 28px);
	border-radius: var(--r-lg);
	background: var(--surface);
	box-shadow: var(--shadow);
	font-size: 14px;
}

#output a { color: var(--ink); }

.reading-open:not(.btn) {
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink);
	font-weight: 600;
	text-align: left;
	text-decoration: underline;
	text-decoration-color: transparent;
	text-underline-offset: 3px;
	transition: text-decoration-color .2s, color .2s;
}
.reading-open:not(.btn):hover { text-decoration-color: currentColor; }

.reading-check {
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	flex: none;
	width: 22px;
	height: 22px;
	margin: 0;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1.5px var(--ink-3);
	cursor: pointer;
	transition: background-color .2s, box-shadow .2s;
}
.reading-check::after {
	content: '';
	position: absolute;
	inset: 0;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 12.5 3.5 3.5 7.5-8'/%3E%3C/svg%3E") center / 16px no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 12.5 3.5 3.5 7.5-8'/%3E%3C/svg%3E") center / 16px no-repeat;
	color: #fff;
	opacity: 0;
	transform: scale(.4);
	transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.reading-check:checked { background: var(--ok); box-shadow: none; }
.reading-check:checked::after { opacity: 1; transform: scale(1); }
#output:not(.plan-checkbox) .reading-check { display: none; }

.entry:has(.reading-check:checked) .reading-open { color: var(--ink-3); text-decoration-line: line-through; text-decoration-color: currentColor; }

/* List */
.plan-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
	gap: 20px 28px;
}
.month-block { break-inside: avoid; }
.month-divider {
	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
	font-weight: 680;
	letter-spacing: -0.02em;
	font-size: 18px;
}
/* Each month reads as one continuous block: square rows with hairline dividers,
   rounded only at the top and bottom of the month */
.plan-list .entry {
	border-radius: 0;
	box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--ink) 7%, transparent);
	display: grid;
	grid-template-columns: auto 52px minmax(0, 1fr);
	grid-template-areas: "check date passage" "check date meta";
	align-items: center;
	column-gap: 12px;
	padding: 10px 12px;
}
.plan-list .month-divider + .entry { border-radius: 12px 12px 0 0; }
.plan-list .entry:last-child { border-radius: 0 0 12px 12px; box-shadow: none; }
.plan-list .month-divider + .entry:last-child { border-radius: 12px; }
.plan-list .entry.is-today { box-shadow: inset 3px 0 0 var(--accent), inset 0 -1px 0 color-mix(in srgb, var(--ink) 7%, transparent); }
.plan-list .entry .verses { grid-area: check; }
.plan-list .entry .date { grid-area: date; }
.plan-list .entry .passage-cell { grid-area: passage; }
.plan-list .entry .reading-meta { grid-area: meta; color: var(--ink-3); font-size: 12px; }
#output:not(.plan-checkbox) .plan-list .entry { grid-template-columns: 52px minmax(0, 1fr); grid-template-areas: "date passage" "date meta"; }

.entry .date {
	color: var(--ink-3);
	font-size: 12.5px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.entry .verses {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* Weeks */
.plan-weeks {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
	gap: 14px;
}
.week-block {
	padding: 14px;
	border-radius: var(--r-md);
	background: var(--bg);
	break-inside: avoid;
}
.week-block .entry:first-child { padding: 0 4px 8px; }
.week-block .week {
	--done: 1;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 680;
	letter-spacing: -0.02em;
	font-size: 16px;
}

/* A finished week dims back; hovering brings it up again so readings can still be unchecked */
.week-block { transition: opacity .45s var(--ease); }
.plan-checkbox .week-block.is-complete { opacity: .45; }
.plan-checkbox .week-block.is-complete:hover,
.plan-checkbox .week-block.is-complete:focus-within { opacity: 1; }
.plan-checkbox .week-block.is-complete .week::after {
	content: '';
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 12.5 3.5 3.5 7.5-8'/%3E%3C/svg%3E") center / 12px no-repeat;
	scale: var(--done);
}
.plan-weeks .entry:not(:first-child) {
	display: grid;
	grid-template-columns: 46px 1fr;
	align-items: center;
	gap: 8px;
	padding: 7px 8px;
	background: var(--surface);
}
.plan-weeks .entry:nth-child(2) { border-radius: 10px 10px 0 0; }
.plan-weeks .entry:last-child { border-radius: 0 0 10px 10px; }
.plan-weeks .entry:nth-child(2):last-child { border-radius: 10px; }
.plan-weeks .entry + .entry:not(:nth-child(2)) { border-top: 1px solid var(--line); }

/* Calendar */
.plan-calendar {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	table-layout: fixed;
	border-radius: var(--r-md);
	box-shadow: inset 0 0 0 1px var(--line);
	overflow: hidden;
}
.plan-calendar th {
	padding: 12px 8px;
	border-bottom: 1px solid var(--line);
	color: var(--ink-3);
	font-size: 12px;
	font-weight: 600;
	text-align: left;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.plan-calendar td {
	height: 96px;
	padding: 8px;
	vertical-align: top;
	border-bottom: 1px solid var(--line);
	border-right: 1px solid var(--line);
}
.plan-calendar td:last-child,
.plan-calendar th:last-child { border-right: 0; }
.plan-calendar tr:last-child td { border-bottom: 0; }
.plan-calendar .monthstart { box-shadow: inset 2px 0 0 var(--ink-3); }

/* One calendar per month */
.plan-calendars {
	display: grid;
	gap: 36px;
}
.calendar-month-title {
	margin: 0 0 12px;
	font-size: 22px;
	letter-spacing: -0.025em;
}
.plan-calendar td.is-blank { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.plan-calendar td.is-outside .date { color: color-mix(in srgb, var(--ink-3) 55%, transparent); }
.plan-calendar td { position: relative; }
.plan-calendar .date { display: block; min-height: 18px; margin-bottom: 6px; padding-right: 24px; }
.plan-calendar .verses { display: block; font-size: 12.5px; line-height: 1.3; }
/* Checkbox sits in the day's top-right corner so the reading gets the full cell width */
.plan-calendar .reading-check { position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; }
.plan-calendar .reading-check::after { -webkit-mask-size: 13px; mask-size: 13px; }
.plan-calendar .stats { display: block; margin-top: 6px; color: var(--ink-3); font-size: 11px; }

@container (max-width: 640px) {
	.plan-calendar th { font-size: 0; }
	.plan-calendar th::first-letter { font-size: 12px; }
	.plan-calendar td { height: 72px; padding: 5px; }
	.plan-calendar .verses { font-size: 10.5px; }
	.plan-calendar .reading-check { display: none; }
}

/* Books */
.plan-books { font-size: 12px; }
.plan-books .book { display: flex; gap: 10px; margin-bottom: 10px; }
.plan-books .name { width: 132px; flex: none; }
.plan-books .chapters { display: flex; flex-wrap: wrap; gap: 4px; }
.plan-books .box {
	display: inline-block;
	padding: 5px 8px;
	border-radius: 8px;
	background: var(--bg);
	line-height: 1.1;
}
.plan-books .title { display: block; padding: 5px 10px; font-weight: 700; }

/* Wheels */
#output svg { display: block; width: 100%; max-width: 900px; height: auto; margin: 0 auto; }
#output svg text { fill: var(--ink); }

/* Stats + key */
.plan-stats {
	margin-bottom: 20px;
	padding: 14px 18px;
	border-radius: var(--r-md);
	background: var(--bg);
}
.plan-stats table { border-collapse: collapse; }
.plan-stats th { padding: 3px 18px 3px 0; color: var(--ink-2); font-weight: 600; text-align: left; }

#color-key {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 16px;
	margin-top: 20px;
	font-size: 12px;
	color: var(--ink-2);
}
#color-key .key-item { display: flex; align-items: center; gap: 6px; }
#color-key .key-color { width: 12px; height: 12px; border-radius: 4px; }

.is-today { background: var(--today) !important; }
.plan-calendar td.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.entry.is-today { box-shadow: inset 3px 0 0 var(--accent); }

/* Section colors */
.plan-color .section-pentateuch { background: #d6f1f5; fill: #d6f1f5; }
.plan-color .section-historical { background: #e4f3cf; fill: #e4f3cf; }
.plan-color .section-poetic { background: #fbf2c9; fill: #fbf2c9; }
.plan-color .section-major,
.plan-color .section-minor { background: #f4e0ee; fill: #f4e0ee; }
.plan-color .section-gospel { background: #fbd9da; fill: #fbd9da; }
.plan-color .section-acts { background: #fbe9c4; fill: #fbe9c4; }
.plan-color .section-pauline,
.plan-color .section-pastoral { background: #d1f3ee; fill: #d1f3ee; }
.plan-color .section-general { background: #d7f2cd; fill: #d7f2cd; }
.plan-color .section-revelation { background: #dcd7fb; fill: #dcd7fb; }
.plan-color .section-deuterocanonical { background: #ecebe8; fill: #ecebe8; }
#color-key .key-color { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }

[data-theme="dark"] .plan-color .section-pentateuch { background: #12343a; fill: #12343a; }
[data-theme="dark"] .plan-color .section-historical { background: #24341a; fill: #24341a; }
[data-theme="dark"] .plan-color .section-poetic { background: #3a3317; fill: #3a3317; }
[data-theme="dark"] .plan-color .section-major,
[data-theme="dark"] .plan-color .section-minor { background: #3a2233; fill: #3a2233; }
[data-theme="dark"] .plan-color .section-gospel { background: #44201f; fill: #44201f; }
[data-theme="dark"] .plan-color .section-acts { background: #3d2e12; fill: #3d2e12; }
[data-theme="dark"] .plan-color .section-pauline,
[data-theme="dark"] .plan-color .section-pastoral { background: #133935; fill: #133935; }
[data-theme="dark"] .plan-color .section-general { background: #1d3a1c; fill: #1d3a1c; }
[data-theme="dark"] .plan-color .section-revelation { background: #2a2650; fill: #2a2650; }
[data-theme="dark"] .plan-color .section-deuterocanonical { background: #2a2826; fill: #2a2826; }
[data-theme="dark"] #output svg circle[fill="#fff"] { fill: var(--surface); }
[data-theme="dark"] #output svg text { fill: var(--ink) !important; }

/* ---------- Extra layouts (layouts.js) ---------- */

.num { font-variant-numeric: tabular-nums; }

.sec-dot {
	display: inline-block;
	flex: none;
	width: 10px;
	height: 10px;
	margin-right: 10px;
	border-radius: 50%;
	background: var(--surface-3);
	vertical-align: 0;
}
#output:not(.plan-color) .sec-dot { display: none; }

.meter {
	display: block;
	height: 6px;
	border-radius: 6px;
	background: var(--surface-2);
	overflow: hidden;
}
.meter > span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: var(--accent);
	transition: width .5s var(--ease);
}

.status {
	display: inline-flex;
	align-items: center;
	height: 26px;
	padding: 0 10px;
	border-radius: 999px;
	font-size: 12.5px;
	font-weight: 600;
	white-space: nowrap;
}
.status-todo { background: var(--surface-2); color: var(--ink-2); }
.status-doing { background: var(--accent-soft); color: var(--ink); }
.status-done { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.status-behind { background: color-mix(in srgb, #e5484d 14%, transparent); color: #c9353a; }
[data-theme="dark"] .status-behind { color: #ff8589; }

/* the new layouts always show their checkboxes; they are how you move through them */
#output:not(.plan-checkbox) :is(.layout-sections, .layout-board, .layout-weekrows, .layout-habit) .reading-check { display: inline-block; }

/* shared table look for Matrix and Week rows */
.layout-matrix,
.layout-weekrows { overflow-x: auto; }
.layout-matrix table,
.layout-weekrows table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}
.layout-matrix th,
.layout-matrix td,
.layout-weekrows th,
.layout-weekrows td {
	padding: 12px 14px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: middle;
	white-space: nowrap;
}
.layout-matrix thead th,
.layout-weekrows thead th {
	padding-top: 4px;
	color: var(--ink-3);
	font-size: 12px;
	font-weight: 600;
}
.layout-matrix tbody th,
.layout-weekrows tbody th { font-weight: 650; }
.layout-matrix tbody tr:last-child > *,
.layout-weekrows tbody tr:last-child > * { border-bottom: 0; }
.layout-matrix tr.is-complete th,
.layout-matrix tr.is-complete td:not(:last-child) { color: var(--ink-3); }
.layout-matrix .is-behind { color: #c9353a; font-weight: 600; }
[data-theme="dark"] .layout-matrix .is-behind { color: #ff8589; }
.layout-matrix .col-progress { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.layout-matrix .col-progress .meter { flex: 1; min-width: 80px; }
@container (max-width: 640px) {
	.layout-matrix .col-scheduled { display: none; }
}

/* Sections */
.layout-sections {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 28px;
	align-items: start;
}
.sec-group header {
	display: flex;
	align-items: center;
	gap: 0;
	margin-bottom: 8px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--line);
}
.sec-group h4 { flex: 1; font-size: 17px; }
.sec-group header .num { color: var(--ink-3); font-size: 13px; }
.sec-group ol { margin: 0; padding: 0; list-style: none; }
.sec-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 6px;
	border-radius: 10px;
}
.sec-item.is-done .reading-open { color: var(--ink-3); text-decoration-line: line-through; text-decoration-color: currentColor; }
.sec-item.is-next { background: var(--today); }
.next-tag {
	margin-left: auto;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--accent);
	color: #121214;
	font-size: 11.5px;
	font-weight: 700;
	white-space: nowrap;
}

/* Progress */
.progress-summary {
	display: grid;
	grid-template-columns: minmax(200px, 1fr) 2fr;
	gap: 20px 36px;
	align-items: center;
	margin-bottom: 28px;
	padding: 22px 24px;
	border-radius: var(--r-md);
	background: var(--bg);
}
.ps-main strong { display: block; font-size: 56px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.ps-main span:not(.meter):not(.meter > span) { display: block; margin: 4px 0 12px; color: var(--ink-2); }
.ps-main .meter { height: 8px; }
.progress-summary dl {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 16px;
	margin: 0;
}
.progress-summary dt { color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.progress-summary dd { margin: 2px 0 0; font-size: 24px; font-weight: 680; letter-spacing: -0.02em; }
.progress-summary dd small { color: var(--ink-3); font-size: 14px; font-weight: 500; }
@container (max-width: 640px) {
	.progress-summary { grid-template-columns: 1fr; }
}
.pb-list { display: grid; }
.pb-row {
	display: grid;
	grid-template-columns: minmax(120px, 180px) 1fr 64px 48px;
	align-items: center;
	gap: 14px;
	padding: 9px 4px;
	border-bottom: 1px solid var(--line);
	font-size: 14px;
}
.pb-row:last-child { border-bottom: 0; }
.pb-name { display: flex; align-items: center; font-weight: 600; }
.pb-count { color: var(--ink-3); text-align: right; }
.pb-pct { font-weight: 650; text-align: right; }
.pb-row.is-complete .meter > span { background: var(--ok); }

/* Board */
.layout-board {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 14px;
	align-items: start;
}
@container (max-width: 760px) {
	.layout-board { grid-template-columns: 1fr; }
}
.board-col {
	padding: 12px;
	border-radius: var(--r-md);
	background: var(--bg);
}
.board-col header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 12px; }
.board-col h4 { font-size: 15px; }
.board-col header .num {
	min-width: 24px;
	height: 22px;
	padding: 0 7px;
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink-2);
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
}
.board-cards { display: grid; gap: 8px; }
.board-card {
	display: grid;
	gap: 10px;
	padding: 12px 14px;
	border-radius: 12px;
	background: var(--surface);
	box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line);
}
.board-card-top { display: flex; align-items: center; }
.board-card-top strong { flex: 1; font-size: 15px; font-weight: 650; }
.board-card-top .num { color: var(--ink-3); font-size: 12.5px; }
.board-card.status-done { opacity: .6; }
.board-card.status-done .meter > span { background: var(--ok); }
.board-next { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.board-next .reading-open { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-next small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.board-next .reading-check { width: 20px; height: 20px; }
.reading-check-proxy {
	flex: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1.5px var(--ink-3);
	cursor: pointer;
}
.board-empty { padding: 18px 4px; color: var(--ink-3); font-size: 13px; text-align: center; }

/* Week rows */
.layout-weekrows tbody th { width: 130px; vertical-align: top; }
.layout-weekrows tbody th small { display: block; margin-top: 2px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.layout-weekrows td { white-space: normal; }
.layout-weekrows tr.is-current { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.layout-weekrows tr.is-complete th,
.layout-weekrows tr.is-complete .wr-done { color: var(--ok); }
.wr-items {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.wr-items li { display: inline-flex; align-items: center; gap: 8px; }
.wr-items li.is-today .wr-day { color: var(--ink); font-weight: 700; }
.wr-items .reading-check { width: 18px; height: 18px; }
.wr-items .reading-check::after { -webkit-mask-size: 13px; mask-size: 13px; }
.wr-items li.is-done .reading-open { color: var(--ink-3); text-decoration-line: line-through; text-decoration-color: currentColor; }
.wr-day { width: 30px; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.wr-done { width: 64px; color: var(--ink-2); text-align: right !important; vertical-align: top !important; }

/* Habit */
.habit-stats {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
	margin-bottom: 28px;
}
.habit-stats > div { padding: 16px 18px; border-radius: var(--r-md); background: var(--bg); }
.habit-stats strong { display: block; font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.habit-stats strong small { color: var(--ink-3); font-size: 16px; font-weight: 600; }
.habit-stats span { color: var(--ink-2); font-size: 13px; }
.habit-stats .habit-pace strong { font-size: 24px; line-height: 1.45; }
.habit-stats .is-behind strong { color: #c9353a; }
[data-theme="dark"] .habit-stats .is-behind strong { color: #ff8589; }
@container (max-width: 640px) {
	.habit-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.habit-months {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
	gap: 28px 32px;
}
.habit-month h4 { margin-bottom: 10px; font-size: 15px; }
.habit-letters,
.habit-days {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
}
.habit-letters { margin-bottom: 6px; color: var(--ink-3); font-size: 11px; font-weight: 600; text-align: center; }
.hd {
	position: relative;
	display: grid;
	place-items: center;
	aspect-ratio: 1;
	border-radius: 10px;
}
.hd-n { font-size: 11px; color: var(--ink-3); pointer-events: none; }
.hd.is-reading { background: var(--surface-2); cursor: pointer; }
.hd.is-reading .reading-check {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border-radius: 10px;
	box-shadow: none;
	background: transparent;
}
.hd.is-reading .reading-check:checked { background: var(--ok); }
.hd.is-reading .reading-check:checked + .hd-n { color: transparent; }
.hd.is-reading .reading-check::after { -webkit-mask-size: 55%; mask-size: 55%; }
.hd.is-reading:hover { background: var(--surface-3); }
.hd.is-future .hd-n { opacity: .6; }
.hd.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.hd.is-rest .hd-n { opacity: .5; }

/* ---------- Sheets ---------- */

.sheet {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	visibility: hidden;
}
.sheet[aria-hidden="false"] { visibility: visible; }

.sheet-backdrop {
	position: absolute;
	inset: 0;
	background: var(--scrim);
}

.sheet-panel {
	position: relative;
	width: 100%;
	max-height: 92vh;
	border-radius: var(--r-xl) var(--r-xl) 0 0;
	background: var(--surface);
	box-shadow: var(--shadow-pop);
	overflow: auto;
	overscroll-behavior: contain;
	padding-bottom: env(safe-area-inset-bottom);
}
.sheet-panel::before {
	content: '';
	position: sticky;
	top: 8px;
	z-index: 2;
	display: block;
	width: 40px;
	height: 5px;
	margin: 8px auto -13px;
	border-radius: 5px;
	background: color-mix(in srgb, var(--ink) 18%, transparent);
}

@media (min-width: 700px) {
	.sheet { align-items: center; padding: 24px; }
	.sheet-panel { max-width: 520px; border-radius: var(--r-xl); }
	.sheet-panel::before { display: none; }
	.sheet-panel-sm { max-width: 440px; }
	.sheet-panel-lg { max-width: 720px; }
}

.sheet-close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 3;
	background: color-mix(in srgb, var(--surface) 80%, transparent);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.sheet-cover { aspect-ratio: 16 / 9; overflow: hidden; }
.sheet-cover svg { display: block; width: 100%; height: 100%; }

.sheet-body { padding: 24px; }
.sheet-body h2 { font-size: 30px; margin-bottom: 8px; padding-right: 40px; }
#plan-sheet .sheet-body h2 { padding-right: 0; }

.facts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 18px 0;
	padding: 0;
	list-style: none;
}
.facts li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 32px;
	padding: 0 12px;
	border-radius: 999px;
	background: var(--surface-2);
	font-size: 13px;
	font-weight: 600;
}
.facts .icon { width: 16px; height: 16px; color: var(--ink-2); }

.first-reading {
	margin-bottom: 22px;
	padding: 14px 16px;
	border-radius: var(--r-md);
	background: var(--bg);
}
.first-reading:empty { display: none; }
.first-reading small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.first-reading strong { display: block; margin-top: 2px; font-weight: 680; letter-spacing: -0.02em; font-size: 20px; }

.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions .btn { width: 100%; }
#plan-sheet-note { margin-top: 12px; text-align: center; }
#plan-sheet-note:empty { display: none; }

.action-list { display: grid; gap: 8px; margin-top: 18px; }
.action {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border: 0;
	border-radius: var(--r-md);
	background: var(--bg);
	text-align: left;
	transition: background-color .2s, scale .2s;
}
.action:hover { background: var(--surface-2); }
.action:active { scale: .98; }
.action .icon { width: 22px; height: 22px; }
.action strong { display: block; font-size: 15px; }
.action small { display: block; color: var(--ink-2); font-size: 13px; }

/* Reading sheet */
.reading-head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 18px 16px 14px 24px;
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}
.reading-head h2 { flex: 1; min-width: 0; font-size: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Reader text settings: size steps and a wide layout */
.reader-tools {
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 3px;
	border-radius: 999px;
	background: var(--surface-2);
}
.reader-tools .icon-btn { width: 34px; height: 34px; color: var(--ink); }
.reader-tools .icon-btn:hover { background: var(--surface); }
.reader-tools .icon-btn[disabled] { opacity: .3; pointer-events: none; }
.reader-tools .reader-wide[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }
.reader-tools [class^="glyph"] { font-family: var(--font-ui); font-weight: 650; line-height: 1; }
.glyph-sm { font-size: 13px; }
.glyph-lg { font-size: 19px; }

.reading-modal-panel { transition: max-width .4s var(--ease); }
.reading-modal-panel.is-wide { max-width: min(1120px, 94vw); }
.reading-modal-panel.is-wide .reading-passage { max-width: 54em; }

@media (max-width: 699px) {
	.reader-wide { display: none; }
}
@media (max-width: 520px) {
	.reading-head { padding-left: 20px; }
	#reading-modal-link span { display: none; }
	#reading-modal-link { padding: 0 10px; }
}
#reading-modal-content {
	--serif: 'New York', 'Iowan Old Style', 'Source Serif 4', Georgia, serif;
	--red-letter: #a8382b;
	padding: 28px clamp(20px, 6vw, 56px) 56px;
	color: var(--ink);
	font-family: var(--serif);
	font-size: var(--reader-size, 19px);
	line-height: 1.75;
	font-kerning: normal;
	hanging-punctuation: first;
}
[data-theme="dark"] #reading-modal-content { --red-letter: #f08e7e; }
#reading-modal-content:focus { outline: none; }

/* Passage text arrives as USFM-style markup from YouVersion; these rules set it like a printed Bible */
.reading-passage { max-width: 36em; margin: 0 auto; }
.reading-passage + .reading-passage { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }
.reading-passage h3 {
	margin-bottom: 20px;
	font-family: var(--font-ui);
	font-size: 1.58em;
	font-weight: 700;
	letter-spacing: -0.03em;
}

.reading-passage-text > div > div { margin: 0; }

/* paragraphs */
.reading-passage-text .p,
.reading-passage-text .m,
.reading-passage-text .pi,
.reading-passage-text .pi1,
.reading-passage-text .mi,
.reading-passage-text .pc,
.reading-passage-text .nb { margin: 0 0 0.85em; }
.reading-passage-text .pi,
.reading-passage-text .pi1,
.reading-passage-text .mi { padding-left: 1.5em; }
.reading-passage-text .pc { text-align: center; }

/* poetry: hanging indents by level, stanzas tight */
.reading-passage-text .q,
.reading-passage-text .q1,
.reading-passage-text .q2,
.reading-passage-text .q3,
.reading-passage-text .q4,
.reading-passage-text .qm,
.reading-passage-text .qm1,
.reading-passage-text .qm2 {
	margin: 0;
	padding-left: 1.6em;
	text-indent: -1.1em;
}
.reading-passage-text .q2,
.reading-passage-text .qm2 { padding-left: 2.8em; }
.reading-passage-text .q3 { padding-left: 4em; }
.reading-passage-text .q4 { padding-left: 5.2em; }
.reading-passage-text :is(.p, .m, .yv-h, .d) + :is(.q, .q1, .q2, .q3, .q4) { margin-top: 0.5em; }
.reading-passage-text :is(.q, .q1, .q2, .q3, .q4) + :is(.p, .m) { margin-top: 0.85em; }
.reading-passage-text .b { height: 0.75em; }
.reading-passage-text .qr,
.reading-passage-text .qs { text-align: right; font-style: italic; color: var(--ink-2); }

/* headings */
.reading-passage-text .yv-h {
	margin: 1.6em 0 0.5em;
	font-family: var(--font-ui);
	font-size: 0.8em;
	font-weight: 650;
	line-height: 1.35;
	letter-spacing: -0.01em;
	color: var(--ink);
}
.reading-passage-text .yv-h:first-child { margin-top: 0; }
.reading-passage-text .yv-h .it { font-style: normal; }
.reading-passage-text .cl { display: none; }
.reading-passage-text .r,
.reading-passage-text .mr,
.reading-passage-text .sr {
	margin: -0.3em 0 0.8em;
	font-family: var(--font-ui);
	font-size: 0.68em;
	color: var(--ink-3);
}
.reading-passage-text .qa {
	margin-top: 1.4em;
	font-size: 0.63em;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-3);
}
.reading-passage-text .d {
	margin: 0 0 0.8em;
	font-style: italic;
	color: var(--ink-2);
}

/* verse numbers */
.reading-passage-text .yv-vlbl {
	position: relative;
	top: -0.5em;
	margin: 0 0.3em 0 0.15em;
	font-family: var(--font-ui);
	font-size: 0.58em;
	font-weight: 700;
	line-height: 0;
	color: var(--ink-3);
	font-variant-numeric: tabular-nums;
	user-select: none;
}
.reading-passage-text :is(.p, .m, .q1, .q) > .yv-v:first-child + .yv-vlbl { margin-left: 0; }

/* inline character styles */
.reading-passage-text .it,
.reading-passage-text .tl,
.reading-passage-text .em,
.reading-passage-text .add { font-style: italic; }
.reading-passage-text .nd,
.reading-passage-text .sc {
	font-variant: small-caps;
	letter-spacing: 0.03em;
}
.reading-passage-text .wj { color: var(--red-letter); }
.reading-passage-text .bd { font-weight: 700; }

.reading-modal-message { font-family: var(--font-ui); font-size: 15px; color: var(--ink-2); }
body.reading-modal-open,
body.has-sheet { overflow: hidden; }

/* Back to top: appears once you're a screen or more down a page */
.to-top {
	position: fixed;
	right: max(var(--gutter), env(safe-area-inset-right));
	bottom: calc(24px + env(safe-area-inset-bottom));
	z-index: 50;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--surface);
	color: var(--ink);
	box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
	transition: box-shadow .2s var(--ease), scale .2s var(--ease);
}
.to-top:hover { box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line-strong); }
.to-top:active { scale: .94; }
.to-top .icon { width: 20px; height: 20px; }

/* Toast */
.toast {
	position: fixed;
	left: 50%;
	bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
	z-index: 80;
	padding: 12px 18px;
	border-radius: 999px;
	background: var(--primary);
	color: var(--primary-ink);
	font-size: 14px;
	font-weight: 600;
	transform: translateX(-50%);
	opacity: 0;
	pointer-events: none;
}
@media (min-width: 760px) {
	.toast { bottom: 32px; }
}

/* ---------- Motion fallbacks ---------- */

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: .01ms !important; }
}

/* ---------- Print ---------- */

@media print {
	@page { margin: 0.5in; }

	body { background: #fff; color: #000; font-size: 10pt; }
	.appbar, .appbar-blur, .to-top, .plan-head, .progress-card, .layout-switch, .sheet, .toast, .plan-empty,
	#view-home, #view-plans, #view-create { display: none !important; }
	#view-plan { display: block !important; padding: 0; max-width: none; }
	main { padding: 0; }

	#output { padding: 0; box-shadow: none; border-radius: 0; background: #fff; }
	#output .print-only { display: block; margin-bottom: 16px; font-size: 18pt; }
	.reading-open { color: #000; text-decoration: none; }
	.reading-check { box-shadow: inset 0 0 0 1px #000; }
	.plan-checkbox .reading-check:checked { background: #fff; }
	.plan-checkbox .reading-check:checked::after { color: #000; }
	.plan-calendar td { height: auto; }
	.week-block { background: #fff; border: 1px solid #ddd; }
	.calendar-month { break-inside: avoid; }
	.calendar-month + .calendar-month { break-before: page; }
	.plan-calendar td.is-blank { background: transparent; }
	.plan-weeks .entry:not(:first-child) { background: transparent; }
	.is-today { background: transparent !important; box-shadow: none !important; }
	* { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
