:root{ --hn-sbp-gap: 40px; }
/* 40px compact bar */
.hn-sbp{
  position: fixed; left:0; right:0; bottom:0;
  display:flex; justify-content:space-around; align-items:center;
  padding:2px 8px calc(2px + env(safe-area-inset-bottom, 0px));
  background:#fff; border-top:1px solid #e5e7eb; box-shadow:0 -4px 12px rgba(0,0,0,.06);
  z-index: 2147483000; touch-action: manipulation;
  min-height:40px;
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
}

/* Icons-only transparent buttons + inline counters */
.hn-sbp-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  min-width:40px; height:32px; padding:0 2px; margin:0;
  background:transparent; border:none; border-radius:0; color:#111; text-decoration:none;
}
.hn-sbp-btn:active{ transform: translateY(1px); }
.hn-sbp-ico{ width:22px; height:22px; }
.hn-sbp-num{ display:inline-block; font:600 12px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial; color:#111; }

/* Dynamic safe space uses measured bar height (set by JS) */
body.hn-sbp-hasbar{ padding-bottom: var(--hn-sbp-gap) !important; }
.entry-content, .site-content, .content-area, .container, .post, .hentry, main {
  margin-bottom: var(--hn-sbp-gap) !important;
}

/* Comments overlay */
.hn-sbp-comments{
  position: fixed; inset:0; background:#fff; z-index:2147483600;
  display:none; flex-direction:column;
}
.hn-sbp-comments[aria-hidden="false"]{ display:flex; }
.hn-sbp-comments__head{
  display:flex; align-items:center; gap:12px; padding:12px 14px;
  border-bottom:1px solid #e5e7eb; position:sticky; top:0; background:#fff; z-index:1;
}
.hn-sbp-back{ border:0; background:none; width:36px; height:36px; display:flex; align-items:center; justify-content:center; color:#333; cursor:pointer; border-radius:8px; }
.hn-sbp-back:hover{ background:#f3f4f6; }
.hn-sbp-back svg{ display:block; }
.hn-sbp-comments__body{ flex:1; overflow:auto; -webkit-overflow-scrolling: touch; padding:8px 12px 24px; }
.hn-sbp-item{ display:flex; gap:10px; padding:10px 4px; border-bottom:1px solid #f1f5f9; }
.hn-sbp-av{ width:32px; height:32px; border-radius:999px; flex:0 0 32px; background:#eee; }
.hn-sbp-meta{ font:600 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial; color:#111; }
.hn-sbp-date{ font:500 11px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial; color:#666; margin-left:6px; }
.hn-sbp-text{ font:400 13px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial; color:#222; margin-top:2px; }
.hn-sbp-comments__compose{ border-top:1px solid #e5e7eb; padding:8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); background:#fff; }
.hn-sbp-form{ display:flex; gap:6px; align-items:flex-end; }

/* YouTube-like composer visuals */
.yt-composer__inner{ display:flex; align-items:flex-start; gap:8px; width:100%; }
.yt-composer__avatar{ width:32px; height:32px; border-radius:999px; background:#e5e7eb; flex:0 0 32px; }
.yt-input{ flex:1; border:1px solid #e5e7eb; border-radius:18px; padding:8px 12px; min-height:36px; font-size:14px; line-height:1.3; }
.yt-send{ border:0; background:#111; color:#fff; border-radius:18px; padding:8px 12px; height:36px; }
.yt-send[disabled]{ opacity:.5; }

.hn-sbp-cta{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; }
.hn-sbp-cta__msg{ font:500 14px/1.2 system-ui,-apple-system,Segoe UI,Roboto,Arial; color:#111; }
.hn-sbp-btn--ghost{ display:inline-flex; align-items:center; justify-content:center; padding:8px 12px; border:1px solid #e5e7eb; border-radius:999px; text-decoration:none; color:#111; font-weight:600; }

/* ── User Profile Bottom Sheet ─────────────────────────── */
.hn-sbp-av-btn{
  background:none;border:0;padding:0;cursor:pointer;
  width:32px;height:32px;border-radius:50%;overflow:hidden;
  flex:0 0 32px;display:block;
}
.hn-sbp-av-btn img{ width:32px;height:32px;object-fit:cover;display:block; }

/* Sheet container — portal approach, max z-index */
.hn-sbp-sheet{
  position:fixed;inset:0;
  z-index:2147483647;
  pointer-events:none;
}
.hn-sbp-sheet[aria-hidden="false"]{ pointer-events:auto; }

/* Backdrop */
.hn-sbp-sheet-backdrop{
  position:fixed;inset:0;
  background:rgba(0,0,0,0);
  transition:background .25s ease;
}
.hn-sbp-sheet[aria-hidden="false"] .hn-sbp-sheet-backdrop{
  background:rgba(0,0,0,.5);
}

/* Panel — slide up from bottom */
.hn-sbp-sheet-panel{
  position:fixed;bottom:0;left:0;right:0;
  background:#fff;border-radius:18px 18px 0 0;
  max-height:80vh;overflow-y:auto;
  transform:translateY(100%);
  transition:transform .3s cubic-bezier(.4,0,.2,1);
  padding-bottom:env(safe-area-inset-bottom,16px);
  box-shadow:0 -4px 20px rgba(0,0,0,.1);
  /* Sirf vertical scroll allow karo, horizontal swipe nahi */
  touch-action:pan-y;
  overscroll-behavior:contain;
}
.hn-sbp-sheet[aria-hidden="false"] .hn-sbp-sheet-panel{
  transform:translateY(0);
}

.hn-sbp-sheet-handle{
  width:40px;height:4px;border-radius:2px;background:#e0e0e0;
  margin:12px auto 0;
}
.hn-sbp-sheet-close{
  position:absolute;top:8px;right:12px;
  width:32px;height:32px;border-radius:50%;
  background:none;border:0;font-size:20px;
  color:#bbb;cursor:pointer;line-height:32px;text-align:center;
}
.hn-sbp-sheet-close:hover{ background:#f5f5f5;color:#555; }

.hn-sbp-sheet-profile{
  display:flex;align-items:center;gap:14px;
  padding:16px 18px;border-bottom:1px solid #f0f0f0;
}
.hn-sbp-sheet-av{
  width:64px;height:64px;border-radius:50%;
  object-fit:cover;flex-shrink:0;border:2px solid #f0f0f0;
}
.hn-sbp-sheet-name{ font-size:17px;font-weight:600;color:#111;margin-bottom:6px; }
.hn-sbp-sheet-meta{ display:flex;flex-direction:column;gap:3px;font-size:13px;color:#888; }
.hn-sbp-sheet-section-title{
  font-size:11px;font-weight:700;color:#bbb;
  text-transform:uppercase;letter-spacing:.6px;
  padding:14px 18px 6px;
}
.hn-sbp-recent-item{
  display:block;padding:10px 18px;
  border-bottom:1px solid #f5f5f5;
  text-decoration:none;color:inherit;
}
.hn-sbp-recent-post{ font-size:13px;font-weight:600;color:#111;margin-bottom:3px; }
.hn-sbp-recent-text{ font-size:13px;color:#666;font-style:italic; }
.hn-sbp-recent-date{ font-size:11px;color:#ccc;margin-top:2px; }
.hn-sbp-sheet-loading{ padding:40px;text-align:center;color:#ccc;font-size:14px; }

/* ══════════════════════════════════════════════════
   DASHBOARD — bar HIDE karo
   ══════════════════════════════════════════════════ */
body.hn-dashboard-page #hn-sbp {
    display: none !important;
}

/* ══════════════════════════════════════════════════
   DARK MODE SUPPORT
   ══════════════════════════════════════════════════ */
body.hn-dark-mode #hn-sbp {
    background: #1e293b !important;
    border-top-color: #334155 !important;
    box-shadow: 0 -4px 12px rgba(0,0,0,.3) !important;
}
body.hn-dark-mode .hn-sbp-btn { color: #e2e8f0 !important; }
body.hn-dark-mode .hn-sbp-num { color: #e2e8f0 !important; }

body.hn-dark-mode .hn-sbp-comments,
body.hn-dark-mode .hn-sbp-sheet-panel,
body.hn-dark-mode .hn-sbp-comments__head,
body.hn-dark-mode .hn-sbp-comments__compose {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
body.hn-dark-mode .hn-sbp-back {
    color: #e2e8f0 !important;
}
body.hn-dark-mode .hn-sbp-back:hover {
    background: #334155 !important;
}
body.hn-dark-mode .hn-sbp-meta,
body.hn-dark-mode .hn-sbp-text,
body.hn-dark-mode .hn-sbp-sheet-name { color: #e2e8f0 !important; }
body.hn-dark-mode .hn-sbp-date { color: #94a3b8 !important; }
body.hn-dark-mode .hn-sbp-item { border-color: #334155 !important; }
body.hn-dark-mode .yt-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ── Profile button styles ── */
.js-hn-profile { position: relative; }

.hn-sbp-profile-av {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(0,0,0,.12);
    display: block;
}

/* Icon sizing tweak for new refined icons */
.hn-sbp-ico {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Liked state — fill the heart/thumb */
.js-hn-like.liked .hn-sbp-ico {
    fill: #16a34a;
    stroke: #16a34a;
}
.js-hn-dislike.disliked .hn-sbp-ico {
    fill: #ef4444;
    stroke: #ef4444;
}

/* Dark mode profile avatar border */
body.hn-dark-mode .hn-sbp-profile-av {
    border-color: rgba(255,255,255,.2);
}

/* ══════════════════════════════════════════════════
   NEW FEATURES CSS — v3.0.0
   ══════════════════════════════════════════════════ */

/* ── Bounce animation on like/dislike ─────── */
@keyframes hn-sbp-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.45); }
  55%  { transform: scale(0.88); }
  75%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.hn-sbp-ico-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform-origin: center;
}
.hn-sbp-ico-wrap.hn-sbp-bounce {
    animation: hn-sbp-bounce 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

/* ── Like/dislike active colors ────────────── */
.js-hn-like.liked .hn-sbp-ico    { fill: #16a34a; stroke: #16a34a; }
.js-hn-dislike.disliked .hn-sbp-ico { fill: #ef4444; stroke: #ef4444; }

/* ── Reply-to indicator ────────────────────── */
.hn-sbp-compose-right {
    display: flex; flex-direction: column; flex: 1; min-width: 0;
}
.hn-sbp-reply-to {
    display: flex; align-items: center; justify-content: space-between;
    background: #f0f9ff; border-left: 3px solid #38bdf8;
    padding: 4px 8px; border-radius: 4px; margin-bottom: 4px;
    font-size: 12px; color: #0369a1; gap: 8px;
}
.hn-sbp-reply-to button {
    background: none; border: none; cursor: pointer;
    color: #94a3b8; font-size: 14px; padding: 0 2px; line-height: 1;
}

/* ── Comment actions row ───────────────────── */
.hn-sbp-actions {
    display: flex; align-items: center; gap: 10px;
    margin-top: 4px;
}
.hn-sbp-reply-btn {
    background: none; border: none; padding: 0;
    font-size: 11px; color: #94a3b8; cursor: pointer;
    font-weight: 600; letter-spacing: .3px;
}
.hn-sbp-reply-btn:hover { color: #475569; }

/* ── Comment vote button ───────────────────── */
.hn-sbp-vote-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: none; cursor: pointer;
    font-size: 11px; color: #94a3b8; padding: 0;
}
.hn-sbp-vote-btn.voted { color: #ef4444; }
.hn-sbp-vote-btn:hover { color: #64748b; }
.hn-sbp-vote-count { min-width: 10px; }

/* ── New comments badge ────────────────────── */
.hn-sbp-new-badge {
    background: #2563eb; color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 12px;
    cursor: pointer; margin-left: auto;
}
.hn-sbp-new-badge:hover { background: #1d4ed8; }

/* ── Nested comment indent ─────────────────── */
.hn-sbp-item + .hn-sbp-item[style*="margin-left"] {
    border-top: 1px solid #f1f5f9;
    padding-top: 8px; margin-top: 4px;
}

/* ── Profile avatar in bar ─────────────────── */
.hn-sbp-profile-av {
    width: 26px; height: 26px; border-radius: 50%;
    object-fit: cover; border: 1.5px solid rgba(0,0,0,.12); display: block;
}

/* Dark mode for new elements */
body.hn-dark-mode .hn-sbp-reply-to     { background: #0c4a6e; border-color: #0284c7; color: #7dd3fc; }
body.hn-dark-mode .hn-sbp-reply-btn    { color: #475569; }
body.hn-dark-mode .hn-sbp-reply-btn:hover { color: #94a3b8; }
body.hn-dark-mode .hn-sbp-vote-btn     { color: #475569; }
body.hn-dark-mode .hn-sbp-new-badge    { background: #1d4ed8; }
body.hn-dark-mode .hn-sbp-profile-av   { border-color: rgba(255,255,255,.2); }

/* ── Login/register in-app iframe modal (WebView-safe, no real popup) ── */
#hn-sbp-login-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.55);
  z-index:2147483000;
  display:flex; align-items:center; justify-content:center;
  padding:16px;
  box-sizing:border-box;
}
.hn-sbp-login-box{
  position:relative;
  width:100%; max-width:440px;
  height:min(88vh, 720px);
  background:#fff;
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 12px 40px rgba(0,0,0,.35);
}
.hn-sbp-login-box iframe{
  width:100%; height:100%;
  border:0; display:block;
}
.hn-sbp-login-close{
  position:absolute;
  top:8px; right:8px;
  width:32px; height:32px;
  border-radius:50%;
  border:0;
  background:rgba(0,0,0,.55);
  color:#fff;
  font-size:20px;
  line-height:1;
  display:flex; align-items:center; justify-content:center;
  z-index:2;
  -webkit-tap-highlight-color:transparent;
}

/* Comments khulne par baaki poori screen (video/ad-iframe koi bhi ho) chhupa
   do — kabhi-kabhi video/iframe apna khud ka hardware layer bana kar
   z-index ke niyam todkar upar dikh jaate hain. visibility:hidden se wo
   layer hi hat jaata hai; visibility:visible sirf comments panel ke liye
   (aur uske descendants ke liye, jo automatically inherit karte hain)
   override kar deta hai. */
html.hn-comments-force-top body{
  visibility:hidden !important;
}
html.hn-comments-force-top #hn-sbp-comments{
  visibility:visible !important;
}
