:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #1c2128;
  --border: #2d333b;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --red: #ff3b30;
  --accent: #3b82f6;
  --mod: #f59e0b;
  --topbar-h: 52px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(180deg, #161b22, #10151c);
  border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}

.live-dot {
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: blink 1.4s ease-in-out infinite;
}
.live-dot.small { width: 6px; height: 6px; background: var(--red); }

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.topbar-title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watching {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
}
.watching b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
}

.video-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  gap: 12px;
  overflow-y: auto;
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - var(--topbar-h) - 120px);
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none; /* no pause/seek by clicking */
}

.video-live-chip {
  position: absolute;
  top: 12px; left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,.65);
  border: 1px solid rgba(255,59,48,.6);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  z-index: 3;
}
.video-live-chip .live-dot { background: var(--red); }

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, .88);
  z-index: 4;
  text-align: center;
}

.overlay-card h2 { font-size: 22px; margin-bottom: 8px; }
.overlay-card p { color: var(--text-dim); font-size: 14px; }

.pulse-ring {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.pulse-ring::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(255,59,48,.25);
  animation: pulse 1.8s ease-out infinite;
}
.pulse-core { width: 22px; height: 22px; background: var(--red); border-radius: 50%; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }

.unmute-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: 16px 26px;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  backdrop-filter: blur(6px);
  transition: background .15s;
}
.unmute-btn:hover { background: rgba(255,255,255,.18); }
.unmute-btn b { font-size: 16px; }

/* floating reactions */
.reactions-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}
.float-emoji {
  position: absolute;
  bottom: -40px;
  font-size: 26px;
  animation: floatUp 3s ease-out forwards;
}
@keyframes floatUp {
  0%   { transform: translateY(0) scale(.7); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(-60vh) translateX(var(--drift, 20px)) scale(1.2); opacity: 0; }
}

/* below video */
.below-video {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.presenter-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(59,130,246,.10), rgba(139,92,246,.08));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 18px 10px 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
}

.presenter-avatar-wrap { position: relative; flex-shrink: 0; }
.presenter-avatar {
  width: 58px; height: 58px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2.5px solid var(--red);
  box-shadow: 0 0 0 3px rgba(255,59,48,.18), 0 0 18px rgba(255,59,48,.25);
}
.presenter-live-chip {
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: #fff;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 2px solid var(--bg);
}

.presenter-info { min-width: 0; }
.presenter-name {
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.presenter-name .verified { flex-shrink: 0; }
.presenter-sub {
  color: #aeb8c4;
  font-size: 12.5px;
  font-weight: 500;
  margin-top: 1px;
}
.presenter-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 3px;
}

.reaction-bar { display: flex; gap: 8px; }
.reaction-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  font-size: 18px;
  padding: 7px 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.reaction-btn:hover { transform: scale(1.15); background: #262d36; }
.reaction-btn:active { transform: scale(.92); }

/* ---------- Chat ---------- */
.chat-col {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.chat-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--text-dim);
}

.pinned {
  background: linear-gradient(135deg, rgba(59,130,246,.15), rgba(139,92,246,.15));
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}
.pinned-label { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--accent); margin-bottom: 4px; }
.pinned-text { font-size: 13px; line-height: 1.45; }
.pinned-btn {
  display: inline-block;
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 6px;
  transition: filter .15s;
}
.pinned-btn:hover { filter: brightness(1.15); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.msg { display: flex; gap: 9px; animation: msgIn .25s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
}
.msg-body { min-width: 0; }
.msg-name { font-size: 12px; font-weight: 700; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.msg-text { font-size: 13.5px; line-height: 1.45; word-wrap: break-word; color: #d6dde5; }

.msg.moderator .msg-name { color: var(--mod); }
.msg.moderator .msg-text { color: #f3f4f6; }
.msg.moderator { background: rgba(245,158,11,.07); margin: 0 -8px; padding: 6px 8px; border-radius: 8px; border-left: 2px solid var(--mod); }
.mod-tag {
  background: var(--mod);
  color: #1a1a1a;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: .5px;
}
.msg.me .msg-name { color: var(--accent); }

.typing {
  padding: 6px 16px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 7px;
}
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i {
  width: 5px; height: 5px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: tBounce 1.2s infinite;
}
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tBounce { 0%,60%,100% { transform: none; } 30% { transform: translateY(-4px); } }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
}
.chat-input-row input:focus { border-color: var(--accent); }
.chat-input-row button {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: filter .15s, transform .1s;
}
.chat-input-row button:hover { filter: brightness(1.15); }
.chat-input-row button:active { transform: scale(.9); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 360px;
  text-align: center;
}
.modal-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,59,48,.12);
  border: 1px solid rgba(255,59,48,.5);
  color: #ff6b62;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.modal-error { color: #ff6b62; font-size: 12.5px; margin-bottom: 10px; }
.modal-note { color: var(--text-dim); font-size: 11px; margin-top: 12px; }
.modal h3 { font-size: 18px; margin-bottom: 6px; }
.modal p { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }
.modal input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
}
.modal input:focus { border-color: var(--accent); }
.modal button {
  width: 100%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
}

/* ---------- Offer / CTA modal ---------- */
.cta-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 7, 10, .75);
  display: flex; align-items: center; justify-content: center;
  z-index: 45;
  backdrop-filter: blur(4px);
  animation: ctaFade .35s ease-out;
}
@keyframes ctaFade { from { opacity: 0; } to { opacity: 1; } }

.cta-card {
  position: relative;
  width: 92%;
  max-width: 460px;
  background: linear-gradient(160deg, #1b2230, #12161d 60%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 34px 32px 30px;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(59,130,246,.15);
  animation: ctaPop .45s cubic-bezier(.18,1.25,.4,1);
}
@keyframes ctaPop { from { transform: scale(.85) translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.cta-glow {
  position: absolute;
  top: -80px; left: 50%;
  transform: translateX(-50%);
  width: 300px; height: 160px;
  background: radial-gradient(ellipse, rgba(59,130,246,.35), transparent 70%);
  pointer-events: none;
}

.cta-close {
  position: absolute;
  top: 12px; right: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text-dim);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  z-index: 2;
  transition: color .15s, background .15s;
}
.cta-close:hover { color: #fff; background: rgba(255,255,255,.14); }

.cta-tag {
  display: inline-block;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
  animation: ctaTagPulse 1.8s ease-in-out infinite;
}
@keyframes ctaTagPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } }

.cta-card h2 { font-size: 22px; line-height: 1.3; margin-bottom: 10px; }
.cta-card p { color: #aeb8c4; font-size: 14px; line-height: 1.55; margin-bottom: 18px; }

.cta-coupon {
  background: rgba(59,130,246,.08);
  border: 1.5px dashed rgba(59,130,246,.5);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
}
.cta-coupon-label { display: block; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 6px; }
.cta-coupon-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cta-coupon-row code {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #fff;
  font-family: 'Consolas', monospace;
}
.cta-coupon-row button {
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: filter .15s;
}
.cta-coupon-row button:hover { filter: brightness(1.15); }

.cta-btn {
  display: block;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  padding: 15px 20px;
  border-radius: 12px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(34,197,94,.35);
  transition: transform .12s, filter .15s;
}
.cta-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }

.cta-countdown { color: var(--text-dim); font-size: 13px; }
.cta-countdown b { color: #f59e0b; font-variant-numeric: tabular-nums; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(22, 27, 34, .92);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  animation: toastIn .3s ease-out, toastOut .4s ease-in 4s forwards;
  backdrop-filter: blur(6px);
}
.toast b { color: var(--text); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-16px); } }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  .layout { flex-direction: column; height: auto; min-height: calc(100vh - var(--topbar-h)); }
  .video-col { padding: 10px; overflow: visible; }
  .chat-col {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    height: 55vh;
  }
  .topbar-title { font-size: 13px; }
  .toasts { display: none; }
}
