:root {
  --bg: #0e0f13;
  --panel: #171922;
  --panel-2: #1f2230;
  --border: #262a38;
  --text: #f0f1f6;
  --muted: #9298ad;
  --accent: #ff5c8a;
  --accent-2: #7c5cff;
  --ok: #4be3a0;
  --gold: #ffce54;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --tabbar-h: 58px;
  --maxw: 480px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; }

/* ── 앱 셸: 모바일 컬럼, 데스크톱 중앙 정렬 ── */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px calc(12px);
  background: linear-gradient(180deg, rgba(14, 15, 19, 0.96), rgba(14, 15, 19, 0.75));
  backdrop-filter: blur(8px);
}
.topbar .logo { font-weight: 800; font-size: 18px; letter-spacing: -0.3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .spacer { flex: 1; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; color: var(--muted); }
.icon-btn:hover { background: var(--panel); color: var(--text); }

/* ── 섹션 공통 ── */
.section { margin: 22px 0; }
.section-head { display: flex; align-items: baseline; gap: 8px; padding: 0 16px 10px; }
.section-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.section-head .more { margin-left: auto; color: var(--muted); font-size: 13px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 0 16px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }

/* ── HERO ── */
.hero { position: relative; margin: 0; }
.hero-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide { position: relative; min-width: 100%; scroll-snap-align: start; aspect-ratio: 3 / 4; max-height: 66vh; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide .fallback { width: 100%; height: 100%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.hero-grad { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14,15,19,0.05) 40%, rgba(14,15,19,0.55) 72%, var(--bg) 99%); }
.hero-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 18px 22px; }
.hero-badges { display: flex; gap: 6px; margin-bottom: 8px; }
.hero-info h2 { margin: 0 0 6px; font-size: 24px; font-weight: 800; letter-spacing: -0.5px; text-shadow: 0 2px 12px rgba(0,0,0,0.6); }
.hero-info p { margin: 0 0 14px; color: #dfe1ea; font-size: 13.5px; max-width: 90%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 8px rgba(0,0,0,0.6); }
.play-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; border-radius: 999px; font-weight: 700; font-size: 15px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 20px rgba(255,92,138,0.35); }
.play-btn.block { display: flex; justify-content: center; width: 100%; }
.dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.35); }
.dots i.on { background: #fff; width: 18px; border-radius: 3px; }

/* ── 카드 ── */
.card { min-width: 130px; width: 130px; scroll-snap-align: start; }
.card .art { position: relative; width: 130px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--border); }
.card .art img { width: 100%; height: 100%; object-fit: cover; }
.card .art .fallback { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 12px; background: linear-gradient(135deg, #2a2140, #40203a); }
.card .title { margin: 8px 2px 2px; font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; gap: 8px; margin: 2px; color: var(--muted); font-size: 11.5px; }
.rank-badge { position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: rgba(0,0,0,0.6); color: #fff; }
.rank-badge.top { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.badge { padding: 2px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 700; }
.badge.aud { background: rgba(124,92,255,0.22); color: #c9bcff; }
.badge.aud.female { background: rgba(255,92,138,0.2); color: #ffb3c9; }
.badge.aud.bl { background: rgba(90,180,255,0.2); color: #a9d6ff; }
.badge.aud.gl { background: rgba(255,150,90,0.2); color: #ffcaa0; }
.badge.status { background: rgba(75,227,160,0.18); color: #a9f0d2; }
.badge.on-hero { background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }

/* ── pill ── */
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 600; }
.pill.on { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }

/* ── 히로인 ── */
.heroine { min-width: 76px; width: 76px; text-align: center; scroll-snap-align: start; }
.heroine .face { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto; overflow: hidden; border: 2px solid var(--accent); }
.heroine .face img { width: 100%; height: 100%; object-fit: cover; }
.heroine .face .fb { width: 100%; height: 100%; display: grid; place-items: center; font-size: 22px; }
.heroine .hname { margin-top: 6px; font-size: 12px; font-weight: 600; }
.heroine .hgame { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 그리드 ── */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; padding: 4px 16px 8px; }
.grid .card, .grid .card .art { width: 100%; min-width: 0; }

/* ── 이어하기 ── */
.continue { min-width: 250px; width: 250px; display: flex; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px; scroll-snap-align: start; }
.continue .art { width: 60px; height: 80px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--panel-2); }
.continue .art img { width: 100%; height: 100%; object-fit: cover; }
.continue .c-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.continue .c-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue .c-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.continue .c-go { margin-top: auto; align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--accent); }

/* ── 상세 ── */
.detail-hero { position: relative; aspect-ratio: 3 / 4; max-height: 60vh; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero .hero-grad { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14,15,19,0.3), var(--bg)); }
.detail-back { position: absolute; top: 12px; left: 12px; z-index: 5; width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); display: grid; place-items: center; font-size: 18px; }
.detail-body { padding: 0 18px 20px; margin-top: -50px; position: relative; z-index: 4; }
.detail-body h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: -0.6px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.detail-body .syn { color: #d7dae5; font-size: 14px; margin: 12px 0 18px; }
.detail-heroines { display: flex; gap: 14px; overflow-x: auto; margin: 16px 0; scrollbar-width: none; }
.cta-bar { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 12px 0 4px; }

/* ── 하단 탭바 ── */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw); z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(20, 22, 30, 0.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 600; }
.tab .ic { font-size: 20px; line-height: 1; }
.tab.on { color: var(--accent); }

.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.loading { text-align: center; color: var(--muted); padding: 80px 20px; }
.page { min-height: 40vh; }
.page-title { font-size: 20px; font-weight: 800; padding: 6px 16px 12px; }
