:root {
  --bg: #000;
  --fg: #fff;
  --muted: rgba(255, 255, 255, 0.6);
  --accent: #fe2c55;      /* like / primary */
  --gold: #ffd24a;        /* favorite */
  --card: #161616;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
body { overflow: hidden; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
  pointer-events: none;
}
.topbar .brand { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.topbar .me {
  pointer-events: auto; border: 1px solid rgba(255,255,255,.35); color: #fff;
  background: rgba(0,0,0,.25); padding: 6px 16px; border-radius: 999px;
  font-size: 14px; cursor: pointer; backdrop-filter: blur(6px);
}
.topbar .me.logged { background: var(--accent); border-color: var(--accent); }

/* ---------- feed ---------- */
.feed { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; scroll-behavior: smooth; }
.feed::-webkit-scrollbar { display: none; }
.card { position: relative; height: 100vh; height: 100dvh; scroll-snap-align: start;
  display: flex; align-items: center; justify-content: center; overflow: hidden; background: #000; }
.card video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.card.playing video { object-fit: cover; }  /* cover once playing for immersive look */
.shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 35%),
              linear-gradient(to bottom, rgba(0,0,0,.4), transparent 25%); }

/* ---------- side actions ---------- */
.actions { position: absolute; right: 12px; bottom: 110px; z-index: 10;
  display: flex; flex-direction: column; gap: 22px; align-items: center; }
.act { background: none; border: 0; color: #fff; cursor: pointer; display: flex;
  flex-direction: column; align-items: center; gap: 4px; font-size: 12px; }
.act svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); transition: transform .12s; }
.act:active svg { transform: scale(.85); }
.act.liked svg { fill: var(--accent); stroke: var(--accent); }
.act.faved svg { fill: var(--gold); stroke: var(--gold); }
.act .cnt { font-weight: 600; }

/* ---------- meta ---------- */
.meta { position: absolute; left: 14px; right: 84px; bottom: 28px; z-index: 10; }
.meta .user { font-weight: 700; font-size: 15px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.meta .title { font-size: 14px; line-height: 1.4; }
.meta .desc { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- progress / mute ---------- */
.mute-btn { position: absolute; top: calc(env(safe-area-inset-top) + 60px); right: 14px; z-index: 20;
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,.35); color: #fff; font-size: 16px; backdrop-filter: blur(6px); }

/* ---------- ad card ---------- */
.ad-card { background: #0a0a0a; }
.ad-inner { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 18px; }
.ad-badge { position: absolute; top: 16px; left: 16px; background: rgba(255,255,255,.15);
  color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 6px; letter-spacing: 1px; }
.ad-skip { position: absolute; top: 16px; right: 16px; background: rgba(0,0,0,.5); color: #fff;
  border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 6px 14px; font-size: 13px;
  cursor: pointer; }
.ad-skip[disabled] { opacity: .5; cursor: default; }
.ad-placeholder { width: min(320px, 80%); aspect-ratio: 9/16; border-radius: var(--radius);
  background: linear-gradient(135deg, #2b2b5e, #5e2b4a); display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 15px; border: 1px dashed rgba(255,255,255,.25); }
.ad-title { font-size: 16px; font-weight: 700; }
.ad-sub { color: var(--muted); font-size: 13px; max-width: 320px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
  justify-content: center; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); padding: 18px; }
.modal-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px;
  padding: 22px; position: relative; animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-card .close { position: absolute; top: 12px; right: 14px; background: none; border: 0;
  color: #fff; font-size: 24px; cursor: pointer; line-height: 1; }
.tabs { display: flex; gap: 18px; margin-bottom: 16px; }
.tab { background: none; border: 0; color: var(--muted); font-size: 17px; font-weight: 700; cursor: pointer; padding: 4px 0; }
.tab.active { color: #fff; border-bottom: 2px solid var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.hidden { display: none; }
.auth-form input { background: #0e0e0e; border: 1px solid #2a2a2a; color: #fff; border-radius: 10px;
  padding: 12px 14px; font-size: 15px; outline: none; }
.auth-form input:focus { border-color: var(--accent); }
.primary { background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 13px;
  font-size: 16px; font-weight: 700; cursor: pointer; }
.primary:active { transform: scale(.98); }
.hint { color: var(--muted); font-size: 12px; text-align: center; margin: 2px 0 0; }
.captcha-row { display: flex; flex-direction: column; gap: 8px; }
.captcha-row .math { display: flex; gap: 8px; align-items: center; }
.captcha-row .math span { font-size: 15px; }
.captcha-row .math input { flex: 1; background: #0e0e0e; border: 1px solid #2a2a2a; color: #fff;
  border-radius: 10px; padding: 11px 12px; font-size: 15px; outline: none; }
.cf-turnstile { display: flex; justify-content: center; }

/* ---------- comment sheet ---------- */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 68vh;
  background: var(--card); border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  animation: slideup .22s ease; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  border-bottom: 1px solid #262626; font-weight: 700; }
.sheet-head .close { background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 16px; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid #1e1e1e; }
.comment .ava { width: 36px; height: 36px; border-radius: 50%; background: #333; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; }
.comment .body { flex: 1; }
.comment .name { font-size: 13px; color: var(--muted); }
.comment .text { font-size: 14px; margin-top: 2px; line-height: 1.4; }
.comment .time { font-size: 11px; color: #666; margin-top: 4px; }
.sheet-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #262626;
  padding-bottom: calc(env(safe-area-inset-bottom) + 12px); }
.sheet-input input { flex: 1; background: #0e0e0e; border: 1px solid #2a2a2a; color: #fff;
  border-radius: 999px; padding: 11px 16px; font-size: 15px; outline: none; }
.sheet-input button { background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 0 18px; font-weight: 700; cursor: pointer; }

/* ---------- misc ---------- */
.hidden { display: none !important; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: rgba(20,20,20,.95); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px;
  z-index: 60; opacity: 0; transition: .25s; pointer-events: none; max-width: 80%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #7a1326; }
.toast.success { background: #14532d; }
