/* One UI (Samsung) — dark mode */
:root {
  --bg: #000000;
  --bg2: #101012;
  --card: #1c1c1f;
  --card2: #2c2c31;
  --line: #2e2e33;
  --text: #ffffff;
  --sub: #a7a7ad;
  --sub2: #7c7c84;
  --accent: #0381fe;
  --accent-soft: rgba(3, 129, 254, .16);
  --danger: #ff5a5a;
  --radius: 20px;
  --radius-sm: 14px;
  --nav-h: 64px;
  --maxw: 1060px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
input { font: inherit; color: inherit; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(0, 0, 0, .82);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.topbar-in { max-width: var(--maxw); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: .2px; }
.logo-badge {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, #0381fe, #00c6ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; color: #fff;
}
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--card); display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.icon-btn:active { background: var(--card2); }
.icon-btn svg { width: 19px; height: 19px; }

.bigtitle { padding: 22px 0 6px; }
.bigtitle h1 { font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: -.4px; }
.bigtitle p { color: var(--sub); margin-top: 4px; font-size: 14px; }

/* ---------- search ---------- */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 999px;
  padding: 11px 16px; margin: 12px 0 4px;
}
.searchbar svg { width: 18px; height: 18px; color: var(--sub); flex: none; }
.searchbar input { flex: 1; background: none; border: 0; outline: 0; font-size: 15px; }
.searchbar input::placeholder { color: var(--sub2); }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 16px; border-radius: 999px;
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.chip.on { background: var(--accent); color: #fff; }
.chip:active { background: var(--card2); }
.subchips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.subchips::-webkit-scrollbar { display: none; }
.subchip {
  flex: none; padding: 6px 13px; border-radius: 999px;
  background: transparent; color: var(--sub); font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); white-space: nowrap;
}
.subchip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ---------- sections & grid ---------- */
.section { margin-top: 20px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.2px; }
.section-head .more { margin-left: auto; color: var(--accent); font-size: 13px; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.card { cursor: pointer; min-width: 0; }
.card .cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden;
  background: var(--card);
}
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .cover .badge {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0, 0, 0, .72); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(6px);
}
.card .cover .score {
  position: absolute; right: 8px; top: 8px;
  background: rgba(0, 0, 0, .72); color: #ffd60a; font-size: 11px; font-weight: 800;
  padding: 3px 8px; border-radius: 999px;
}
.card h3 {
  margin-top: 8px; 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 p { color: var(--sub); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* horizontal rail */
.rail { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail .card { flex: none; width: 132px; }
@media (min-width: 640px) { .rail .card { width: 150px; } }

/* ---------- detail ---------- */
.hero { position: relative; margin: 0 -16px; padding: 0 16px 18px; overflow: hidden; }
.hero-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(28px) brightness(.45); transform: scale(1.15); }
.hero-in { position: relative; display: flex; gap: 16px; padding-top: 18px; }
.hero-cover { width: 128px; flex: none; aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .55); background: var(--card); }
.hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.hero-info { min-width: 0; padding-top: 4px; }
.hero-info h1 { font-size: 22px; font-weight: 800; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-meta { color: var(--sub); font-size: 13px; margin-top: 8px; line-height: 1.6; }
.hero-meta b { color: #ffd60a; }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { background: rgba(255, 255, 255, .12); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.playbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 16px; padding: 14px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
}
.playbtn:active { opacity: .85; }
.playbtn svg { width: 18px; height: 18px; }
.desc { color: #d7d7db; font-size: 14px; line-height: 1.65; margin-top: 16px; white-space: pre-line; }
.desc.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.linklike { color: var(--accent); font-weight: 700; font-size: 13px; margin-top: 6px; display: inline-block; }
.epgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 12px; }
@media (min-width: 640px) { .epgrid { grid-template-columns: repeat(8, 1fr); } }
.epbtn {
  aspect-ratio: 1.5; border-radius: 12px; background: var(--card);
  font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.epbtn.on { background: var(--accent); color: #fff; }
.epbtn:active { background: var(--card2); }

/* ---------- player ---------- */
.player-wrap { margin: 12px -16px 0; background: #000; }
.player-wrap video { width: 100%; aspect-ratio: 16 / 9; display: block; background: #000; }
.player-title { padding: 14px 0 4px; }
.player-title h1 { font-size: 19px; font-weight: 800; line-height: 1.3; }
.player-title p { color: var(--sub); font-size: 13px; margin-top: 4px; }
.epnav { display: flex; gap: 10px; margin-top: 12px; }
.epnav button {
  flex: 1; padding: 12px; border-radius: 999px; background: var(--card);
  font-weight: 700; font-size: 14px;
}
.epnav button:disabled { opacity: .35; }
.epnav button.primary { background: var(--accent); color: #fff; }

/* ---------- list rows (topics/posts) ---------- */
.rowitem { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.rowitem:last-child { border-bottom: 0; }
.rowitem .thumb { width: 92px; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: var(--card); flex: none; }
.rowitem .thumb img { width: 100%; height: 100%; object-fit: cover; }
.rowitem h3 { font-size: 15px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rowitem p { color: var(--sub); font-size: 12.5px; margin-top: 4px; }

/* ---------- misc ---------- */
.loadmore {
  display: block; margin: 22px auto 8px; padding: 12px 28px; border-radius: 999px;
  background: var(--card); font-weight: 700; font-size: 14px;
}
.loadmore:disabled { opacity: .5; }
.empty { text-align: center; color: var(--sub); padding: 48px 20px; font-size: 14px; line-height: 1.7; }
.skel { border-radius: 16px; background: linear-gradient(100deg, var(--card) 40%, var(--card2) 50%, var(--card) 60%); background-size: 200% 100%; animation: sh 1.2s infinite linear; }
@keyframes sh { to { background-position: -200% 0; } }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); transform: translateX(-50%) translateY(20px);
  background: #2c2c31; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 99; max-width: 92vw; text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.spin { width: 34px; height: 34px; margin: 60px auto; border-radius: 50%; border: 3px solid var(--card2); border-top-color: var(--accent); animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- bottom nav ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(16, 16, 18, .92);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, .07);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottomnav-in { max-width: var(--maxw); margin: 0 auto; display: flex; }
.navitem {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 8px; color: var(--sub); font-size: 11px; font-weight: 600;
}
.navitem svg { width: 22px; height: 22px; }
.navitem.on { color: var(--accent); }
