/* YOUKAI - AI時代の学園ホラー漫画 */
/* Global Styles */

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

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

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --text-primary: #f0f0f0;
  --text-secondary: #999999;
  --text-muted: #666666;
  --accent: #e94560;
  --accent-dark: #b8354d;
  --accent-glow: rgba(233, 69, 96, 0.3);
  --border: #2a2a2a;
  --font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
  --max-width: 1200px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: #ff6b84;
}

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

/* ================================
   LANDING PAGE
   ================================ */

/* Header / Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: 0.15em;
}

.site-logo span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition);
}

.site-nav a:hover {
  color: var(--text-primary);
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center top, var(--accent-glow) 0%, transparent 60%);
  pointer-events: none;
}

.hero-logo {
  max-width: min(500px, 80vw);
  height: auto;
  margin-bottom: 1.5rem;
  position: relative;
  filter: drop-shadow(0 0 30px var(--accent-glow));
}

.hero-title {
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  line-height: 1.1;
  margin-bottom: 1rem;
  position: relative;
}

.hero-title .accent {
  color: var(--accent);
}

.hero-tagline {
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--text-secondary);
  font-weight: 300;
  margin-bottom: 0.75rem;
  letter-spacing: 0.1em;
}

.hero-credit {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.hero-subcopy {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.hero-credit a {
  color: var(--accent);
  text-decoration: none;
}

.hero-credit a:hover {
  text-decoration: underline;
}

.about-hashtag {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 1.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: var(--bg-card);
}

/* Section */
.section {
  padding: 5rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.section-divider {
  width: 40px;
  height: 2px;
  background: var(--accent);
  margin: 1rem auto 0;
}

/* Episode Grid */
.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.episode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.episode-card:hover {
  background: var(--bg-card-hover);
  border-color: #333;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  color: inherit;
}

.episode-card-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--bg-secondary);
  overflow: hidden;
  position: relative;
}

.episode-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.episode-card:hover .episode-card-thumb img {
  transform: scale(1.03);
}

.episode-card-thumb .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
}

.episode-card-body {
  padding: 1rem;
}

.episode-card-number {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.episode-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.episode-card-arc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.episode-card-synopsis {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.episode-badge.external {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.episode-badge.special {
  background: #7c3aed;
}

/* Character Gallery */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.character-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: center;
  transition: all var(--transition);
}

.character-card:hover {
  border-color: #333;
  transform: translateY(-2px);
}

.character-portrait {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-secondary);
  overflow: hidden;
}

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

.character-portrait .placeholder-char {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-muted);
}

.character-info {
  padding: 1rem;
}

.character-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.125rem;
}

.character-reading {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}

.character-role {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.character-color-bar {
  height: 3px;
  width: 100%;
}

/* About / Info Section */
.about-content {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.about-content p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.about-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* YOUKAI Zukan (図鑑) */
.zukan-intro {
  margin-bottom: 2rem;
}

.zukan-navigator {
  max-width: 600px;
  margin: 0 auto;
}

.navigator-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.navigator-bubble p {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.navigator-bubble.small {
  text-align: center;
  margin-top: 2rem;
}

.navigator-bubble.small p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.navigator-name {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
}

.navigator-role {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.zukan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.zukan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.zukan-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.zukan-card-header {
  border-left: 3px solid;
  padding-left: 0.75rem;
  margin-bottom: 0.75rem;
}

.zukan-card-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.zukan-type {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.zukan-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.zukan-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.zukan-footer {
  max-width: 500px;
  margin: 0 auto;
}

/* Tankoubon Banner */
.banner {
  padding: 0;
}

.banner-link {
  display: block;
  background: linear-gradient(135deg, var(--accent-dark), #1a1a2e);
  border-bottom: 2px solid var(--accent);
  text-decoration: none;
  color: var(--text-primary);
  transition: filter var(--transition);
}

.banner-link:hover {
  filter: brightness(1.1);
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.banner-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.banner-text {
  flex: 1;
  line-height: 1.5;
}

.banner-text strong {
  display: block;
  font-size: 0.9375rem;
}

.banner-text span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.banner-cta {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .banner-content { flex-wrap: wrap; gap: 0.5rem; padding: 0.75rem 1rem; }
  .banner-cta { width: 100%; text-align: center; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
}

.site-footer p {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.site-footer a {
  color: var(--text-secondary);
}

/* ================================
   READER PAGE
   ================================ */

body.reader-body {
  background: #000;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.reader-container {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.reader-page-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.reader-page-wrapper img {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
  pointer-events: none;
}

/* Reader Top Bar */
.reader-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: opacity 0.3s ease;
}

.reader-topbar.hidden {
  opacity: 0;
  pointer-events: none;
}

.reader-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.reader-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  text-decoration: none;
  transition: background var(--transition);
}

.reader-back:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.reader-ep-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.reader-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reader-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.125rem;
  transition: background var(--transition);
  font-family: var(--font-family);
}

.reader-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Reader Bottom Bar */
.reader-bottombar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: opacity 0.3s ease;
}

.reader-bottombar.hidden {
  opacity: 0;
  pointer-events: none;
}

.reader-page-counter {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reader-progress {
  flex: 1;
  max-width: 400px;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.reader-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s ease;
}

/* Navigation Zones (invisible tap areas) */
.reader-nav-zone {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 50;
  cursor: pointer;
}

.reader-nav-zone.prev {
  left: 0;
  width: 30%;
}

.reader-nav-zone.next {
  right: 0;
  width: 30%;
}

.reader-nav-zone.center {
  left: 30%;
  right: 30%;
  z-index: 49;
}

/* Page turn indicator */
.reader-nav-indicator {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 60;
}

.reader-nav-indicator.left {
  left: 1rem;
}

.reader-nav-indicator.right {
  right: 1rem;
}

.reader-nav-indicator.visible {
  opacity: 1;
}

/* Reader Loading */
.reader-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  background: #000;
  z-index: 300;
}

.reader-loading .spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reader-loading p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Reader error state */
.reader-error {
  text-align: center;
  padding: 2rem;
}

.reader-error h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.reader-error p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 768px) {
  .site-nav {
    gap: 1rem;
  }

  .site-nav a {
    font-size: 0.8125rem;
  }

  .hero {
    padding: 5rem 1rem 3rem;
    min-height: 80vh;
  }

  .hero-title {
    letter-spacing: 0.1em;
  }

  .section {
    padding: 3rem 0;
  }

  .episode-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .episode-card-body {
    padding: 0.75rem;
  }

  .episode-card-title {
    font-size: 1rem;
  }

  .episode-card-synopsis {
    display: none;
  }

  .character-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .character-info {
    padding: 0.75rem;
  }

  .reader-ep-title {
    font-size: 0.8125rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .reader-nav-zone.prev {
    width: 25%;
  }

  .reader-nav-zone.next {
    width: 25%;
  }

  .reader-nav-zone.center {
    left: 25%;
    right: 25%;
  }
}

@media (max-width: 480px) {
  .episode-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .character-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .site-header .container {
    padding: 0.5rem 1rem;
  }

  .container {
    padding: 0 1rem;
  }
}

/* ================================
   UTILITY
   ================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-accent {
  color: var(--accent);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
