* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.reels-shell {
  position: relative;
  height: 100dvh;
  background: #000;
  overflow: hidden;
}

/* --- Top bar: Home/Search, Timeline/Following/For You, add button --- */
.reels-topbar {
  position: fixed;
  z-index: 90;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 24px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .7), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.reels-topbar > * { pointer-events: auto; }

.topbar-left-actions { display: flex; align-items: center; gap: 6px; }
.topbar-icon-btn {
  width: 34px; height: 34px; flex-shrink: 0; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .35); display: grid; place-items: center; cursor: pointer;
  text-decoration: none;
}
.topbar-icon-btn svg { width: 18px; height: 18px; fill: #fff; }
.topbar-home-btn { background: rgba(0, 0, 0, .48); }
.topbar-icon-btn:focus-visible,
.topbar-tab:focus-visible,
.reels-add-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.topbar-tabs {
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 3vw, 18px);
}
.topbar-tab {
  appearance: none;
  background: none; border: 0; color: rgba(255, 255, 255, .62);
  font-weight: 800; font-size: .92rem; line-height: 1;
  padding: 4px 1px; position: relative; cursor: pointer;
  text-shadow: 0 1px 4px #000; text-decoration: none; white-space: nowrap;
}
.topbar-tab:hover,
.topbar-route-link { color: rgba(255, 255, 255, .9); }
.topbar-tab.active { color: #fff; }
.topbar-tab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -7px; height: 2px;
  background: #fff; border-radius: 2px;
}

.reels-add-btn {
  width: 34px; height: 34px; flex-shrink: 0; border: 0; border-radius: 50%;
  background: #ff2d55; color: #fff; font-size: 1.35rem; font-weight: 700; line-height: 1;
  display: grid; place-items: center; box-shadow: 0 2px 10px #0006; cursor: pointer;
  transition: transform .15s ease;
}
.reels-add-btn:active { transform: scale(.9); }

.talent-reels, .reels-feed { height: 100%; background: #000; }
.talent-reels { position: relative; overflow: hidden; }

.reels-feed {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
.reels-feed::-webkit-scrollbar { display: none; }

.feed-empty {
  height: 100%; display: grid; place-items: center; text-align: center;
  color: #999; font-size: .95rem; padding: 0 40px; line-height: 1.4;
}

.reel {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #000;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.reel-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #000;
}
.reel-music-art{position:absolute;inset:0;display:grid;place-items:center;overflow:hidden;background:radial-gradient(circle at 50% 35%,#57306f,#090909 68%)}
.reel-music-art img{width:78%;aspect-ratio:1;object-fit:cover;border-radius:50%;box-shadow:0 0 0 8px #111,0 20px 60px #000;animation:reelRecordSpin 16s linear infinite}
.reel-music-art span{position:absolute;display:grid;width:54px;height:54px;place-items:center;border-radius:50%;background:#ff2d55;color:#fff;font-size:1.5rem;box-shadow:0 0 28px #ff2d55aa}
.reel-audio{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important}
@keyframes reelRecordSpin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.reel-music-art img{animation:none}}

.reel-tap-layer { position: absolute; z-index: 2; inset: 0; }

/* --- Floating "bullet" comments over the video, TikTok-style --- */
.reel-comment-feed {
  position: absolute; z-index: 4;
  left: clamp(12px, 3vw, 32px); right: 100px;
  bottom: 132px; max-height: 46%;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  overflow: hidden;
  pointer-events: none;
}
.reel-comment-bubble {
  align-self: flex-start; max-width: 100%;
  background: rgba(0, 0, 0, .45);
  color: #fff; font-size: .82rem; line-height: 1.3;
  padding: 6px 12px; border-radius: 14px;
  text-shadow: 0 1px 4px #000;
  word-break: break-word;
  opacity: 0;
  animation: commentBubbleIn .3s ease forwards, commentBubbleOut 1.1s ease forwards;
  animation-delay: 0s, 4.5s;
}
.reel-comment-bubble b { color: #ff5c7a; margin-right: 5px; font-weight: 800; }
@keyframes commentBubbleIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes commentBubbleOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-30px); }
}

.reel-overlay {
  position: absolute;
  z-index: 4;
  left: clamp(12px, 3vw, 32px);
  right: 95px;
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 82px));
  color: #fff;
  text-shadow: 0 2px 8px #000, 0 0 20px #000;
}
.reel-overlay p { margin: 10px 0 0; font-weight: 700; }

.reel-person-row { display: flex; align-items: center; gap: 8px; }
.media-person { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: #fff; }
.reel-avatar {
  display: block; width: 52px; height: 52px; border-radius: 50%;
  overflow: hidden; box-shadow: 0 0 0 2px #fff; flex-shrink: 0;
}
.reel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.media-person span:last-child { display: grid; }
.media-person b { font-size: .95rem; }
.media-person small { font-size: .75rem; opacity: .9; }

.reel-follow {
  position: relative; z-index: 6; width: 22px; height: 22px;
  margin-left: -18px; margin-top: 40px; padding: 0;
  display: grid; place-items: center;
  border: 2px solid #fff; border-radius: 50%;
  background: rgba(255, 255, 255, .18); color: #fff;
  box-shadow: 0 2px 10px #0008; cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}
.reel-follow svg { width: 12px; height: 12px; fill: #fff; }
.reel-follow.active {
  background: #22c55e; border-color: #22c55e;
  transform: scale(1.08);
}
.reel-follow.pop { animation: bouncePop .35s ease; }
@keyframes bouncePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.3); }
  100% { transform: scale(1.08); }
}

.reel-actions {
  position: absolute; z-index: 5; right: 12px; bottom: max(96px, calc(env(safe-area-inset-bottom) + 82px));
  display: grid; gap: 8px;
}
.reel-action {
  display: grid; place-items: center; width: 60px; padding: 0; border: 0;
  border-radius: 0; background: transparent; color: #fff;
  box-shadow: none; text-shadow: 0 2px 8px #000; appearance: none; cursor: pointer;
}
.reel-action svg {
  width: 40px; height: 40px; overflow: visible; fill: #fff;
  stroke: #101010; stroke-width: 1.8; filter: drop-shadow(0 3px 4px #000);
}
.reel-action.active svg { fill: #fe2c55; }
.reel-action-count { min-height: 16px; margin-top: 2px; font-size: .7rem; font-weight: 900; }

@media (max-width: 410px) {
  .reels-topbar {
    gap: 5px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .topbar-left-actions { gap: 4px; }
  .topbar-icon-btn,
  .reels-add-btn { width: 30px; height: 30px; }
  .topbar-icon-btn svg { width: 16px; height: 16px; }
  .topbar-tabs { gap: 8px; }
  .topbar-tab { font-size: .78rem; }
}

@media (max-width: 340px) {
  .topbar-tabs { gap: 6px; }
  .topbar-tab { font-size: .72rem; }
}

@media (max-height: 700px) {
  .reel-actions { bottom: max(86px, calc(env(safe-area-inset-bottom) + 74px)); gap: 5px; }
  .reel-action { width: 54px; }
  .reel-action svg { width: 30px; height: 30px; }
  .reel-action-count { min-height: 13px; font-size: .64rem; }
  .reel-overlay { bottom: max(86px, calc(env(safe-area-inset-bottom) + 74px)); right: 78px; }
}

.tap-heart {
  position: absolute; z-index: 10; translate: -50% -50%; color: #fff;
  font-size: clamp(68px, 14vw, 128px); pointer-events: none;
  filter: drop-shadow(0 0 12px #22c55e) drop-shadow(0 0 26px #22c55e);
  animation: tapHeart .85s ease-out forwards;
}
@keyframes tapHeart {
  0% { opacity: 0; transform: scale(.25) rotate(-18deg); }
  25% { opacity: 1; transform: scale(1.2) rotate(8deg); }
  100% { opacity: 0; transform: translateY(-90px) scale(.82) rotate(16deg); }
}

/* --- Like: green fill + zoom-pop on click (shared by other action icons too) --- */
.reel-action[data-action="like"].active svg { fill: #22c55e; }
.reel-action[data-action="vote"] svg { fill: #f5c542; }
.reel-action[data-action="vote"] .reel-action-count { color: #f5c542; letter-spacing: .05em; }
.reel-action.zoom-pop svg { animation: likeZoom .45s ease; }
@keyframes likeZoom {
  0% { transform: scale(1); }
  35% { transform: scale(1.55); }
  60% { transform: scale(.9); }
  100% { transform: scale(1); }
}

/* --- Dislike: red buzz shake on the icon itself --- */
.reel-action[data-action="dislike"].active svg { fill: #ff3b30; }
.reel-action[data-action="dislike"].buzz svg { animation: dislikeBuzz .4s ease; }
@keyframes dislikeBuzz {
  0%, 100% { transform: translateX(0) rotate(0); }
  15% { transform: translateX(-4px) rotate(-8deg); }
  30% { transform: translateX(4px) rotate(8deg); }
  45% { transform: translateX(-4px) rotate(-6deg); }
  60% { transform: translateX(4px) rotate(6deg); }
  75% { transform: translateX(-2px) rotate(-3deg); }
  90% { transform: translateX(2px) rotate(3deg); }
}

/* --- Whole-screen shake when a reel is disliked --- */
.talent-reels.screen-shake { animation: screenShake .4s ease; }
@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-6px, 2px); }
  20% { transform: translate(6px, -2px); }
  30% { transform: translate(-6px, 0); }
  40% { transform: translate(6px, 2px); }
  50% { transform: translate(-4px, -2px); }
  60% { transform: translate(4px, 2px); }
  70% { transform: translate(-3px, 0); }
  80% { transform: translate(3px, -1px); }
  90% { transform: translate(-2px, 0); }
}

/* --- Full red screen flash on dislike --- */
.reel-flash-overlay {
  position: fixed;
  z-index: 500;
  inset: 0;
  background:
    linear-gradient(#ff3b30, #ff3b30) top / 100% 8px no-repeat,
    linear-gradient(#ff3b30, #ff3b30) bottom / 100% 8px no-repeat,
    radial-gradient(ellipse at center, rgba(255, 59, 48, .38) 0%, rgba(255, 59, 48, .18) 45%, rgba(255, 59, 48, 0) 78%);
  opacity: 0;
  pointer-events: none;
}
.reel-flash-overlay.flash { animation: flashOverlay .55s ease; }
@keyframes flashOverlay {
  0% { opacity: 0; }
  14% { opacity: 1; }
  100% { opacity: 0; }
}

.reel-video-missing {
  display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle, #17243d, #000);
  font-size: clamp(1rem, 3vw, 1.6rem);
}

/* --- Lightweight toast (used for "added to timeline", "link copied") --- */
.reels-toast {
  position: fixed; z-index: 700; left: 50%; bottom: 90px;
  background: rgba(20, 20, 20, .94); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: .85rem; font-weight: 700;
  box-shadow: 0 6px 20px #0008; opacity: 0; pointer-events: none;
}
.reels-toast.show { animation: toastPop 2.2s ease forwards; }
@keyframes toastPop {
  0% { opacity: 0; transform: translate(-50%, 16px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

/* --- Shared bottom-sheet chrome (comments drawer + share sheet) --- */
.comment-drawer {
  position: fixed; z-index: 400; inset: 0;
  visibility: hidden; pointer-events: none;
}
.comment-drawer.open { visibility: visible; pointer-events: auto; }
.comment-drawer-backdrop {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0);
  transition: background-color .25s ease;
}
.comment-drawer.open .comment-drawer-backdrop { background: rgba(0, 0, 0, .55); }
.comment-drawer-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 68vh; display: flex; flex-direction: column;
  background: #14151a; border-radius: 18px 18px 0 0;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32, .72, 0, 1);
  box-shadow: 0 -8px 30px #000a;
}
.comment-drawer.open .comment-drawer-panel { transform: translateY(0); }
.comment-drawer-handle {
  width: 36px; height: 4px; border-radius: 999px;
  background: #444; margin: 10px auto 4px;
}
.comment-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px 10px; color: #fff; font-weight: 800; font-size: .9rem;
  border-bottom: 1px solid #232323;
}
.comment-drawer-close {
  background: none; border: 0; color: #999; font-size: 1rem; cursor: pointer; padding: 4px 6px;
}

/* --- Comment list + quick "team flag" support buttons --- */
.comment-list {
  flex: 1; overflow-y: auto; padding: 10px 16px; min-height: 120px;
  display: flex; flex-direction: column; gap: 5px;
}
.comment-row { color: #fff; font-size: .86rem; line-height: 1.3; display:grid; grid-template-columns:32px minmax(0,1fr); gap:8px; align-items:start; padding:4px 0; }
.comment-avatar { width:32px; height:32px; border-radius:50%; object-fit:cover; background:#24262d; }
.comment-avatar--fallback { display:grid; place-items:center; color:#fff; font-size:.75rem; font-weight:900; }
.comment-row-copy { min-width:0; }
.comment-row b { display: block; font-size: .75rem; color: #ff2d55; margin-bottom: 2px; }
.comment-owner-actions { display:flex; gap:10px; margin-top:2px; }
.comment-owner-actions button { border:0; padding:0; background:transparent; color:#aeb7c8; font-family:inherit; font-size:.7rem; font-weight:700; line-height:1.2; text-decoration:underline; cursor:pointer; }
.comment-owner-actions button[data-comment-action="delete"] { color:#ff8096; }
.comment-empty { color: #777; font-size: .82rem; text-align: center; margin-top: 24px; }
.comment-form {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid #232323;
}
.comment-flag {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: #1e1f24; display: grid; place-items: center; cursor: pointer;
  transition: transform .15s ease;
}
.comment-flag svg { width: 17px; height: 17px; }
.comment-flag:active { transform: scale(.88); }
.comment-flag.pop { animation: bouncePop .35s ease; }
.comment-form input {
  flex: 1; min-width: 0; border-radius: 999px; border: 1px solid #333; background: #1e1f24;
  color: #fff; padding: 10px 14px; font-size: .88rem; outline: none;
}
.comment-form input:focus { border-color: #ff2d55; }
.comment-form button[type="submit"] {
  flex-shrink: 0; border: 0; border-radius: 999px; background: #ff2d55; color: #fff;
  font-weight: 800; font-size: .82rem; padding: 0 18px; height: 36px; cursor: pointer;
}
.comment-form button[type="submit"]:disabled { opacity: .4; cursor: not-allowed; }

/* --- Share sheet --- */
.share-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 8px;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
.share-target {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; color: #ddd; font-size: .72rem; cursor: pointer;
}
.share-target-icon {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 1.2rem; font-weight: 800;
}

/* --- Search overlay --- */
.search-overlay {
  position: fixed; z-index: 550; inset: 0; background: #0c0c0f;
  transform: translateY(-100%); transition: transform .28s ease;
}
.search-overlay.open { transform: translateY(0); }
.search-header {
  display: flex; align-items: center; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 12px;
  border-bottom: 1px solid #232323;
}
.search-back { background: none; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; padding: 4px; }
.search-header input {
  flex: 1; border-radius: 999px; border: 1px solid #333; background: #1b1c21; color: #fff;
  padding: 10px 14px; font-size: .9rem; outline: none;
}
.search-header input:focus { border-color: #ff2d55; }
.search-results { padding: 6px 14px; overflow-y: auto; height: calc(100% - 64px); }
.search-result {
  width: 100%; display: flex; align-items: center; gap: 12px; background: none; border: 0;
  padding: 10px 4px; border-bottom: 1px solid #1c1c1c; color: #fff; text-align: left; cursor: pointer;
}
.search-result img { width: 44px; height: 66px; object-fit: cover; border-radius: 6px; background: #111; flex-shrink: 0; }
.search-result span { font-size: .85rem; }

@media (prefers-reduced-motion: reduce) {
  .tap-heart,
  .reel-action.zoom-pop svg,
  .reel-action.buzz svg,
  .talent-reels.screen-shake,
  .reel-flash-overlay.flash,
  .reel-comment-bubble,
  .reels-toast.show { animation-duration: .01ms; }
}

/* V34 vertical Reel advertising. */
.reel-ad{display:grid;place-items:center;background:linear-gradient(155deg,#020202,#231700 52%,#050505);color:#fff}
.reel-ad-creative{width:min(88%,560px);min-height:min(72vh,720px);display:grid;place-content:center;justify-items:center;gap:18px;padding:34px 24px;border:1px solid rgba(255,226,74,.58);text-align:center;background:radial-gradient(circle at 50% 24%,rgba(255,224,64,.24),transparent 33%),rgba(255,255,255,.04);-webkit-backdrop-filter:blur(22px);backdrop-filter:blur(22px);clip-path:polygon(28px 0,100% 0,100% calc(100% - 28px),calc(100% - 28px) 100%,0 100%,0 28px);box-shadow:inset 0 1px 0 rgba(255,255,255,.16),0 0 50px rgba(255,206,40,.15)}
.reel-ad-creative span{font-size:.72rem;font-weight:950;letter-spacing:.18em;color:#ffe66d}.reel-ad-creative strong{font-size:clamp(2.2rem,11vw,5.8rem);line-height:.88}.reel-ad-creative p{max-width:420px;margin:0;color:rgba(255,255,255,.72);line-height:1.55}.reel-ad-creative a{display:inline-flex;min-height:48px;align-items:center;padding:11px 20px;border-radius:999px;background:#ffe04b;color:#211600;font-weight:950;text-decoration:none}


/* ===== V56.10 REELS SOUND CONTROL ===== */
.reel-action[data-action="sound"] svg{fill:#fff}
.reel-action[data-action="sound"].active{color:#22c55e}
.reel-action[data-action="sound"].active svg{fill:#22c55e;filter:drop-shadow(0 0 8px rgba(34,197,94,.7))}


/* ===== V59.2 SOUND-FIRST REELS ===== */
.reel-sound-start{position:absolute;z-index:18;left:50%;top:50%;transform:translate(-50%,-50%);min-height:46px;padding:11px 17px;border:1px solid rgba(255,255,255,.76);border-radius:999px;background:rgba(0,0,0,.78);color:#fff;font-weight:950;box-shadow:0 8px 28px rgba(0,0,0,.48);backdrop-filter:blur(12px);cursor:pointer}
.reel.sound-start-blocked .reel-video{filter:brightness(.78)}

/* V87.10: raise the five-button social rail above bottom navigation/safe area. */
.reel-actions{bottom:max(132px,calc(env(safe-area-inset-bottom) + 116px))!important;}
@media(max-height:700px){.reel-actions{bottom:max(116px,calc(env(safe-area-inset-bottom) + 102px))!important;gap:4px!important;}.reel-action{width:54px!important;}.reel-action svg{width:28px!important;height:28px!important;}}

/* V89.3 — shared create + TikTok-style comment tools */
.reels-add-btn[hidden]{display:none!important}
.comment-drawer-panel{max-height:66dvh}
.comment-row{display:grid;grid-template-columns:1fr;gap:2px}
.comment-row>span{display:block;min-width:0;overflow-wrap:anywhere}
.comment-tools{display:flex;align-items:center;gap:7px;overflow-x:auto;padding:8px 12px;background:#101115;border-top:1px solid #232323;scrollbar-width:none}
.comment-tools::-webkit-scrollbar{display:none}
.comment-tools[hidden]{display:none!important}
.comment-tools button,.comment-tool-toggle{border:0;background:#202127;color:#fff;border-radius:12px;min-width:38px;height:38px;display:grid;place-items:center;font-size:1.15rem;cursor:pointer;flex:0 0 auto}
.comment-sticker-tray button{font-size:1.65rem;min-width:48px;height:48px}
.comment-form{position:sticky;bottom:0;background:#14151a;z-index:3;padding-left:10px;padding-right:10px}
.comment-form .comment-tool-toggle{width:36px;min-width:36px;height:36px;border-radius:50%;font-size:1.05rem}
.comment-sticker-render{display:inline-block;font-size:2.35rem;line-height:1.05;filter:drop-shadow(0 3px 6px rgba(0,0,0,.28))}
.reel-comment-bubble .comment-sticker-render{font-size:2rem}
body.sheet-open{overflow:hidden}
@media(max-width:520px){.comment-drawer-panel{max-height:70dvh}.comment-list{padding:9px 12px}.comment-form{gap:6px}.comment-form button[type="submit"]{padding:0 12px}}

/* V286 — persistent Videos return link in Reels top navigation. */
.topbar-videos-link{text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
