:root {
  color-scheme: dark;
  --bg: #090b12;
  --panel: #111522;
  --panel-2: #171c2c;
  --text: #f7f7fb;
  --muted: #969cad;
  --accent: #8b5cf6;
  --accent-2: #d946ef;
  --line: rgba(255,255,255,.09);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 82% -8%, rgba(139,92,246,.2), transparent 32rem), var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, .file-button { min-height: 44px; }
.app-shell { width: min(100%, 920px); min-height: 100vh; margin: 0 auto; padding-bottom: calc(88px + var(--safe-bottom)); }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(14px + var(--safe-top)) 18px 12px; background: linear-gradient(to bottom, rgba(9,11,18,.98) 72%, rgba(9,11,18,.8)); backdrop-filter: blur(18px); }
.topbar h1 { margin: 1px 0 0; font-size: 24px; letter-spacing: -.8px; }
.topbar h1 span, .hero em { color: #b69aff; font-style: normal; }
.eyebrow { margin: 0; color: #9b7cf4; font-size: 10px; font-weight: 800; letter-spacing: 1.7px; }
.network-badge { padding: 7px 10px; border: 1px solid rgba(74,222,128,.25); border-radius: 999px; color: #86efac; background: rgba(74,222,128,.08); font-size: 11px; font-weight: 700; }
.network-badge.offline { color: #fca5a5; border-color: rgba(248,113,113,.25); background: rgba(248,113,113,.08); }
main { padding: 0 16px; }
.view { display: none; animation: fade .18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: .4; transform: translateY(4px); } }
.hero { padding: 28px 4px 22px; }
.hero h2 { max-width: 650px; margin: 8px 0 10px; font-size: clamp(38px, 10vw, 62px); line-height: .98; letter-spacing: -2.4px; }
.hero > p:last-child { max-width: 560px; margin: 0; color: var(--muted); line-height: 1.5; }
.search-wrap { position: sticky; top: calc(68px + var(--safe-top)); z-index: 15; padding: 8px 0 14px; background: linear-gradient(to bottom, var(--bg) 80%, transparent); }
.search-form { display: flex; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: rgba(19,23,37,.95); box-shadow: 0 18px 40px rgba(0,0,0,.22); }
.search-form input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 0 10px; color: var(--text); background: transparent; font-size: 16px; }
.search-form button, .empty-state button, .primary { border: 0; border-radius: 13px; padding: 0 17px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-weight: 800; box-shadow: 0 8px 24px rgba(139,92,246,.26); }
.subtle { margin: 10px 3px 0; color: var(--muted); font-size: 13px; }
.poster-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px 11px; padding: 4px 0 22px; }
.anime-card { min-width: 0; cursor: pointer; }
.poster-wrap { position: relative; overflow: hidden; aspect-ratio: 2/3; border-radius: 17px; background: var(--panel-2); box-shadow: 0 10px 30px rgba(0,0,0,.32); }
.poster-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .25s ease; }
.anime-card:active .poster-wrap img { transform: scale(.98); }
.score-badge, .status-badge { position: absolute; top: 9px; padding: 6px 8px; border-radius: 10px; font-size: 11px; font-weight: 850; backdrop-filter: blur(12px); }
.score-badge { right: 9px; background: rgba(9,11,18,.78); }
.status-badge { left: 9px; background: rgba(139,92,246,.86); }
.card-copy { padding: 9px 3px 0; }
.card-copy h3 { margin: 0; overflow: hidden; font-size: 14px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.card-copy p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; padding: 26px 2px 14px; }
.section-heading h2 { margin: 4px 0 0; font-size: 34px; letter-spacing: -1.3px; }
.count-pill { min-width: 34px; padding: 7px 10px; border-radius: 999px; background: var(--panel-2); color: #c4b5fd; text-align: center; font-weight: 800; }
.filter-row { display: flex; gap: 7px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px 8px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; color: var(--muted); background: var(--panel); font-size: 13px; }
.chip.active { color: white; border-color: rgba(139,92,246,.55); background: rgba(139,92,246,.18); }
.empty-state { margin: 44px auto; max-width: 360px; padding: 30px 22px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); text-align: center; }
.empty-state span { display: block; color: #b69aff; font-size: 32px; }
.empty-state h3 { margin: 12px 0 5px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.empty-state button { padding: 0 18px; }
.hidden { display: none !important; }
.top-list { display: grid; gap: 11px; margin-top: 18px; }
.top-card { display: grid; grid-template-columns: 40px 68px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(23,28,44,.92), rgba(14,17,28,.94)); }
.top-card.podium { grid-template-columns: 45px 88px minmax(0,1fr) auto; min-height: 145px; background: radial-gradient(circle at 10% 20%, rgba(139,92,246,.2), transparent 45%), var(--panel); }
.rank { color: #b69aff; font-size: 25px; font-weight: 900; text-align: center; }
.top-card img { width: 100%; aspect-ratio: 2/3; border-radius: 12px; object-fit: cover; }
.top-info { min-width: 0; }
.top-info h3 { margin: 0; font-size: 14px; line-height: 1.3; }
.top-info p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.rank-actions { display: grid; gap: 5px; }
.rank-actions button { min-width: 38px; min-height: 36px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.04); }
.stats-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-bottom: 16px; }
.stat { min-height: 104px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.stat strong { display: block; font-size: 29px; letter-spacing: -1px; }
.stat span { color: var(--muted); font-size: 12px; }
.settings-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 10px 0; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.settings-card h3 { margin: 0 0 5px; }
.settings-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.button-row { display: flex; flex-direction: column; gap: 7px; }
.secondary, .file-button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: rgba(255,255,255,.045); font-size: 13px; font-weight: 750; white-space: nowrap; cursor: pointer; }
.file-button input { display: none; }
.privacy-note { padding: 13px 10px; color: #747b8e; font-size: 12px; text-align: center; }
.bottom-nav { position: fixed; z-index: 40; left: 50%; bottom: 0; display: grid; grid-template-columns: repeat(4,1fr); width: min(100%, 920px); transform: translateX(-50%); padding: 7px 10px calc(7px + var(--safe-bottom)); border-top: 1px solid var(--line); background: rgba(11,13,21,.91); backdrop-filter: blur(22px) saturate(1.4); }
.nav-item { display: grid; place-items: center; gap: 2px; border: 0; border-radius: 13px; color: #767d90; background: transparent; }
.nav-item span { font-size: 22px; line-height: 1; }
.nav-item small { font-size: 10px; }
.nav-item.active { color: #b69aff; background: rgba(139,92,246,.09); }
dialog { width: min(calc(100% - 20px), 600px); max-height: calc(100dvh - 22px); margin: auto auto 10px; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 27px; color: var(--text); background: #0e111c; box-shadow: 0 30px 90px rgba(0,0,0,.75); }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(7px); }
.detail-hero { position: relative; min-height: 340px; overflow: hidden; border-radius: 26px 26px 0 0; }
.detail-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.52); }
.detail-hero::after { content:""; position:absolute; inset:0; background:linear-gradient(to top,#0e111c 2%,transparent 75%); }
.detail-close { position: sticky; z-index: 5; top: 12px; float: right; margin: 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; width: 44px; height: 44px; background: rgba(8,10,17,.66); backdrop-filter: blur(10px); }
.detail-title { position: absolute; z-index: 2; right: 20px; bottom: 12px; left: 20px; }
.detail-title h2 { margin: 5px 0; font-size: 30px; line-height: 1.05; letter-spacing: -1px; }
.detail-title p { margin: 0; color: #c9ccda; font-size: 13px; }
.detail-body { padding: 12px 20px calc(22px + var(--safe-bottom)); }
.genre-row { display: flex; gap: 6px; overflow: auto; padding-bottom: 10px; }
.genre-row span { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; color: #c4b5fd; background: rgba(139,92,246,.12); font-size: 11px; }
.description { color: #aeb3c2; font-size: 13px; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1/-1; }
.field span { color: var(--muted); font-size: 11px; font-weight: 700; }
.field select, .field input, .field textarea { width: 100%; min-height: 48px; outline: 0; border: 1px solid var(--line); border-radius: 13px; padding: 11px; color: var(--text); background: var(--panel-2); font-size: 16px; }
.field textarea { min-height: 86px; resize: vertical; }
.detail-actions { display: flex; gap: 8px; margin-top: 12px; }
.detail-actions button { flex: 1; border-radius: 13px; }
.danger { border: 1px solid rgba(248,113,113,.24); background: rgba(248,113,113,.08); color: #fca5a5; }
.toast { position: fixed; z-index: 80; right: 18px; bottom: calc(92px + var(--safe-bottom)); left: 18px; max-width: 420px; margin: auto; padding: 12px 15px; border: 1px solid var(--line); border-radius: 14px; opacity: 0; transform: translateY(12px); pointer-events: none; background: rgba(26,30,47,.96); text-align: center; font-size: 13px; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.loader { grid-column: 1/-1; padding: 50px 0; color: var(--muted); text-align: center; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (min-width: 620px) { .poster-grid { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 22px 14px; } main { padding: 0 24px; } .bottom-nav { border-inline: 1px solid var(--line); border-radius: 20px 20px 0 0; } dialog { margin: auto; } }
@media (max-width: 430px) { .settings-card { align-items: stretch; flex-direction: column; } .button-row { flex-direction: row; } .button-row > * { flex: 1; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
