/* =========================================================
   DRAMAKU — tokens
   ========================================================= */
:root {
  --bg: #0f0b14;
  --bg-alt: #150f1a;
  --surface: #1f1720;
  --surface-hi: #2a1f2a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f6eff3;
  --text-muted: #a8929b;
  --accent: #ff3d68;
  --accent-dim: #ff3d6833;
  --accent-2: #ffc857;
  --radius: 14px;
  --font-display: "Fraunces", "Georgia", serif;
  --font-ui: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-hi); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(to bottom, rgba(15,11,20,0.97), rgba(15,11,20,0.85));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 68px;
}

.brand {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.brand span { color: var(--accent); font-style: normal; }

.search-form {
  flex: 1;
  max-width: 480px;
  display: flex;
  gap: 8px;
}
.search-form input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 18px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
}
.search-form input::placeholder { color: var(--text-muted); }
.search-form input:focus { border-color: var(--accent); }

.search-form button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-ui);
}
.search-form button:hover { background: #ff5c81; }

.nav-links { display: flex; gap: 18px; margin-left: auto; font-size: 14px; color: var(--text-muted); }
.nav-links a:hover { color: var(--text); }

@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  padding: 48px 0 40px;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.hero-eyebrow {
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 700;
  margin-bottom: 14px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.05;
  margin: 0 0 16px;
  font-style: italic;
  font-weight: 600;
}

.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tag {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.hero-desc {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 52ch;
  margin-bottom: 26px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 12px 30px -10px var(--accent-dim);
}
.btn-primary:hover { background: #ff5c81; }

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  perspective: 1000px;
}

.hero-poster {
  width: min(280px, 70vw);
  aspect-ratio: 2 / 3;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  transition: transform 0.4s ease;
  background: var(--surface);
}
.hero-poster img { width: 100%; height: 100%; object-fit: cover; }

.hero-strip {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  overflow-x: auto;
  padding-bottom: 4px;
  max-width: 100%;
}
.hero-strip-item {
  width: 52px;
  aspect-ratio: 2/3;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0.5;
  border: 2px solid transparent;
  transition: opacity 0.2s, border-color 0.2s;
}
.hero-strip-item.active { opacity: 1; border-color: var(--accent); }
.hero-strip-item img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .hero-tags { justify-content: center; }
  .hero-visual { order: -1; }
  .hero-strip { justify-content: center; }
}

/* =========================================================
   Rails / grids
   ========================================================= */
.rail {
  margin: 44px 0;
}
.rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.rail-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-style: italic;
  font-weight: 600;
}
.rail-title .n { color: var(--accent-2); font-style: normal; font-weight: 700; margin-right: 8px; }

.rail-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}

.card {
  scroll-snap-align: start;
  flex-shrink: 0;
  width: 160px;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); }

.card-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; }

.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15,11,20,0.85);
  border: 1px solid var(--border);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to top, rgba(15,11,20,0.75), transparent 45%);
  opacity: 0;
  transition: opacity 0.2s;
}
.card:hover .card-play { opacity: 1; }

.card-title {
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.rail-scroll .grid { display: contents; }

/* =========================================================
   Loading / empty states
   ========================================================= */
.skeleton {
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-hi) 50%, var(--surface) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card { width: 160px; aspect-ratio: 2/3; border-radius: 12px; flex-shrink: 0; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
}
.empty-state h3 { font-family: var(--font-display); font-style: italic; color: var(--text); font-size: 22px; }

/* =========================================================
   Detail page
   ========================================================= */
.detail-hero {
  padding: 40px 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
}
.detail-poster {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.55);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }

.detail-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(26px, 4vw, 40px);
  margin: 0 0 10px;
}
.detail-stats {
  display: flex;
  gap: 18px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.detail-stats b { color: var(--accent-2); }

.detail-synopsis {
  color: var(--text-muted);
  max-width: 68ch;
  margin-bottom: 22px;
}

@media (max-width: 720px) {
  .detail-hero { grid-template-columns: 1fr; }
  .detail-poster { max-width: 220px; margin: 0 auto; }
  .detail-stats, .detail-title, .detail-synopsis { text-align: center; }
  .detail-stats { justify-content: center; }
}

/* Episode dots — signature element: real progress strip, not decoration */
.episode-section { margin: 30px 0 60px; }
.episode-strip-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.episode-strip-label h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  margin: 0;
}
.episode-strip-label span { font-size: 13px; color: var(--text-muted); }

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
}

.ep-dot {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.ep-dot:hover { border-color: var(--accent); color: var(--text); }
.ep-dot.watched { background: var(--surface-hi); color: var(--accent-2); }
.ep-dot.current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Player */
.player-wrap {
  position: sticky;
  top: 80px;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.player-wrap video {
  width: 100%;
  max-height: 70vh;
  display: block;
  background: #000;
}
.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  flex-wrap: wrap;
}
.player-bar .ep-now { font-weight: 700; }
.player-controls { display: flex; gap: 8px; align-items: center; }
.player-controls select, .player-controls button {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
}
.player-controls button.primary { background: var(--accent); border-color: var(--accent); font-weight: 700; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 30px 0 50px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
.site-footer .brand { font-size: 18px; display: block; margin-bottom: 8px; }
