:root {
  --bg: #0b0f19;
  --surface: #111827;
  --surface-2: #1a2234;
  --border: #1f2937;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --accent: #6366f1;
  --accent-2: #38bdf8;
  --radius: 14px;
  --max-w: 1120px;
}

body.light {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.menu-toggle {
  display: none;
}

/* Hero */
.hero {
  padding: 44px 0 28px;
}

.hero-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(14, 165, 233, 0.1));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  margin-bottom: 10px;
}

.hero h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}

.hero p {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 20px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.btn:hover {
  opacity: 0.92;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.mini-countdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.mini-countdown h2 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.85rem;
}

.mini-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-2);
  white-space: nowrap;
  font-size: 0.8rem;
}

/* Filter & Search Bar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0 22px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.search-input {
  width: 260px;
  max-width: 100%;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
}

/* Post Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding-bottom: 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.card-banner {
  height: 148px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.25;
}

.banner-1 { background: linear-gradient(135deg, #312e81, #0ea5e9); }
.banner-2 { background: linear-gradient(135deg, #0f172a, #6366f1); }
.banner-3 { background: linear-gradient(135deg, #1e1b4b, #ec4899); }

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-2);
}

.card h3 {
  font-size: 1.08rem;
  line-height: 1.35;
}

.card p {
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

/* Countdown Grid */
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  padding: 20px 0 54px;
}

.anime-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.anime-cover {
  position: relative;
  height: 180px;
  background: var(--surface-2);
  overflow: hidden;
}

.anime-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ep-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(11, 15, 25, 0.86);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.anime-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.anime-info h3 {
  font-size: 0.98rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.timer-box {
  margin-top: auto;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent-2);
}

/* Article & Legal Pages */
.article-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 36px 20px 64px;
}

.article-header {
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.22;
  margin: 8px 0 12px;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.prose h2 {
  font-size: 1.38rem;
  margin: 28px 0 10px;
  letter-spacing: -0.015em;
}

.prose h3 {
  font-size: 1.1rem;
  margin: 20px 0 8px;
}

.prose p {
  margin-bottom: 14px;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
}

.prose ul,
.prose ol {
  margin: 0 0 16px 22px;
}

.prose li {
  margin-bottom: 7px;
}

.callout {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 20px 0;
  font-size: 0.93rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

.prose th {
  background: var(--surface-2);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 0;
  margin-top: 24px;
  font-size: 0.86rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a:hover {
  color: var(--text);
}

@media (max-width: 820px) {
  .hero-card {
    grid-template-columns: 1fr;
    padding: 24px 20px;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 20px;
    gap: 14px;
  }
  .nav-links.open {
    display: flex;
  }
  .menu-toggle {
    display: inline-flex;
  }
}

/* Mobile Overflow & Responsive Polish */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

.hero-card > *,
.mini-countdown,
.mini-list,
.mini-item {
  min-width: 0;
  max-width: 100%;
}

.mini-countdown {
  width: 100%;
  overflow: hidden;
}

.mini-title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-time {
  flex-shrink: 0;
}

.grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}

.countdown-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 14px;
  }
  .hero {
    padding: 20px 0 18px;
  }
  .hero-card {
    padding: 18px 14px;
    gap: 18px;
    border-radius: 16px;
  }
  .mini-countdown {
    padding: 14px 12px;
  }
  .search-input {
    width: 100% !important;
  }
  .prose table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* v2 Device-Adaptive UI: Extra Banners + App-Style Mobile Bottom Nav & Swipeable Pills */
.banner-4 { background: linear-gradient(135deg, #1e293b, #059669); }
.banner-5 { background: linear-gradient(135deg, #172554, #7c3aed); }
.banner-6 { background: linear-gradient(135deg, #7c2d12, #ea580c); }

.mobile-bottom-nav {
  display: none;
}

html.is-mobile body {
  padding-bottom: 68px;
}

html.is-mobile .mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 4px max(8px, env(safe-area-inset-bottom));
}

.mobile-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 2px;
}

.mobile-bottom-nav a .mnav-ico {
  font-size: 1.05rem;
  line-height: 1.1;
}

.mobile-bottom-nav a.active {
  color: var(--accent-2);
}

html.is-mobile .pills {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  padding-bottom: 2px;
}

html.is-mobile .pills::-webkit-scrollbar {
  display: none;
}

html.is-mobile .pill {
  flex: 0 0 auto;
  white-space: nowrap;
}

html.is-mobile .card-banner {
  height: 118px;
  font-size: 1rem;
}

html.is-mobile .header-inner {
  height: 54px;
}

/* v3 Cinematic 2:3 Portrait Poster Grid, Detail Modal & Animated Attack Countdown Stage */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  padding: 8px 0 56px;
}

@media (max-width: 520px) {
  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }
}

.poster-card {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.poster-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.poster-img-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 100%;
  background: var(--surface-2);
  overflow: hidden;
}

.poster-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.poster-card:hover .poster-img-wrap img {
  transform: scale(1.04);
}

.poster-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(9, 13, 22, 0.96) 0%, rgba(9, 13, 22, 0.48) 42%, rgba(9, 13, 22, 0.08) 100%);
}

.score-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.86);
  color: #facc15;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}

.poster-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.poster-bottom h3 {
  font-size: 0.88rem;
  line-height: 1.25;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-timer {
  background: rgba(99, 102, 241, 0.24);
  border: 1px solid rgba(99, 102, 241, 0.55);
  color: #e0f2fe;
  font-variant-numeric: tabular-nums;
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  padding: 5px 6px;
  border-radius: 8px;
  backdrop-filter: blur(6px);
}

.poster-timer-muted {
  background: rgba(30, 41, 59, 0.78);
  border-color: rgba(148, 163, 184, 0.28);
  color: #cbd5e1;
}

/* Anime Detail Modal */
.anime-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 120;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.anime-modal.open {
  display: flex;
}

.anime-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(8px);
}

.anime-modal-sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(11, 15, 25, 0.85);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-banner {
  height: 160px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.modal-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--surface) 0%, rgba(17, 24, 39, 0.35) 100%);
}

.modal-body {
  padding: 0 20px 24px;
  margin-top: -54px;
  position: relative;
  z-index: 3;
}

.modal-top {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.modal-poster {
  width: 104px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}

.modal-head-info {
  min-width: 0;
  flex: 1;
}

.modal-head-info h2 {
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  line-height: 1.25;
  margin: 6px 0 3px;
}

.modal-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.m-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.m-badge-gold {
  color: #facc15;
}

.modal-meta-row {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Animated Signature Attack Countdown Stage */
.attack-countdown-stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(circle at 20% 50%, #1e1b4b, #090d16 75%);
  border: 1px solid rgba(99, 102, 241, 0.45);
  margin-bottom: 16px;
  min-height: 148px;
}

.attack-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.attack-stage-content {
  position: relative;
  z-index: 2;
  padding: 16px 18px;
  text-align: center;
}

.attack-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.attack-ep-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #38bdf8;
}

.fx-pill {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.hero-timer-digits {
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.45rem, 4.5vw, 2.25rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #ffffff;
  text-shadow: 0 0 18px rgba(56, 189, 248, 0.65);
  margin: 4px 0;
}

.attack-air-date {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.attack-move-tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(15, 23, 42, 0.65);
  padding: 3px 10px;
  border-radius: 999px;
}

.modal-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.genre-chip {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent-2);
}

.modal-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  white-space: pre-line;
  margin-bottom: 16px;
}

.modal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 560px) {
  .anime-modal {
    padding: 0;
    align-items: flex-end;
  }
  .anime-modal-sheet {
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }
  .modal-body {
    padding: 0 14px 24px;
  }
  .modal-poster {
    width: 82px;
  }
}
