/* KanKan — follows DESIGN.md */

:root {
  --bg: #FFFFFF;
  --text: #111111;
  --muted: #6E6E73;
  --faint: #A1A1A6;
  --line: #E8E8EB;
  --divider: #EFEFF1;
  --surface: #F5F5F7;
  --track: #E2E2E6;
  --pad: 48px;
  --card-w: 300px;
  --gap: 20px;
  --font: -apple-system, "SF Pro Text", BlinkMacSystemFont, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; }
main { padding-bottom: 64px; }

/* ---------- Header ---------- */
.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo { display: flex; align-items: baseline; gap: 10px; }
.logo b { font-size: 25px; font-weight: 700; letter-spacing: -0.03em; }
.logo span { font-size: 21px; font-weight: 400; color: var(--muted); }
.nav { display: flex; gap: 30px; font-size: 15px; font-weight: 500; color: var(--muted); }
.nav a { padding: 10px 0; }
.nav a:hover, .nav a.on { color: var(--text); }
.parents {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px;
  min-height: 40px;
}
.parents:hover { color: var(--text); }

/* ---------- Shared bits ---------- */
.back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 500; color: var(--muted);
  margin: 20px var(--pad) 0; min-height: 44px;
}
.back:hover { color: var(--text); }
.label {
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 16px; font-weight: 600; padding: 13px 24px; border-radius: 999px;
  min-height: 48px; transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-dark { background: var(--text); color: #fff; }
.btn-dark:hover { opacity: .88; }
.btn-outline { border: 1px solid #D9D9DE; color: var(--text); }
.btn-outline:hover { background: var(--surface); }
.btn-light { background: #fff; color: var(--text); }
.btn-light:hover { opacity: .92; }
.btn-glass { background: rgba(255,255,255,.22); color: #fff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.btn-glass:hover { background: rgba(255,255,255,.32); }

.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--surface); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }

.track { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.track > div { height: 100%; background: var(--text); border-radius: 2px; }

/* ---------- Home banner ---------- */
.hero {
  position: relative; display: block;
  margin: 28px var(--pad) 0; height: 470px;
  border-radius: 18px; overflow: hidden; background: var(--surface);
}
.hero > img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; }
.hero .shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.35) 42%, rgba(0,0,0,0) 65%); }
.hero .text { position: absolute; left: 48px; bottom: 48px; right: 48px; max-width: 460px; color: #fff; }
.hero .label { color: rgba(255,255,255,.85); }
.hero h1 { font-size: 52px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; margin: 8px 0 10px; }
.hero p { font-size: 16px; line-height: 1.45; opacity: .9; }

/* ---------- Rows of cards ---------- */
.row-section { margin-top: 44px; position: relative; }
.row-section h2 {
  font-size: 21px; font-weight: 650; letter-spacing: -0.015em;
  margin: 0 var(--pad) 16px; scroll-margin-top: 96px;
}
.row {
  display: flex; gap: var(--gap);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding: 0 var(--pad);
  padding: 8px var(--pad) 4px; margin-top: -8px;
  scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.card { flex: 0 0 var(--card-w); scroll-snap-align: start; min-width: 0; }
.card .title {
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-top: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .track { margin-top: 10px; }
.card.show { position: relative; padding-top: 8px; margin-top: -8px; }
.card.show .stack { position: absolute; top: 0; left: 14px; right: 14px; height: 20px; border-radius: 10px 10px 0 0; background: var(--track); }
.card.show .title { font-size: 16px; }

/* Row arrows: only for mouse users */
.arrow {
  display: none; position: absolute; z-index: 2;
  top: calc(41px + var(--card-w) * 0.28125 - 22px); /* middle of the thumbnails */
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15);
  align-items: center; justify-content: center;
}
.arrow.left { left: 16px; }
.arrow.right { right: 16px; }
@media (hover: hover) {
  .card:hover .thumb img { transform: scale(1.04); }
  .row-section:hover .arrow.can { display: flex; }
}

/* ---------- Show page ---------- */
.show-hero {
  margin: 12px var(--pad) 0;
  display: flex; gap: 56px; align-items: center; justify-content: space-between;
}
.show-hero .text { flex: 1; max-width: 480px; }
.show-hero h1 { font-size: 56px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; margin: 8px 0 12px; }
.show-hero p { font-size: 17px; line-height: 1.5; color: #3A3A3C; }
.show-hero .thumb { flex: 0 1 760px; border-radius: 18px; }

.episodes { margin: 40px var(--pad) 0; }
.episodes-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 8px; }
.episodes-head h2 { font-size: 21px; font-weight: 650; letter-spacing: -0.015em; }
.ep {
  display: flex; align-items: center; gap: 24px;
  padding: 16px; border-top: 1px solid var(--divider); border-radius: 14px;
}
.ep:hover { background: var(--surface); }
.ep.now { background: var(--surface); border-top-color: transparent; }
.ep.now + .ep, .ep:hover + .ep { border-top-color: transparent; }
.ep .num { width: 32px; flex: none; font-size: 22px; font-weight: 600; color: var(--faint); text-align: center; }
.ep .thumb { width: 224px; flex: none; border-radius: 10px; }
.ep .info { flex: 1; min-width: 0; }
.ep .title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.ep .state { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.ep .state:empty { display: none; }
.ep .state .track { width: 120px; }
.pill { font-size: 12px; font-weight: 600; color: var(--muted); background: #F0F0F2; padding: 3px 9px; border-radius: 999px; }

/* ---------- Watch screen ---------- */
.watch { display: flex; gap: 32px; margin: 12px var(--pad) 0; align-items: flex-start; }
.watch-main { flex: 1; min-width: 0; }
.player-box { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.player-box iframe, .player-box #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.blocked {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 10px;
  padding: 24px; background: var(--surface); color: var(--text);
}
.blocked[hidden] { display: none; }
.blocked h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.blocked p { color: var(--muted); max-width: 420px; line-height: 1.45; }
.blocked .btn { margin-top: 10px; }
.watch-info { margin-top: 20px; }
.watch-info h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; margin: 6px 0; }
.watch-info .meta a { text-decoration: underline; }
.watch-side { width: 360px; flex: none; }
.next-card { display: block; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.next-card.ended { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.next-card .label { margin-bottom: 12px; }
.next-card .thumb { border-radius: 10px; }
.next-card .title { font-size: 17px; font-weight: 600; margin-top: 12px; }
.next-card .btn { width: 100%; margin-top: 14px; }
.side-list h3 { font-size: 15px; font-weight: 650; margin: 28px 0 12px; }
.up { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; border-radius: 10px; }
.up:hover .title { text-decoration: underline; }
.up .thumb { width: 140px; flex: none; border-radius: 8px; }
.up .title { font-size: 14px; font-weight: 600; line-height: 1.3; }

.empty { margin: 80px var(--pad); text-align: center; color: var(--muted); }
.empty .btn { margin-top: 16px; }

/* ---------- iPad ---------- */
@media (max-width: 1100px) {
  :root { --pad: 32px; --card-w: 260px; }
  .hero { height: 400px; }
  .hero h1 { font-size: 44px; }
  .show-hero { gap: 32px; }
  .show-hero h1 { font-size: 44px; }
  .watch { flex-direction: column; align-items: stretch; }
  .watch-side { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .side-list h3 { margin-top: 0; }
}

/* ---------- Phone ---------- */
@media (max-width: 720px) {
  :root { --pad: 16px; --card-w: 72vw; --gap: 12px; }
  .site-header { height: 60px; }
  .logo b { font-size: 22px; }
  .logo span { font-size: 18px; }
  .nav { display: none; }
  .parents { padding: 8px 12px; }
  .parents .word { display: none; }
  .hero { margin-top: 16px; height: auto; aspect-ratio: 4 / 5; max-height: 70vh; border-radius: 16px; }
  .hero > img { object-position: 60% center; }
  .hero .shade { background: linear-gradient(0deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 50%, rgba(0,0,0,0) 75%); }
  .hero .text { left: 20px; right: 20px; bottom: 20px; }
  .hero h1 { font-size: 34px; }
  .hero p { font-size: 15px; }
  .btns { margin-top: 18px; }
  .btn { padding: 12px 18px; font-size: 15px; }
  .row-section { margin-top: 32px; }
  .row-section h2 { font-size: 19px; margin-bottom: 12px; }
  .back { margin-top: 8px; }
  .show-hero { flex-direction: column-reverse; align-items: stretch; gap: 20px; }
  .show-hero .thumb { flex: none; width: 100%; border-radius: 14px; }
  .show-hero h1 { font-size: 34px; }
  .show-hero p { font-size: 15px; }
  .episodes { margin-top: 32px; }
  .episodes-head .meta { display: none; }
  .ep { gap: 12px; padding: 12px 8px; }
  .ep .num { display: none; }
  .ep .thumb { width: 136px; border-radius: 8px; }
  .ep .title { font-size: 15px; }
  .ep .state { margin-top: 6px; }
  .ep .state .track { width: 72px; }
  .watch { margin-left: 0; margin-right: 0; gap: 20px; }
  .player-box { border-radius: 0; }
  .watch-info { margin: 16px var(--pad) 0; }
  .watch-info h1 { font-size: 22px; }
  .watch-side { display: block; padding: 0 var(--pad); }
  .side-list h3 { margin-top: 24px; }
  .up .thumb { width: 128px; }
}
