@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@300;400;600;700;900&family=Inter:wght@300;400;500;600&family=Noto+Serif+JP:wght@400;700&display=swap');

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

:root {
  --bg:       #06060c;
  --bg2:      #0d0d18;
  --bg3:      #13131f;
  --border:   #1e1e30;
  --red:      #e8002d;
  --red2:     #ff1744;
  --gold:     #ffd700;
  --gold2:    #ffb300;
  --teal:     #00e5c8;
  --text:     #f0f0fa;
  --muted:    #6b6b85;
  --radius:   10px;
  --shadow:   0 8px 40px rgba(0,0,0,.7);
  --ink:      rgba(232,0,45,.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  /* Subtle ink pattern */
  background-image:
    radial-gradient(ellipse 120% 60% at 50% -5%, rgba(232,0,45,.07) 0%, transparent 65%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231e1e30' fill-opacity='0.25'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ── JAPANESE BRUSH BORDER ACCENT ── */
.brush-line {
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--red) 30%, var(--gold) 70%, transparent 100%);
  opacity: .7;
}

/* ── HEADER ── */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(6,6,12,.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px,4vw,48px);
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: 'Exo 2', sans-serif;
  font-weight: 900; font-size: 1.5rem;
  letter-spacing: -1px;
  text-decoration: none; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.logo-kanji {
  font-family: 'Noto Serif JP', serif;
  font-size: .85rem; color: var(--red);
  letter-spacing: 2px; opacity: .8;
  writing-mode: horizontal-tb;
  border: 1px solid var(--red);
  padding: 1px 6px; border-radius: 3px;
}
.logo span { color: var(--red); }

.lang-switcher {
  display: flex; align-items: center; gap: 6px;
}
.lang-sep {
  color: var(--border); font-size: .85rem; user-select: none;
}
.lang-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); border-radius: 4px;
  padding: 4px 12px; font-size: .75rem; font-weight: 700;
  text-decoration: none; transition: .15s; letter-spacing: 1px;
}
.lang-btn:hover { color: var(--gold); border-color: var(--gold); }
.lang-btn.active {
  color: var(--gold); border-color: var(--gold);
  background: rgba(255,215,0,.08);
}

/* ── HERO ── */
.hero {
  text-align: center;
  padding: clamp(56px, 10vw, 100px) clamp(16px,4vw,48px) clamp(48px,7vw,80px);
  position: relative; overflow: hidden;
}
.hero::before {
  content: '漫画';
  position: absolute; right: 5%; top: 50%; transform: translateY(-50%);
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(5rem, 15vw, 14rem);
  font-weight: 700; color: rgba(232,0,45,.04);
  line-height: 1; pointer-events: none; user-select: none;
  letter-spacing: -4px;
}
.hero::after {
  content: 'おすすめ';
  position: absolute; left: 5%; top: 55%; transform: translateY(-50%);
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 700; color: rgba(255,215,0,.03);
  line-height: 1; pointer-events: none; user-select: none;
}
.hero h1 {
  font-family: 'Exo 2', sans-serif;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  font-weight: 900; line-height: 1.1;
  margin-bottom: 16px; position: relative;
}
.hero h1 em { font-style: normal; color: var(--red); }
.hero-subtitle {
  font-family: 'Noto Serif JP', serif;
  font-size: .82rem; color: var(--red);
  letter-spacing: 3px; margin-bottom: 6px;
  opacity: .75;
}
.hero p {
  color: var(--muted); font-size: clamp(.9rem,2vw,1.1rem);
  max-width: 560px; margin: 0 auto 40px; position: relative;
}

/* ── SEARCH BOX ── */
.search-wrap {
  position: relative; max-width: 620px;
  margin: 0 auto 32px;
}
.search-input {
  width: 100%; padding: 17px 54px 17px 22px;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 6px; color: var(--text);
  font-size: 1rem; font-family: 'Inter', sans-serif;
  outline: none; transition: .2s;
}
.search-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(232,0,45,.12), 0 0 20px rgba(232,0,45,.08);
}
.search-input::placeholder { color: var(--muted); }
.search-icon {
  position: absolute; right: 18px; top: 50%;
  transform: translateY(-50%); color: var(--muted);
  pointer-events: none; font-size: 1.2rem;
}

/* Autocomplete */
.autocomplete {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
  box-shadow: var(--shadow); z-index: 200; display: none;
}
.autocomplete.open { display: block; }
.ac-item {
  padding: 11px 18px; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  transition: .1s; border-bottom: 1px solid var(--border);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active { background: var(--bg3); }
.ac-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.ac-title { font-weight: 500; font-size: .95rem; }

/* Quick chips */
.quick-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; max-width: 700px; margin: 0 auto;
  position: relative;
}
.chip {
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--muted); border-radius: 4px;
  padding: 5px 14px; font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: .15s;
}
.chip:hover { background: var(--bg3); color: var(--text); border-color: var(--red); }

/* ── RESULTS SECTION ── */
#results-section {
  padding: 0 clamp(16px,4vw,48px) 60px;
  max-width: 1300px; margin: 0 auto;
  display: none;
}
#results-section.visible { display: block; }

.results-header {
  text-align: center; padding: 48px 0 32px;
  position: relative;
}
.results-header::before {
  content: '';
  display: block; width: 60px; height: 3px;
  background: var(--red);
  margin: 0 auto 20px;
}
.results-header h2 {
  font-family: 'Exo 2', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 700;
}
.results-header h2 span { color: var(--red); }
.results-header p { color: var(--muted); margin-top: 8px; font-size: .9rem; }

/* Source card */
.source-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg2); border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius); padding: 16px 20px;
  max-width: 520px; margin: 0 auto 44px;
}
.source-dot {
  width: 44px; height: 44px; border-radius: 6px; flex-shrink: 0;
}
.source-info .source-title { font-weight: 700; font-size: 1rem; }
.source-link {
  display: inline-block; margin-top: 4px;
  font-size: .78rem; color: var(--red);
  text-decoration: none; opacity: .8; transition: .15s;
}
.source-link:hover { opacity: 1; }

/* Recommendations grid */
.reco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

/* ── MANGA CARD ── */
.manga-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative; text-decoration: none; color: var(--text);
  display: block;
}
.manga-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
  border-color: rgba(232,0,45,.35);
}

.card-banner {
  height: 95px; position: relative;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 12px;
}
.card-banner::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(13,13,24,.95) 100%);
}
.card-banner-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
.card-banner-title {
  font-family: 'Noto Serif JP', serif;
  font-weight: 700; font-size: .75rem;
  color: rgba(255,255,255,.18);
  text-align: center; padding: 0 12px;
  pointer-events: none; user-select: none;
  letter-spacing: 3px; text-transform: uppercase;
  position: relative; z-index: 1;
}

.card-body { padding: 14px 16px 18px; }
.card-title {
  font-family: 'Exo 2', sans-serif;
  font-weight: 700; font-size: 1rem;
  margin-bottom: 10px; line-height: 1.3;
}
.card-desc {
  font-size: .82rem; color: var(--muted); line-height: 1.6;
  border-top: 1px solid var(--border); padding-top: 10px;
  margin-top: 4px;
}

/* ── BROWSE SECTION ── */
#browse-section {
  max-width: 1300px; margin: 0 auto;
  padding: 0 clamp(16px,4vw,48px) 80px;
}
.section-title {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.5rem; font-weight: 700;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 14px;
}
.section-title span { color: var(--red); }
.section-title .jp-label {
  font-family: 'Noto Serif JP', serif;
  font-size: .75rem; color: var(--muted);
  font-weight: 400; letter-spacing: 2px;
}
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--red) 0%, transparent 60%);
  margin-bottom: 28px; opacity: .4;
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.browse-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 13px 14px;
  cursor: pointer; transition: .15s;
  display: flex; align-items: center; gap: 12px;
}
.browse-card:hover { border-color: var(--red); background: var(--bg3); }
.browse-dot {
  width: 34px; height: 34px; border-radius: 6px; flex-shrink: 0;
}
.browse-name {
  font-weight: 600; font-size: .87rem;
  line-height: 1.35;
}

/* ── SEO TEXT ── */
.seo-section {
  max-width: 800px; margin: 0 auto;
  padding: 0 clamp(16px,4vw,48px) 80px;
}
.seo-section h2 {
  font-family: 'Exo 2', sans-serif;
  font-size: 1.25rem; font-weight: 700; margin-bottom: 10px;
  color: var(--text);
}
.seo-section p {
  color: var(--muted); font-size: .9rem; line-height: 1.75;
  margin-bottom: 28px;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 30px clamp(16px,4vw,48px);
  text-align: center; color: var(--muted); font-size: .8rem;
}
footer strong { color: var(--red); }
.footer-jp {
  font-family: 'Noto Serif JP', serif;
  font-size: .75rem; letter-spacing: 2px;
  color: var(--muted); opacity: .5; margin-top: 6px;
}

/* ── SERIE DETAIL PAGE ── */
.serie-detail {
  max-width: 960px; margin: 0 auto;
  padding: clamp(32px,5vw,60px) clamp(16px,4vw,48px) 80px;
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); text-decoration: none;
  font-size: .85rem; margin-bottom: 36px;
  transition: .15s; border-bottom: 1px solid transparent;
}
.back-link:hover { color: var(--red); border-bottom-color: var(--red); }

.serie-header {
  display: flex; gap: clamp(24px,4vw,48px);
  align-items: flex-start; margin-bottom: 56px;
}
.serie-image-wrap {
  flex-shrink: 0;
  width: clamp(140px, 25vw, 220px);
  position: relative;
}
.serie-image-wrap::before {
  content: '';
  position: absolute; inset: -3px; border-radius: 8px;
  background: linear-gradient(135deg, var(--red) 0%, var(--gold) 100%);
  z-index: 0; opacity: .6;
}
.serie-image {
  display: block; width: 100%; border-radius: 6px;
  aspect-ratio: 2/3; object-fit: cover;
  position: relative; z-index: 1;
  background: var(--bg3);
}
.serie-image-placeholder {
  width: 100%; aspect-ratio: 2/3;
  border-radius: 6px; background: var(--bg3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Noto Serif JP', serif;
  font-size: 3rem; color: rgba(232,0,45,.15);
  position: relative; z-index: 1;
}

.serie-info { flex: 1; min-width: 0; }
.serie-kanji {
  font-family: 'Noto Serif JP', serif;
  font-size: .78rem; color: var(--red);
  letter-spacing: 3px; margin-bottom: 8px;
  opacity: .75;
}
.serie-title {
  font-family: 'Exo 2', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900; line-height: 1.15;
  margin-bottom: 20px;
}
.serie-title::after {
  content: '';
  display: block; width: 48px; height: 3px;
  background: var(--red); margin-top: 14px;
}
.serie-desc {
  font-size: .97rem; color: var(--muted); line-height: 1.8;
}
.serie-desc p + p { margin-top: 14px; }

/* Reco section on serie page */
.reco-section { margin-top: 8px; }
.reco-section .section-title { margin-bottom: 6px; }

/* ── UTILS ── */
.hidden { display: none !important; }
.loading { color: var(--muted); text-align: center; padding: 48px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

@media (max-width: 640px) {
  .reco-grid { grid-template-columns: 1fr; }
  .browse-grid { grid-template-columns: repeat(2, 1fr); }
  .serie-header { flex-direction: column; align-items: center; text-align: center; }
  .serie-image-wrap { width: clamp(140px, 50vw, 200px); }
  .serie-title::after { margin: 14px auto 0; }
}
