:root {
  color-scheme: dark;
  --background: #111116;
  --foreground: #f2f2f3;
  --card: #1c1c24;
  --card-soft: rgba(28, 28, 36, .68);
  --muted: #292934;
  --muted-foreground: #8b8b98;
  --border: #2b2b36;
  --sidebar: #0d0d12;
  --primary: #ed46a0;
  --secondary: #9152cf;
  --accent: #2eaee9;
  --danger: #ef6a77;
  --radius: 12px;
  --display: "Space Grotesk", "Segoe UI", sans-serif;
  --body: Inter, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(circle at 88% -10%, rgba(145,82,207,.08), transparent 28rem);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }
h1,h2,h3,h4 { font-family: var(--display); }
p { margin-top: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.skip-link { position: fixed; top: -4rem; left: 1rem; z-index: 100; padding: .7rem 1rem; border-radius: 0 0 8px 8px; background: var(--foreground); color: var(--background); }
.skip-link:focus { top: 0; }
.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; }
.gradient-text { background: linear-gradient(135deg,var(--primary),var(--secondary),var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.button-primary { display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.15rem; border: 0; border-radius: var(--radius); background: linear-gradient(135deg,var(--primary),var(--secondary)); color: white; font-size: .875rem; font-weight: 600; box-shadow: 0 0 20px rgba(237,70,160,.27),0 0 60px rgba(237,70,160,.09); transition: opacity .2s,transform .2s; }
.button-primary:hover { opacity: .9; transform: translateY(-1px); }
.icon { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; width: 220px; flex-direction: column; border-right: 1px solid #22222b; background: var(--sidebar); }
.brand { display: flex; min-height: 75px; align-items: center; gap: .65rem; padding: 1rem; border-bottom: 1px solid #22222b; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
.brand-name { font: 700 1.125rem var(--display); white-space: nowrap; }
.nav { flex: 1; padding: 1rem .5rem; }
.nav-link { display: flex; align-items: center; gap: .75rem; min-height: 42px; margin-bottom: .25rem; padding: .625rem .75rem; border-radius: 8px; color: #d4d4d8; font-size: .875rem; font-weight: 500; transition: background .2s,color .2s; }
.nav-link:hover,.nav-link.is-active { background: #202029; color: var(--foreground); }
.nav-link.is-active { color: var(--primary); }
.languages { display: grid; grid-template-columns: 1.25rem repeat(3,minmax(0,1fr)); align-items: center; width: 100%; gap: .3rem .2rem; padding: .55rem .75rem; color: #b8b8c2; }
.languages > .icon { grid-row: 1 / span 2; align-self: center; }
.language-link { min-width: 0; padding: .24rem .2rem; border-radius: 5px; font-size: .68rem; text-align: center; }
.language-link:hover,.language-link.is-active { background: #202029; color: var(--primary); font-weight: 700; }
.settings { margin: 0 .5rem 1rem; }
.site-main { min-height: 100vh; margin-left: 220px; padding: 1.5rem 2rem; }
.site-main.inner { padding: 1.5rem; }
.content-width { max-width: 1500px; margin-inline: auto; }

.hero { position: relative; min-height: 260px; margin-bottom: 2rem; overflow: hidden; border-radius: 16px; animation: rise-in .55s ease-out both; isolation: isolate; }
.hero-image { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg,rgba(17,17,22,.93),rgba(17,17,22,.62),rgba(17,17,22,0)); }
.hero-content { display: flex; min-height: 260px; flex-direction: column; justify-content: center; align-items: flex-start; padding: 2.5rem; }
.eyebrow { display: flex; align-items: center; gap: .4rem; margin-bottom: .5rem; color: var(--primary); font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { max-width: 750px; margin: 0 0 .5rem; font-size: clamp(1.5rem,3.3vw,2.25rem); line-height: 1.12; }
.hero p { max-width: 560px; margin-bottom: 1rem; color: var(--muted-foreground); font-size: clamp(.8rem,1.5vw,1rem); line-height: 1.6; white-space: pre-line; }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

.section-title { margin: 0 0 1rem; font-size: 1.25rem; }
.category-tabs-shell { position: relative; margin-bottom: 1.5rem; padding-inline: 2.65rem; transition: padding .2s; }
.category-tabs-shell:not(.is-scrollable) { padding-inline: 0; }
.category-tabs { display: flex; gap: .5rem; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; scroll-behavior: smooth; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tabs-arrow { position: absolute; top: 50%; z-index: 2; display: grid; width: 2rem; height: 2rem; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; transform: translateY(-50%); background: rgba(32,32,41,.94); color: var(--foreground); box-shadow: 0 5px 18px rgba(0,0,0,.3),0 0 14px rgba(237,70,160,.1); cursor: pointer; transition: border-color .2s,background .2s,color .2s,opacity .2s,transform .2s; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.category-tabs-arrow::before { content: ""; width: .48rem; height: .48rem; border-top: 2px solid currentColor; border-right: 2px solid currentColor; }
.category-tabs-arrow.is-prev { left: 0; }
.category-tabs-arrow.is-prev::before { transform: translateX(.1rem) rotate(-135deg); }
.category-tabs-arrow.is-next { right: 0; }
.category-tabs-arrow.is-next::before { transform: translateX(-.1rem) rotate(45deg); }
.category-tabs-arrow:hover:not(:disabled) { border-color: rgba(237,70,160,.55); background: linear-gradient(135deg,rgba(237,70,160,.3),rgba(145,82,207,.3)); color: #fff; transform: translateY(-50%) scale(1.06); }
.category-tabs-arrow:disabled { opacity: .28; cursor: default; box-shadow: none; }
.category-tabs-shell:not(.is-scrollable) .category-tabs-arrow { display: none; }
.tab { position: relative; flex: 0 0 auto; padding: .55rem 1rem; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted-foreground); font-size: .875rem; font-weight: 600; cursor: pointer; transition: color .2s,background .2s,box-shadow .2s; }
.tab:hover { color: var(--foreground); background: rgba(255,255,255,.025); }
.tab.is-active { background: linear-gradient(135deg,var(--primary),var(--secondary)); color: white; box-shadow: 0 0 20px rgba(237,70,160,.25); }
.character-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 1rem; }
.character-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--card); transition: transform .28s,border-color .28s,box-shadow .28s; animation: card-in .35s ease-out both; }
.character-card:hover { z-index: 2; transform: translateY(-4px) scale(1.015); border-color: rgba(237,70,160,.34); box-shadow: 0 0 20px rgba(237,70,160,.22),0 0 55px rgba(237,70,160,.07); }
.character-card.is-hidden { display: none; }
.card-link { display: block; }
.card-image-wrap { position: relative; aspect-ratio: 3/4; overflow: hidden; background: #202029; }
.card-image { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.character-card:hover .card-image { transform: scale(1.08); }
.aigirlfriend-page .card-image-wrap { aspect-ratio: 2/3; }
.aigirlfriend-page .card-image { object-fit: cover; object-position: center; }
.aigirlfriend-page .character-card:hover .card-image { transform: none; }
.card-image-wrap::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg,var(--card),transparent 48%); pointer-events: none; }
.tag { position: absolute; top: .75rem; left: .75rem; z-index: 1; padding: .27rem .58rem; border: 1px solid rgba(255,255,255,.09); border-radius: 999px; background: rgba(28,28,36,.68); color: var(--foreground); font-size: .7rem; font-weight: 600; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.favorite { position: absolute; top: .75rem; right: .75rem; z-index: 3; display: grid; width: 2rem; height: 2rem; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; background: rgba(28,28,36,.68); color: var(--muted-foreground); cursor: pointer; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: color .2s,background .2s; }
.favorite:hover,.favorite.is-favorite { color: var(--primary); background: rgba(28,28,36,.88); }
.favorite .icon { width: 1rem; height: 1rem; }
.favorite.is-favorite .icon { fill: currentColor; }
.card-body { padding: .75rem; }
.card-body h3 { margin: 0; overflow: hidden; color: var(--foreground); font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.card-description { display: -webkit-box; min-height: 2.15rem; margin: .3rem 0 0; overflow: hidden; color: var(--muted-foreground); font-size: .72rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-stats { display: flex; gap: .8rem; margin-top: .75rem; color: var(--muted-foreground); font-size: .7rem; }
.card-stats span { display: inline-flex; align-items: center; gap: .25rem; }
.card-stats .icon { width: .85rem; height: .85rem; }
@keyframes card-in { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: none; } }

.page-header { margin-bottom: 2rem; }
.back-link { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1rem; color: var(--muted-foreground); font-size: .875rem; transition: color .2s; }
.back-link:hover { color: var(--foreground); }
.back-link .icon { width: 1rem; height: 1rem; }
.page-header h1 { margin: 0; font-size: clamp(1.85rem,4vw,2.5rem); line-height: 1.15; }
.page-header p { max-width: 650px; margin: .55rem 0 0; color: var(--muted-foreground); line-height: 1.6; white-space: pre-line; }
.page-header .button-primary { margin-top: 1rem; }
.prose-section { max-width: 780px; margin: 4rem 0 2rem; }
.prose-section + .prose-section { margin-top: 0; }
.prose-section h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.prose-section h3 { margin: 1.5rem 0 .75rem; font-size: 1.05rem; }
.prose-section p,.prose-section li { color: var(--muted-foreground); font-size: .875rem; line-height: 1.75; }
.prose-section ul { padding-left: 1.2rem; }
.feature-list { padding: 0 !important; list-style: none; }
.feature-list li { margin: .45rem 0; }
.feature-list li::before { content: "✦"; margin-right: .55rem; color: var(--primary); }
.home-seo { max-width: none; }
.rich-home-section { max-width: 980px; }
.rich-feature-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; margin: 1.5rem 0; }
.rich-feature { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-soft); }
.rich-feature h3 { margin: 0 0 .45rem; color: var(--foreground); font-size: 1rem; }
.rich-feature p { margin: 0; }

.faq-list { max-width: 780px; display: grid; gap: .75rem; }
.faq-item { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.25rem; cursor: pointer; font-weight: 600; list-style: none; transition: background .2s; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { background: rgba(28,28,36,.52); }
.faq-item summary::after { content: "⌄"; flex: 0 0 auto; color: var(--muted-foreground); font-size: 1.25rem; transition: transform .2s; }
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item p { margin: 0; padding: 0 1.25rem 1.2rem; color: var(--muted-foreground); font-size: .875rem; line-height: 1.7; }

.site-footer { margin-top: 4rem; padding: 3rem 0 2rem; border-top: 1px solid var(--border); }
.footer-grid { display: grid; grid-template-columns: 1.2fr repeat(3,1fr); gap: 2rem; margin-bottom: 3rem; }
.footer-brand { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; font: 700 1rem var(--display); }
.footer-brand img { width: 32px; height: 32px; }
.footer-copy { max-width: 260px; color: var(--muted-foreground); font-size: .82rem; line-height: 1.65; }
.footer-column h4 { margin: 0 0 1rem; font-size: .875rem; }
.footer-column ul { margin: 0; padding: 0; list-style: none; }
.footer-column li { margin-bottom: .65rem; }
.footer-column a,.footer-bottom { color: var(--muted-foreground); font-size: .8rem; transition: color .2s; }
.footer-column a:hover,.footer-bottom a:hover { color: var(--foreground); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.socials { display: flex; flex-wrap: wrap; gap: 1rem; }

.wiki-main { padding: 0; }
.wiki-head { border-bottom: 1px solid var(--border); background: rgba(28,28,36,.5); }
.wiki-head-inner,.wiki-layout { max-width: 1024px; margin-inline: auto; padding-inline: 1.5rem; }
.wiki-head-inner { padding-top: 1rem; }
.wiki-head h1 { margin: 0; color: var(--primary); font-size: clamp(1.9rem,4vw,2.5rem); font-style: italic; }
.wiki-tabs { display: flex; gap: 1.5rem; margin-top: .75rem; border-bottom: 1px solid rgba(237,70,160,.25); }
.wiki-tab { padding-bottom: .55rem; color: var(--primary); font-size: .875rem; }
.wiki-tab.active { border-bottom: 2px solid var(--primary); font-weight: 600; }
.wiki-tab.discussion { color: rgba(239,106,119,.82); }
.wiki-layout { display: flex; gap: 2rem; padding-top: 2rem; padding-bottom: 3rem; }
.toc { width: 210px; flex: 0 0 auto; }
.toc-box { position: sticky; top: 2rem; padding: 1rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(28,28,36,.62); }
.toc-title { color: var(--primary); font-size: .875rem; font-weight: 600; }
.toc ol { padding-left: 1.15rem; }
.toc li { margin: .45rem 0; color: var(--muted-foreground); font-size: .78rem; }
.toc a:hover { color: var(--primary); }
.wiki-article { min-width: 0; flex: 1; }
.wiki-article h2 { margin: 0 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); color: var(--primary); font-size: 1.5rem; }
.wiki-article h3 { margin: 1.5rem 0 .75rem; color: rgba(239,106,119,.9); font-size: 1.1rem; }
.wiki-article p,.wiki-article li { color: #d2d2d8; line-height: 1.75; }
.wiki-article section { margin-bottom: 2.5rem; }
.wiki-hero-row { display: flex; align-items: flex-start; gap: 1.5rem; }
.wiki-logo { flex: 0 0 185px; padding: .75rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(28,28,36,.62); text-align: center; }
.wiki-logo img { width: 160px; height: 160px; object-fit: contain; }
.wiki-logo small { display: block; margin-top: .5rem; color: var(--muted-foreground); font-style: italic; }
.guide-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; }
.guide { padding: 1rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(28,28,36,.42); }
.guide h4 { margin: 0 0 .25rem; color: var(--primary); }
.guide p { margin: 0; color: var(--muted-foreground); font-size: .8rem; }
.wiki-note { padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: .75rem; }

.error-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem; text-align: center; }
.error-code { margin: 0; font-size: clamp(5rem,20vw,11rem); line-height: .9; }
.error-page h1 { margin: 1rem 0 .5rem; }
.error-page p { color: var(--muted-foreground); }

@media (max-width: 1279px) { .character-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media (max-width: 1023px) {
  .sidebar { width: 72px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand-name,.nav-label,.languages .language-link,.settings .nav-label { display: none; }
  .nav-link { justify-content: center; padding-inline: 0; }
  .languages { display: flex; justify-content: center; padding: .5rem; }
  .site-main { margin-left: 72px; }
  .wiki-logo { display: none; }
}
@media (max-width: 767px) {
  .site-main,.site-main.inner { padding: 1.25rem 1rem; }
  .character-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .footer-grid { grid-template-columns: repeat(2,1fr); }
  .footer-grid > :first-child { grid-column: 1/-1; }
  .toc { display: none; }
  .wiki-layout { padding-inline: 1rem; }
}
@media (max-width: 639px) {
  .hero,.hero-content { min-height: 220px; }
  .hero-content { padding: 1.5rem 1rem; }
  .hero::after { background: linear-gradient(90deg,rgba(17,17,22,.96),rgba(17,17,22,.72),rgba(17,17,22,.28)); }
  .hero h1 { font-size: 1.22rem; }
  .hero p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; font-size: .75rem; }
  .button-primary { padding: .6rem 1rem; font-size: .78rem; }
  .character-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
  .card-body { padding: .65rem; }
  .tag,.favorite { top: .55rem; }
  .tag { left: .55rem; }
  .favorite { right: .55rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid > :first-child { grid-column: auto; }
  .footer-bottom { align-items: flex-start; flex-direction: column; }
  .guide-grid { grid-template-columns: 1fr; }
  .rich-feature-grid { grid-template-columns: 1fr; }
}

/* Editorial content flow on static category pages */
.character-grid ~ .prose-section {
  position: relative;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: clamp(3rem,5vw,4.5rem) clamp(1rem,3.5vw,3.75rem);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  text-align: left;
}
.character-grid + .prose-section { margin-top: clamp(2.5rem,5vw,4rem); }
.character-grid ~ .prose-section::before {
  content: "";
  position: absolute;
  inset: 0 auto auto clamp(1rem,3.5vw,3.75rem);
  width: 5rem;
  height: 2px;
  transform: none;
  background: linear-gradient(90deg,transparent,var(--primary),var(--secondary),transparent);
  box-shadow: 0 0 16px rgba(237,70,160,.28);
}
.character-grid ~ .prose-section h2 {
  max-width: none;
  margin: 0 0 1.35rem;
  color: var(--foreground);
  font-size: clamp(1.25rem,2.4vw,1.7rem);
  line-height: 1.25;
  text-align: left;
  text-wrap: balance;
}
.character-grid ~ .prose-section h3 {
  max-width: none;
  margin: 2.25rem 0 1rem;
  color: #e2e2e8;
  font-size: clamp(1.05rem,1.8vw,1.25rem);
  line-height: 1.35;
  text-align: left;
  text-wrap: balance;
}
.character-grid ~ .prose-section p,
.character-grid ~ .prose-section li {
  max-width: none;
  margin: 0 0 1rem;
  color: #aaaab7;
  font-size: clamp(.9rem,1.25vw,1rem);
  line-height: 1.78;
  text-align: left;
}
.character-grid ~ .prose-section > p:first-of-type {
  max-width: none;
  margin: 0 0 1rem;
  color: #bdbdc8;
  font-size: clamp(.98rem,1.45vw,1.08rem);
  line-height: 1.8;
  text-align: left;
}
.character-grid ~ .prose-section strong { color: #dedee5; font-weight: 650; }
.character-grid ~ .prose-section .feature-list { display: grid; gap: .55rem; max-width: none; margin-inline: 0; }
.character-grid ~ .prose-section:has(.faq-list) { display: block; max-width: none; }
.character-grid ~ .prose-section .faq-list { max-width: none; margin: 1.8rem 0 0; text-align: left; }
.character-grid ~ .prose-section .faq-item p { max-width: none; text-align: left; }
@media (max-width: 767px) {
  .character-grid ~ .prose-section {
    padding: 2.75rem .35rem;
  }
  .character-grid ~ .prose-section p,
  .character-grid ~ .prose-section li { text-align: left; }
}
@media (max-width: 639px) {
  .character-grid + .prose-section { margin-top: 2rem; }
}
