:root{
  --bg: #ffffff;
  --bg-soft: #f4f4f6;
  --ink: #17171a;
  --ink-dim: #6b6b72;
  --line: #e7e7ea;
  --accent: #e04a3f;
  --pill-bg: #f0f0f2;
  --pill-active-bg: #17171a;
  --pill-active-ink: #ffffff;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
:root[data-theme="dark"]{
  --bg: #0f0f11; --bg-soft: #17171a; --ink: #f1f1f3; --ink-dim: #96969e;
  --line: #26262a; --pill-bg: #1e1e22; --pill-active-bg: #f1f1f3; --pill-active-ink: #0f0f11;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]):not([data-theme="dark"]){
    --bg: #0f0f11; --bg-soft: #17171a; --ink: #f1f1f3; --ink-dim: #96969e;
    --line: #26262a; --pill-bg: #1e1e22; --pill-active-bg: #f1f1f3; --pill-active-ink: #0f0f11;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.4);
  }
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg); color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  padding-bottom:100px;
}

header{ position:sticky; top:0; z-index:20; background:var(--bg); border-bottom:1px solid var(--line); }
.topline{ display:flex; align-items:center; gap:14px; padding:12px 18px; max-width:760px; margin:0 auto; }
.logo{ font-size:20px; font-weight:800; letter-spacing:-0.02em; color:var(--ink); flex:none; display:flex; align-items:center; gap:6px; }
.logo span{ color:var(--accent); }
.logo small{ font-size:11px; font-weight:700; color:var(--ink-dim); background:var(--pill-bg); padding:3px 8px; border-radius:8px; margin-left:8px; }

.search{ flex:1; display:flex; align-items:center; gap:8px; background:var(--bg-soft); border:1px solid var(--line); border-radius:20px; padding:8px 14px; }
.search svg{ width:16px; height:16px; flex:none; opacity:0.55; }
.search input{ border:none; background:none; outline:none; color:var(--ink); font-size:14px; width:100%; }
.search input::placeholder{ color:var(--ink-dim); }

.theme-toggle{ display:flex; border:1px solid var(--line); border-radius:20px; overflow:hidden; flex:none; }
.theme-toggle button{ border:none; background:var(--bg); color:var(--ink-dim); font-size:12px; font-weight:600; padding:8px 10px; cursor:pointer; }
.theme-toggle button.active{ background:var(--pill-active-bg); color:var(--pill-active-ink); }

.categories{ max-width:760px; margin:0 auto; display:flex; gap:8px; padding:0 18px 12px; overflow-x:auto; scrollbar-width:none; }
.categories::-webkit-scrollbar{ display:none; }
.pill{ flex:none; padding:7px 14px; border-radius:16px; background:var(--pill-bg); color:var(--ink); font-size:13px; font-weight:600; border:none; cursor:pointer; white-space:nowrap; }
.pill.active{ background:var(--pill-active-bg); color:var(--pill-active-ink); }

main{ max-width:760px; margin:0 auto; padding:18px; }
.empty{ text-align:center; color:var(--ink-dim); padding:60px 20px; font-size:14px; }

.card{ background:var(--bg); border:1px solid var(--line); border-radius:14px; margin-bottom:20px; overflow:hidden; box-shadow:var(--card-shadow); }
.video-wrap{ position:relative; width:100%; aspect-ratio:16/9; background:#000; }
.video-wrap video, .video-wrap iframe{ position:absolute; inset:0; width:100%; height:100%; border:none; object-fit:cover; }
.badge{ position:absolute; top:10px; left:10px; background:rgba(0,0,0,0.55); color:#fff; font-size:11px; font-weight:700; padding:4px 8px; border-radius:6px; text-transform:uppercase; letter-spacing:0.03em; z-index:2; }
.play-overlay{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,0.15); cursor:pointer; z-index:1; }
.play-overlay svg{ width:56px; height:56px; filter:drop-shadow(0 2px 8px rgba(0,0,0,0.5)); }
.play-overlay.hidden{ display:none; }

.card-body{ display:flex; gap:12px; padding:12px 14px; }
.avatar{ width:38px; height:38px; border-radius:50%; flex:none; background:linear-gradient(135deg, var(--accent), #f3a35a); }
.card-info{ flex:1; min-width:0; }
.card-title{ font-size:14.5px; font-weight:650; margin:0 0 4px; line-height:1.35; }
.card-sub{ font-size:12.5px; color:var(--ink-dim); margin:0; }

.fab-row{ position:fixed; bottom:20px; left:0; right:0; display:flex; justify-content:center; z-index:15; }
.refresh-btn{ display:flex; align-items:center; gap:8px; background:var(--pill-active-bg); color:var(--pill-active-ink); border:none; border-radius:24px; padding:12px 20px; font-size:14px; font-weight:650; box-shadow:0 6px 18px rgba(0,0,0,0.25); cursor:pointer; }
.refresh-btn svg{ width:16px; height:16px; }
.refresh-btn.spinning svg{ animation:spin .6s linear; }
@keyframes spin{ to{ transform:rotate(360deg); } }

/* ---- Admin-specific ---- */
.admin-body{ background:var(--bg-soft); }
.admin-header{ display:flex; align-items:center; justify-content:space-between; padding:16px 24px; background:var(--bg); border-bottom:1px solid var(--line); }
.admin-header nav a{ color:var(--ink-dim); text-decoration:none; font-size:13.5px; font-weight:600; margin-left:18px; }
.admin-header nav a:hover{ color:var(--ink); }

.admin-main{ max-width:640px; margin:24px auto; padding:0 18px; display:flex; flex-direction:column; gap:20px; }
.panel{ background:var(--bg); border:1px solid var(--line); border-radius:14px; padding:22px; }
.panel h2{ margin:0 0 16px; font-size:16px; }

.panel label{ display:block; font-size:12.5px; color:var(--ink-dim); margin:14px 0 6px; font-weight:650; }
.panel input[type="text"], .panel input[type="url"], .panel input[type="password"], .panel select, .panel input[type="file"]{
  width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--line); background:var(--bg-soft); color:var(--ink); font-size:14px; outline:none;
}
.hint{ font-size:12px; color:var(--ink-dim); margin:6px 0 0; }

.source-toggle{ display:flex; gap:8px; margin-top:16px; }
.src-btn{ flex:1; padding:9px; border-radius:10px; border:1px solid var(--line); background:var(--bg-soft); color:var(--ink-dim); font-weight:650; font-size:13px; cursor:pointer; }
.src-btn.active{ background:var(--pill-active-bg); color:var(--pill-active-ink); border-color:transparent; }

.btn-primary{ background:var(--accent); color:#fff; border:none; padding:10px 16px; border-radius:10px; font-weight:650; font-size:13.5px; cursor:pointer; }
.btn-secondary{ background:var(--pill-bg); color:var(--ink); border:none; padding:8px 14px; border-radius:10px; font-weight:650; font-size:13px; cursor:pointer; }

.modal-error{ color:var(--accent); font-size:13px; margin:0 0 10px; font-weight:600; }
.modal-success{ color:#1a8a4a; font-size:13px; margin:0 0 10px; font-weight:600; }

.video-list{ display:flex; flex-direction:column; gap:10px; }
.video-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; background:var(--bg-soft); border-radius:10px; }
.video-row-info{ display:flex; flex-direction:column; gap:2px; font-size:13.5px; }

.login-wrap{ max-width:360px; margin:80px auto; padding:0 18px; text-align:center; }
.login-card{ background:var(--bg); border:1px solid var(--line); border-radius:14px; padding:24px; margin-top:20px; text-align:left; }
.login-card h2{ margin:0 0 14px; font-size:16px; text-align:center; }
.login-card label{ display:block; font-size:12.5px; color:var(--ink-dim); margin:12px 0 6px; font-weight:650; }
.login-card input{ width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--line); background:var(--bg-soft); color:var(--ink); font-size:14px; outline:none; }

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

/* ---- Like / comment / share ---- */
.card-actions{ display:flex; align-items:center; gap:18px; padding:10px 14px 0; }
.action-btn{ display:flex; align-items:center; gap:6px; background:var(--pill-bg); border:none; border-radius:20px; color:var(--ink-dim); font-size:13px; font-weight:650; cursor:pointer; padding:8px 14px; transition:transform .15s ease, background .15s ease; }
.action-btn:hover{ background:var(--line); }
.action-btn:active{ transform:scale(0.94); }
.action-btn svg{ width:18px; height:18px; }

.action-btn.liked{ color:#fff; background:linear-gradient(135deg, #ff5470, #ff8a5c); }
.action-btn.liked svg path{ fill:#fff; stroke:#fff; }

.action-btn:nth-child(3){ background:linear-gradient(135deg, #4f8dfd, #6f5cff); color:#fff; }
.action-btn:nth-child(3):hover{ filter:brightness(1.08); }

.comments-panel{ display:none; padding:12px 14px 14px; border-top:1px solid var(--line); margin-top:10px; }
.comments-panel.open{ display:block; }
.comment-list{ display:flex; flex-direction:column; gap:10px; margin-bottom:12px; max-height:220px; overflow-y:auto; }
.comment-item{ font-size:13px; line-height:1.4; }
.comment-item strong{ font-size:12.5px; }
.comment-item span{ color:var(--ink-dim); }
.comment-empty{ font-size:12.5px; color:var(--ink-dim); }

.comment-form{ display:flex; gap:8px; }
.comment-form input{ flex:1; padding:9px 12px; border-radius:18px; border:1px solid var(--line); background:var(--bg-soft); color:var(--ink); font-size:13px; outline:none; }
.comment-form button{ background:var(--pill-active-bg); color:var(--pill-active-ink); border:none; border-radius:18px; padding:8px 16px; font-size:13px; font-weight:650; cursor:pointer; flex:none; }

.share-toast{ position:fixed; bottom:90px; left:50%; transform:translateX(-50%); background:var(--pill-active-bg); color:var(--pill-active-ink); padding:10px 18px; border-radius:20px; font-size:13px; font-weight:600; z-index:40; opacity:0; pointer-events:none; transition:opacity .25s ease; }
.share-toast.show{ opacity:1; }

/* ---- Pagination ---- */
.pagination{ display:flex; align-items:center; justify-content:center; gap:16px; padding:20px 0 10px; }
.page-btn{ background:var(--pill-bg); color:var(--ink); border:none; border-radius:20px; padding:9px 18px; font-size:13.5px; font-weight:650; cursor:pointer; }
.page-btn:disabled{ opacity:0.4; cursor:default; }
.page-btn:not(:disabled):hover{ background:var(--line); }
.page-status{ font-size:13px; color:var(--ink-dim); font-weight:600; }

/* ---- Age verification gate ---- */
body.age-gate-active{ overflow:hidden; }
.age-gate{
  position:fixed; inset:0; z-index:999;
  background:rgba(10,10,12,0.82);
  backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
}
.age-gate-card{
  background:var(--bg);
  border-radius:18px;
  max-width:420px;
  width:100%;
  padding:32px 28px;
  text-align:center;
  box-shadow:0 20px 60px rgba(0,0,0,0.4);
  border:1px solid var(--line);
}
.age-gate-card h2{ margin:0 0 14px; font-size:19px; color:var(--ink); }
.age-gate-card p{ margin:0 0 24px; font-size:14px; line-height:1.6; color:var(--ink-dim); }
.age-gate-actions{ display:flex; flex-direction:column; gap:12px; }
.age-btn{
  border:none; border-radius:14px; padding:14px 20px;
  font-size:14.5px; font-weight:700; cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease;
}
.age-btn:active{ transform:scale(0.97); }
.age-btn-yes{
  background:linear-gradient(135deg, #34d399, #10b981);
  color:#fff;
  box-shadow:0 6px 20px rgba(16,185,129,0.45);
}
.age-btn-yes:hover{ box-shadow:0 8px 26px rgba(16,185,129,0.6); }
.age-btn-no{
  background:linear-gradient(135deg, #f87171, #ef4444);
  color:#fff;
  box-shadow:0 6px 20px rgba(239,68,68,0.4);
}
.age-btn-no:hover{ box-shadow:0 8px 26px rgba(239,68,68,0.55); }
