/* ==========================================================================
   Onomato — tema aconchegante, mobile first
   ========================================================================== */

:root {
	--font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-display: "Fraunces", Georgia, "Times New Roman", serif;

	--gutter: 16px;
	--max: 1200px;
	--header-h: 60px;
	--tabbar-h: 64px;

	--r-sm: 10px;
	--r-md: 14px;
	--r-lg: 22px;
	--r-pill: 999px;

	--ease: cubic-bezier(.2, .7, .2, 1);
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-t: env(safe-area-inset-top, 0px);
}

/* Noite aconchegante (padrão) */
:root,
:root[data-theme="dark"] {
	color-scheme: dark;
	--bg: #17120f;
	--bg-soft: #1d1713;
	--surface: #261e19;
	--surface-2: #2f251f;
	--surface-3: #3a2e26;
	--line: rgba(255, 226, 190, .10);
	--line-strong: rgba(255, 226, 190, .18);
	--text: #f5ece0;
	--muted: #b8a897;
	--faint: #8c7d6e;
	--accent: #f0a857;
	--accent-2: #e2733f;
	--accent-ink: #2a1706;
	--accent-soft: rgba(240, 168, 87, .14);
	--glow: rgba(240, 168, 87, .12);
	--shadow: 0 10px 30px -12px rgba(0, 0, 0, .65);
	--shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .75);
	--glass: rgba(23, 18, 15, .78);
	--shimmer-a: #2a211b;
	--shimmer-b: #34281f;
}

/* Papel de manhã */
:root[data-theme="light"] {
	color-scheme: light;
	--bg: #faf4ea;
	--bg-soft: #f5ecdd;
	--surface: #fffaf1;
	--surface-2: #f3e8d6;
	--surface-3: #ead9bf;
	--line: rgba(90, 55, 20, .12);
	--line-strong: rgba(90, 55, 20, .22);
	--text: #2b1f16;
	--muted: #6f5d4b;
	--faint: #9a8671;
	--accent: #b4521b;
	--accent-2: #d07a2d;
	--accent-ink: #fff8ee;
	--accent-soft: rgba(180, 82, 27, .10);
	--glow: rgba(214, 140, 60, .16);
	--shadow: 0 10px 28px -14px rgba(90, 55, 20, .45);
	--shadow-lg: 0 24px 50px -22px rgba(90, 55, 20, .5);
	--glass: rgba(250, 244, 234, .82);
	--shimmer-a: #efe3d0;
	--shimmer-b: #f6ecdc;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
	margin: 0;
	min-height: 100dvh;
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.55;
	color: var(--text);
	background:
		radial-gradient(900px 420px at 15% -80px, var(--glow), transparent 70%),
		radial-gradient(700px 380px at 100% 0, rgba(226, 115, 63, .07), transparent 70%),
		var(--bg);
	background-attachment: fixed;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
	overflow-x: hidden;
}

/* grão de papel bem sutil */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	opacity: .035;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

main, .site-header, .site-footer, .tabbar { position: relative; z-index: 1; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: min(var(--max), 100% - var(--gutter) * 2); margin-inline: auto; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600; transition: top .2s; }
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }

.icon { width: 20px; height: 20px; flex: none; }
:root[data-theme="dark"] .only-light,
:root[data-theme="light"] .only-dark { display: none; }

/* --------------------------------------------------------------------------
   Botões e controles
   -------------------------------------------------------------------------- */

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 46px; padding: 0 20px;
	border: 1px solid transparent; border-radius: var(--r-pill);
	font-weight: 600; font-size: 15px; line-height: 1; white-space: nowrap;
	transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, border-color .18s;
}
.btn:active { transform: scale(.97); }
.btn--primary {
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	color: var(--accent-ink);
	box-shadow: 0 8px 22px -8px var(--accent-2);
}
.btn--primary:hover { box-shadow: 0 12px 28px -8px var(--accent-2); transform: translateY(-1px); }
.btn--ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { min-height: 38px; padding: 0 16px; font-size: 14px; }

.icon-btn {
	display: inline-grid; place-items: center;
	width: 44px; height: 44px; flex: none;
	border: 0; border-radius: var(--r-pill);
	background: transparent; color: var(--text);
	transition: background .18s, transform .18s var(--ease);
}
.icon-btn:hover { background: var(--accent-soft); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.is-disabled { opacity: .3; pointer-events: none; }

.link-btn { background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 5px 12px; border-radius: var(--r-pill);
	font-size: 13px; font-weight: 600;
	background: var(--accent-soft); color: var(--accent);
	border: 1px solid transparent;
}
.chip .icon { width: 15px; height: 15px; }
.chip--soft { background: var(--surface); color: var(--muted); border-color: var(--line); font-weight: 500; }

.eyebrow {
	display: inline-flex; align-items: center; gap: 6px;
	font-size: 12.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
	color: var(--accent);
}
.eyebrow .icon { width: 15px; height: 15px; }

/* --------------------------------------------------------------------------
   Cabeçalho, rodapé e navegação
   -------------------------------------------------------------------------- */

.site-header {
	position: sticky; top: 0; z-index: 50;
	padding-top: var(--safe-t);
	background: var(--glass);
	-webkit-backdrop-filter: blur(16px) saturate(1.3);
	backdrop-filter: blur(16px) saturate(1.3);
	border-bottom: 1px solid transparent;
	transition: border-color .2s, box-shadow .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 8px 24px -18px rgba(0, 0, 0, .6); }
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 12px; }

.brand { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; }
.logo { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 6px 16px -6px var(--accent-2); }
.brand-name { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 24px; letter-spacing: -.02em; }
.brand--small .logo { width: 26px; height: 26px; }
.brand--small .brand-name { font-size: 20px; }

.top-nav, .header-search { display: none; }

.tabbar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
	display: grid; grid-template-columns: repeat(4, 1fr);
	height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
	background: var(--glass);
	-webkit-backdrop-filter: blur(18px) saturate(1.3);
	backdrop-filter: blur(18px) saturate(1.3);
	border-top: 1px solid var(--line);
}
.tabbar a {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
	font-size: 11.5px; font-weight: 600; color: var(--faint);
	position: relative; transition: color .18s;
}
.tabbar a .icon { width: 23px; height: 23px; transition: transform .25s var(--ease); }
.tabbar a.is-active { color: var(--accent); }
.tabbar a.is-active .icon { transform: translateY(-1px) scale(1.08); }
.tabbar a.is-active::before {
	content: ""; position: absolute; top: 0; width: 28px; height: 3px;
	border-radius: 0 0 4px 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.site-main { min-height: 60dvh; padding-bottom: 32px; }

.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); font-size: 14px; }
.footer-inner { display: grid; gap: 10px; }
.footer-inner p { max-width: 520px; }

.toasts {
	position: fixed; left: 0; right: 0; z-index: 200;
	bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
	display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 var(--gutter);
}
.is-reader .toasts { bottom: calc(80px + var(--safe-b)); }
.toast {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 12px 18px; border-radius: var(--r-pill);
	background: var(--surface-3); color: var(--text);
	border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
	font-size: 14.5px; font-weight: 500;
	animation: toast-in .3s var(--ease) both;
}
.toast.is-leaving { animation: toast-out .25s ease both; }
.toast .icon { color: var(--accent); width: 18px; height: 18px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }

/* --------------------------------------------------------------------------
   Capas e cards
   -------------------------------------------------------------------------- */

.cover {
	position: relative; overflow: hidden;
	aspect-ratio: 2 / 3; border-radius: var(--r-md);
	background: linear-gradient(110deg, var(--shimmer-a) 30%, var(--shimmer-b) 50%, var(--shimmer-a) 70%) 0 0 / 200% 100%;
	animation: shimmer 1.6s linear infinite;
	box-shadow: var(--shadow);
	isolation: isolate;
}
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); pointer-events: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

.badge {
	position: absolute; left: 8px; bottom: 8px; z-index: 2;
	max-width: calc(100% - 16px);
	padding: 4px 10px; border-radius: var(--r-pill);
	font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
	background: var(--accent); color: var(--accent-ink);
	box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .5);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.card { position: relative; min-width: 0; }
.card-link { display: block; }
.card-title {
	margin-top: 10px;
	font-family: var(--font-body); font-weight: 600; font-size: 15px; line-height: 1.3; letter-spacing: 0;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	text-wrap: pretty;
}
.card-sub { margin-top: 2px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (hover: hover) {
	.card-link:hover .cover img { transform: scale(1.05); }
	.card-link:hover .card-title { color: var(--accent); }
}

.fav-btn {
	position: absolute; top: 6px; right: 6px; z-index: 3;
	width: 36px; height: 36px; display: grid; place-items: center;
	border: 0; border-radius: 50%;
	background: rgba(20, 14, 10, .55); color: #fff;
	-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
	transition: transform .2s var(--ease), background .2s, color .2s;
}
.fav-btn::after { content: ""; position: absolute; inset: -6px; }
.fav-btn .icon { width: 18px; height: 18px; }
.fav-btn:active { transform: scale(.88); }
.fav-btn.is-on { background: var(--accent); color: var(--accent-ink); }
.fav-btn.is-on .icon, .fav-toggle.is-on .icon { fill: currentColor; }
.fav-btn.pop, .fav-toggle.pop .icon { animation: pop .35s var(--ease); }
@keyframes pop { 40% { transform: scale(1.25); } }
.fav-toggle.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.grid {
	display: grid; gap: 22px 14px;
	grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
}

.rail {
	display: flex; gap: 14px; overflow-x: auto;
	margin-inline: calc(var(--gutter) * -1); padding: 4px var(--gutter) 12px;
	scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter);
	scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.rail::-webkit-scrollbar { display: none; }
.rail .card { flex: 0 0 140px; scroll-snap-align: start; }

/* --------------------------------------------------------------------------
   Seções
   -------------------------------------------------------------------------- */

.section { padding-top: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 24px; }
.link-more { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; font-size: 14.5px; }
.link-more .icon { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.link-more:hover .icon { transform: translateX(3px); }

.page-head { padding: 28px 0 18px; }
.page-head h1 { font-size: clamp(30px, 6vw, 42px); }
.page-head p { margin-top: 6px; color: var(--muted); }

/* Hero */
.hero { position: relative; }
.hero-track {
	display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
	scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide { position: relative; flex: 0 0 100%; scroll-snap-align: start; overflow: hidden; }
.hero-bg {
	position: absolute; inset: -40px; background-size: cover; background-position: center;
	filter: blur(36px) saturate(1.3); opacity: .38; transform: scale(1.1);
}
.hero-slide::after {
	content: ""; position: absolute; inset: 0;
	background: linear-gradient(180deg, transparent 35%, var(--bg) 100%);
}
.hero-inner {
	position: relative; z-index: 2;
	display: grid; grid-template-columns: 116px 1fr; column-gap: 16px; row-gap: 10px;
	align-content: start; padding: 24px 0 52px;
}
.hero-cover { grid-row: 1 / span 3; display: block; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-lg); aspect-ratio: 2 / 3; transform: rotate(-2deg); background: var(--surface); }
.hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.hero-copy { display: contents; }
.hero-copy > .eyebrow, .hero-copy > .hero-title, .hero-copy > .chips { grid-column: 2; }
.hero-copy > .hero-text, .hero-copy > .hero-actions { grid-column: 1 / -1; }
.hero-title { font-size: clamp(24px, 6.4vw, 44px); font-weight: 700; }
.hero-title a:hover { color: var(--accent); }
.hero-text { color: var(--muted); font-size: 15px; max-width: 60ch; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.hero-dots { position: absolute; z-index: 3; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 8px; }
.dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: var(--r-pill); background: var(--line-strong); transition: width .3s var(--ease), background .3s; position: relative; }
.dot::after { content: ""; position: absolute; inset: -10px -4px; }
.dot.is-active { width: 26px; background: var(--accent); }

/* Atualizações recentes */
.updates { display: grid; gap: 12px; grid-template-columns: 1fr; }
.update {
	display: grid; grid-template-columns: 82px 1fr; gap: 14px; align-items: start;
	padding: 12px; border-radius: var(--r-lg);
	background: var(--surface); border: 1px solid var(--line);
	transition: transform .2s var(--ease), border-color .2s, background .2s;
}
.update:hover { transform: translateY(-2px); border-color: var(--line-strong); background: var(--surface-2); }
.cover--sm { border-radius: var(--r-sm); box-shadow: none; }
.update-body { min-width: 0; display: grid; gap: 4px; align-content: start; }
.update-body h3 { font-family: var(--font-body); font-size: 16px; font-weight: 700; line-height: 1.25; letter-spacing: 0; }
.update-chapters, .update-time { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent); }
.update-chapters .icon, .update-time .icon { width: 15px; height: 15px; }
.update-time { color: var(--faint); font-weight: 500; }
.update-text { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Estados vazios e erros */
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 56px 16px; }
.empty-icon { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.empty-icon .icon { width: 30px; height: 30px; }
.empty h2 { font-size: 24px; }
.empty p { color: var(--muted); max-width: 40ch; }
.empty .btn { margin-top: 12px; }

.error-page { text-align: center; padding: 56px 0 40px; display: grid; justify-items: center; gap: 12px; }
.error-code { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: clamp(88px, 28vw, 168px); line-height: .9; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { font-size: clamp(26px, 6vw, 38px); }
.error-page > p:not(.error-code) { color: var(--muted); max-width: 44ch; }
.error-page .hero-actions { justify-content: center; margin-top: 10px; }
.debug { margin-top: 20px; text-align: left; max-width: 100%; color: var(--muted); font-size: 13px; }
.debug pre { white-space: pre-wrap; word-break: break-word; background: var(--surface); padding: 12px; border-radius: var(--r-sm); }

/* --------------------------------------------------------------------------
   Filtros, busca, paginação
   -------------------------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.select { position: relative; display: block; flex: 1 1 100%; min-width: 0; }
@media (min-width: 640px) { .filters .select { flex: 1 1 180px; } }
.select::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-75%) rotate(45deg); pointer-events: none; }
.select select {
	width: 100%; min-height: 46px; padding: 0 38px 0 16px; appearance: none; -webkit-appearance: none;
	background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-pill);
	font-size: 15px; font-weight: 500; text-overflow: ellipsis;
}
.select select:hover { background: var(--surface-2); }

.search-box, .mini-search, .header-search {
	display: flex; align-items: center; gap: 10px;
	background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-pill);
	transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within, .mini-search:focus-within, .header-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.header-search { display: none; }
.search-box { padding: 5px 5px 5px 18px; margin-bottom: 22px; }
.search-box > .icon, .mini-search > .icon, .header-search > .icon { color: var(--faint); }
.search-box input, .mini-search input, .header-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 16px; }
.search-box input { min-height: 42px; }
.search-box input::placeholder, .mini-search input::placeholder, .header-search input::placeholder { color: var(--faint); }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; }
.result-count { margin-bottom: 18px; }
.result-count strong { color: var(--text); }
#search-results { min-height: 200px; transition: opacity .2s; }
#search-results.is-loading { opacity: .5; }

.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin: 36px 0 8px; }
.page-btn {
	min-width: 44px; height: 44px; padding: 0 12px; display: inline-grid; place-items: center;
	border-radius: var(--r-pill); font-weight: 600; background: var(--surface); border: 1px solid var(--line);
	transition: background .18s, transform .18s var(--ease);
}
.page-btn:hover { background: var(--surface-2); }
.page-btn.is-current { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.page-gap { color: var(--faint); }

/* --------------------------------------------------------------------------
   Página da HQ
   -------------------------------------------------------------------------- */

.hq-hero { position: relative; overflow: hidden; }
.hq-hero-bg { position: absolute; inset: -50px; background-size: cover; background-position: center top; filter: blur(44px) saturate(1.3); opacity: .35; transform: scale(1.1); }
.hq-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--bg) 100%); }
.hq-hero-inner { position: relative; z-index: 2; padding: 14px 0 28px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin-left: -6px; padding: 0 10px 0 4px; color: var(--muted); font-weight: 600; font-size: 14.5px; }
.back-link:hover { color: var(--text); }
.hq-top { display: grid; gap: 20px; justify-items: center; text-align: center; margin-top: 4px; }
.cover--lg { width: min(58vw, 230px); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: none; background: var(--surface); }
.hq-info { display: grid; gap: 12px; justify-items: center; }
.hq-info h1 { font-size: clamp(28px, 7.5vw, 46px); font-weight: 700; }
.hq-info .chips, .hq-info .hero-actions { justify-content: center; }
.hq-info .hero-actions .btn { flex: 1 1 auto; }

.hq-body { padding-bottom: 20px; }
.hq-synopsis { padding-top: 6px; }
.hq-synopsis h2, .chapters h2 { font-size: 22px; }
.hq-synopsis h2 { margin-bottom: 10px; }
.synopsis { color: var(--muted); max-width: 72ch; white-space: pre-line; text-wrap: pretty; }
.synopsis.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

.chapters { padding-top: 30px; }
.chapters-tools { display: flex; align-items: center; gap: 6px; }
.mini-search { padding: 0 14px; min-height: 44px; }
.mini-search input { width: 120px; font-size: 15px; }
.chapter-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.chapter {
	position: relative; display: grid; align-content: center; gap: 1px; min-height: 58px; padding: 10px 12px;
	border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
	transition: transform .18s var(--ease), border-color .18s, background .18s;
}
.chapter:hover { border-color: var(--accent); transform: translateY(-2px); }
.chapter-num { font-weight: 700; font-size: 16px; }
.chapter-name { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-mark { position: absolute; top: 7px; right: 8px; color: var(--accent); }
.chapter-mark .icon { width: 15px; height: 15px; }
.chapter.is-read { background: transparent; }
.chapter.is-read .chapter-num { color: var(--faint); font-weight: 600; }
.chapter.is-current { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.no-match { padding: 24px 0; text-align: center; }

/* --------------------------------------------------------------------------
   Biblioteca
   -------------------------------------------------------------------------- */

.tabs { display: flex; gap: 8px; margin-bottom: 26px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r-pill); font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; transition: background .18s, color .18s; }
.tab .icon { width: 18px; height: 18px; }
.tab .count { font-size: 12px; min-width: 22px; padding: 1px 7px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text); text-align: center; }
.tab.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tab.is-active .count { background: var(--accent); color: var(--accent-ink); }

.history { display: grid; gap: 12px; grid-template-columns: 1fr; }
.history-item { display: grid; grid-template-columns: 78px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); transition: opacity .25s, transform .25s; }
.history-item.is-removing { opacity: 0; transform: translateX(16px); }
.history-body { min-width: 0; display: grid; gap: 4px; }
.history-body h3 { font-family: var(--font-body); font-size: 16px; font-weight: 700; letter-spacing: 0; line-height: 1.25; }
.history-body h3 a:hover { color: var(--accent); }
.history-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }

/* --------------------------------------------------------------------------
   Leitor
   -------------------------------------------------------------------------- */

body.is-reader { padding-bottom: 0; background: #0f0b09; }
:root[data-theme="light"] body.is-reader { background: #e9dfce; }
body.is-reader::before { display: none; }

.reader { --bar-bg: var(--glass); min-height: 100dvh; }
.reader-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; background: transparent; }
.reader-progress span { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: transform .15s linear; }

.reader-bar {
	position: fixed; left: 0; right: 0; z-index: 80;
	display: flex; align-items: center; gap: 4px;
	padding: 6px 8px; background: var(--bar-bg);
	-webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
	transition: transform .3s var(--ease), opacity .3s;
}
.reader-bar--top { top: 0; padding-top: calc(6px + var(--safe-t)); border-bottom: 1px solid var(--line); }
.reader-bar--bottom { bottom: 0; padding-bottom: calc(6px + var(--safe-b)); border-top: 1px solid var(--line); justify-content: center; gap: 10px; }
.reader.bars-hidden .reader-bar--top { transform: translateY(-110%); opacity: 0; }
.reader.bars-hidden .reader-bar--bottom { transform: translateY(110%); opacity: 0; }
.reader-title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.reader-title strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-title span { font-size: 12.5px; color: var(--muted); }
.select--reader { flex: 0 1 280px; }
.select--reader select { min-height: 44px; }

.reader-counter {
	position: fixed; right: 16px; bottom: calc(76px + var(--safe-b)); z-index: 80;
	padding: 6px 13px; border-radius: 999px; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
	color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
	backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
	pointer-events: none; transition: bottom .25s ease;
}
.reader.counter-off .reader-counter { display: none; }
[data-counter-toggle][aria-pressed="false"] { opacity: .5; }
.reader.bars-hidden .reader-counter { bottom: calc(14px + var(--safe-b)); }
.reader-pages { width: min(100%, 860px); margin-inline: auto; padding: calc(56px + var(--safe-t)) 0 calc(76px + var(--safe-b)); }
.page { margin: 0; background: linear-gradient(110deg, var(--shimmer-a) 30%, var(--shimmer-b) 50%, var(--shimmer-a) 70%) 0 0 / 200% 100%; }
.page:not(.is-loaded) { aspect-ratio: 2 / 3; animation: shimmer 1.6s linear infinite; }
.page img { width: 100%; height: auto; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.reader-end { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 56px 20px 40px; }
.reader-end h2 { font-size: 28px; }
.reader-end .hero-actions { justify-content: center; margin-top: 8px; }

/* modo página a página */
.reader.is-paged { height: 100dvh; overflow: hidden; }
.reader.is-paged .reader-pages { position: fixed; inset: 0; width: 100%; max-width: none; padding: 0; }
.reader.is-paged .page { display: none; height: 100dvh; background: none; animation: none; }
.reader.is-paged { --pg-top: calc(52px + var(--safe-t)); --pg-bottom: calc(60px + var(--safe-b)); }
.reader.is-paged.bars-hidden { --pg-top: var(--safe-t); --pg-bottom: var(--safe-b); }
.reader.is-paged .page.is-active { display: grid; place-items: center; padding: var(--pg-top) 0 var(--pg-bottom); }
.reader.is-paged .page img { width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - var(--pg-top) - var(--pg-bottom)); object-fit: contain; }
.reader.is-paged .reader-end { display: none; }
.reader.is-paged .reader-end.is-active { display: grid; height: 100dvh; align-content: center; }

/* --------------------------------------------------------------------------
   Telas maiores
   -------------------------------------------------------------------------- */

@media (min-width: 640px) {
	:root { --gutter: 24px; }
	.grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 28px 20px; }
	.rail .card { flex-basis: 168px; }
	.updates { grid-template-columns: repeat(2, 1fr); }
	.history { grid-template-columns: repeat(2, 1fr); }
	.hero-inner { grid-template-columns: 150px 1fr; column-gap: 24px; padding-top: 32px; }
	.hq-info .hero-actions .btn { flex: 0 0 auto; }
}

@media (min-width: 900px) {
	:root { --header-h: 68px; }
	body { padding-bottom: 0; }
	.tabbar { display: none; }
	.toasts { bottom: 24px; }
	.top-nav { display: flex; gap: 4px; margin-right: 8px; }
	.top-nav a { padding: 8px 14px; border-radius: var(--r-pill); font-weight: 600; font-size: 15px; color: var(--muted); transition: color .18s, background .18s; }
	.top-nav a:hover { color: var(--text); background: var(--accent-soft); }
	.top-nav a.is-active { color: var(--accent); background: var(--accent-soft); }
	.brand { margin-right: 12px; }
	.header-search { display: flex; width: 280px; padding: 0 14px; min-height: 42px; margin-left: auto; }
	.section { padding-top: 52px; }
	.section-head h2 { font-size: 28px; }
	.rail { margin-inline: 0; padding-inline: 0; }
	.updates { grid-template-columns: repeat(3, 1fr); }
	.history { grid-template-columns: repeat(3, 1fr); }
	.grid { grid-template-columns: repeat(6, 1fr); }
	.hero-inner { grid-template-columns: 250px 1fr; column-gap: 48px; padding: 56px 0 80px; align-items: center; align-content: center; }
	.hero-cover { grid-row: auto; transform: rotate(-2.5deg); transition: transform .4s var(--ease); }
	.hero-slide:hover .hero-cover { transform: rotate(0) scale(1.02); }
	.hero-copy { display: grid; gap: 14px; align-content: center; }
	.hero-copy > * { grid-column: auto !important; }
	.hero-text { font-size: 16.5px; -webkit-line-clamp: 4; }
	.hq-hero-inner { padding-bottom: 44px; }
	.hq-top { grid-template-columns: 260px 1fr; text-align: left; justify-items: start; align-items: end; gap: 44px; margin-top: 12px; }
	.cover--lg { width: 260px; }
	.hq-info { justify-items: start; }
	.hq-info .chips, .hq-info .hero-actions { justify-content: flex-start; }
	.chapter-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
	.synopsis.is-clamped { -webkit-line-clamp: 5; }
	.mini-search input { width: 160px; }
	.footer-inner { grid-template-columns: auto 1fr; align-items: center; gap: 24px; }
	.reader-pages { padding-top: calc(64px + var(--safe-t)); }
}

@media (min-width: 1200px) {
	.grid { grid-template-columns: repeat(7, 1fr); }
}

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

/* ==========================================================================
   Conta, formulários e administração
   ========================================================================== */

.btn--block { width: 100%; }
.btn--danger { color: #e0614f; border-color: rgba(224, 97, 79, .4); }
.btn--danger:hover { background: rgba(224, 97, 79, .12); }

.avatar {
	display: inline-grid; place-items: center; flex: none;
	width: 40px; height: 40px; border-radius: 50%;
	background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
	font-weight: 700; font-size: 16px; font-family: var(--font-display);
	box-shadow: 0 6px 16px -8px var(--accent-2);
	transition: transform .2s var(--ease);
}
.avatar:hover { transform: scale(1.06); }
.site-header .btn--sm { min-height: 40px; }

/* Cartão de login/cadastro */
.auth-card {
	width: min(440px, 100%); margin: 28px auto 12px; padding: 28px 22px;
	display: grid; gap: 14px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
	box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 32px; }
.auth-alt { text-align: center; color: var(--muted); font-size: 14.5px; }
.auth-alt a { color: var(--accent); font-weight: 600; }
.fine-print { font-size: 12.5px; color: var(--faint); text-align: center; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-size: 13.5px; font-weight: 600; color: var(--muted); }
.field small { font-weight: 400; color: var(--faint); }
.field input, .input {
	width: 100%; min-height: 48px; padding: 0 16px;
	background: var(--bg-soft); border: 1px solid var(--line-strong); border-radius: var(--r-md);
	font-size: 16px; /* 16px evita o zoom automático do iOS */
	transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.password { position: relative; display: block; }
.password input { padding-right: 52px; }
.password .icon-btn { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; color: var(--muted); }
.password .icon-btn.is-on { color: var(--accent); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.alert { padding: 12px 16px; border-radius: var(--r-md); font-size: 14.5px; border: 1px solid transparent; margin-bottom: 4px; }
.alert--error { background: rgba(224, 97, 79, .12); border-color: rgba(224, 97, 79, .35); color: #e8806f; }
:root[data-theme="light"] .alert--error { color: #a8321f; }
.alert--ok { background: rgba(120, 180, 110, .13); border-color: rgba(120, 180, 110, .35); color: #8fcf84; margin-bottom: 16px; }
:root[data-theme="light"] .alert--ok { color: #2f6b27; }

/* Conta */
.account-grid { display: grid; gap: 16px; margin-bottom: 20px; }
.panel { display: grid; gap: 14px; align-content: start; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel h2 { font-size: 20px; }
.sessions { display: grid; gap: 10px; }
.session { padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-soft); border: 1px solid var(--line); }
.session p { font-size: 13px; margin-top: 2px; }
.session .chip { margin-left: 8px; padding: 2px 10px; font-size: 12px; }
.logout-form { margin: 8px 0 24px; }

/* Administração */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { display: grid; gap: 2px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat strong { font-family: var(--font-display); font-size: 30px; line-height: 1.1; }
.stat small { color: var(--faint); font-size: 12.5px; }

.bars { display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(80px, 1.3fr) 2fr auto; gap: 10px; align-items: center; font-size: 14px; }
.bars li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 12px 14px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-bot { opacity: .6; }
.table code { font-size: 13px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.tag--accent { background: var(--accent-soft); color: var(--accent); }
.tag--warn { background: rgba(224, 160, 60, .16); color: #e0a03c; }
.method { font-size: 11.5px; font-weight: 700; color: var(--faint); }
.status { font-size: 12px; font-weight: 700; color: var(--faint); }
.status--4, .status--5 { color: #e0614f; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.filters--grid { align-items: center; }
.filters--grid .input { flex: 1 1 150px; min-height: 42px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); min-height: 42px; }

/* Em telas pequenas as tabelas viram cartões empilhados */
@media (max-width: 760px) {
	.table-wrap { border: 0; background: none; overflow: visible; }
	.table thead { display: none; }
	.table, .table tbody, .table tr, .table td { display: block; width: 100%; }
	.table tr { margin-bottom: 12px; padding: 6px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
	.table td { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
	.table td:last-child { border-bottom: 0; }
	.table td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--faint); }
	.table td[colspan] { display: block; }
	.table td[colspan]::before { content: none; }
}

@media (min-width: 640px) {
	.stats { grid-template-columns: repeat(3, 1fr); }
	.account-grid { grid-template-columns: repeat(2, 1fr); }
	.panel--wide { grid-column: 1 / -1; }
	.auth-card { padding: 34px 32px; margin-top: 48px; }
}
@media (min-width: 900px) {
	.stats { grid-template-columns: repeat(6, 1fr); }
	.stat strong { font-size: 26px; }
}
