/* ============================================================
   KIRAZONE: NEON KINGDOM — design system
   Void #07080D · Panel #11131C · Paper #EDEFF7 · Mist #8B90A8
   Neon Violet #9D5CFF · Resonance line = the six elements
   ============================================================ */

:root {
  --void: #07080D;
  --panel: #11131C;
  --panel-2: #161927;
  --paper: #EDEFF7;
  --mist: #8B90A8;
  --neon: #9D5CFF;
  --neon-soft: rgba(157, 92, 255, 0.16);
  --line: rgba(139, 144, 168, 0.18);
  --resonance: linear-gradient(90deg, #FF4655, #3D8BFF, #C98A4B, #43E97B, #FFE27A, #B468FF);
  --radius: 14px;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--void);
  color: var(--paper);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
}

/* Neon atmosphere: two soft glows + faint dot grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(700px 420px at 85% -10%, rgba(157, 92, 255, 0.20), transparent 65%),
    radial-gradient(600px 420px at -10% 100%, rgba(61, 139, 255, 0.10), transparent 65%),
    radial-gradient(rgba(139, 144, 168, 0.10) 1px, transparent 1px);
  background-size: auto, auto, 26px 26px;
}

img { max-width: 100%; display: block; }

a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- The resonance line (signature) ---------- */
.resonance {
  height: 2px;
  background: var(--resonance);
  background-size: 300% 100%;
  border: 0;
  animation: flow 14s linear infinite;
  opacity: 0.9;
}
@keyframes flow {
  0% { background-position: 0% 0; }
  100% { background-position: 300% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .resonance { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Layout ---------- */
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 8, 13, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--paper);
  text-shadow: 0 0 18px rgba(157, 92, 255, 0.55);
  margin-right: auto;
}
.brand:hover { text-decoration: none; }
.brand .sigil { color: var(--neon); }
.nav a.link {
  color: var(--mist);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav a.link:hover, .nav a.link[aria-current="page"] { color: var(--paper); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  padding: 84px 0 56px;
  text-align: center;
}
.hero .eyebrow {
  color: var(--neon);
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(40px, 9vw, 88px);
  letter-spacing: 0.02em;
  line-height: 1.05;
  margin: 14px 0 6px;
  text-shadow:
    0 0 24px rgba(157, 92, 255, 0.45),
    0 0 80px rgba(157, 92, 255, 0.25);
}
.hero .sub {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(13px, 2.4vw, 18px);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--mist);
}
.hero .tagline {
  max-width: 560px;
  margin: 26px auto 0;
  color: var(--mist);
  font-size: 17px;
}
.hero .tagline strong { color: var(--paper); }
.hero .resonance { max-width: 320px; margin: 30px auto 0; }

.cta-row { margin-top: 34px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-block;
  font-family: var(--body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-neon {
  background: var(--neon);
  color: #0B0316;
  box-shadow: 0 0 22px rgba(157, 92, 255, 0.55);
}
.btn-neon:hover { box-shadow: 0 0 34px rgba(157, 92, 255, 0.8); }
.btn-ghost {
  color: var(--paper);
  border-color: var(--line);
  background: rgba(17, 19, 28, 0.6);
}
.btn-ghost:hover { border-color: var(--neon); }

/* ---------- Sections ---------- */
section.block { padding: 56px 0; }
.block h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.block .lead { color: var(--mist); max-width: 640px; }

/* ---------- Episode cards ---------- */
.ep-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.ep-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ep-card:hover {
  transform: translateY(-3px);
  border-color: rgba(157, 92, 255, 0.6);
  box-shadow: 0 8px 30px rgba(157, 92, 255, 0.18);
  text-decoration: none;
}
.ep-card .cover { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; background: var(--panel-2); }
.ep-card .meta { padding: 14px 16px 16px; }
.ep-card .num {
  color: var(--neon);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.ep-card .title { color: var(--paper); font-weight: 600; margin-top: 3px; }
.ep-card .date { color: var(--mist); font-size: 13px; margin-top: 2px; }

/* ---------- Lore / characters ---------- */
.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 26px;
  margin-top: 22px;
}
.panel-card h3 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}
.panel-card p { color: var(--mist); margin-bottom: 12px; }
.panel-card p:last-child { margin-bottom: 0; }
.panel-card strong { color: var(--paper); }

.char-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.char-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.char-card .portrait { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; background: var(--panel-2); }
.char-card .meta { padding: 16px; }
.char-card .affinity {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--neon);
}
.char-card h3 { font-family: var(--display); font-size: 18px; margin: 4px 0 8px; }
.char-card p { color: var(--mist); font-size: 14px; }

/* ---------- Reader ---------- */
.reader-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 60;
  background: rgba(139, 144, 168, 0.15);
}
.reader-top .fill {
  height: 100%;
  width: 0%;
  background: var(--resonance);
  background-size: 300% 100%;
  animation: flow 14s linear infinite;
}
.reader-head { text-align: center; padding: 46px 0 18px; }
.reader-head .num { color: var(--neon); letter-spacing: 0.26em; text-transform: uppercase; font-size: 13px; }
.reader-head h1 { font-family: var(--display); font-size: clamp(24px, 5vw, 36px); margin-top: 8px; }

.strip {
  max-width: 720px;
  margin: 26px auto 0;
  padding: 0 12px;
}
.strip img.panel {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 14px;
  background: var(--panel-2);
}

.reader-nav {
  max-width: 720px;
  margin: 36px auto 70px;
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Ad slots ---------- */
.ad-slot {
  max-width: 720px;
  margin: 30px auto;
  padding: 8px;
  text-align: center;
  border-radius: var(--radius);
  color: var(--mist);
  font-size: 12px;
  min-height: 0;
  overflow: hidden;
}
.ad-slot:empty { display: none; }

/* ---------- Prose pages (legal, about) ---------- */
.prose { max-width: 720px; margin: 0 auto; padding: 50px 20px 80px; }
.prose h1 { font-family: var(--display); font-size: clamp(26px, 5vw, 36px); margin-bottom: 18px; }
.prose h2 { font-family: var(--display); font-size: 19px; margin: 28px 0 10px; }
.prose p, .prose li { color: var(--mist); margin-bottom: 12px; }
.prose ul { padding-left: 22px; }

/* ---------- Footer ---------- */
footer.site {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 34px 0 46px;
  color: var(--mist);
  font-size: 14px;
}
footer .links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
footer a { color: var(--mist); }
footer a:hover { color: var(--paper); }

@media (max-width: 640px) {
  .nav { gap: 12px; }
  .nav a.link { font-size: 12px; }
  .hero { padding: 56px 0 40px; }
}

/* ---------- Side ad rails (sections) ---------- */
.wrap-wide { max-width: 1440px; margin: 0 auto; padding: 0 16px; }
.rails { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: center; gap: 18px; }
.rail-main { grid-column: 1; min-width: 0; max-width: 1060px; margin: 0 auto; width: 100%; }
.ad-rail { display: none; }
@media (min-width: 1240px) {
  .rails { grid-template-columns: 170px minmax(0, 1060px) 170px; }
  .ad-rail { display: block; padding-top: 56px; }
  .ad-rail:first-child { grid-column: 1; }
  .rail-main { grid-column: 2; }
  .ad-rail:last-child { grid-column: 3; }
  .ad-rail .ad-slot.side { position: sticky; top: 80px; height: 300px; margin: 0 0 18px; display: flex; align-items: center; justify-content: center; }
}
.media-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.media-card h3 { font-family: var(--display); font-size: 17px; margin-bottom: 8px; }
.media-card .desc { color: var(--mist); font-size: 14px; margin: 10px 0 0; }
.yt-frame { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.wall-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.wall-card img { width: 100%; aspect-ratio: 9/16; object-fit: cover; }
.wall-card a.dl { display: block; text-align: center; padding: 12px; color: var(--paper); font-weight: 600; font-size: 14px; }

/* ============================================================
   MOBILE OVERHAUL — no horizontal overflow, reachable controls
   ============================================================ */
html, body { overflow-x: hidden; max-width: 100%; }
img, iframe, video { max-width: 100%; height: auto; }

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 0;
}
.brand { flex: 0 1 auto; min-width: 0; margin-right: 0; }
.auth-slot { margin-left: auto; order: 2; }
.social-row + .auth-slot, .nav .social-row ~ .auth-slot { margin-left: 12px; }
.nav .social-row { order: 1; }
.navlinks {
  order: 3;
  display: flex;
  gap: 18px;
  flex-basis: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.navlinks::-webkit-scrollbar { display: none; }
.navlinks a.link { white-space: nowrap; }

@media (min-width: 860px) {
  .navlinks { order: 0; flex-basis: auto; margin-left: 26px; margin-right: auto; overflow: visible; }
  .auth-slot { order: 0; }
}

@media (max-width: 640px) {
  .brand { font-size: 15px; }
  .nav a.link { font-size: 12px; }
  .hero { padding: 44px 0 36px; }
  .hero h1 { font-size: clamp(34px, 11vw, 56px); }
  .hero .sub { letter-spacing: 0.32em; }
  .hero .tagline { font-size: 15px; padding: 0 4px; }
  .cta-row { flex-direction: column; align-items: stretch; padding: 0 8px; }
  .cta-row .btn { text-align: center; padding: 14px 22px; }
  .block h2 { font-size: 22px; }
  .ep-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .ep-card .meta { padding: 10px 12px 12px; }
  .ep-card .title { font-size: 14px; }
  .char-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .char-card .meta { padding: 12px; }
  .char-card p { font-size: 13px; }
  .panel-card { padding: 18px; }
  .media-card { padding: 14px; }
  .wall-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .reader-nav { flex-wrap: wrap; }
  .reader-nav .btn { flex: 1; text-align: center; min-width: 110px; }
  footer .links { gap: 12px; }
}

/* keep tap targets comfortably big */
.btn, .tab, button { min-height: 40px; }
.navlinks a.link { padding: 6px 0; }

/* ---------- Anime: series catalog + watch page ---------- */
.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.series-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .15s, border-color .15s; }
.series-card:hover { transform: translateY(-3px); border-color: rgba(157,92,255,.6); text-decoration: none; }
.series-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.series-cover-empty { aspect-ratio: 2/3; display: flex; align-items: center; justify-content: center; color: var(--mist); background: var(--panel-2); padding: 10px; text-align: center; font-size: 14px; }
.series-card .meta { padding: 12px 14px 14px; }
.series-card .status { color: var(--neon); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.series-card h3 { font-family: var(--display); font-size: 15px; color: var(--paper); margin: 4px 0 6px; }
.genres span { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); color: var(--mist); border-radius: 999px; font-size: 11px; padding: 3px 10px; margin: 2px 4px 2px 0; }
.status-chip { display: inline-block; background: rgba(157,92,255,.15); border: 1px solid rgba(157,92,255,.4); color: var(--neon); border-radius: 999px; font-size: 11px; padding: 3px 10px; }
.watch-player { margin-top: 6px; }
.watch-head { margin-top: 16px; }
.ep-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.ep-btn { min-width: 46px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--paper); font: 600 14px var(--body); cursor: pointer; }
.ep-btn.on { background: var(--neon); color: #0B0316; border-color: transparent; box-shadow: 0 0 14px rgba(157,92,255,.5); }

/* ---------- Header social icons ---------- */
.social-row { display: inline-flex; gap: 8px; margin-left: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.social-row .soc {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); color: var(--mist);
  font-size: 13px; text-decoration: none; flex: none;
}
.social-row .soc:hover { color: var(--neon); border-color: rgba(157,92,255,.6); text-decoration: none; }

/* ---------- Home hub tiles ---------- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 34px;
  text-align: left;
}
.hub-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.hub-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(157,92,255,.6);
  box-shadow: 0 8px 30px rgba(157,92,255,.16);
  text-decoration: none;
}
.hub-icon { font-size: 26px; }
.hub-tile h3 { font-family: var(--display); font-size: 16px; color: var(--paper); margin: 10px 0 6px; }
.hub-tile p { color: var(--mist); font-size: 13px; line-height: 1.5; }
@media (max-width: 640px) {
  .hub-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hub-tile { padding: 14px; }
  .hub-tile p { font-size: 12px; }
}
