/* Theme tokens */
:root {
	--ink-0: #07080b;
	--ink-1: #0b0e14;
	--ink-2: #111723;
	--ink-3: #172233;
	--ink-4: #1d2b42;
	--glow-1: #1f5b8a;
	--glow-2: #2f7f8f;
	--glow-3: #74b0c3;
	--line-1: #2c3a4a;
	--line-2: #384a60;
	--text-1: #e8edf6;
	--text-2: #c1c9d6;
	--text-3: #93a2b8;
	--accent-1: #f2a65a;
	--accent-2: #9de3d4;
	/* Genre accent colors - high contrast */
	--genre-law: #f4d35e;
	--genre-history: #29b3d1;
	--genre-poetry: #da70d6;
	--genre-prophecy: #ff5757;
	--genre-gospel: #20c997;
	--genre-epistle: #ffd93d;
	--genre-apocalyptic: #ff006e;
	--shadow-1: 0 12px 24px rgba(5, 9, 17, 0.6);
	--shadow-2: 0 16px 40px rgba(8, 18, 35, 0.7);
	--radius-1: 10px;
	--radius-2: 16px;
	--radius-3: 22px;
	--grid-gap: 12px;
	--font-body: "Space Grotesk", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
	--font-display: "Fraunces", "Times New Roman", serif;
	--zoom: 1;
	--card-min: 72px;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
}

body {
	margin: 0;
	font-family: var(--font-body);
	color: var(--text-1);
	background: radial-gradient(1200px 600px at 12% -5%, rgba(47, 127, 143, 0.22), transparent 60%),
		radial-gradient(900px 500px at 90% 0%, rgba(31, 91, 138, 0.25), transparent 55%),
		linear-gradient(160deg, var(--ink-0), var(--ink-1) 35%, var(--ink-2) 70%, #0a0e16 100%);
	overflow: hidden;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
	background-size: 120px 120px;
	opacity: 0.35;
	pointer-events: none;
}

#app {
	height: 100vh;
	display: grid;
	grid-template-rows: auto 1fr auto;
	gap: 12px;
	padding: 20px 24px 12px;
	overflow: hidden;
}

.header {
	display: flex;
	align-items: center;
	gap: 16px;
	justify-content: space-between;
}

.title-block {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.header-main {
	display: flex;
	align-items: baseline;
	gap: 20px;
}

.app-title {
	font-family: var(--font-display);
	font-size: clamp(2.4rem, 3vw, 3.8rem);
	margin: 0;
	letter-spacing: 0.03em;
	font-weight: 700;
}

.by-link {
	font-size: clamp(0.85rem, 1vw, 1.2rem);
	color: var(--text-3);
	text-decoration: none;
	font-weight: 400;
	letter-spacing: 0.02em;
	transition: color 0.2s ease;
}

.by-link:hover {
	color: var(--text-2);
}

.state-indicator {
	font-family: var(--font-display);
	font-size: clamp(1rem, 1.2vw, 1.6rem);
	margin: 0;
	letter-spacing: 0.03em;
	color: var(--text-2);
	font-weight: 600;
}

.subtitle {
	display: none;
}

.source {
	margin: 0;
	font-size: 0.78rem;
	color: var(--text-3);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	display: inline-block;
	text-decoration: none;
	transition: color 0.2s ease;
	cursor: pointer;
}

.source:hover {
	color: var(--text-2);
}

.source-link {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s ease;
}

.source-link:hover {
	color: var(--text-2);
}

.controls {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.state-switcher {
	display: grid;
	gap: 7px;
	padding: clamp(12px, 1.1vw, 18px) clamp(15px, 1.3vw, 22px) clamp(13px, 1.2vw, 20px);
	background: rgba(14, 22, 35, 0.85);
	border: 1px solid rgba(96, 130, 168, 0.35);
	border-radius: 14px;
	min-width: clamp(250px, 19vw, 370px);
	box-shadow: var(--shadow-1);
}

.state-labels,
.state-captions {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4px;
	font-size: clamp(0.68rem, 0.7vw, 1rem);
	text-transform: uppercase;
	letter-spacing: 0.16em;
	color: var(--text-3);
}

.state-labels {
	display: none;
}

.state-captions {
	font-size: clamp(0.84rem, 0.9vw, 1.2rem);
	gap: 0;
	letter-spacing: 0.08em;
	text-transform: none;
	color: var(--text-2);
}

.state-captions > span {
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
	transition: all 0.2s ease;
}

.state-captions > span:hover {
	color: var(--text-1);
	background: rgba(157, 227, 212, 0.15);
}

.state-captions > span:nth-child(1) {
	justify-self: start;
	text-align: left;
}

.state-captions > span:nth-child(2) {
	justify-self: center;
	text-align: center;
}

.state-captions > span:nth-child(3) {
	justify-self: end;
	text-align: right;
}

.state-slider {
	width: 100%;
	appearance: none;
	background: linear-gradient(90deg, rgba(157, 227, 212, 0.65), rgba(116, 176, 195, 0.35));
	height: clamp(7px, 0.45vw, 10px);
	margin: clamp(6px, 0.45vw, 10px) 0 clamp(4px, 0.35vw, 8px);
	border-radius: 999px;
	outline: none;
}

.state-slider::-webkit-slider-thumb {
	appearance: none;
	width: clamp(19px, 1.05vw, 28px);
	height: clamp(19px, 1.05vw, 28px);
	border-radius: 50%;
	background: var(--accent-2);
	border: 2px solid rgba(10, 15, 24, 0.9);
	box-shadow: 0 0 10px rgba(157, 227, 212, 0.5);
	cursor: pointer;
}

.state-slider::-moz-range-thumb {
	width: clamp(19px, 1.05vw, 28px);
	height: clamp(19px, 1.05vw, 28px);
	border-radius: 50%;
	background: var(--accent-2);
	border: 2px solid rgba(10, 15, 24, 0.9);
	box-shadow: 0 0 10px rgba(157, 227, 212, 0.5);
	cursor: pointer;
}

.topic-search {
	display: grid;
	gap: 6px;
	color: var(--text-3);
	font-size: clamp(0.84rem, 0.8vw, 1.12rem);
	text-transform: uppercase;
	letter-spacing: 0.14em;
}

.topic-search .start-hint {
	margin-left: 8px;
	font-style: normal;
	font-size: clamp(0.7rem, 0.75vw, 0.95rem);
	letter-spacing: 0.08em;
	text-transform: none;
	color: rgba(255, 210, 128, 0.6);
	background: rgba(255, 210, 128, 0.12);
	border: 1px solid rgba(255, 210, 128, 0.25);
	border-radius: 999px;
	padding: 2px 8px;
	box-shadow: 0 0 8px rgba(255, 210, 128, 0.12);
}

.topic-search input {
	min-width: clamp(242px, 17.5vw, 352px);
	padding: clamp(11px, 0.88vw, 15px) clamp(13px, 1.05vw, 20px);
	border-radius: 12px;
	border: 1px solid rgba(95, 200, 255, 0.55);
	background: rgba(12, 18, 28, 0.9);
	color: var(--text-1);
	font-size: clamp(1.05rem, 1.05vw, 1.43rem);
	font-family: var(--font-body);
	box-shadow: 0 0 14px rgba(95, 200, 255, 0.25), var(--shadow-1);
	transition: box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
	animation: topic-glow 5s ease-in-out infinite;
}

.topic-search input:focus {
	box-shadow: 0 0 20px rgba(95, 200, 255, 0.45), var(--shadow-1);
	border-color: rgba(95, 200, 255, 0.9);
	background: rgba(12, 18, 28, 0.95);
	animation: none;
}

@keyframes topic-glow {
	0%,
	100% {
		box-shadow: 0 0 10px rgba(95, 200, 255, 0.2), var(--shadow-1);
	}
	50% {
		box-shadow: 0 0 18px rgba(95, 200, 255, 0.35), var(--shadow-1);
	}
}

.topic-search input::placeholder {
	color: var(--text-3);
}

/* Datalist dropdown styling for 4K */
@media (min-width: 2560px) {
	.topic-search input {
		font-size: 1.05rem;
		padding: 11px 14px;
	}
	
	/* Webkit browsers (Chrome, Edge, Safari) */
	.topic-datalist option {
		font-size: 1.05rem;
	}
	
	/* Firefox */
	@-moz-document url-prefix() {
		.topic-datalist option {
			font-size: 1.05rem;
		}
	}
}

.topic-action {
	align-self: end;
	padding: clamp(11px, 0.95vw, 16px) clamp(15px, 1.2vw, 22px);
	border-radius: 12px;
	border: 1px solid rgba(95, 200, 255, 0.45);
	background: rgba(14, 22, 35, 0.85);
	color: rgba(95, 200, 255, 0.9);
	font-size: clamp(0.9rem, 0.9vw, 1.26rem);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: var(--shadow-1);
}

.topic-action:hover {
	background: rgba(95, 200, 255, 0.15);
	box-shadow: 0 0 12px rgba(95, 200, 255, 0.25);
	transform: translateY(-1px);
}

.topic-action:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	box-shadow: none;
}

.control-pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: clamp(10px, 0.88vw, 15px) clamp(13px, 1.1vw, 20px);
	background: rgba(18, 26, 40, 0.85);
	border: 1px solid rgba(96, 130, 168, 0.3);
	color: var(--text-2);
	border-radius: 999px;
	font-size: clamp(0.95rem, 0.9vw, 1.32rem);
	box-shadow: var(--shadow-1);
}

.control-pill strong {
	color: var(--text-1);
	font-weight: 600;
}

.viewport {
	position: relative;
	background: linear-gradient(130deg, rgba(14, 22, 35, 0.85), rgba(11, 16, 26, 0.92));
	border-radius: var(--radius-3);
	border: 1px solid rgba(62, 94, 124, 0.4);
	box-shadow: var(--shadow-2);
	overflow: hidden;
}

.viewport::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image: linear-gradient(120deg, rgba(64, 96, 130, 0.05), transparent 60%);
	pointer-events: none;
}

.canvas {
	position: absolute;
	inset: 0;
	overflow: auto;
	padding: 16px;
	display: grid;
	gap: 12px;
	transform: scale(var(--zoom));
	transform-origin: 0 0;
}

.canvas::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}

.canvas::-webkit-scrollbar-track {
	background: rgba(8, 12, 20, 0.8);
}

.canvas::-webkit-scrollbar-thumb {
	background: rgba(118, 160, 196, 0.4);
	border-radius: 20px;
}

.state {
	display: grid;
	gap: 16px;
	height: 100%;
	grid-template-rows: auto minmax(0, 1fr);
}

body[data-state="1"] .state--book,
body[data-state="1"] .state--read {
	display: none;
}

body[data-state="2"] .state--overview,
body[data-state="2"] .state--read {
	display: none;
}

body[data-state="3"] .state--overview,
body[data-state="3"] .state--book {
	display: none;
}

.state-header {
	display: grid;
	align-items: center;
	grid-template-columns: 1fr auto 1fr auto;
	gap: 12px;
	position: relative;
}

.state-title {
	font-size: clamp(0.9rem, 1.5vw, 2.5rem);
	text-transform: uppercase;
	letter-spacing: 0.2em;
	color: var(--text-3);
	margin: 0;
}

.state-current-topic {
	color: var(--text-2);
	font-size: clamp(0.85rem, 1.1vw, 1.6rem);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-align: center;
}

.state-topic-group {
	display: flex;
	align-items: center;
	gap: 12px;
	justify-self: center;
	flex-wrap: wrap;
	justify-content: center;
}

.state-meta {
	color: var(--text-3);
	font-size: clamp(0.8rem, 1vw, 1.4rem);
	justify-self: end;
}

.jump-control {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-self: end;
}

.jump-control--verse {
	gap: 6px;
}

.jump-select {
	background: rgba(14, 22, 35, 0.85);
	border: 1px solid rgba(95, 200, 255, 0.45);
	color: rgba(95, 200, 255, 0.95);
	border-radius: 6px;
	padding: 6px 10px;
	font-size: clamp(0.75rem, 0.85vw, 0.95rem);
	cursor: pointer;
	transition: all 0.2s ease;
	max-width: 180px;
}

.jump-select:hover {
	border-color: rgba(95, 200, 255, 0.75);
	background: rgba(14, 22, 35, 0.95);
}

.jump-select:focus {
	outline: none;
	border-color: rgba(95, 200, 255, 0.95);
	box-shadow: 0 0 8px rgba(95, 200, 255, 0.3);
}

.jump-select option {
	background: rgba(14, 22, 35);
	color: var(--text-2);
}

.jump-button {
	background: rgba(14, 22, 35, 0.85);
	border: 1px solid rgba(95, 200, 255, 0.45);
	color: rgba(95, 200, 255, 0.95);
	border-radius: 6px;
	padding: 6px 12px;
	font-size: clamp(0.75rem, 0.85vw, 0.95rem);
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.jump-button:hover {
	border-color: rgba(95, 200, 255, 0.75);
	background: rgba(14, 22, 35, 0.95);
}

.jump-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.verse-count {
	color: var(--text-3);
	font-size: clamp(0.75rem, 0.9vw, 1.2rem);
	opacity: 0.7;
	font-weight: 500;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.panel-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(var(--card-min), 1fr));
	gap: var(--grid-gap);
	min-width: min(1600px, 100%);
}

.treemap {
	position: relative;
	width: 100%;
	height: 100%;
	min-height: 0;
	border-radius: var(--radius-2);
	background: rgba(9, 13, 21, 0.4);
	border: 1px solid rgba(68, 96, 126, 0.25);
	overflow: hidden;
}

.treemap-item {
	position: absolute;
	padding: 8px;
}

.treemap-item .card--abstract {
	height: 100%;
	min-height: 0;
}

.card-title-bar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	padding: 6px 32px 6px 8px;
	background: rgba(8, 12, 20, 0.75);
	border-bottom: 1px solid rgba(96, 130, 168, 0.2);
	font-size: 0.7rem;
	font-weight: 600;
	color: var(--text-1);
	letter-spacing: 0.02em;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	z-index: 2;
}

.card-title-bar.is-clickable {
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.card-title-bar.is-clickable:hover {
	background: rgba(95, 200, 255, 0.2);
	color: rgba(232, 237, 246, 0.95);
}

.card-title-bar.is-clickable::after {
	content: "Click to open Book view";
	position: absolute;
	left: 50%;
	top: 100%;
	transform: translate(-50%, 6px);
	background: rgba(10, 16, 26, 0.95);
	border: 1px solid rgba(95, 200, 255, 0.45);
	color: var(--text-1);
	font-size: 1.8rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 8px 14px;
	border-radius: 999px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	box-shadow: 0 6px 16px rgba(5, 11, 20, 0.5);
	z-index: 20;
}

.card-title-bar.is-clickable:hover::after {
	opacity: 1;
	transform: translate(-50%, 10px);
}

.card {
	position: relative;
	background: linear-gradient(160deg, rgba(25, 36, 54, 0.85), rgba(16, 24, 37, 0.9));
	border-radius: var(--radius-2);
	border: 1px solid rgba(82, 122, 162, 0.25);
	padding: 12px;
	min-height: 90px;
	box-shadow: inset 0 0 0 1px rgba(12, 18, 28, 0.9), var(--shadow-1);
	overflow: hidden;
	transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card--separator {
	background: linear-gradient(160deg, rgba(40, 50, 65, 0.85), rgba(30, 38, 50, 0.9));
	border: 1px solid rgba(157, 227, 212, 0.5);
	box-shadow: inset 0 0 0 1px rgba(157, 227, 212, 0.2), var(--shadow-1);
}

.card--separator .card-title-bar {
	background: rgba(157, 227, 212, 0.15);
	border-bottom: 1px solid rgba(157, 227, 212, 0.4);
	color: var(--accent-2);
	font-weight: 700;
	letter-spacing: 0.15em;
}

.separator-text {
	padding: 28px 12px 12px;
	text-align: center;
	color: var(--text-2);
	font-size: 0.55rem;
	line-height: 1.5;
	font-style: italic;
	letter-spacing: 0.05em;
}

.card--separator .pin-lines {
	display: none;
}

.card:hover {
	transform: translateY(-2px);
	border-color: rgba(143, 198, 215, 0.5);
	box-shadow: 0 14px 28px rgba(5, 11, 20, 0.7);
}

.card.genre-highlighted {
	transform: translateY(-3px) scale(1.02);
	border-color: rgba(157, 227, 212, 0.7);
	box-shadow: 0 0 20px rgba(157, 227, 212, 0.3), 0 14px 28px rgba(5, 11, 20, 0.7);
	z-index: 10;
}

.card-title {
	margin: 0 0 6px;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--text-1);
}

.card-subtitle {
	margin: 0;
	color: var(--text-3);
	font-size: 0.78rem;
}

.card--abstract {
	padding: 10px;
	min-height: 110px;
}

.card--abstract .card-title,
.card--abstract .card-subtitle {
	display: none;
}

/* Genre-specific accent colors on card borders */
.card[data-genre="law"] {
	border-color: rgba(244, 211, 94, 0.5);
}

.card[data-genre="law"]:hover {
	border-color: rgba(244, 211, 94, 0.8);
	box-shadow: 0 14px 28px rgba(244, 211, 94, 0.2);
}

.card[data-genre="history"] {
	border-color: rgba(41, 179, 209, 0.5);
}

.card[data-genre="history"]:hover {
	border-color: rgba(41, 179, 209, 0.8);
	box-shadow: 0 14px 28px rgba(41, 179, 209, 0.2);
}

.card[data-genre="poetry"] {
	border-color: rgba(218, 112, 214, 0.5);
}

.card[data-genre="poetry"]:hover {
	border-color: rgba(218, 112, 214, 0.8);
	box-shadow: 0 14px 28px rgba(218, 112, 214, 0.2);
}

.card[data-genre="prophecy"] {
	border-color: rgba(255, 87, 87, 0.5);
}

.card[data-genre="prophecy"]:hover {
	border-color: rgba(255, 87, 87, 0.8);
	box-shadow: 0 14px 28px rgba(255, 87, 87, 0.2);
}

.card[data-genre="gospel"] {
	border-color: rgba(32, 201, 151, 0.5);
}

.card[data-genre="gospel"]:hover {
	border-color: rgba(32, 201, 151, 0.8);
	box-shadow: 0 14px 28px rgba(32, 201, 151, 0.2);
}

.card[data-genre="epistle"] {
	border-color: rgba(255, 217, 61, 0.5);
}

.card[data-genre="epistle"]:hover {
	border-color: rgba(255, 217, 61, 0.8);
	box-shadow: 0 14px 28px rgba(255, 217, 61, 0.2);
}

.card[data-genre="apocalyptic"] {
	border-color: rgba(255, 0, 110, 0.5);
}

.card[data-genre="apocalyptic"]:hover {
	border-color: rgba(255, 0, 110, 0.8);
	box-shadow: 0 14px 28px rgba(255, 0, 110, 0.2);
}

.pin-lines {
	display: grid;
	gap: 8px;
	margin: 0;
	position: absolute;
	top: 32px;
	left: 10px;
	right: 10px;
	bottom: 10px;
	height: auto;
	min-height: 0;
	overflow: hidden;
}

.pin-line {
	height: 6px;
	border-radius: 999px;
	background: linear-gradient(90deg, rgba(157, 227, 212, 0.8), rgba(157, 227, 212, 0.2));
	box-shadow: 0 0 6px rgba(157, 227, 212, 0.2);
	width: 100%;
	position: relative;
	left: 0;
	transition: height 0.2s ease, box-shadow 0.2s ease;
}

.pin-line-wrapped {
	background: linear-gradient(90deg, rgba(157, 227, 212, 0.95), rgba(157, 227, 212, 0.4));
	box-shadow: 0 0 10px rgba(157, 227, 212, 0.4);
}

.pin-line:hover {
	box-shadow: 0 0 12px rgba(157, 227, 212, 0.6);
	transform: scaleY(1.3);
}

/* Placeholder lines (when no topic selected) */
/* Dynamic lines (when topic selected) */
.pin-lines > .pin-line[style*="position: absolute"] {
	position: absolute !important;
	left: 0;
	right: 0;
	width: 100%;
	margin: 0;
}

.expand-indicator {
	position: absolute;
	top: 4px;
	right: 4px;
	padding: 3px 8px;
	background: rgba(157, 227, 212, 0.25);
	border: 1px solid rgba(157, 227, 212, 0.5);
	border-radius: 12px;
	color: var(--accent-2);
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: all 0.2s ease;
}

.expand-indicator:hover {
	background: rgba(157, 227, 212, 0.4);
	box-shadow: 0 0 8px rgba(157, 227, 212, 0.3);
	transform: scale(1.05);
}

.expand-verses-btn {
	position: absolute;
	bottom: 8px;
	right: 8px;
	width: clamp(22px, 1.1vw, 34px);
	height: clamp(22px, 1.1vw, 34px);
	padding: 0;
	background: rgba(95, 200, 255, 0.16);
	border: 1px solid rgba(95, 200, 255, 0.65);
	border-radius: 999px;
	color: rgba(95, 200, 255, 0.95);
	font-size: clamp(0.6rem, 0.5vw, 0.78rem);
	font-weight: 700;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	box-shadow: 0 0 8px rgba(95, 200, 255, 0.2);
}

.expand-verses-btn:hover {
	background: rgba(95, 200, 255, 0.28);
	border-color: rgba(95, 200, 255, 0.9);
	box-shadow: 0 0 14px rgba(95, 200, 255, 0.45);
	transform: scale(1.08);
}

.info-btn {
	position: absolute;
	top: 8px;
	right: 12px;
	width: auto;
	height: auto;
	padding: 0;
	margin-left: 2px;
	background: transparent;
	border: none;
	color: rgba(157, 227, 212, 0.9);
	font-size: 1.4rem;
	font-weight: bold;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 15;
}

.info-btn:hover {
	color: rgba(157, 227, 212, 1);
	text-shadow: 0 0 12px rgba(157, 227, 212, 0.6);
	transform: scale(1.2);
}

.book-summary-text {
	font-size: 0.95rem;
	line-height: 1.7;
	color: var(--text-1);
	margin: 0;
	padding: 20px;
}

/* Verse Modal Styles */
.verse-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	backdrop-filter: blur(2px);
}

.verse-modal {
	background: linear-gradient(135deg, rgba(20, 25, 40, 0.98), rgba(30, 40, 60, 0.95));
	border: 1px solid rgba(95, 200, 255, 0.3);
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(95, 200, 255, 0.1);
	max-width: 1500px;
	width: 96%;
	max-height: 94vh;
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.verse-detail-pop {
	position: absolute;
	left: 20px;
	top: 20px;
	width: min(520px, 45%);
	max-height: 45vh;
	background: rgba(10, 16, 26, 0.97);
	border: 1px solid rgba(255, 210, 128, 0.45);
	border-radius: 10px;
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
	color: var(--text-1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 3;
}

.verse-detail-header {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 12px;
	align-items: center;
	padding: 12px 16px;
	border-bottom: 1px solid rgba(255, 210, 128, 0.25);
	font-size: clamp(0.95rem, 1vw, 1.4rem);
	cursor: grab;
}

.verse-detail-subtopic {
	color: rgba(255, 230, 190, 0.8);
	font-size: clamp(0.8rem, 0.9vw, 1.2rem);
}

.verse-detail-close {
	margin-left: auto;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 1px solid rgba(255, 210, 128, 0.4);
	background: rgba(255, 210, 128, 0.12);
	color: rgba(255, 230, 190, 0.9);
	font-size: 1rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.verse-detail-close:hover {
	background: rgba(255, 210, 128, 0.2);
	box-shadow: 0 0 10px rgba(255, 220, 150, 0.35);
}

.verse-detail-body {
	padding: 14px 16px;
	font-size: clamp(0.9rem, 1vw, 1.35rem);
	line-height: 1.6;
	white-space: pre-wrap;
	overflow-y: auto;
}

.verse-modal-header {
	padding: 20px;
	border-bottom: 1px solid rgba(95, 200, 255, 0.2);
	position: relative;
}

.verse-modal-header h3 {
	margin: 0 0 4px 0;
	font-family: "Fraunces", serif;
	font-size: clamp(1.4rem, 2vw, 2.8rem);
	color: var(--text-1);
}

.verse-modal-header p {
	margin: 0;
	font-size: clamp(0.85rem, 1vw, 1.4rem);
	color: var(--text-3);
	font-style: italic;
}

.verse-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	padding: 0;
	background: rgba(255, 87, 87, 0.15);
	border: 1px solid rgba(255, 87, 87, 0.3);
	border-radius: 50%;
	color: rgba(255, 87, 87, 0.8);
	font-size: 1.2rem;
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.verse-modal-close:hover {
	background: rgba(255, 87, 87, 0.25);
	box-shadow: 0 0 10px rgba(255, 87, 87, 0.3);
	transform: scale(1.1);
}

.verse-modal-content {
	padding: 20px;
	overflow-y: auto;
	flex: 1;
	display: flex;
	flex-direction: row;
	align-items: stretch;
	gap: 20px;
	min-height: 0;
}

.verse-modal-content--split {
	overflow: hidden;
}

@media (max-width: 700px) {
	.verse-modal-content {
		grid-template-columns: 1fr;
		gap: 15px;
	}
}

.verse-visualization {
	position: relative;
	background: rgba(95, 200, 255, 0.05);
	border: 1px solid rgba(95, 200, 255, 0.2);
	border-radius: 8px;
	padding: 10px;
	flex: 1;
	min-height: 0;
	height: 100%;
	overflow: visible;
}

.verse-item {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 100%;
	pointer-events: none;
}

.verse-line {
	position: absolute;
	left: 10px;
	right: 10px;
	height: 5px;
	background: linear-gradient(90deg, rgba(95, 200, 255, 0.3), rgba(95, 200, 255, 0.8), rgba(95, 200, 255, 0.3));
	box-shadow: 0 0 8px rgba(95, 200, 255, 0.4);
	border-radius: 1px;
	transform: translateY(-2.5px);
	transition: background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
	pointer-events: auto;
	cursor: pointer;
	z-index: 1;
}

.verse-line.is-active {
	background: linear-gradient(90deg, rgba(255, 210, 128, 0.35), rgba(255, 230, 170, 0.95), rgba(255, 210, 128, 0.35));
	box-shadow: 0 0 14px rgba(255, 220, 150, 0.6);
}
.verse-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-gutter: stable;
	padding-right: clamp(10px, 0.9vw, 16px);
	scrollbar-width: thin;
	scrollbar-color: rgba(95, 200, 255, 0.45) transparent;
}

.verse-list::-webkit-scrollbar {
	width: 10px;
}

.verse-list::-webkit-scrollbar-track {
	background: transparent;
}

.verse-list::-webkit-scrollbar-thumb {
	background: rgba(95, 200, 255, 0.45);
	border-radius: 999px;
	border: 2px solid transparent;
	background-clip: content-box;
}

.verse-list-item {
	padding: 10px 12px;
	margin-right: clamp(2px, 0.35vw, 6px);
	background: rgba(95, 200, 255, 0.08);
	border: 1px solid rgba(95, 200, 255, 0.2);
	border-radius: 6px;
	font-size: clamp(0.85rem, 1vw, 1.5rem);
	color: var(--text-2);
	transition: all 0.2s ease;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: space-between;
	align-items: center;
}

.verse-list-item:hover {
	background: rgba(95, 200, 255, 0.15);
	border-color: rgba(95, 200, 255, 0.4);
	box-shadow: 0 0 8px rgba(95, 200, 255, 0.2);
}

.verse-position {
	font-size: 0.75rem;
	color: rgba(95, 200, 255, 0.6);
	font-weight: 600;
}

.verse-subtopic {
	font-size: clamp(0.72rem, 1.1vw, 1.6rem);
	color: rgba(95, 200, 255, 0.75);
	margin-left: 10px;
	font-weight: 600;
	flex: 1;
	text-align: right;
}

.verse-modal-footer {
	padding: 16px 20px;
	border-top: 1px solid rgba(95, 200, 255, 0.2);
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

.state3-nav-btn {
	padding: 10px 20px;
	background: linear-gradient(135deg, rgba(95, 200, 255, 0.25), rgba(95, 200, 255, 0.15));
	border: 1px solid rgba(95, 200, 255, 0.4);
	border-radius: 6px;
	color: rgba(95, 200, 255, 0.95);
	font-size: clamp(0.9rem, 1.1vw, 1.5rem);
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
}

.state3-nav-btn:hover {
	background: linear-gradient(135deg, rgba(95, 200, 255, 0.35), rgba(95, 200, 255, 0.25));
	border-color: rgba(95, 200, 255, 0.6);
	box-shadow: 0 0 12px rgba(95, 200, 255, 0.3);
	transform: translateY(-2px);
}

.state3-nav-btn:active {
	transform: translateY(0);
}

/* Custom tooltip styling */
::-webkit-scrollbar-thumb:vertical {
  background: rgba(95, 200, 255, 0.3);
}

/* Tooltip styling for verse text */
tip {
  position: fixed;
  background: rgba(12, 15, 25, 0.95);
  border: 1px solid rgba(95, 200, 255, 0.5);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-2);
  max-width: 420px;
  white-space: pre-wrap;
  word-wrap: break-word;
  z-index: 2000;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 16px rgba(95, 200, 255, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

tip.show {
  opacity: 1;
  visibility: visible;
}

/* Larger tooltips on 4K displays */
@media (min-width: 2560px) {
  tip {
    padding: 16px 20px;
    font-size: 1.6rem;
    max-width: 500px;
    line-height: 1.6;
  }
}

/* Smaller tooltips on mobile */
@media (max-width: 600px) {
  tip {
    padding: 10px 12px;
    font-size: 0.75rem;
    max-width: 90vw;
  }
}

.squiggle {
	position: absolute;
	inset: 10px 10px auto;
	height: 28px;
	opacity: 0.22;
	background-image: repeating-linear-gradient(
		-45deg,
		rgba(116, 176, 195, 0.7) 0,
		rgba(116, 176, 195, 0.7) 6px,
		transparent 6px,
		transparent 12px
	);
	filter: blur(0.2px);
}

.state--book .card {
	min-height: 110px;
}

.state--book #book-grid {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	background: rgba(9, 13, 21, 0.28);
	border: 1px solid rgba(68, 96, 126, 0.25);
	border-radius: var(--radius-2);
	overflow: hidden;
}

.chapter-tile {
	position: absolute;
	padding: 6px;
}

.state--book #book-grid[data-density="high"] .chapter-tile {
	padding: 5px;
}

.state--book #book-grid[data-density="ultra"] .chapter-tile {
	padding: 3px;
}

.state--book #book-grid .card {
	height: 100%;
	min-height: 0;
	overflow: hidden;
}

.state--book #book-grid .card-title-bar {
	padding: 6px 8px;
	cursor: pointer;
}

.state--book #book-grid[data-density="high"] .card-title-bar {
	padding: 5px 6px;
	font-size: 0.66rem;
}

.state--book #book-grid[data-density="ultra"] .card-title-bar {
	padding: 3px 4px;
	font-size: 0.56rem;
	letter-spacing: 0.01em;
}

.state--book #book-grid[data-density="high"] .pin-lines {
	top: 28px;
	left: 8px;
	right: 8px;
	bottom: 8px;
}

.state--book #book-grid[data-density="ultra"] .pin-lines {
	top: 20px;
	left: 6px;
	right: 6px;
	bottom: 6px;
}

.state--book #book-grid[data-density="high"] .expand-verses-btn {
	width: clamp(18px, 0.9vw, 28px);
	height: clamp(18px, 0.9vw, 28px);
	font-size: clamp(0.52rem, 0.45vw, 0.68rem);
	right: 6px;
	bottom: 6px;
}

.state--book #book-grid[data-density="ultra"] .expand-verses-btn {
	width: clamp(16px, 0.8vw, 24px);
	height: clamp(16px, 0.8vw, 24px);
	font-size: clamp(0.45rem, 0.38vw, 0.6rem);
	right: 4px;
	bottom: 4px;
	border-width: 1px;
	box-shadow: 0 0 5px rgba(95, 200, 255, 0.18);
}

.state--book #book-grid .card.is-clickable {
	cursor: pointer;
}

#book-meta {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.book-meta-name {
	font-weight: 700;
	color: var(--text-1);
	font-size: 1.05em;
	letter-spacing: 0.02em;
}

.book-nav-controls {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.book-nav-btn {
	padding: 6px 10px;
	background: rgba(14, 22, 35, 0.85);
	border: 1px solid rgba(95, 200, 255, 0.45);
	color: rgba(95, 200, 255, 0.95);
	border-radius: 10px;
	font-size: 0.82rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	cursor: pointer;
	transition: all 0.2s ease;
}

.book-nav-btn:hover {
	background: rgba(95, 200, 255, 0.15);
	border-color: rgba(95, 200, 255, 0.75);
	box-shadow: 0 0 10px rgba(95, 200, 255, 0.22);
}

.state--read {
	background: rgba(8, 12, 20, 0.6);
	border: 1px solid rgba(68, 96, 126, 0.35);
	border-radius: var(--radius-2);
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.reading-container {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	gap: clamp(20px, 3vw, 60px);
	width: 100%;
	min-height: 0;
}

.reading-block {
	display: grid;
	gap: 12px;
	color: var(--text-2);
	line-height: 1.6;
	font-size: clamp(0.95rem, 1.2vw, 2rem);
	min-height: 0;
	max-width: 1800px;
	width: 100%;
	flex: 0 1 auto;
}

.reading-block h3 {
	font-family: var(--font-display);
	color: var(--text-1);
	margin: 0;
	font-size: clamp(1.2rem, 1.5vw, 2.4rem);
}

.chapter-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 6px 0 2px;
}

.chapter-nav-center {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 auto;
}

.chapter-nav-label {
	font-weight: 600;
	color: var(--text-2);
}

.chapter-nav-btn {
	background: rgba(14, 22, 35, 0.85);
	border: 1px solid rgba(95, 200, 255, 0.45);
	color: rgba(95, 200, 255, 0.95);
	border-radius: 10px;
	padding: 6px 12px;
	font-size: 0.9rem;
	cursor: pointer;
	transition: all 0.2s ease;
}

.chapter-nav-btn--ghost {
	background: rgba(12, 18, 28, 0.65);
	border-color: rgba(95, 200, 255, 0.25);
	color: var(--text-2);
}

.chapter-nav-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.reading-block p {
	margin: 0;
}

.chapter-verses {
	display: grid;
	gap: 10px;
	padding-right: 6px;
	max-height: min(60vh, 560px);
	overflow-y: auto;
	border-top: 1px solid rgba(95, 200, 255, 0.15);
	padding-top: 8px;
}

.chapter-verse {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 10px 12px;
	border-radius: 10px;
	background: rgba(12, 18, 28, 0.65);
	border: 1px solid rgba(95, 200, 255, 0.15);
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chapter-verse:hover {
	border-color: rgba(95, 200, 255, 0.4);
	background: rgba(95, 200, 255, 0.08);
}

.chapter-verse-number {
	min-width: 3ch;
	color: var(--text-3);
	font-weight: 700;
}

.chapter-verse-text {
	color: var(--text-2);
}

.chapter-verse.is-topic {
	border-color: rgba(157, 227, 212, 0.6);
	background: rgba(157, 227, 212, 0.15);
	box-shadow: 0 0 8px rgba(157, 227, 212, 0.25);
}

.chapter-verse.is-current {
	border-color: rgba(255, 210, 128, 0.8);
	background: rgba(255, 210, 128, 0.18);
	animation: verse-pulse 2.6s ease-in-out infinite;
}

@keyframes verse-pulse {
	0%,
	100% {
		box-shadow: 0 0 8px rgba(255, 210, 128, 0.3);
	}
	50% {
		box-shadow: 0 0 20px rgba(255, 210, 128, 0.6);
	}
}

.chapter-verse.is-selected {
	/* Deprecated - use is-current instead */
	border-color: rgba(255, 210, 128, 0.7);
	background: rgba(255, 210, 128, 0.12);
}

.reading-sidebar {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	padding-top: 60px;
	opacity: 0.4;
	transition: opacity 0.3s ease;
}

.reading-sidebar:hover {
	opacity: 0.85;
}

.sidebar-nav {
	display: flex;
	flex-direction: column;
	gap: 16px;
	position: sticky;
	top: 60px;
}

.sidebar-link {
	color: var(--text-3);
	text-decoration: none;
	font-size: clamp(0.75rem, 0.85vw, 0.95rem);
	font-weight: 400;
	letter-spacing: 0.015em;
	transition: color 0.25s ease, transform 0.2s ease;
	text-align: center;
	padding: 4px 8px;
	border-radius: 4px;
	white-space: nowrap;
}

.sidebar-link:hover {
	color: var(--text-2);
	transform: translateX(2px);
}

.reading-sidebar--left .sidebar-link:hover {
	transform: translateX(-2px);
}

.sidebar-link--subtle {
	font-size: clamp(0.68rem, 0.75vw, 0.85rem);
}

.sidebar-link--subtle:hover {
	opacity: 1;
}

/* Hide sidebars on smaller screens */
@media (max-width: 1400px) {
	.reading-sidebar {
		display: none;
	}
}

.footer {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	color: var(--text-3);
	font-size: clamp(0.72rem, 0.78vw, 1rem);
	padding: 0;
	height: clamp(30px, 2.2vh, 42px);
	min-height: clamp(30px, 2.2vh, 42px);
	max-height: clamp(30px, 2.2vh, 42px);
	overflow: hidden;
	flex-shrink: 0;
}

.legend {
	display: flex;
	gap: 8px;
	flex-wrap: nowrap;
	overflow-x: auto;
	padding: 0 4px;
}

.book-genre-indicator {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: clamp(5px, 0.5vw, 9px) clamp(10px, 0.85vw, 16px);
	border-radius: 999px;
	background: rgba(95, 200, 255, 0.18);
	border: 1px solid rgba(95, 200, 255, 0.5);
	color: rgba(95, 200, 255, 0.95);
	font-size: clamp(0.8rem, 0.84vw, 1.12rem);
	font-weight: 600;
	letter-spacing: 0.04em;
	margin-right: 12px;
	flex-shrink: 0;
}

.legend-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 1.2rem;
}

.legend-line {
	width: 14px;
	height: 4px;
	border-radius: 999px;
	background: linear-gradient(90deg, rgba(157, 227, 212, 0.8), rgba(157, 227, 212, 0.2));
}

.legend-genre {
	flex-shrink: 0;
	font-size: clamp(0.78rem, 0.82vw, 1.1rem);
	padding: clamp(4px, 0.45vw, 8px) clamp(8px, 0.75vw, 14px);
	border-radius: 999px;
	background: rgba(18, 26, 40, 0.92);
	gap: 4px;
	height: auto;
	min-height: clamp(20px, 1.5vw, 30px);
	border: 1px solid rgba(96, 130, 168, 0.35);
	transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
	cursor: default;
}

.legend-color-bar {
	width: 8px;
	height: 8px;
	border-radius: 999px;
	border: 2px solid currentColor;
	background: currentColor;
	box-shadow: 0 0 8px currentColor;
}

.legend-genre[data-genre="law"] {
	border-color: rgba(244, 211, 94, 0.5);
	background: rgba(244, 211, 94, 0.12);
	color: rgba(244, 211, 94, 0.95);
}

.legend-genre[data-genre="history"] {
	border-color: rgba(41, 179, 209, 0.5);
	background: rgba(41, 179, 209, 0.12);
	color: rgba(41, 179, 209, 0.95);
}

.legend-genre[data-genre="poetry"] {
	border-color: rgba(218, 112, 214, 0.5);
	background: rgba(218, 112, 214, 0.12);
	color: rgba(218, 112, 214, 0.95);
}

.legend-genre[data-genre="prophecy"] {
	border-color: rgba(255, 87, 87, 0.5);
	background: rgba(255, 87, 87, 0.12);
	color: rgba(255, 87, 87, 0.95);
}

.legend-genre[data-genre="gospel"] {
	border-color: rgba(32, 201, 151, 0.5);
	background: rgba(32, 201, 151, 0.12);
	color: rgba(32, 201, 151, 0.95);
}

.legend-genre[data-genre="epistle"] {
	border-color: rgba(255, 217, 61, 0.5);
	background: rgba(255, 217, 61, 0.12);
	color: rgba(255, 217, 61, 0.95);
}

.legend-genre[data-genre="apocalyptic"] {
	border-color: rgba(255, 0, 110, 0.5);
	background: rgba(255, 0, 110, 0.12);
	color: rgba(255, 0, 110, 0.95);
}

.legend-genre.active {
	box-shadow: 0 0 14px currentColor;
	transform: scale(1.1);
}

.legend-genre:hover {
	box-shadow: 0 0 12px currentColor;
	transform: scale(1.05);
	border-color: currentColor;
}

@media (max-width: 1920px) and (min-width: 1101px) {
	.controls {
		gap: 12px;
	}

	.state-switcher {
		gap: 6px;
		padding: 10px 13px 11px;
		min-width: 230px;
	}

	.state-captions {
		font-size: 0.95rem;
	}

	.state-slider {
		height: 7px;
		margin: 4px 0 4px;
	}

	.state-slider::-webkit-slider-thumb {
		width: 20px;
		height: 20px;
	}

	.state-slider::-moz-range-thumb {
		width: 20px;
		height: 20px;
	}

	.topic-search {
		font-size: 0.9rem;
	}

	.topic-search input {
		min-width: 230px;
		padding: 10px 12px;
		font-size: 1rem;
	}

	.topic-action {
		padding: 10px 13px;
		font-size: 0.88rem;
	}

	.control-pill {
		padding: 9px 12px;
		font-size: 0.92rem;
	}

	body[data-state="1"] .state-title {
		font-size: clamp(0.82rem, 1.25vw, 1.7rem);
	}

	.reading-block {
		max-width: 1620px;
	}

	.state--read {
		padding: 12px;
	}

	.reading-container {
		gap: clamp(16px, 2.5vw, 40px);
	}

	.chapter-verses {
		max-height: min(65vh, 600px);
	}
}

/* Mobile Notice Popup */
.mobile-notice {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 10000;
	background: linear-gradient(135deg, rgba(31, 91, 138, 0.95), rgba(47, 127, 143, 0.95));
	backdrop-filter: blur(10px);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
	animation: slideDown 0.3s ease-out;
}

.mobile-notice-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	max-width: 600px;
	margin: 0 auto;
}

.mobile-notice-text {
	flex: 1;
	margin: 0;
	color: var(--text-1);
	font-size: clamp(0.9rem, 3.5vw, 1rem);
	font-weight: 500;
	letter-spacing: 0.01em;
}

.mobile-notice-btn {
	flex-shrink: 0;
	padding: 8px 20px;
	background: rgba(255, 255, 255, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 6px;
	color: var(--text-1);
	font-size: 0.95rem;
	font-weight: 600;
	font-family: var(--font-body);
	cursor: pointer;
	transition: all 0.2s ease;
	min-height: 44px;
	min-width: 60px;
}

.mobile-notice-btn:hover {
	background: rgba(255, 255, 255, 0.3);
	border-color: rgba(255, 255, 255, 0.5);
	transform: scale(1.05);
}

.mobile-notice-btn:active {
	transform: scale(0.98);
}

@keyframes slideDown {
	from {
		transform: translateY(-100%);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

@media (max-width: 1100px) {
	:root {
		--card-min: 88px;
		--grid-gap: 10px;
	}

	#app {
		padding: 16px;
	}
}

@media (max-width: 780px) {
	body {
		overflow: auto;
	}

	#app {
		grid-template-rows: auto 1fr;
		padding: 12px;
	}

	.viewport {
		min-height: 520px;
	}

	/* Show mobile notice on tablets and phones */
	.mobile-notice:not(.dismissed) {
		display: block;
	}

	.controls {
		justify-content: flex-start;
		flex-wrap: wrap;
		gap: 8px;
	}

	/* Make touch targets larger for mobile */
	.topic-action,
	.jump-button,
	.chapter-nav-btn {
		min-height: 44px;
		min-width: 44px;
		padding: 10px 16px;
		font-size: clamp(0.85rem, 3vw, 1rem);
	}

	/* Adjust header for mobile */
	.header {
		padding: 12px 8px;
	}

	.title {
		font-size: clamp(1.5rem, 5vw, 2rem);
	}

	.subtitle {
		font-size: clamp(0.8rem, 3vw, 1rem);
	}

	/* Make card titles more readable */
	:root {
		--card-min: 75px;
		--grid-gap: 8px;
	}

	/* Adjust reading pane max-width for mobile */
	.reading-pane {
		max-width: 100%;
		padding: 12px;
	}

	/* Stack verse modal content vertically on mobile */
	.verse-modal-content {
		padding: 12px;
	}

	/* Improve topic search on mobile */
	.topic-search input {
		font-size: 16px; /* Prevents iOS zoom on focus */
		min-height: 44px;
	}

	/* Make control pills more touch-friendly */
	.control-pill {
		padding: 8px 14px;
		font-size: clamp(0.8rem, 3vw, 0.95rem);
	}

	/* Hide info button on tablets and mobile */
	.info-btn {
		display: none;
	}
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
	:root {
		--card-min: 60px;
		--grid-gap: 6px;
	}

	#app {
		padding: 8px;
	}

	.header {
		padding: 8px 6px;
	}

	.title {
		font-size: clamp(1.2rem, 6vw, 1.8rem);
	}

	.controls {
		gap: 6px;
	}

	/* Hide less critical elements on very small screens */
	.control-pill {
		display: none;
	}

	/* Make jump controls stack better */
	.jump-controls {
		flex-wrap: wrap;
		gap: 6px;
	}

	.jump-select {
		min-width: 100px;
		font-size: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
	}
}

@media (min-width: 2560px) {
	.title {
		font-size: clamp(2.4rem, 2.2rem + 1vw, 3.8rem);
	}

	.subtitle {
		font-size: 1.35rem;
	}

	.source {
		font-size: 1.1rem;
	}

	.eyebrow {
		font-size: 0.9rem;
	}

	.control-pill {
		font-size: 1.28rem;
		padding: 13px 20px;
	}

	.state-labels,
	.state-captions {
		font-size: 1.02rem;
	}

	.state-captions {
		font-size: 1.16rem;
	}

	.topic-search input {
		font-size: 1.32rem;
		padding: 15px 18px;
	}

	.card-title-bar {
		font-size: 1rem;
		padding: 10px 12px;
	}

	.state-title {
		font-size: 2rem !important;
	}

	.state-meta {
		font-size: 1.3rem;
	}

	.state-current-topic {
		font-size: 1.4rem;
	}

	.chapter-nav-btn {
		font-size: 1.1rem;
		padding: 9px 16px;
		border-radius: 12px;
	}

	.chapter-nav-btn--ghost {
		font-size: 1.1rem;
		padding: 9px 16px;
	}

	.footer {
		font-size: 0.75rem;
		height: 32px;
		min-height: 32px;
		max-height: 32px;
	}

	.legend-item {
		font-size: 1.5rem;
	}

	.legend-line {
		width: 18px;
		height: 6px;
	}

	.separator-text {
		font-size: 1.1rem;
	}

	.info-btn {
		width: auto;
		height: auto;
		font-size: 1.8rem;
	}

	.book-summary-text {
		font-size: 1.15rem;
		line-height: 1.8;
	}

	.book-meta-name {
		font-size: 1.32em;
	}

	/* Book/Verse views 4K scaling (~30% increase) */
	.state--book .card {
		min-height: 143px;
	}

	.state--book #book-grid .card {
		min-height: 0;
	}

	.state--book #book-grid[data-density="high"] .card-title-bar {
		font-size: 0.84rem;
		padding: 5px 7px;
	}

	.state--book #book-grid[data-density="ultra"] .card-title-bar {
		font-size: 0.72rem;
		padding: 4px 6px;
	}

	.state--book #book-grid[data-density="high"] .expand-verses-btn {
		width: clamp(20px, 0.95vw, 30px);
		height: clamp(20px, 0.95vw, 30px);
		font-size: clamp(0.6rem, 0.46vw, 0.76rem);
	}

	.state--book #book-grid[data-density="ultra"] .expand-verses-btn {
		width: clamp(18px, 0.84vw, 26px);
		height: clamp(18px, 0.84vw, 26px);
		font-size: clamp(0.54rem, 0.4vw, 0.68rem);
	}

	.verse-modal {
		max-height: 100vh;
		max-width: 2200px;
		width: 98%;
		height: 77vh;
	}

	.verse-detail-pop {
		max-height: min(60vh, calc(100% - 140px));
		width: min(640px, 50%);
	}

	.verse-modal-overlay {
		align-items: center;
		overflow-y: auto;
		padding: 8px;
	}

	.reading-block {
		gap: 16px;
		font-size: 1.6rem;
		line-height: 1.8;
	}

	.reading-block h3 {
		font-size: 2rem;
	}

	.reading-block p {
		font-size: 1.6rem;
	}

	.state--read {
		padding: 21px;
	}

	.chapter-verses {
		max-height: min(75vh, 900px);
	}
}
