/* AppLogo */
.app-logo { display: block; flex: none; }

/* AppHeader */
.app-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: color-mix(in srgb, var(--bg) 86%, transparent);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
	padding-top: env(safe-area-inset-top);
}
.app-header .bar { display: flex; align-items: center; gap: 12px; height: var(--header-h); }
.app-header .brand {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--text);
	text-decoration: none !important;
}
.app-header .wordmark { font: 600 1.12rem/1 var(--font-serif); letter-spacing: -0.01em; }
.app-header .middle { flex: 1; min-width: 0; }
.app-header .nav { display: flex; gap: 2px; }
.app-header .nav .icon-btn { color: var(--muted); }
.app-header .nav .icon-btn:hover { color: var(--text); }

/* AppFooter */
.app-footer {
	margin-top: 64px;
	padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--border);
	color: var(--muted);
	font-size: 0.875rem;
}
.app-footer .inner p { margin: 0 0 8px; max-width: 46rem; }
.app-footer .links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.app-footer .links a { color: var(--muted); }
.app-footer .links a:hover { color: var(--text); }

/* WorkCover */
.work-cover {
	position: relative;
	aspect-ratio: 2 / 3;
	border-radius: 6px 10px 10px 6px;
	overflow: hidden;
	background: var(--surface-2);
	box-shadow: inset 3px 0 0 rgb(0 0 0 / 6%), var(--shadow);
	container-type: inline-size;
}
.work-cover .fallback {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 12% 10%;
	background:
		linear-gradient(160deg, hsl(var(--h) 32% 38%), hsl(calc(var(--h) + 30) 38% 24%));
	color: hsl(var(--h) 40% 94%);
	text-align: center;
}
.work-cover .f-title {
	font: 600 11cqi/1.2 var(--font-serif);
	display: -webkit-box;
	-webkit-line-clamp: 5;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: anywhere;
}
.work-cover .f-author {
	font: 7.5cqi/1.25 var(--font-ui);
	opacity: 0.8;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.work-cover img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top;
	background: #fff;
	opacity: 0;
	transition: opacity 0.35s var(--ease);
}
.work-cover.loaded img { opacity: 1; }
[data-theme='dark'] .work-cover.loaded img { filter: brightness(0.92); }

/* ProgressBar */
.progress-bar {
	display: flex;
	height: 4px;
	border-radius: 999px;
	overflow: hidden;
	background: var(--q-none);
}
.progress-bar.thick { height: 8px; }
.progress-bar span { display: block; height: 100%; }

/* WorkCard */
.work-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	text-align: left;
	cursor: pointer;
	color: inherit;
}
.work-card .work-cover { transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.work-card:hover .work-cover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.work-card .read {
	height: 3px;
	margin-top: -4px;
	border-radius: 999px;
	background: var(--q-none);
	overflow: hidden;
}
.work-card .read span { display: block; height: 100%; background: var(--accent); }
.work-card .title {
	font: 600 0.92rem/1.3 var(--font-ui);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.work-card .author {
	margin-top: 2px;
	color: var(--muted);
	font-size: 0.82rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.work-card .foot { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.work-card .note { color: var(--faint); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* WorkRow */
.work-row {
	display: grid;
	grid-template-columns: 56px 1fr;
	gap: 14px;
	width: 100%;
	padding: 12px 8px;
	border: 0;
	border-radius: var(--radius-sm);
	background: none;
	color: inherit;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s;
}
.work-row:hover { background: var(--surface-2); }
@media (min-width: 720px) {
	.work-row { grid-template-columns: 64px 1fr; padding: 14px 12px; }
}
.work-row .thumb { box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
.work-row .body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.work-row .title { font: 600 1rem/1.35 var(--font-ui); overflow-wrap: anywhere; }
.work-row .volume { font-weight: 400; color: var(--muted); }
.work-row .author { color: var(--muted); font-size: 0.9rem; }
.work-row .facts {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin-top: 3px;
	color: var(--faint);
	font-size: 0.8rem;
}
.work-row .fact { display: inline-flex; align-items: center; gap: 5px; }
.work-row .status.complete { color: var(--q4); font-weight: 600; }
.work-row .progress { margin-top: 7px; max-width: 280px; }

/* SheetDialog */
.sheet-dialog {
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--text);
	max-width: 100vw;
	max-height: 100dvh;
	width: 100%;
	margin: auto auto 0;
	overflow: visible;
}
.sheet-dialog::backdrop { background: rgb(10 10 15 / 42%); backdrop-filter: blur(2px); }
.sheet-dialog .inner {
	position: relative;
	max-height: 88dvh;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
	background: var(--surface);
	border-radius: 22px 22px 0 0;
	box-shadow: var(--shadow-lg);
	animation: up 0.28s var(--ease);
}
.sheet-dialog .grabber {
	width: 40px;
	height: 4px;
	margin: -10px auto 12px;
	border-radius: 999px;
	background: var(--border);
}
.sheet-dialog .close { position: absolute; top: 10px; right: 10px; color: var(--muted); }
@media (min-width: 720px) {
	.sheet-dialog { width: min(560px, calc(100vw - 48px)); margin: auto; }
	.sheet-dialog.wide { width: min(760px, calc(100vw - 48px)); }
	.sheet-dialog .inner { border-radius: 22px; padding: 28px; max-height: 86dvh; animation-name: pop; }
	.sheet-dialog .grabber { display: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(0.97); opacity: 0; } }

/* WorkSheet */
.work-sheet .top {
	display: grid;
	grid-template-columns: 104px 1fr;
	gap: 18px;
	align-items: start;
	padding-right: 28px;
}
@media (min-width: 720px) {
	.work-sheet .top { grid-template-columns: 132px 1fr; gap: 24px; }
}
.work-sheet .kind {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--muted);
	font-size: 0.8rem;
	margin-bottom: 6px;
}
.work-sheet h2 {
	font: 600 1.35rem/1.25 var(--font-serif);
	margin: 0;
	letter-spacing: -0.01em;
	overflow-wrap: anywhere;
}
.work-sheet .sub { margin: 6px 0 0; color: var(--muted); }
.work-sheet .author { margin: 8px 0 2px; font-weight: 500; }
.work-sheet .headline p { margin-bottom: 0; }
.work-sheet .actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 8px; }
.work-sheet .actions .primary { flex: 1 1 100%; min-height: 48px; font-size: 1rem; }
.work-sheet .actions .btn:not(.primary) { flex: 1; }
@media (min-width: 720px) {
	.work-sheet .actions .primary { flex: 1.4; }
}
.work-sheet .facts {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 6px 16px;
	margin: 18px 0;
	font-size: 0.92rem;
}
.work-sheet .facts dt { color: var(--muted); }
.work-sheet .facts dd { margin: 0; }
.work-sheet .quality { margin: 18px 0; padding: 16px; border-radius: var(--radius); background: var(--bg); }
.work-sheet .q-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.9rem; }
.work-sheet .legend {
	list-style: none;
	padding: 0;
	margin: 12px 0 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 4px 16px;
	font-size: 0.82rem;
	color: var(--muted);
}
.work-sheet .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
.work-sheet .legend span { float: right; font-variant-numeric: tabular-nums; }
.work-sheet .links {
	display: flex;
	flex-direction: column;
	border-top: 1px solid var(--border);
	margin-top: 10px;
}
.work-sheet .links a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 2px;
	border-bottom: 1px solid var(--border);
	color: var(--text);
}
.work-sheet .links a:hover { color: var(--accent); text-decoration: none; }
.work-sheet .links svg { color: var(--muted); }

/* SearchBox */
.search-box { position: relative; }
.search-box .box {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 56px;
	padding: 0 8px 0 18px;
	border: 1px solid var(--border);
	border-radius: 18px;
	background: var(--surface);
	box-shadow: var(--shadow);
	transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box .box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.search-box .lead { color: var(--muted); flex: none; }
.search-box input {
	flex: 1;
	min-width: 0;
	height: 100%;
	border: 0;
	outline: none;
	background: transparent;
	font-size: 1.05rem;
}
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box .trail { color: var(--muted); flex: none; margin-right: 8px; }
.search-box .icon-btn.trail { margin-right: 0; }
.search-box .results {
	list-style: none;
	margin: 8px 0 0;
	padding: 6px;
	border: 1px solid var(--border);
	border-radius: 18px;
	background: var(--surface);
	box-shadow: var(--shadow-lg);
	max-height: min(70vh, 640px);
	overflow-y: auto;
}
.search-box .hit {
	display: grid;
	grid-template-columns: 36px 1fr auto;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 8px 10px;
	border: 0;
	border-radius: 12px;
	background: none;
	color: inherit;
	text-align: left;
	cursor: pointer;
}
.search-box .hit.active { background: var(--surface-2); }
.search-box .mini { box-shadow: none; border-radius: 3px 5px 5px 3px; }
.search-box .text { min-width: 0; display: flex; flex-direction: column; }
.search-box .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-box .v { font-weight: 400; color: var(--muted); }
.search-box .a {
	color: var(--muted);
	font-size: 0.85rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.search-box .none { padding: 16px; color: var(--muted); text-align: center; }

/* LanguageGrid */
.language-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
}
@media (min-width: 720px) {
	.language-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
.language-grid .tile {
	display: flex;
	flex-direction: column;
	gap: 2px;
	height: 100%;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
	text-decoration: none !important;
	transition: border-color 0.15s, transform 0.15s var(--ease), box-shadow 0.15s;
}
.language-grid .tile:hover { border-color: var(--faint); transform: translateY(-1px); box-shadow: var(--shadow); }
.language-grid .name { font: 600 1.05rem/1.3 var(--font-serif); }
.language-grid .meta { color: var(--muted); font-size: 0.8rem; }

/* ReaderPage */
.reader-page { padding-bottom: 8px; }
.reader-page .mark {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 auto;
	padding: 18px 0 14px;
	color: var(--faint);
	font: 500 0.75rem/1 var(--font-ui);
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}
.reader-page .rule { flex: 1; height: 1px; background: var(--border); }
.reader-page .label { display: inline-flex; align-items: center; gap: 7px; }
.reader-page .dot { width: 7px; height: 7px; border-radius: 50%; }
.reader-page .tools {
	position: absolute;
	right: 0;
	display: flex;
	gap: 2px;
	background: var(--bg);
	opacity: 0;
	transition: opacity 0.15s;
}
.reader-page .tools .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.reader-page:hover .tools, .reader-page .tools:focus-within { opacity: 1; }
@media (hover: none) {
	.reader-page .tools { display: none; }
}
.reader-page .body { display: grid; gap: 28px; }
.reader-page .text-col { min-width: 0; }
.reader-page .placeholder {
	min-height: 70vh;
	display: grid;
	place-items: start center;
	padding-top: 20vh;
	color: var(--faint);
}
.reader-page .note { padding: 28px 0; color: var(--muted); font-style: italic; font-family: var(--font-serif); }
.reader-page .note a { font-style: normal; }
.reader-page .scan-col { margin: 0; min-width: 0; }
.reader-page .scan {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: var(--scan-bg);
	cursor: zoom-in;
	overflow: hidden;
	box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
}
.reader-page .scan img { display: block; width: 100%; height: 100%; object-fit: contain; }
[data-theme='dark'] .reader-page .scan img { filter: brightness(0.86) contrast(1.05); }

/* ReaderSettings */
.reader-settings h2 { font: 600 1.2rem/1.2 var(--font-ui); margin: 0 0 18px; }
.reader-settings .row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 0;
	border-top: 1px solid var(--border);
}
.reader-settings .lbl { display: flex; flex-direction: column; font-weight: 500; }
.reader-settings .lbl small { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.reader-settings .seg {
	display: inline-flex;
	padding: 3px;
	border-radius: 12px;
	background: var(--surface-2);
	flex-wrap: wrap;
}
.reader-settings .seg button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 34px;
	padding: 0 12px;
	border: 0;
	border-radius: 9px;
	background: none;
	color: var(--muted);
	font-size: 0.875rem;
	cursor: pointer;
}
.reader-settings .seg button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
.reader-settings .serif { font-family: var(--font-serif); }
.reader-settings .stepper { display: flex; align-items: center; gap: 4px; }
.reader-settings .val { min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.reader-settings .toggle { cursor: pointer; }
.reader-settings input[role='switch'] {
	appearance: none;
	flex: none;
	width: 46px;
	height: 28px;
	border-radius: 999px;
	background: var(--border);
	position: relative;
	cursor: pointer;
	transition: background 0.2s;
}
.reader-settings input[role='switch']::after {
	content: '';
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
	transition: transform 0.2s var(--ease);
}
.reader-settings input[role='switch']:checked { background: var(--accent); }
.reader-settings input[role='switch']:checked::after { transform: translateX(18px); }

/* PageJumper */
.page-jumper h2 { font: 600 1.2rem/1.2 var(--font-ui); margin: 0 0 18px; }
.page-jumper .preview { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 14px; }
.page-jumper .big { font: 500 2.6rem/1.1 var(--font-serif); font-variant-numeric: oldstyle-nums; }
.page-jumper .range-wrap { position: relative; padding: 10px 0; }
.page-jumper .strip {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 6px;
	margin-top: -3px;
	border-radius: 999px;
	opacity: 0.7;
}
.page-jumper input[type='range'] { position: relative; width: 100%; accent-color: var(--accent); background: transparent; }
.page-jumper .by-label { margin-top: 22px; }
.page-jumper .inline { display: flex; gap: 10px; margin-top: 6px; }

/* BookSearch */
.book-search h2 { font: 600 1.2rem/1.2 var(--font-ui); margin: 0 0 16px; }
.book-search .box {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 48px;
	padding: 0 14px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--bg);
}
.book-search .box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.book-search .box input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: none;
	background: none;
	height: 100%;
	font-size: 1rem;
}
.book-search .hits { list-style: none; margin: 8px 0 0; padding: 0; }
.book-search .hits button {
	display: grid;
	grid-template-columns: 3.5em 1fr;
	gap: 12px;
	width: 100%;
	padding: 10px 4px;
	border: 0;
	border-top: 1px solid var(--border);
	background: none;
	text-align: left;
	cursor: pointer;
	color: inherit;
}
.book-search .hits button:hover { background: var(--surface-2); }
.book-search .pg {
	font: 600 0.95rem/1.4 var(--font-serif);
	color: var(--accent);
	text-align: right;
	font-variant-numeric: oldstyle-nums;
}
.book-search .snip {
	font-size: 0.88rem;
	color: var(--muted);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.book-search .snip .searchmatch {
	color: var(--text);
	font-weight: 600;
	background: color-mix(in srgb, #ffd54a 45%, transparent);
	border-radius: 2px;
}

/* ScanZoom */
.scan-zoom {
	width: 100vw;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgb(12 12 14 / 96%);
	color: #fff;
}
.scan-zoom::backdrop { background: transparent; }
.scan-zoom .viewport {
	width: 100%;
	height: 100%;
	overflow: auto;
	display: grid;
	place-items: center;
	touch-action: pan-x pan-y pinch-zoom;
}
.scan-zoom .viewport img {
	max-width: 100vw;
	max-height: 100dvh;
	object-fit: contain;
	cursor: zoom-in;
	background: #fff;
}
.scan-zoom .viewport.actual { place-items: start center; }
.scan-zoom .viewport.actual img { max-width: none; max-height: none; width: min(1920px, 220vw); cursor: zoom-out; }
.scan-zoom .tools {
	position: fixed;
	left: 50%;
	bottom: calc(18px + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 4px;
	border-radius: 999px;
	background: rgb(30 30 34 / 88%);
	backdrop-filter: blur(10px);
}
.scan-zoom .tools .icon-btn { color: #fff; }
.scan-zoom .tools .icon-btn:hover { background: rgb(255 255 255 / 12%); }
.scan-zoom .lbl { min-width: 3em; text-align: center; font-variant-numeric: tabular-nums; font-size: 0.9rem; }

/* HomeView */
.home-view .hero { padding: 48px 0 8px; max-width: 760px; }
@media (min-width: 720px) {
	.home-view .hero { padding: 88px 0 16px; }
}
.home-view h1 {
	font: 500 clamp(2.2rem, 7vw, 3.6rem)/1.05 var(--font-serif);
	letter-spacing: -0.025em;
	margin: 0 0 18px;
}
.home-view h1 em { font-style: italic; color: var(--accent); }
.home-view .lede { color: var(--muted); font-size: 1.08rem; margin: 0 0 28px; max-width: 36rem; }
.home-view .tools { display: flex; align-items: center; gap: 6px; }
.home-view .shelf.dim { opacity: 0.5; transition: opacity 0.2s; }
.home-view .all-langs {
	font: 600 0.8rem/1 var(--font-ui);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
	margin: 26px 0 12px;
}

/* LanguageView */
.language-view .head { padding: 36px 0 8px; }
.language-view h1 {
	font: 500 clamp(2rem, 6vw, 2.8rem)/1.1 var(--font-serif);
	letter-spacing: -0.02em;
	margin: 0 0 6px;
}
.language-view .head p { margin: 0; }
.language-view .toolbar {
	position: sticky;
	top: calc(var(--header-h) + env(safe-area-inset-top));
	z-index: 10;
	display: flex;
	gap: 10px;
	padding: 14px 0 10px;
	background: var(--bg);
}
.language-view .find {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	height: 44px;
	padding: 0 4px 0 14px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface);
	color: var(--muted);
}
.language-view .find:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.language-view .find input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: none;
	background: none;
	color: var(--text);
	height: 100%;
}
.language-view .find input::-webkit-search-cancel-button { display: none; }
.language-view .sort { flex: none; width: 160px; }
@media (max-width: 480px) {
	.language-view .sort { width: 128px; }
}
.language-view .filter-row { margin: 4px 0 10px; }
.language-view .texts {
	margin: 18px 0 8px;
	padding: 16px 18px;
	border-radius: var(--radius);
	background: var(--surface);
	border: 1px solid var(--border);
}
.language-view .texts .section-head { margin-bottom: 8px; }
.language-view .texts h2 { font-size: 1rem; }
.language-view .texts .section-head a { display: inline-flex; align-items: center; gap: 4px; }
.language-view .text-hits { list-style: none; margin: 0; padding: 0; }
.language-view .more { margin-top: 4px; }
.language-view .text-hit {
	display: flex;
	gap: 10px;
	padding: 8px 0;
	color: var(--text);
	border-top: 1px solid var(--border);
}
.language-view li:first-child .text-hit { border-top: 0; }
.language-view .text-hit:hover { text-decoration: none; }
.language-view .text-hit:hover .t { color: var(--accent); }
.language-view .text-hit .icon { flex: none; margin-top: 3px; color: var(--muted); }
.language-view .t { display: block; font-weight: 600; }
.language-view .s {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: var(--muted);
	font-size: 0.85rem;
}
.language-view .s .searchmatch { color: var(--text); font-weight: 600; }
.language-view .count-line { margin: 14px 0 4px; min-height: 1.5em; }
.language-view .list { list-style: none; margin: 0 -8px; padding: 0; }
.language-view .sentinel { display: grid; place-items: center; min-height: 64px; }
.language-view .row-skeleton { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 12px 0; }
.language-view .row-skeleton > .skeleton { aspect-ratio: 2/3; }
.language-view .line { height: 14px; margin: 6px 0 10px; width: 70%; }
.language-view .line.short { width: 40%; }

/* Topics */
.topics-chips { flex-wrap: wrap; overflow: visible; }
.browse-view .head, .topic-view .head, .portal-view .head { padding: 36px 0 8px; }
.browse-view h1, .topic-view h1, .portal-view h1 {
	font: 500 clamp(2rem, 6vw, 2.8rem)/1.1 var(--font-serif);
	letter-spacing: -0.02em;
	margin: 0 0 6px;
}
.browse-view .head p, .topic-view .head p, .portal-view .head p { margin: 0 0 4px; }
.browse-view .head h1 { margin-bottom: 10px; }
.browse-types { flex-wrap: wrap; overflow: visible; margin-top: 18px; }
.browse-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 18px 0 8px; }
.browse-search { flex: 1 1 300px; min-width: 0; }
.browse-search .box {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 46px;
	padding: 0 8px 0 16px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	transition: border-color 0.15s, box-shadow 0.15s;
}
.browse-search .box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.browse-search .lead, .browse-search .trail { color: var(--muted); flex: none; }
.browse-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; font-size: 1rem; }
.browse-search input::-webkit-search-cancel-button { display: none; }
.browse-langs { flex-wrap: wrap; overflow: visible; }
.browse-more { width: auto; max-width: 210px; height: 36px; border-radius: 999px; font-size: 0.875rem; }
.browse-group { margin: 30px 0; }
.browse-group .section-head { margin-bottom: 6px; }
.browse-group h2 { display: flex; align-items: center; gap: 8px; }
.browse-group h2 .count { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.browse-intro { margin: 0 0 14px; }
.browse-group .topic-grid { margin: 14px 0; }
.browse-group .more { margin-top: 12px; }
.topic-grid.dim { opacity: 0.5; transition: opacity 0.2s; }
.topic-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	padding: 0;
	margin: 24px 0;
}
.topic-grid .chip { height: auto; min-height: 34px; padding: 6px 14px; white-space: normal; }
.topic-view .filter-row { margin: 4px 0 10px; }
.topic-view .count-line { margin: 14px 0 4px; min-height: 1.5em; }
.topic-view .list, .portal-view .list { list-style: none; margin: 0 -8px; padding: 0; }
.topic-view .row-skeleton, .portal-view .row-skeleton { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 12px 0; }
.topic-view .row-skeleton > .skeleton, .portal-view .row-skeleton > .skeleton { aspect-ratio: 2/3; }
.topic-view .line, .portal-view .line { height: 14px; margin: 6px 0 10px; width: 70%; }
.topic-view .line.short, .portal-view .line.short { width: 40%; }
.topic-view .more, .browse-view .more, .portal-view .more { margin-top: 18px; }
.topic-view .portals { margin: 18px 0 8px; }
.topic-view .portals h2 { font-size: 1rem; }
.portal-links { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 0; }
.portal-links a { display: inline-flex; align-items: center; gap: 5px; }
.work-sheet .facts dd.topics { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* ReaderView */
.reader-view { min-height: 100dvh; }
.reader-view .chrome {
	position: fixed;
	left: 0;
	right: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 4px;
	background: color-mix(in srgb, var(--bg) 95%, transparent);
	backdrop-filter: blur(14px);
	transition: transform 0.3s var(--ease), opacity 0.3s;
}
.reader-view .chrome-top {
	top: 0;
	height: calc(var(--header-h) + env(safe-area-inset-top));
	padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
	border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.reader-view .chrome-bottom {
	bottom: 0;
	justify-content: space-between;
	gap: 12px;
	height: calc(60px + env(safe-area-inset-bottom));
	padding: 0 max(12px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(12px, env(safe-area-inset-left));
	border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.reader-view.chrome-hidden .chrome-top { transform: translateY(-100%); opacity: 0; }
.reader-view.chrome-hidden .chrome-bottom { transform: translateY(100%); opacity: 0; }
.reader-view .heading {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 4px 6px;
	border: 0;
	background: none;
	color: inherit;
	text-align: left;
	cursor: pointer;
}
.reader-view .t1, .reader-view .t2 { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-view .t1 { font: 600 0.98rem/1.25 var(--font-ui); }
.reader-view .t2 { color: var(--muted); font-size: 0.8rem; }
.reader-view .view-switch { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.reader-view .view-switch button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 36px;
	padding: 0 12px;
	border: 0;
	border-radius: 9px;
	background: none;
	color: var(--muted);
	font-size: 0.85rem;
	cursor: pointer;
}
.reader-view .view-switch button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
@media (max-width: 380px) {
	.reader-view .view-switch span { display: none; }
}
.reader-view .pager {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	padding: 4px 8px;
	border: 0;
	border-radius: 10px;
	background: none;
	color: inherit;
	cursor: pointer;
	font-variant-numeric: tabular-nums;
}
.reader-view .pager:hover { background: var(--surface-2); }
.reader-view .pl { font: 600 1rem/1.2 var(--font-serif); }
.reader-view .pn { color: var(--muted); font-size: 0.75rem; }
.reader-view .progress { position: absolute; left: 0; right: 0; top: -1px; height: 2px; }
.reader-view .progress span {
	display: block;
	height: 100%;
	background: var(--accent);
	transition: width 0.3s var(--ease);
}
.reader-view .search-pill {
	position: fixed;
	z-index: 29;
	top: calc(var(--header-h) + env(safe-area-inset-top) + 10px);
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 2px 2px 2px 14px;
	border-radius: 999px;
	background: var(--text);
	color: var(--bg);
	font-size: 0.85rem;
	box-shadow: var(--shadow);
	transition: top 0.3s var(--ease);
}
.reader-view.chrome-hidden .search-pill { top: calc(10px + env(safe-area-inset-top)); }
.reader-view .search-pill button:first-child { border: 0; background: none; color: inherit; cursor: pointer; }
.reader-view .search-pill .icon-btn { width: 30px; height: 30px; color: inherit; }
.reader-view .search-pill .icon-btn:hover { background: rgb(255 255 255 / 15%); }
.reader-view .pages {
	padding: calc(var(--header-h) + env(safe-area-inset-top) + 12px) max(20px, env(safe-area-inset-right)) calc(110px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.reader-view .pages > .reader-page { margin: 0 auto; }
.reader-view .view-text > .reader-page { max-width: var(--measure); }
.reader-view .view-scan > .reader-page { max-width: 900px; }
.reader-view .view-split > .reader-page { max-width: 1560px; }
.reader-view .view-split .body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.reader-view .view-split .scan-col { position: sticky; top: calc(var(--header-h) + 12px); }
.reader-view .view-split .text-col { max-width: 40rem; justify-self: end; width: 100%; }
@media (max-width: 600px) {
	.reader-view .view-scan { padding-left: 8px; padding-right: 8px; }
}
.reader-view .reader-loading { max-width: var(--measure); margin: 40px auto; }
.reader-view .reader-loading .line { height: 14px; margin: 14px 0; }
.reader-view .error { max-width: 30rem; margin: 18vh auto; text-align: center; color: var(--muted); }

/* TextView */
.text-view .state { padding-top: 18vh; text-align: center; max-width: 36rem; }
.text-view .state p { display: flex; justify-content: center; align-items: center; gap: 8px; }
.text-view h1 { font: 500 1.8rem/1.2 var(--font-serif); }
.text-view .actions { gap: 10px; margin-top: 24px; }

/* AboutView */
.about-view .prose { max-width: 46rem; padding-top: 40px; }
.about-view h1 { font: 500 2.4rem/1.1 var(--font-serif); letter-spacing: -0.02em; }
.about-view h2 { font: 600 1.25rem/1.3 var(--font-ui); margin-top: 2.2em; scroll-margin-top: 80px; }
.about-view p, .about-view li { line-height: 1.65; }
.about-view code {
	font-size: 0.88em;
	background: var(--surface-2);
	padding: 1px 6px;
	border-radius: 5px;
	overflow-wrap: anywhere;
}
.about-view kbd {
	font: 600 0.8em var(--font-ui);
	padding: 1px 6px;
	border: 1px solid var(--border);
	border-bottom-width: 2px;
	border-radius: 5px;
	background: var(--surface);
}
.about-view .url {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
}
.about-view .url code { flex: 1; background: none; padding: 0; font-size: 0.95rem; }
.about-view .api li { margin-bottom: 6px; }

/* NotFoundView */
.not-found-view .nf { padding-top: 20vh; text-align: center; }
.not-found-view h1 { font: 500 2rem/1.2 var(--font-serif); }

/* AppFooter: interface language */
.app-footer .ui-lang { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.app-footer .ui-lang label { display: inline-flex; align-items: center; gap: 6px; }
.app-footer .ui-lang select { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 4px 8px; font-size: 0.85rem; }

/* SearchBox: texts */
.search-box .group { padding: 12px 10px 4px; color: var(--muted); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.search-box .text-icon { justify-self: center; color: var(--muted); }

/* WorkSheet: offline, contents */
.work-sheet .offline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; min-height: 36px; font-size: 0.9rem; }
.work-sheet .offline .ok { color: var(--q4); }
.work-sheet .author a { color: inherit; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 0.2em; }
.work-sheet .author a:hover { text-decoration-color: currentColor; }
.work-sheet .contents h3 { font: 600 0.8rem/1 var(--font-ui); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 0 8px; }

/* WorkContents */
.work-contents .toc { list-style: none; margin: 0 0 6px; padding: 0; }
.work-contents .toc button {
	display: flex;
	align-items: baseline;
	gap: 12px;
	width: 100%;
	padding: 8px 6px;
	border: 0;
	border-bottom: 1px solid var(--border);
	background: none;
	color: var(--text);
	text-align: left;
	cursor: pointer;
	font: 0.98rem/1.35 var(--font-serif);
}
.work-contents .toc button:hover { color: var(--accent); }
.work-contents .toc button.current { color: var(--accent); font-weight: 600; }
.work-contents .name { flex: 1; min-width: 0; }
.work-contents .pg { flex: none; color: var(--muted); font-size: 0.85rem; font-variant-numeric: oldstyle-nums tabular-nums; }

/* AuthorView */
.author-view .who { display: flex; gap: 24px; align-items: center; padding: 40px 0 8px; }
.author-view .portrait { width: 112px; height: 140px; object-fit: cover; object-position: top; border-radius: 12px; box-shadow: var(--shadow); background: var(--surface-2); flex: none; }
.author-view h1 { font: 500 clamp(2rem, 6vw, 2.8rem)/1.1 var(--font-serif); letter-spacing: -0.02em; margin: 0 0 6px; }
.author-view .who p { margin: 0; }
.author-view .ext { display: flex; gap: 16px; margin-top: 10px !important; font-size: 0.9rem; }
.author-view .ext a { display: inline-flex; align-items: center; gap: 5px; }
.author-view .bio { max-width: 46rem; font: 1.05rem/1.7 var(--font-serif); white-space: pre-line; margin: 18px 0 0; }
.author-view .site { border-top: 1px solid var(--border); padding: 4px 0; }
.author-view .site summary { display: flex; align-items: center; gap: 12px; padding: 12px 2px; cursor: pointer; list-style: none; }
.author-view .site summary::-webkit-details-marker { display: none; }
.author-view .site summary::before { content: '›'; color: var(--muted); transition: transform 0.2s; display: inline-block; width: 1em; }
.author-view .site[open] summary::before { transform: rotate(90deg); }
.author-view .site .name { font: 600 1.05rem/1.3 var(--font-serif); flex: 1; }
.author-view .texts { list-style: none; padding: 0 0 8px; margin: 0; columns: 2 18rem; column-gap: 32px; }
.author-view .texts li { break-inside: avoid; }
.author-view .texts a { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; color: var(--text); }
.author-view .texts a:hover { color: var(--accent); text-decoration: none; }
.author-view .texts svg { flex: none; color: var(--muted); position: relative; top: 2px; }
@media (max-width: 560px) { .author-view .who { flex-direction: column; align-items: flex-start; } }

/* ReaderPage: proofreading invitation */
.reader-page .invite {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 6px 0 4px;
	padding: 6px 4px 6px 12px;
	border-radius: 10px;
	background: color-mix(in srgb, var(--q1) 9%, transparent);
	color: var(--muted);
	font-size: 0.85rem;
	line-height: 1.4;
}
.reader-page .invite .icon { flex: none; color: var(--q1); }
.reader-page .invite span { flex: 1; }
.reader-page .invite .icon-btn { width: 30px; height: 30px; color: var(--muted); }

/* ReaderView: read-aloud player, panels */
.reader-view .player {
	position: fixed;
	z-index: 31;
	left: 50%;
	bottom: calc(72px + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 2px;
	max-width: calc(100vw - 24px);
	padding: 4px 14px 4px 4px;
	border-radius: 999px;
	background: var(--text);
	color: var(--bg);
	box-shadow: var(--shadow-lg);
	font-size: 0.85rem;
}
.reader-view.chrome-hidden .player { bottom: calc(14px + env(safe-area-inset-bottom)); }
.reader-view .player .icon-btn { color: inherit; width: 36px; height: 36px; }
.reader-view .player .icon-btn:hover { background: rgb(255 255 255 / 14%); }
.reader-view .player .rate { min-width: 3.2em; height: 30px; margin: 0 6px 0 2px; border: 1px solid rgb(255 255 255 / 30%); border-radius: 999px; background: none; color: inherit; font: 600 0.8rem var(--font-ui); cursor: pointer; }
.reader-view .player .what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.85; }
.reader-view .chrome-top .icon-btn[aria-pressed='true'] { color: var(--accent); }
.reader-view .panel-title { font: 600 1.2rem/1.2 var(--font-ui); margin: 0 0 12px; }
