#change-avatar-btn {
  margin: 10px auto 16px auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
  font-size: 0.85em;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

#change-avatar-btn .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 15px;
}

#change-avatar-btn .btn-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

#change-avatar-btn .btn-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72em;
  letter-spacing: 0.1em;
}

#change-avatar-btn .btn-sub {
  font-size: 0.68em;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.74);
  letter-spacing: 0.04em;
}

#change-avatar-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.38);
}

#change-avatar-btn:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.12);
}

#change-avatar-btn:focus-visible {
  outline: 2px solid rgba(79, 209, 197, 0.75);
  outline-offset: 3px;
}
:root {
  --bg-main: #121212;
  --bg-panel: #1c1c1e;
  --bg-panel-light: #2c2c2e;
  --primary: #0fb3d1;
  --secondary: #9fd6f9;
  --taskbar: #1b1f25ee;
  --coin: #ffe56b;
  --pink: #ff2b5e;
  --taskbar-h: 62px;
  --content-w: 540px; /* Match taskbar width */
}
html, body {
  margin: 0;
  padding: 0;
  height: 100dvh;                 /* lock to dynamic viewport to avoid zoom drift */
  width: 100%;
  overflow: hidden;               /* prevent page panning */
  overscroll-behavior: none;      /* disable rubber-band/pull-to-refresh */
  background: var(--bg-main);
  color: #fff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-action: manipulation;
  touch-action: manipulation;
  position: fixed;                /* prevent keyboard from pushing content up */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

#live-feed {
  display: flex;
  flex-direction: column;
  height: 100dvh; /* Full dynamic viewport height */
  background-color: #121212;
  max-width: var(--content-w);
  margin: 0 auto;
  width: 100vw;
  box-sizing: border-box;
  position: relative;
  /* stream is flush; container below accounts for toolbar */
  padding: 0;
  /* Ensure the stream area is properly sized */
  overflow: hidden;
  cursor: pointer; /* Make the entire live feed clickable for likes */
  -webkit-user-select: none; /* Prevent text selection */
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* Prevent callout on long press */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
  -webkit-touch-action: manipulation; /* Optimize for touch */
  touch-action: manipulation;
}

.live-info {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 15px;
  right: 15px;
  z-index: 500; /* Above stream container (z-index: 1-2) but below modals */
  text-shadow: 0 2px 8px #000c;
  pointer-events: auto; /* Ensure clicks work */
}

.live-info h1 {
  font-size: 1.3em;
  margin: 0 0 5px 0;
  opacity: 0.3;
}

.live-info p {
  font-size: 0.9em;
  margin: 0;
  opacity: 0.3;
  pointer-events: auto; /* Ensure clicks work */
}

#watching-as {
  pointer-events: auto; /* Ensure clicks work - this is the "Watching as" text */
  position: relative;
  z-index: 501; /* Above stream container */
}

/* Viewer Count Display */
.viewer-count {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 20px;
  padding: 8px 12px;
  z-index: 502; /* Above video (z-index: 2) and stream container, below modals */
  pointer-events: auto; /* Ensure clicks work */
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.viewer-icon {
  font-size: 16px;
  opacity: 0.9;
}

.viewer-number {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

/* Viewer List Panel Styles */
#viewer-list-panel {
  background: linear-gradient(135deg, #0f0f23, #1a1a2e);
  border: 2px solid rgba(138, 43, 226, 0.4);
  box-shadow: 0 12px 40px rgba(138, 43, 226, 0.3), 0 0 60px rgba(138, 43, 226, 0.1);
  backdrop-filter: blur(20px);
  z-index: 1400;
  pointer-events: auto;
}

#viewer-list-panel .panel-content {
  max-height: 50vh;
  overflow-y: auto;
  background: linear-gradient(135deg, rgba(15, 15, 35, 0.95), rgba(26, 26, 46, 0.9));
  border-radius: 0 0 12px 12px;
}

#viewer-list-panel .panel-title {
  background: linear-gradient(135deg, #8a2be2, #9370db);
  border-bottom: 2px solid rgba(138, 43, 226, 0.6);
  position: relative;
  overflow: hidden;
  padding: 0.6rem 1rem;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

#viewer-list-panel .panel-title h3 {
  color: #fff;
  font-size: 0.9em;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  position: relative;
  z-index: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.viewer-list-content {
  padding: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}

#viewer-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.viewer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8a2be2, #9370db);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.4);
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
  overflow: hidden;
}

.viewer-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.viewer-item:hover .viewer-avatar {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(138, 43, 226, 0.6);
  border-color: rgba(255, 255, 255, 0.5);
}

.viewer-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.8rem;
  background: rgba(20, 20, 40, 0.9);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  cursor: pointer;
  margin-bottom: 0.4rem;
  transition: background 0.2s ease, transform 0.15s ease;
  backdrop-filter: none;
  box-shadow: none;
}

.viewer-item:hover {
  background: rgba(40, 40, 70, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.viewer-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.viewer-name {
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.viewer-level {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
}

.viewer-level-badge {
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  border: 2px solid #222;
}

.viewer-level-badge.basic { background: linear-gradient(135deg, #6c757d, #495057); }
.viewer-level-badge.bronze { background: linear-gradient(135deg, #cd7f32, #b8860b); }
.viewer-level-badge.silver { background: linear-gradient(135deg, #c0c0c0, #a9a9a9); }
.viewer-level-badge.gold { background: linear-gradient(135deg, #ffd700, #ffb347); color: #222; }
.viewer-level-badge.platinum { background: linear-gradient(135deg, #e5e4e2, #b4b4b4); }
.viewer-level-badge.diamond { background: linear-gradient(135deg, #b9f2ff, #87ceeb); color: #222; }

.viewer-xp-container {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: 100%;
}

.viewer-xp-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.viewer-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #8a2be2, #9370db);
  border-radius: 2px;
  transition: width 0.3s ease;
  position: relative;
}



.viewer-xp-text {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.7);
  text-align: right;
  font-weight: 500;
}

.viewer-status {
  margin-left: auto;
  padding: 0.2rem 0.4rem;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.3), rgba(76, 175, 80, 0.1));
  color: #4caf50;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid rgba(76, 175, 80, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Make viewer count clickable */
.viewer-count {
  cursor: pointer;
  transition: all 0.2s ease;
}

.viewer-count:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
}

#chat-messages-area {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 1;
  background: transparent;
  position: absolute;
  bottom: calc(var(--taskbar-h) + 2px);
  left: 0;
  right: 0;
  height: auto;
  box-sizing: border-box;
  padding-bottom: 0px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  pointer-events: none; /* Allow clicks to pass through to elements behind */
  width: 100%;
  max-height: 300px;
}

#chat-messages-area.logged-in {
  pointer-events: auto; /* Re-enable pointer events when logged in */
}

#taskbar {
  flex-shrink: 0;
  background: linear-gradient(90deg, #ffb347, #ff5e62, #36d1c4, #43cea2);
  z-index: 1000;
  position: static;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  border-radius: 0 !important;
  box-shadow: 0 0 16px 0 rgba(0,0,0,0.18), 0 2px 8px 0 rgba(0,0,0,0.10);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  min-height: 62px;
  transition: background 0.4s;
}

/* --- Blurred Background for Modals --- */
#blur-bg {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1399; /* Just below panels (1400) but above everything else */
  width: 100vw; 
  min-height: 100vh;
  height: 100dvh; /* Modern dynamic viewport height for better mobile support */
  background: transparent; /* No dark overlay */
  transition: opacity 0.3s;
  opacity: 0;
  pointer-events: none; /* Don't block clicks when hidden */
}
#blur-bg.visible {
    display: block;
    opacity: 1;
    pointer-events: auto; /* Allow clicks when visible (for modal interaction) */
}

/* --- Auth Screen --- */
#auth-modal {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: fixed;
  inset: 0;
  z-index: 1500; /* Above backdrop (1399) and panels (1400) */
  transition: opacity .25s, visibility .25s;
  visibility: hidden;
  opacity: 0;
  backdrop-filter: blur(10px);
  pointer-events: none; /* Don't block clicks when hidden */
}
#auth-modal.visible {
    display: flex;
    visibility: visible;
    opacity: 1;
    pointer-events: auto; /* Allow clicks when visible */
}

/* --- Age Verification Modal --- */
#age-verification-modal {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  inset: 0;
  z-index: 1001;
  transition: opacity .25s, visibility .25s;
  visibility: hidden;
  opacity: 0;
  backdrop-filter: blur(10px);
  background: rgba(0, 0, 0, 0.5);
}

#age-verification-modal.visible {
  visibility: visible;
  opacity: 1;
}

.age-verification-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border-radius: 20px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  max-width: 400px;
  width: 90vw;
  padding: 30px;
  text-align: center;
  color: #fff;
}

.age-verification-card h2 {
  margin: 0 0 15px 0;
  font-size: 1.5em;
  font-weight: 700;
}

.age-verification-card p {
  margin: 10px 0;
  opacity: 0.9;
  line-height: 1.5;
}

.age-verification-question {
  font-weight: 600;
  font-size: 1.1em;
  margin-top: 20px !important;
}

.age-verification-icon {
  font-size: 64px;
  margin-bottom: 15px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.age-verification-buttons {
  display: flex;
  gap: 15px;
  margin-top: 25px;
}

.age-verify-btn {
  flex: 1;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.age-verify-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.age-verify-btn:active {
  transform: translateY(0);
}

.age-verify-yes {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
}

.age-verify-yes:hover {
  background: linear-gradient(135deg, #45a049, #3d8b40);
}

.age-verify-no {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  color: white;
}

.age-verify-no:hover {
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
}

.auth-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border-radius: 20px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  max-width: 380px;
  width: 90vw;
  margin: 0 auto;
  padding: 2.5rem 2rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  z-index: 10;
  align-items: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(15px);
}
.auth-card h2 { 
  margin-top: 0; 
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-size: 1.8em;
  font-weight: 800;
  background: linear-gradient(45deg, #FFD700, #FFA500, #4ECDC4);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  letter-spacing: 1px;
}
.auth-card input {
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 12px;
  font-size: 1.1em;
  padding: 1em 1.2em;
  margin-bottom: 0.8em;
  outline: none;
  transition: all 0.3s ease;
  width: 100%;
  backdrop-filter: blur(10px);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}

.auth-card input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.auth-card input:focus { 
  border: 2px solid rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.02);
}
.auth-card button {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #000;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  padding: 1.2em 0;
  font-size: 1.1em;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 
    0 4px 15px rgba(255, 215, 0, 0.3),
    0 0 20px rgba(255, 215, 0, 0.2);
}
.auth-card button:hover { 
  background: linear-gradient(135deg, #FFA500, #FFD700);
  transform: scale(1.05);
  box-shadow: 
    0 6px 20px rgba(255, 215, 0, 0.4),
    0 0 30px rgba(255, 215, 0, 0.3);
}
.auth-card .switch-link {
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  text-align: center;
  font-size: 0.95em;
  margin-top: 0.5em;
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
}

.auth-card .switch-link:hover {
  color: rgba(255, 215, 0, 0.9);
  text-decoration-color: rgba(255, 215, 0, 0.6);
  transform: scale(1.02);
}

/* --- Stream Container Styles --- */
.twitch-player-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60; /* Higher than offline overlay (50) */
    /* Ensure proper aspect ratio and fit */
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.twitch-player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
    /* Ensure proper scaling and fit */
    min-height: 100%;
    min-width: 100%;
    max-width: 100%;
    max-height: 100%;
    pointer-events: none; /* Disable all interactions */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-action: none;
    touch-action: none;
}

.twitch-unmute-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 1.5em;
    font-weight: bold;
    z-index: 70; /* Higher than player container (60) */
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}
.twitch-unmute-overlay:hover {
    background: rgba(0,0,0,0.7);
}

/* --- Bottom Taskbar --- */
#taskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1200;
  height: var(--taskbar-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 10px;
  box-sizing: border-box;
  background: linear-gradient(to top, rgba(27, 31, 37, 0.95) 0%, rgba(27, 31, 37, 0.85) 50%, rgba(27, 31, 37, 0.7) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  /* Ensure taskbar doesn't interfere with chat */
  pointer-events: auto;
  /* Ensure proper stacking context */
  transform: translateZ(0);
}

/* --- Mobile: make stream + toolbar full-screen and aligned --- */
@media (max-width: 600px) {
  html, body { overflow-x: hidden !important; }
  #live-feed {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: calc(env(safe-area-inset-top)) 0
             calc(var(--taskbar-h) + env(safe-area-inset-bottom)) 0 !important;
  }
  #taskbar {
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* Icons-only on mobile: elevated bubbles with a little more breathing room */
  .taskbar-item {
    background: rgba(80, 80, 80, 0.45) !important;
    border: none !important;
    border-radius: 9999px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .taskbar-item .tab-label,
  .taskbar-item .label,
  .taskbar-item .text { display: none !important; }
  .taskbar-item .icon { 
    width: 22px !important; 
    height: 22px !important; 
    display: block !important;
    margin: 0 auto !important;
  }

  .taskbar-item.tab-recharge {
    min-width: 42px !important;
    padding: 0 !important;
    background: rgba(255, 215, 0, 0.16) !important;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.25) !important;
  }
  .taskbar-item.tab-recharge .icon {
    width: 24px !important;
    height: 24px !important;
    color: #ffd700 !important;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.55));
  }
  .taskbar-item.tab-recharge .tab-label {
    display: block !important;
    color: #ffd700 !important;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.45);
  }

  #send-gift-btn {
    padding: 6px 14px !important;
    gap: 6px !important;
    font-size: 0.85em !important;
  }
  #send-gift-btn .cta-icon {
    width: 20px !important;
    height: 20px !important;
    font-size: 12px !important;
  }
  #send-gift-btn .cta-sub {
    font-size: 0.58em;
    letter-spacing: 0.1em;
  }

  /* Hide stream/admin button on mobile */
  #tab-streaming-admin, .tab-streaming-admin { display: none !important; }
  .stream-video-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom)) !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
    z-index: 1 !important; /* Behind UI elements (500+) */
    pointer-events: none !important; /* Allow clicks to pass through to UI elements */
  }
  .stream-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center bottom !important;
    z-index: 2 !important; /* Above container but below UI */
    pointer-events: auto !important; /* Video itself can be clicked */
    position: relative !important;
  }
}

/* Touch devices: enforce non-fixed, scrollable layout regardless of width */
@media (hover: none) and (pointer: coarse) {
  html, body { position: static !important; height: auto !important; min-height: 100vh !important; overflow-x: hidden !important; overflow-y: auto !important; }
  #live-feed { height: auto !important; min-height: 100vh !important; }
  @supports (height: 100svh) {
    html, body { min-height: 100svh !important; }
    #live-feed { min-height: 100svh !important; }
  }
}

.chat-input-container {
  flex: 1;
  max-width: 400px;
  position: relative;
  margin: 0 15px;
  padding-right: 0px;
}

/* Emoji button positioned next to chat input */
.chat-input-container #emoji-button {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #ffd700;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 40px;
  pointer-events: auto;
  /* Remove from taskbar flow */
  position: absolute !important;
  float: none !important;
  margin: 0 !important;
  flex: none !important;
  width: auto !important;
  min-width: auto !important;
}

.chat-input-container #emoji-button:hover {
  background: rgba(255, 215, 0, 0.1);
  transform: translateY(-50%) scale(1.05);
}

.chat-input-container #emoji-button .icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.chat-input-container #emoji-button .tab-label {
  display: none;
}

#mobile-chat-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  color: #fff;
  padding: 6px 12px;
  font-size: 0.85em;
  outline: none;
  transition: border-color 0.2s;
  padding-right: 38px !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}

#mobile-chat-input:focus {
  border-color: var(--primary);
}

#mobile-chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.taskbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #e0e0e0;
  cursor: pointer;
  user-select: none;
  transition: color .18s, transform .18s;
  gap: 2px;
  font-size: 0.75em;
  font-weight: 600;
  min-width: 50px;
  padding: 4px 0;
}
.taskbar-item:active { transform: scale(0.9); }
.taskbar-item.active { color: var(--primary); }
.taskbar-item.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.taskbar-item.disabled:hover {
    transform: none;
}

/* Subscribe button styling */
#tab-subscribe {
  color: #ffd700;
}
#tab-subscribe .icon {
  fill: #ffd700;
}
#tab-subscribe:hover {
  color: #ffed4e;
}
#tab-subscribe:hover .icon {
  fill: #ffed4e;
}

.taskbar-item .icon {
  width: 24px; height: 24px;
  fill: currentColor;
  font-size: 2.1em;
  margin-bottom: 2px;
  transition: color 0.2s, filter 0.2s, text-shadow 0.2s;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
}
.taskbar-item:hover .icon, .taskbar-item.active .icon {
  filter: drop-shadow(0 0 8px #fff8) brightness(1.2);
  text-shadow: 0 0 8px currentColor, 0 0 2px #fff;
}

.tab-label {
  font-weight: 800;
  font-size: 1.05em;
  letter-spacing: 0.02em;
  margin-top: 1px;
  text-align: center;
  transition: color 0.2s;
  color: #fff;
}

.tab-recharge .tab-label { color: #ffd700; }
.tab-superchat .tab-label { color: #ff5e62; }
.tab-gift .tab-label { color: #ff9900; }
.tab-profile .tab-label { color: #36d1c4; }
.tab-treasure .tab-label { color: #FFD700; }

.tab-recharge.active .tab-label, .tab-recharge:hover .tab-label { color: #ffe066; }
.tab-superchat.active .tab-label, .tab-superchat:hover .tab-label { color: #ff2e4d; }
.tab-gift.active .tab-label, .tab-gift:hover .tab-label { color: #ffd700; }
.tab-profile.active .tab-label, .tab-profile:hover .tab-label { color: #1fa97a; }
.tab-treasure.active .tab-label, .tab-treasure:hover .tab-label { color: #FFA500; }

#tab-gift .icon {
    width: 28px; height: 28px;
}

/* Mobile: slightly larger icons and compact CTA */
@media (max-width: 768px) {
  .taskbar-item .icon { width: 30px; height: 30px; }
  .tab-recharge .tab-label { color: #ffd700; }
  #send-gift-btn { padding: 9px 20px; font-size: 0.92em; gap: 8px; }
  #send-gift-btn .cta-icon { width: 26px; height: 26px; font-size: 14px; }
}

/* Add spacing to specific taskbar items */
#tab-superchat, #tab-gift, #tab-profile {
  margin: 0 8px;
  min-width: 60px;
}

#tab-topup {
  margin-left: 12px;
}

/* Reduce left margin for Superchat to bring chat closer */
#tab-superchat {
  margin-left: 0px;
}





/* --- Slide-up Panels --- */
.slideup-panel {
  display: block;
  position: fixed;
  left: 50%; right: auto; bottom: 0;
  transform: translateX(-50%) translateY(100%);
  z-index: 1400;
  pointer-events: auto;
  background: rgba(18, 18, 18, 0.95);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -5px 30px #000c;
  width: var(--content-w);
  max-width: var(--content-w);
  margin: 0;
  opacity: 0;
  transition: transform .4s cubic-bezier(0.2, 0.9, 0.3, 1), opacity .2s, visibility .4s;
  visibility: hidden;
  height: 45vh;
  max-height: 400px;
}
.slideup-panel.open {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Desktop chat alignment inside stream area */
@media (min-width: 601px) {
  #chat-messages-area {
    position: fixed !important;
    /* inside-left edge of stream with a small inset */
    left: calc(50% - (var(--content-w)) / 2 + 12px) !important;
    transform: none !important;
    --chat-w: clamp(260px, 28vw, calc(var(--content-w) * 0.38));
    width: var(--chat-w) !important;
    max-width: var(--chat-w) !important;
    bottom: calc(var(--taskbar-h) + 12px) !important;
    margin: 0 !important;
    z-index: 1300 !important;
    box-sizing: border-box !important;
  }
}

/* Mobile modals: reset to full-width, anchored to bottom */
@media (max-width: 600px) {
  .slideup-panel {
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    transform: translateY(100%) !important; /* no horizontal centering on mobile */
  }
  .slideup-panel.open {
    transform: translateY(0) !important;
  }
}
.panel-content {
    padding: 20px;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
.panel-title {
    font-size: 1.2em;
    font-weight: 700;
    text-align: center;
    margin: 0 0 8px 0;
    flex-shrink: 0;
}
.panel-button {
    background: var(--bg-panel-light);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    text-align: center;
    font-size: 1em;
    margin-bottom: 12px;
}
.panel-button:hover { background: #3a3a3c; }
.panel-button.primary {
    background: var(--primary);
}
 .panel-button.danger {
    background: var(--pink);
}

/* --- Gift Panel Specifics --- */
.gift-panel-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.gift-grid {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 15px;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* Gift grid scrollbar - show on PC, hide on mobile */
@media (min-width: 601px) {
  .gift-grid::-webkit-scrollbar {
    width: 8px;
  }
  .gift-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
  }
  .gift-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
  }
  .gift-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
  }
  .gift-grid {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
  }
}

@media (max-width: 600px) {
  .gift-grid::-webkit-scrollbar { display: none; }
  .gift-grid { -ms-overflow-style: none; scrollbar-width: none; }
}

.gift-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 10px 5px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: 2px solid transparent;
    transition: all .2s;
}
.gift-item.selected {
    border-color: var(--pink);
    background: rgba(255, 43, 94, 0.1);
}
.gift-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 8px;
}
.gift-item .name {
    font-weight: 600;
    font-size: 0.9em;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}
.gift-item .price {
    display: flex;
    align-items: center;
    font-size: 0.8em;
    color: var(--coin);
    font-weight: 700;
    margin-top: 4px;
}
.gift-item .price img {
    width: 14px;
    height: 14px;
    margin-right: 4px;
    margin-bottom: 0;
}

.gift-panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.balance-section {
    display: flex;
    align-items: center;
}
#panel-balance {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.1em;
}
 #panel-balance img {
    width: 40px;
    height: 40px;
    margin-right: 1px;
    object-fit: contain;
    object-position: center;
}
#send-gift-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: linear-gradient(135deg, #ffd700 0%, #ff9a1f 100%);
    color: #1b1f25;
    font-weight: 700;
    font-size: 0.95em;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    box-shadow: 0 10px 26px rgba(255, 193, 7, 0.4), 0 0 18px rgba(255, 215, 0, 0.35);
}
#send-gift-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(255, 193, 7, 0.45), 0 0 22px rgba(255, 215, 0, 0.5);
}
#send-gift-btn:active {
    transform: translateY(0);
    box-shadow: 0 8px 20px rgba(255, 193, 7, 0.35), 0 0 18px rgba(255, 215, 0, 0.4);
}
#send-gift-btn:disabled {
    background: linear-gradient(135deg, rgba(120, 120, 120, 0.65) 0%, rgba(90, 90, 90, 0.65) 100%);
    color: rgba(240, 240, 240, 0.75);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.75;
}

#send-gift-btn .cta-icon { display: none !important; }

#send-gift-btn .cta-title {
    display: flex;
    flex-direction: column;
    font-size: 0.95em;
    color: #1b1f25;
}

#send-gift-btn .cta-sub {
    font-size: 0.7em;
    font-weight: 600;
    color: rgba(27, 31, 37, 0.7);
    letter-spacing: 0.08em;
}

/* --- Superchat Panel --- */
#superchat-panel .panel-content {
    justify-content: space-between;
}
#superchat-list {
    flex-grow: 1;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    overflow-y: auto;
    color: #ccc;
    font-size: 0.9em;
}
#superchat-form {
    display: flex;
    gap: 10px;
}
#superchat-input {
    flex-grow: 1;
    background: var(--bg-panel-light);
    border: 1px solid #444;
    border-radius: 10px;
    color: #fff;
    padding: 0 15px;
    font-size: 1em;
    padding-right: 38px !important;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}
#superchat-send {
    background: var(--primary);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
}
#superchat-cost {
  font-weight: 700;
  font-size: 1.1em;
  color: #ffb347;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
  text-align: left;
}

/* --- Profile Panel --- */
#profile-panel .panel-content {
  align-items: center;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 12px 0 0 0;
  position: relative;
}

/* Profile panel scrollbar styling */
#profile-panel .panel-content::-webkit-scrollbar {
  width: 6px;
}

#profile-panel .panel-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

#profile-panel .panel-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

#profile-panel .panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}
#profile-panel .panel-title {
  text-align: center;
  width: 100%;
  margin: 0 auto;
}

.profile-header {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  position: relative;
}

.logout-btn {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(255, 43, 94, 0.3);
  z-index: 2;
}

.logout-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 43, 94, 0.4);
}

.logout-btn .icon {
    width: 20px;
    height: 20px;
}

.profile-avatar-section {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 4px auto;
  display: block;
}

#profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

.profile-upload-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: pointer;
  border: 2px solid var(--primary);
}

.profile-upload-overlay:hover {
  opacity: 1;
}

.upload-icon {
  width: 20px;
  height: 20px;
  color: white;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
#profile-username {
  font-size: 1.05em;
  font-weight: 600;
  text-align: center;
  margin-bottom: 4px;
  margin-top: 0;
}
.profile-stats {
  margin: 0.2rem 0 0 0;
  padding: 0.5rem 0.7rem 0.3rem 0.7rem;
  background: rgba(0,0,0,0.18);
  border-radius: 0.5rem;
  border: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  max-width: 260px;
  box-sizing: border-box;
}

/* Stats Modal */
.stats-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.stats-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-content {
    background: var(--bg-panel);
    border-radius: 18px;
    padding: 25px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-header h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 700;
}

.close-stats-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-stats-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-weight: 500;
    color: #ccc;
    font-size: 0.9em;
}

.stat-value {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9em;
}

#profile-rank.stat-value {
    color: #ffd700;
}

#profile-xp.stat-value {
    color: #ff6b6b;
}

#profile-level.stat-value {
    color: #4ecdc4;
}

#profile-team.stat-value {
    color: #a8e6cf;
}

.profile-xp-bar {
  width: 100%;
  background-color: #e0e0e0;
  border-radius: 50px;
  position: relative;
  margin: 10px 0 0 0;
  height: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}
#xp-bar-fill {
  width: 0%;
  background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
  height: 100%;
  border-radius: 50px 0 0 50px;
  transition: width 0.4s cubic-bezier(.4,2,.6,1);
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
}
.xp-bar-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #000000;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
}

/* --- Top-up Panel --- */
#topup-panel .panel-content {
    align-items: center;
    padding: 15px;
    gap: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    max-height: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Bonus Banner */
.bonus-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #ff6b6b, #ffa726, #ffd54f);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    animation: pulse 2s infinite;
    max-width: 100%;
    box-sizing: border-box;
}

.bonus-icon {
    font-size: 24px;
    /* Removed bouncing animation to prevent icon from going off page */
}

.bonus-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bonus-title {
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.bonus-subtitle {
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

/* Quick Amounts Grid */
.quick-amounts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-bottom: 15px;
    max-width: 100%;
    box-sizing: border-box;
}

.amount-option {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.amount-option:hover {
    transform: translateY(-2px);
}

.amount-card {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    position: relative;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
}

.amount-card:hover {
    border-color: #3498db;
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.amount-card.popular {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: 2px solid #e74c3c;
}

.amount-card.premium {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border: 2px solid #f39c12;
}

.popular-badge, .premium-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-badge {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

/* Payment Instruction Section */
.payment-instruction {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
    border-radius: 12px;
    padding: 12px;
    margin: 15px 0 6px 0;
}

.payment-icon {
    font-size: 24px;
}

.payment-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.payment-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.payment-subtitle {
    font-size: 12px;
    color: #bdc3c7;
    font-weight: 500;
}

.amount-value {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}

.amount-coins {
    font-size: 11px;
    color: #bdc3c7;
    margin-bottom: 6px;
}

.bonus-badge {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 6px;
    margin-bottom: 3px;
    display: inline-block;
}

.bonus-coins {
    font-size: 10px;
    color: #27ae60;
    font-weight: 600;
}

/* Custom Amount Section */
.custom-amount-section {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 100%;
    box-sizing: border-box;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    text-align: center;
}

#topup-amount {
    width: 100%;
    padding: 8px;
    background: var(--bg-panel-light);
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    margin-bottom: 10px;
    transition: border-color 0.3s ease;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

#topup-amount:focus {
    border-color: var(--primary);
    outline: none;
}

.estimated-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

.estimated-label {
    font-size: 12px;
    color: #bdc3c7;
    font-weight: 500;
}

.estimated-amount {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    display: block;
}

.estimated-bonus {
    font-size: 12px;
    color: #27ae60;
    font-weight: 600;
    display: block;
    margin-top: 2px;
}

#paypal-button-container {
    width: 100%;
    margin: 0 auto;
    text-align: center;
    padding-bottom: 10px;
}

/* Custom scrollbar for recharge modal */
#topup-panel .panel-content::-webkit-scrollbar {
    width: 4px;
}

#topup-panel .panel-content::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

#topup-panel .panel-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

#topup-panel .panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

#topup-panel .panel-content {
    -ms-overflow-style: none;
    scrollbar-width: thin;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-1px); }
}

/* --- Dynamic Animations --- */
@keyframes fall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}
.falling-gift {
    position: absolute;
    top: -100px;
    left: 0;
    width: 50px;
    height: 50px;
    animation: fall 3s linear forwards;
    pointer-events: none;
    z-index: 5;
}
#superchat-banner-container {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 9999; /* Much higher z-index to appear in front of everything */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}
.superchat-banner {
    width: 100%;
    max-width: 500px;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(255, 94, 98, 0.4), 0 4px 20px rgba(0,0,0,0.8);
    animation: superchat-exciting 7s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
    background: linear-gradient(135deg, #ff5e62, #ff9966, #ff5e62);
    background-size: 200% 200%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}
.superchat-banner-header {
    padding: 0.75rem 1rem;
    font-weight: 800;
    font-size: 1.1em;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.superchat-banner-header::before {
    content: "💬";
    font-size: 1.2em;
    animation: superchat-icon-bounce 2s infinite;
}
.superchat-banner-body {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(20, 20, 20, 0.8));
    padding: 1rem;
    color: #fff;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
@keyframes superchat-exciting {
    0% { 
        transform: translateY(-150%) scale(0.8); 
        opacity: 0; 
        background-position: 0% 50%;
    }
    15% { 
        transform: translateY(0) scale(1.05); 
        opacity: 1; 
        background-position: 100% 50%;
    }
    20% { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
    85% { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
        background-position: 0% 50%;
    }
    100% { 
        transform: translateY(-150%) scale(0.8); 
        opacity: 0; 
        background-position: 100% 50%;
    }
}

@keyframes superchat-icon-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-2px); }
}

/* --- Chat Messages Area --- */
#chat-messages-area {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 1;
    pointer-events: auto;
    /* Ensure proper scrolling behavior */
    scroll-behavior: smooth;
    /* Use dynamic viewport height for better mobile keyboard handling */
    height: auto;
    /* Prevent messages from being cut off */
    padding-bottom: 5px;
    /* Ensure proper stacking context */
    transform: translateZ(0);
    /* Hide chat when user is not logged in */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show chat when user is logged in */
#chat-messages-area.logged-in {
    opacity: 1;
    visibility: visible;
}

#chat-messages-area::-webkit-scrollbar {
    display: none;
}

#chat-messages-area {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.chat-message {
    padding: 0.3rem 0;
    margin-bottom: 0.2rem;
    max-width: 95%;
    word-wrap: break-word;
    font-size: 0.95em;
    transition: opacity 0.5s ease-out;
    opacity: 1;
    color: #fff;
    text-shadow: 
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 4px rgba(0, 0, 0, 0.8);
    font-weight: 500;
    /* Ensure messages are always visible and properly positioned */
    position: relative;
    z-index: 100;
    /* Prevent messages from being cut off */
    break-inside: avoid;
    page-break-inside: avoid;
    /* Ensure proper line height */
    line-height: 1.4;
}

.chat-message.fade-out {
    opacity: 0;
}
.chat-message.superchat-message {
    color: var(--primary);
    text-shadow: 
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 8px rgba(15, 179, 209, 0.8),
        0 0 12px rgba(15, 179, 209, 0.6);
    font-weight: 600;
}

/* Chat message profile picture styles */
.chat-message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.chat-message-text {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin-left: 34px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 4px;
    padding: 2px;
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: calc(100% - 34px);
    line-height: 1.4;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}

.chat-message-text:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-profile-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.chat-username {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 14px;
}

.chat-username:hover {
    color: var(--primary);
}

.chat-message-text {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin-left: 34px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: calc(100% - 34px);
    line-height: 1.4;
}

.mention-highlight {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
    animation: mentionPulse 2s ease-in-out infinite;
}

@keyframes mentionPulse {
    0%, 100% { 
        box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 4px 8px rgba(255, 107, 107, 0.5);
        transform: scale(1.02);
    }
}

.chat-profile-pic {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-level-badge {
    border-radius: 3px;
    padding: 1px 4px;
    min-width: 16px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #222;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    opacity: 0.85;
}

/* Level Badge Tiers - Vibrant Blue to Purple Progression */
.level-basic {
    background: linear-gradient(135deg, #42A5F5, #2196F3);
}

.level-bronze {
    background: linear-gradient(135deg, #5C6BC0, #3F51B5);
}

.level-silver {
    background: linear-gradient(135deg, #7E57C2, #673AB7);
}

.level-gold {
    background: linear-gradient(135deg, #AB47BC, #9C27B0);
}

.level-platinum {
    background: linear-gradient(135deg, #8E24AA, #7B1FA2);
}

.level-diamond {
    background: linear-gradient(135deg, #6A1B9A, #4A148C);
}

.level-number {
    color: white;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Arial', sans-serif;
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.9),
        0 0 4px rgba(0, 0, 0, 0.7);
    line-height: 1;
    letter-spacing: 0.2px;
}

.chat-message-text {
    flex: 1;
    min-width: 0; /* Allows text to wrap properly */
}

/* Ensure profile pictures work well with superchat messages */
.chat-message.superchat-message .chat-profile-pic {
    border-color: rgba(15, 179, 209, 0.4);
    box-shadow: 0 0 4px rgba(15, 179, 209, 0.3);
}

.chat-message.superchat-message .chat-level-badge {
    background: linear-gradient(135deg, #0fb3d1, #9fd6f9);
    border-color: rgba(15, 179, 209, 0.3);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 3px rgba(15, 179, 209, 0.2);
}

.chat-message.superchat-message .chat-username {
    color: var(--primary);
    text-shadow: 
        0 0 4px rgba(15, 179, 209, 0.6),
        0 0 8px rgba(15, 179, 209, 0.4);
}

.chat-message.superchat-message .chat-message-text {
    color: var(--primary);
    text-shadow: 
        0 0 4px rgba(15, 179, 209, 0.6),
        0 0 8px rgba(15, 179, 209, 0.4);
    font-weight: 600;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: calc(100% - 34px);
    line-height: 1.4;
}

.superchat-list-entry {
  display: block;
  margin: 0.5em 0;
  padding: 0.7em 1em;
  border-radius: 10px;
  font-size: 1.05em;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  word-break: break-word;
  transition: background 0.3s;
}
.superchat-color-0 { background: linear-gradient(90deg, #ffb347, #ffcc33); color: #222; }
.superchat-color-1 { background: linear-gradient(90deg, #ff5e62, #ff9966); }
.superchat-color-2 { background: linear-gradient(90deg, #36d1c4, #5b86e5); }
.superchat-color-3 { background: linear-gradient(90deg, #f7971e, #ffd200); color: #222; }
.superchat-color-4 { background: linear-gradient(90deg, #43cea2, #185a9d); }
.superchat-color-5 { background: linear-gradient(90deg, #ff6a00, #ee0979); }
.superchat-color-6 { background: linear-gradient(90deg, #c471f5, #fa71cd); }
.superchat-color-7 { background: linear-gradient(90deg, #f857a6, #ff5858); }
.superchat-color-8 { background: linear-gradient(90deg, #00c3ff, #ffff1c); color: #222; }
.superchat-color-9 { background: linear-gradient(90deg, #f953c6, #b91d73); }
.superchat-color-10 { background: linear-gradient(90deg, #43e97b, #38f9d7); color: #222; }
.superchat-color-11 { background: linear-gradient(90deg, #fa709a, #fee140); color: #222; }

/* Responsive */
@media (min-width: 601px) {
  #chat-messages-area {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 600px) {
  #chat-messages-area {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 600px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }
  #live-feed {
    padding-top: 0; /* Remove top padding for fullscreen */
    box-sizing: border-box;
    height: 100vh; /* Full viewport height on mobile too */
    /* no side padding so the stream is flush; keep space for toolbar + safe area */
    padding: 0 0 calc(var(--taskbar-h) + env(safe-area-inset-bottom) + 10px) 0;
  }
  
  /* iOS Safari/Chrome specific fixes */
  @supports (-webkit-touch-callout: none) {
    #live-feed {
      height: -webkit-fill-available;
      min-height: -webkit-fill-available;
    }
    .twitch-player-container {
      height: -webkit-fill-available;
      min-height: -webkit-fill-available;
    }
  }
  /* Chat area positioning for mobile with improved keyboard handling */
  #chat-messages-area {
    margin-bottom: 0;
    max-height: min(180px, calc(100dvh - var(--taskbar-h) - 25px));
    padding-bottom: 0;
    z-index: 100;
    /* Use dynamic viewport height for better keyboard handling */
    height: auto;
    /* Improved mobile scroll behavior */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Better touch interaction */
    touch-action: pan-y;
    /* No background on mobile - transparent */
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .chat-input-container {
    box-sizing: border-box;
    padding: 0;
  }
  
  .chat-input-container #emoji-button {
    display: none;
  }
  
  /* Reset taskbar spacing on mobile */
  #tab-superchat, #tab-gift, #tab-profile {
    margin: 0;
    min-width: 50px;
  }
  #tab-topup {
    margin-left: 14px;
  }
  

  #mobile-chat-input {
    width: 100%;
    font-size: 0.85em;
    border-radius: 8px;
    padding: 4px 8px;
    height: 28px;
    min-height: 28px;
    max-height: 28px;
  }
  #taskbar {
    width: 100vw;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 0 !important;
    min-height: 54px;
    padding: 0 2px;
  }
  
  /* Mobile-specific Twitch player adjustments */
  .twitch-player-container {
    height: 100vh; /* Full viewport height */
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
  }
  
  /* Additional iOS fixes */
  @supports (-webkit-touch-callout: none) {
    .twitch-player-container {
      height: -webkit-fill-available;
      min-height: -webkit-fill-available;
    }
  }
  
  /* Ensure the player respects the parent's padding and doesn't sit under the toolbar */
  .twitch-player-container {
    position: absolute !important;   /* not fixed */
    top: 0; left: 0; right: 0; bottom: 0;  /* fill #live-feed's content box */
    height: auto !important;
  }
  
  /* Android Chrome fixes - only for non-iOS devices */
  @supports not (-webkit-touch-callout: none) {
    @media screen and (max-width: 600px) {
      .twitch-player-container {
        height: 100vh !important;
        min-height: 100vh !important;
      }
    }
    
    @media screen and (max-width: 600px) and (orientation: portrait) {
      .twitch-player-container {
        height: 100vh !important;
        min-height: 100vh !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
      }
    }
    
    @media screen and (max-width: 600px) {
      html, body {
        height: 100vh !important;
        min-height: 100vh !important;
      }
      #live-feed {
        height: 100vh !important;
        min-height: 100vh !important;
      }
    }
  }
  .tab-recharge {
    padding-left: 6px;
  }
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    #chat-container {
        bottom: calc(var(--taskbar-h) + 20px);
        left: 10px;
        right: 10px;
        height: 28vh;
        max-height: 250px;
        padding: 12px;
    }
    
    .live-info {
        top: 15px;
        left: 15px;
        right: 15px;
    }
    
    .live-info h1 {
        font-size: 1.3em;
    }
    
    .live-info p {
        font-size: 0.9em;
    }

    #chat-messages-area {
        max-height: min(150px, calc(100dvh - var(--taskbar-h) - 30px));
        z-index: 100;
        /* Use dynamic viewport height for better keyboard handling */
        height: auto;
        /* Improved mobile scroll behavior */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        /* Better touch interaction */
        touch-action: pan-y;
        /* Ensure proper word wrapping on mobile */
        width: calc(100% - 2rem);
        max-width: 100%;
        /* No background on mobile - transparent */
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Mobile Auth Modal - Smaller */
    .auth-card {
        max-width: 320px;
        width: 85vw;
        padding: 2rem 1.5rem 1.5rem 1.5rem;
        gap: 1em;
    }

    .auth-card h2 {
        font-size: 1.5em;
    }

    .auth-card input {
        font-size: 1em;
        padding: 0.8em 1em;
        margin-bottom: 0.6em;
    }

    .auth-card button {
        padding: 1em 0;
        font-size: 1em;
    }

    .auth-card .switch-link {
        font-size: 0.9em;
        margin-top: 0.3em;
    }
    
    /* Mobile-specific chat message text improvements */
    .chat-message-text {
        font-size: 15px;
        line-height: 1.4;
        max-width: calc(100% - 34px);
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }
}

.gift-flyout {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 9999;
  background: linear-gradient(90deg, #ffe56b 0%, #ffd700 100%);
  color: #222;
  font-weight: bold;
  font-size: 1.3em;
  padding: 0.7em 1.5em;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 1.5px 0 #fff inset;
  pointer-events: none;
  opacity: 1;
  transform: scale(1);
  transition: all 1.6s cubic-bezier(.4,2,.6,1);
  text-align: center;
  letter-spacing: 0.03em;
  filter: drop-shadow(0 2px 8px #ffd70088);
}

.gift-stream-left {
  position: absolute;
  left: 0;
  top: 40%;
  transform: translateY(-50%);
  width: 260px;
  z-index: 900; /* Lowered so it appears behind modal and toolbar */
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto; /* Enable clicks on gift notifications */
}
.gift-stream-entry {
  background: linear-gradient(90deg, #ffe56b99 0%, #ffd70099 100%);
  color: #222;
  font-weight: bold;
  border-radius: 12px;
  padding: 0.6em 1.2em;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  font-size: 1.1em;
  opacity: 0;
  transform: translateX(0); /* Stay in place after sliding in */
  animation: gift-slide-in 0.7s cubic-bezier(.4,2,.6,1) forwards;
  margin-left: 20px;
}
.gift-stream-entry.fade-out {
  animation: gift-fade-out 1.5s linear forwards;
  pointer-events: none; /* don't block clicks even if it visually bugged */
}
@keyframes gift-slide-in {
  from {
    transform: translateX(-100%);
    opacity: 0.2;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes gift-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
.gift-name {
  color: #e67e22;
  font-weight: bold;
}

.gift-counter {
  color: #ff2b5e;
  font-weight: bold;
  margin-left: 6px;
  font-size: 1.1em;
  text-shadow: 0 1px 2px #fff8;
}

/* Character counter inside input box */
.input-with-counter {
  position: relative;
  width: 100%;
}
.input-with-counter input {
  width: 100%;
  box-sizing: border-box;
}
.input-char-count {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95em;
  color: #aaa;
  pointer-events: none;
  background: none;
  font-weight: 600;
}
.swal2-container {
  z-index: 20000 !important;
}

.tiktok-gift-entry {
  display: flex;
  flex-direction: row;
  align-items: center;
  background: linear-gradient(90deg, rgba(255, 0, 0, 0.6) 0%, rgba(0, 0, 255, 0.6) 100%);
  border-radius: 32px;
  box-shadow: 0 4px 24px #0006, 0 1.5px 0 #fff1 inset;
  padding: 0.32em 0.9em 0.32em 0.6em;
  margin: 0.18em 0 0.18em 0.4em;
  min-width: 0;
  width: fit-content;
  gap: 0.55em;
  font-size: 1em;
  opacity: 0;
  transform: translateX(0);
  animation: gift-slide-in 0.7s cubic-bezier(.4,2,.6,1) forwards;
  transition: all 0.2s ease;
}

.tiktok-gift-entry:hover {
  background: linear-gradient(90deg, rgba(255, 0, 0, 0.7) 0%, rgba(0, 0, 255, 0.7) 100%);
  box-shadow: 0 6px 32px #0008, 0 2px 0 #fff2 inset;
  transform: translateX(0) scale(1.02);
  cursor: pointer;
}
.tiktok-gift-entry .profile-pic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #222;
  background: #181818;
  margin-right: 0.38em;
  flex-shrink: 0;
}
.tiktok-gift-entry .username {
  font-weight: 700;
  color: #fff;
  font-size: 0.97em;
  flex: 1 1 auto;
}
.tiktok-gift-entry .gift-icon-wrap {
  display: flex;
  align-items: center;
  background: #232323;
  border-radius: 50%;
  padding: 0.22em;
  min-width: 24px;
  min-height: 24px;
  justify-content: center;
  margin-left: 0.2em;
  margin-right: 0.2em;
}
.tiktok-gift-entry .gift-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: contain;
  background: #181818;
}
.tiktok-gift-entry .gift-name {
  color: #ffe56b;
  font-weight: 600;
  font-size: 0.97em;
  margin-left: 0.32em;
  margin-right: 0.18em;
}
.tiktok-gift-entry .gift-counter {
  color: #ff2b5e;
  font-weight: 800;
  font-size: 1.08em;
  margin-left: 0.45em;
  text-shadow: 0 1px 2px #fff8;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

/* Gift Level Badge Styles */
.tiktok-gift-entry .gift-level-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.8em;
  font-weight: bold;
  margin-left: 6px;
  margin-right: 6px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  border: 2px solid #222;
}

.tiktok-gift-entry .gift-level-badge .level-number {
  color: #fff;
  font-size: 0.75em;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Level badge colors for gift notifications */
.tiktok-gift-entry .gift-level-badge.basic { background: linear-gradient(135deg, #6c757d, #495057); }
.tiktok-gift-entry .gift-level-badge.bronze { background: linear-gradient(135deg, #cd7f32, #b8860b); }
.tiktok-gift-entry .gift-level-badge.silver { background: linear-gradient(135deg, #c0c0c0, #a9a9a9); }
.tiktok-gift-entry .gift-level-badge.gold { background: linear-gradient(135deg, #ffd700, #ffb347); }
.tiktok-gift-entry .gift-level-badge.platinum { background: linear-gradient(135deg, #e5e4e2, #b4b4b4); }
.tiktok-gift-entry .gift-level-badge.diamond { background: linear-gradient(135deg, #b9f2ff, #87ceeb); }

#landscape-warning {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  color: #fff;
  font-size: 2em;
  text-align: center;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#landscape-warning.active {
  display: flex;
}

/* XP Bar Section for Gift Modal */
.xp-section {
  background: var(--bg-panel-light);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.xp-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #fff;
}

.xp-label {
  font-weight: 600;
  color: var(--secondary);
}

.xp-separator {
  color: #666;
}

.level-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #fff;
  margin-top: 6px;
}

.level-label {
  font-weight: 600;
  color: var(--secondary);
}

.xp-bar-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0;
}

#gift-xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 8px rgba(15, 179, 209, 0.3);
}

/* Treasure Box Button */
.tab-treasure .tab-label { color: #FFD700; }
.tab-treasure.active .tab-label, .tab-treasure:hover .tab-label { color: #FFA500; }

/* Treasure Box Modal Styles */
#treasure-panel .panel-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  max-height: 90vh;
  overflow-y: auto;
  gap: 12px;
}

.treasure-header { 
  text-align: center; 
  margin-bottom: 6px; 
  width: 100%;
}

.treasure-header .panel-title {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.4em;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
  margin: 0;
}

.treasure-container { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 14px; 
  width: 100%;
  max-width: 320px;
}

.treasure-box-display { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1));
  border-radius: 16px;
  border: 2px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 6px 24px rgba(255, 215, 0, 0.2);
}

.treasure-box-image { 
  width: 100px; 
  height: 100px; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.treasure-box-image:hover {
  transform: scale(1.1);
}

.treasure-chest { 
  width: 100%; 
  height: 100%; 
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
  animation: treasureGlow 3s ease-in-out infinite;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.treasure-chest:hover {
  transform: scale(1.05);
}

@keyframes treasureGlow { 
  0%, 100% {
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)) brightness(1);
  } 
  50% {
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)) brightness(1.2) drop-shadow(0 0 16px rgba(255, 215, 0, 0.6));
  } 
}

.treasure-message { 
  font-size: 1em; 
  font-weight: 700; 
  color: #333; 
  text-align: center; 
  margin: 6px 0; 
  padding: 12px 18px; 
  background: linear-gradient(135deg, #fff3cd, #ffeaa7); 
  border-radius: 20px; 
  border: 2px solid #ffd700; 
  box-shadow: 0 3px 12px rgba(255,215,0,0.4);
  position: relative;
  overflow: hidden;
}

.treasure-message::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.treasure-info { 
  width: 100%; 
  max-width: 280px;
}

.treasure-rules { 
  background: linear-gradient(135deg, #f8f9fa, #e9ecef); 
  border-radius: 16px; 
  padding: 16px; 
  box-shadow: 0 3px 12px rgba(0,0,0,0.1); 
  border: 2px solid #dee2e6;
  position: relative;
  overflow: hidden;
}

.treasure-rules::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700);
  background-size: 200% 100%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.treasure-rules h3 { 
  color: #333; 
  font-size: 1.1em; 
  font-weight: 800; 
  margin-bottom: 12px; 
  text-align: center;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.treasure-rules ul { 
  list-style: none; 
  padding: 0; 
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.treasure-rules li { 
  padding: 8px 12px; 
  font-size: 0.9em; 
  color: #555; 
  display: flex; 
  align-items: center; 
  gap: 8px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  border-left: 3px solid #FFD700;
  transition: all 0.3s ease;
}

.treasure-rules li:hover {
  background: rgba(255, 215, 0, 0.1);
  transform: translateX(3px);
}

.treasure-rules li:not(:last-child) { 
  border-bottom: 1px solid rgba(222, 226, 230, 0.5);
}

.treasure-open-btn:disabled { 
  background: linear-gradient(135deg, #6c757d, #495057); 
  color: #fff; 
  cursor: not-allowed; 
  transform: none; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  opacity: 0.7;
}

/* Mobile Responsive Improvements */
@media (max-width: 600px) {
  #treasure-panel .panel-content {
    padding: 12px 8px;
    max-height: 85vh;
    gap: 10px;
  }
  
  .treasure-header .panel-title {
    font-size: 1.2em;
  }
  
  .treasure-container { 
    padding: 6px; 
    gap: 12px; 
  }
  
  .treasure-box-display {
    padding: 12px;
    gap: 10px;
  }
  
  .treasure-box-image { 
    width: 80px; 
    height: 80px; 
  }
  
  .treasure-message { 
    font-size: 0.95em; 
    padding: 10px 14px; 
  }
  
  .treasure-rules { 
    padding: 12px; 
  }
  
  .treasure-rules h3 { 
    font-size: 1em; 
    margin-bottom: 10px;
  }
  
  .treasure-rules li { 
    font-size: 0.85em;
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  #treasure-panel .panel-content {
    padding: 10px 6px;
    max-height: 80vh;
  }
  
  .treasure-header .panel-title {
    font-size: 1.1em;
  }
  
  .treasure-box-image { 
    width: 70px; 
    height: 70px; 
  }
  
  .treasure-message { 
    font-size: 0.9em; 
    padding: 8px 12px; 
  }
  
  .treasure-rules { 
    padding: 10px; 
  }
  
  .treasure-rules h3 { 
    font-size: 0.95em; 
  }
  
  .treasure-rules li { 
    font-size: 0.8em;
    padding: 5px 8px;
  }
}

/* Treasure box success animations */
@keyframes coinFloat {
  0% {
    transform: translateY(0) scale(0);
    opacity: 1;
  }
  20% {
    transform: translateY(-20px) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translateY(-250px) scale(0.6);
    opacity: 0;
  }
}

@keyframes sparkleFloat {
  0% {
    transform: translateY(0) scale(0) rotate(0deg);
    opacity: 0;
  }
  20% {
    transform: translateY(-10px) scale(1) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-150px) scale(0.5) rotate(360deg);
    opacity: 0;
  }
}

@keyframes screenFlash {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes coinBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes numberGlow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(255, 165, 0, 0.5);
  }
  50% {
    text-shadow: 0 0 20px rgba(255, 165, 0, 0.8), 0 0 30px rgba(255, 165, 0, 0.6);
  }
}

@keyframes messageGlow {
  0%, 100% {
    box-shadow: 0 3px 12px rgba(255,215,0,0.4);
  }
  50% {
    box-shadow: 0 6px 24px rgba(255,215,0,0.8), 0 0 30px rgba(255,215,0,0.6);
  }
}

@keyframes balanceUpdate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
    color: #FFD700;
  }
  100% {
    transform: scale(1);
  }
}

.treasure-opened {
  animation: treasureOpen 0.5s ease-out;
}

@keyframes treasureOpen {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* SweetAlert treasure success styling */
.treasure-success-popup {
  border-radius: 20px !important;
  box-shadow: 0 10px 40px rgba(255, 215, 0, 0.3) !important;
}

.treasure-success-popup .swal2-title {
  color: #FFD700 !important;
  font-weight: 800 !important;
}

.treasure-success-popup .swal2-html-container {
  margin: 0 !important;
}

.treasure-success-popup .swal2-confirm {
  background: linear-gradient(135deg, #FFD700, #FFA500) !important;
  border: none !important;
  border-radius: 25px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4) !important;
  transition: all 0.3s ease !important;
}

.treasure-success-popup .swal2-confirm:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6) !important;
}



/* Treasure Box Animation Classes */
.treasure-box-shake {
  animation: treasureBoxShake 0.6s ease-in-out;
}

.treasure-box-open {
  animation: treasureBoxOpen 0.8s ease-out;
}

.treasure-box-glow {
  animation: treasureBoxGlow 1s ease-in-out infinite;
}

.treasure-box-success {
  animation: treasureBoxSuccess 0.5s ease-out;
}

.treasure-box-celebration {
  animation: treasureBoxCelebration 0.8s ease-out;
}

.treasure-box-available {
  animation: treasureBoxPulse 2s ease-in-out infinite;
}

/* Coin Animation */
.coin {
  position: absolute;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #222;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
  z-index: 1000;
}

.coin-animation {
  animation: coinFloat 2s ease-out forwards;
}

/* Success Message Animation */
.success-message {
  animation: successMessage 0.5s ease-out;
}

/* Button Success Animation */
.button-success {
  animation: buttonSuccess 1s ease-in-out;
}

/* Enhanced Treasure Box Hover and Active States */
#treasure-box-clickable {
  transition: transform 0.3s ease;
  cursor: pointer;
}

#treasure-box-clickable:hover {
  transform: scale(1.05);
}

#treasure-box-clickable:active {
  transform: scale(0.95);
}

/* Treasure Message Animation */
#treasure-message {
  transition: all 0.3s ease;
}

/* Disabled State for Treasure Box */
#treasure-box-clickable:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: scale(1);
}

#treasure-box-clickable:disabled:hover {
  transform: scale(1);
}

/* --- Treasure Box Animations --- */
@keyframes treasureBoxShake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
  75% { transform: rotate(-3deg); }
  100% { transform: rotate(0deg); }
}

@keyframes treasureBoxOpen {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes treasureBoxGlow {
  0%, 100% { 
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
  }
  50% { 
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 30px rgba(255, 215, 0, 0.6));
  }
}

@keyframes treasureBoxSuccess {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1.1); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes treasureBoxCelebration {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  50% { transform: scale(1.2) rotate(5deg); }
  75% { transform: scale(1.1) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes treasureBoxPulse {
  0%, 100% { 
    transform: scale(1);
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
  }
  50% { 
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
  }
}

@keyframes coinFloat {
  0% { 
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% { 
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes celebration {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes successMessage {
  0% { 
    opacity: 0;
    transform: translateY(20px);
  }
  100% { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes buttonSuccess {
  0% { background: var(--primary); }
  50% { background: #FFD700; }
  100% { background: var(--primary); }
}

/* Treasure Box Animation Classes */
.treasure-box-shake {
  animation: treasureBoxShake 0.6s ease-in-out;
}

.treasure-box-open {
  animation: treasureBoxOpen 0.8s ease-out;
}

.treasure-box-glow {
  animation: treasureBoxGlow 1s ease-in-out infinite;
}

.treasure-box-success {
  animation: treasureBoxSuccess 0.5s ease-out;
}

.treasure-box-celebration {
  animation: treasureBoxCelebration 0.8s ease-out;
}

.treasure-box-available {
  animation: treasureBoxPulse 2s ease-in-out infinite;
}

/* Coin Animation */
.coin {
  position: absolute;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #222;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
  z-index: 1000;
}

.coin-animation {
  animation: coinFloat 2s ease-out forwards;
}

/* Success Message Animation */
.success-message {
  animation: successMessage 0.5s ease-out;
}

/* Button Success Animation */
.button-success {
  animation: buttonSuccess 1s ease-in-out;
}

/* Enhanced Treasure Box Hover and Active States */
#treasure-box-clickable {
  transition: transform 0.3s ease;
  cursor: pointer;
}

#treasure-box-clickable:hover {
  transform: scale(1.05);
}

#treasure-box-clickable:active {
  transform: scale(0.95);
}

/* Treasure Message Animation */
#treasure-message {
  transition: all 0.3s ease;
}

/* Disabled State for Treasure Box */
#treasure-box-clickable:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: scale(1);
}

#treasure-box-clickable:disabled:hover {
  transform: scale(1);
}

/* --- Treasure Box Animations --- */
@keyframes treasureBoxShake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
  75% { transform: rotate(-3deg); }
  100% { transform: rotate(0deg); }
}

@keyframes treasureBoxOpen {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes treasureBoxGlow {
  0%, 100% { 
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
  }
  50% { 
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 30px rgba(255, 215, 0, 0.6));
  }
}

@keyframes treasureBoxSuccess {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1.1); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes treasureBoxCelebration {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  50% { transform: scale(1.2) rotate(5deg); }
  75% { transform: scale(1.1) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes treasureBoxPulse {
  0%, 100% { 
    transform: scale(1);
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
  }
  50% { 
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
  }
}

@keyframes coinFloat {
  0% { 
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% { 
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes celebration {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes successMessage {
  0% { 
    opacity: 0;
    transform: translateY(20px);
  }
  100% { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes buttonSuccess {
  0% { background: var(--primary); }
  50% { background: #FFD700; }
  100% { background: var(--primary); }
}

/* Treasure Box Animation Classes */
.treasure-box-shake {
  animation: treasureBoxShake 0.6s ease-in-out;
}

.treasure-box-open {
  animation: treasureBoxOpen 0.8s ease-out;
}

.treasure-box-glow {
  animation: treasureBoxGlow 1s ease-in-out infinite;
}

.treasure-box-success {
  animation: treasureBoxSuccess 0.5s ease-out;
}

.treasure-box-celebration {
  animation: treasureBoxCelebration 0.8s ease-out;
}

.treasure-box-available {
  animation: treasureBoxPulse 2s ease-in-out infinite;
}

/* Coin Animation */
.coin {
  position: absolute;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #222;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
  z-index: 1000;
}

.coin-animation {
  animation: coinFloat 2s ease-out forwards;
}

/* Success Message Animation */
.success-message {
  animation: successMessage 0.5s ease-out;
}

/* Button Success Animation */
.button-success {
  animation: buttonSuccess 1s ease-in-out;
}

/* Enhanced Treasure Box Hover and Active States */
#treasure-box-clickable {
  transition: transform 0.3s ease;
  cursor: pointer;
}

#treasure-box-clickable:hover {
  transform: scale(1.05);
}

#treasure-box-clickable:active {
  transform: scale(0.95);
}

/* Treasure Message Animation */
#treasure-message {
  transition: all 0.3s ease;
}

/* Disabled State for Treasure Box */
#treasure-box-clickable:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: scale(1);
}

#treasure-box-clickable:disabled:hover {
  transform: scale(1);
}

/* --- Treasure Box Animations --- */
@keyframes treasureBoxShake {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
  75% { transform: rotate(-3deg); }
  100% { transform: rotate(0deg); }
}

@keyframes treasureBoxOpen {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes treasureBoxGlow {
  0%, 100% { 
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
  }
  50% { 
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 30px rgba(255, 215, 0, 0.6));
  }
}

@keyframes treasureBoxSuccess {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1.1); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes treasureBoxCelebration {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.1) rotate(-5deg); }
  50% { transform: scale(1.2) rotate(5deg); }
  75% { transform: scale(1.1) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes treasureBoxPulse {
  0%, 100% { 
    transform: scale(1);
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.3));
  }
  50% { 
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
  }
}

@keyframes coinFloat {
  0% { 
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% { 
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes celebration {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes successMessage {
  0% { 
    opacity: 0;
    transform: translateY(20px);
  }
  100% { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes buttonSuccess {
  0% { background: var(--primary); }
  50% { background: #FFD700; }
  100% { background: var(--primary); }
}

/* Treasure Box Animation Classes */
.treasure-box-shake {
  animation: treasureBoxShake 0.6s ease-in-out;
}

.treasure-box-open {
  animation: treasureBoxOpen 0.8s ease-out;
}

.treasure-box-glow {
  animation: treasureBoxGlow 1s ease-in-out infinite;
}

.treasure-box-success {
  animation: treasureBoxSuccess 0.5s ease-out;
}

.treasure-box-celebration {
  animation: treasureBoxCelebration 0.8s ease-out;
}

.treasure-box-available {
  animation: treasureBoxPulse 2s ease-in-out infinite;
}

/* Coin Animation */
.coin {
  position: absolute;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #222;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
  z-index: 1000;
}

.coin-animation {
  animation: coinFloat 2s ease-out forwards;
}

/* Success Message Animation */
.success-message {
  animation: successMessage 0.5s ease-out;
}

/* Button Success Animation */
.button-success {
  animation: buttonSuccess 1s ease-in-out;
}

/* Enhanced Treasure Box Hover and Active States */
#treasure-box-clickable {
  transition: transform 0.3s ease;
  cursor: pointer;
}

#treasure-box-clickable:hover {
  transform: scale(1.05);
}

#treasure-box-clickable:active {
  transform: scale(0.95);
}

/* Treasure Message Animation */
#treasure-message {
  transition: all 0.3s ease;
}

/* Disabled State for Treasure Box */
#treasure-box-clickable:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: scale(1);
}

#treasure-box-clickable:disabled:hover {
  transform: scale(1);
}

/* --- Weekly Ranks Panel Styles --- */
#ranks-panel .panel-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  background: rgba(18,18,18,0.95);
  border-radius: 16px;
  box-shadow: none;
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: none;
  position: relative;
  overflow: hidden;
  max-height: 80vh;
  overflow-y: auto;
}

#ranks-panel .panel-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(255, 107, 107, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(78, 205, 196, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(254, 202, 87, 0.2) 0%, transparent 50%);
  pointer-events: none;
  animation: backgroundShift 8s ease-in-out infinite;
}

@keyframes backgroundShift {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.ranks-header {
  padding: 20px 20px 15px 20px;
  text-align: center;
  border-bottom: 3px solid rgba(255, 255, 255, 0.4);
  background: rgba(0,0,0,0.4);
  border-radius: 16px 16px 0 0;
  position: relative;
  backdrop-filter: none;
  box-shadow: none;
}

.ranks-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.ranks-title-section {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}

.ranks-icon-large {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%) scale(1.1);
  font-size: 36px;
  filter: drop-shadow(0 4px 8px rgba(255, 215, 0, 0.8));
  animation: trophyGlow 2s ease-in-out infinite alternate;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
  transition: transform 0.3s ease;
  z-index: 1;
}

.ranks-icon-large:hover {
  transform: scale(1.2) rotate(5deg);
}

@keyframes trophyGlow {
  0% { 
    filter: drop-shadow(0 4px 8px rgba(255, 215, 0, 0.8));
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
  }
  100% { 
    filter: drop-shadow(0 8px 16px rgba(255, 215, 0, 1));
    text-shadow: 0 0 30px rgba(255, 215, 0, 1);
  }
}

.ranks-title-text {
  flex: 1;
  position: relative;
  z-index: 2;
}

.ranks-title-text h2 {
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-size: 2em;
  font-weight: 900;
  color: #fff;
  text-shadow: none;
  margin: 0;
  letter-spacing: 2px;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.ranks-subtitle {
  margin: 8px 0 0 0;
  font-size: 1.1em;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-family: 'Arial', sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
  animation: subtitlePulse 3s ease-in-out infinite;
}

@keyframes subtitlePulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

.user-rank-highlight {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  padding: 12px 16px;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: highlightPulse 3s ease-in-out infinite;
  margin: 0 auto;
  max-width: 200px;
  position: relative;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.user-rank-highlight::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: highlightShimmer 2s ease-in-out infinite;
}

@keyframes highlightShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes highlightPulse {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 15px rgba(255, 255, 255, 0.2);
  }
  50% { 
    transform: scale(1.02); 
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.4);
  }
}

.highlight-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.8));
  animation: starTwinkle 2s ease-in-out infinite;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
  z-index: 1;
}

@keyframes starTwinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.2) rotate(180deg); opacity: 0.8; }
}

.highlight-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 2;
  align-items: center;
  text-align: center;
}

.highlight-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-family: 'Arial', sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

.highlight-rank {
  font-size: 18px;
  font-weight: 900;
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  background: linear-gradient(45deg, #FFD700, #FFA500, #FF6B6B);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: rankGradient 3s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  letter-spacing: 1px;
}

@keyframes rankGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.ranks-container {
  flex: 1;
  padding: 15px;
  position: relative;
  z-index: 2;
}

.ranks-container::-webkit-scrollbar {
  width: 8px;
}

.ranks-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.ranks-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.ranks-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.3));
}

.ranks-table-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ranks-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.3);
  font-family: 'Arial', sans-serif;
}

.ranks-table th {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  color: rgba(255, 255, 255, 0.95);
  font-weight: 800;
  padding: 12px 8px;
  text-align: center;
  font-size: 0.85em;
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  letter-spacing: 1px;
  text-shadow: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: none;
}

.ranks-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9em;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: none;
  transition: none;
}

.ranks-table tbody tr:hover td { background: rgba(255,255,255,0.06); }

.ranks-table tbody tr:nth-child(-n+3) {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.1));
  font-weight: 700;
  position: relative;
}

.ranks-table tbody tr:nth-child(-n+3)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
  animation: topRowShimmer 3s ease-in-out infinite;
}

@keyframes topRowShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.ranks-table tbody tr:nth-child(1) {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 165, 0, 0.2));
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  font-weight: 800;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.ranks-table tbody tr:nth-child(2) {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.3), rgba(169, 169, 169, 0.2));
  color: #C0C0C0;
  text-shadow: 0 0 10px rgba(192, 192, 192, 0.5);
  font-weight: 800;
  box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
}

.ranks-table tbody tr:nth-child(3) {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.3), rgba(184, 115, 51, 0.2));
  color: #CD7F32;
  text-shadow: 0 0 10px rgba(205, 127, 50, 0.5);
  font-weight: 800;
  box-shadow: 0 0 15px rgba(205, 127, 50, 0.3);
}

/* Highlight current user's row */
.ranks-table tbody tr.current-user-row {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 215, 0, 0.2)) !important;
  color: #FFD700 !important;
  font-weight: 800;
  box-shadow: 
    0 0 30px rgba(255, 215, 0, 0.6),
    0 0 50px rgba(255, 255, 255, 0.3),
    inset 0 0 20px rgba(255, 215, 0, 0.2);
  border: 3px solid rgba(255, 215, 0, 0.8);
  animation: userRowGlow 2s ease-in-out infinite alternate;
  position: relative;
  z-index: 1;
}

.ranks-table tbody tr.current-user-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: userRowShimmer 2s ease-in-out infinite;
}

@keyframes userRowShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes userRowGlow {
  0% { 
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 0 50px rgba(255, 255, 255, 0.3);
    transform: scale(1);
  }
  100% { 
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 255, 255, 0.5);
    transform: scale(1.01);
  }
}

.position-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.medal-icon {
  font-size: 1.5em;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  animation: medalGlow 2s ease-in-out infinite alternate;
}

@keyframes medalGlow {
  0% { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); transform: scale(1); }
  100% { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.8)); transform: scale(1.1); }
}

.gold-medal {
  color: #FFD700;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  animation: goldMedalGlow 3s ease-in-out infinite;
}

@keyframes goldMedalGlow {
  0%, 100% { text-shadow: 0 0 15px rgba(255, 215, 0, 0.8); }
  50% { text-shadow: 0 0 25px rgba(255, 215, 0, 1); }
}

.silver-medal {
  color: #C0C0C0;
  text-shadow: 0 0 15px rgba(192, 192, 192, 0.8);
  animation: silverMedalGlow 3s ease-in-out infinite;
}

@keyframes silverMedalGlow {
  0%, 100% { text-shadow: 0 0 15px rgba(192, 192, 192, 0.8); }
  50% { text-shadow: 0 0 25px rgba(192, 192, 192, 1); }
}

.bronze-medal {
  color: #CD7F32;
  text-shadow: 0 0 15px rgba(205, 127, 50, 0.8);
  animation: bronzeMedalGlow 3s ease-in-out infinite;
}

@keyframes bronzeMedalGlow {
  0%, 100% { text-shadow: 0 0 15px rgba(205, 127, 50, 0.8); }
  50% { text-shadow: 0 0 25px rgba(205, 127, 50, 1); }
}

/* Ranks tab styling */
.tab-ranks .tab-label {
  color: #FFD700;
}

.tab-ranks.active .tab-label,
.tab-ranks:hover .tab-label {
  color: #FFA500;
}

/* Mobile responsive for ranks */
@media (max-width: 600px) {
  .ranks-table th,
  .ranks-table td {
    padding: 10px 8px;
    font-size: 0.8em;
  }
  
  .ranks-header {
    padding: 15px 15px 8px 15px;
  }
  
  .ranks-container {
    padding: 15px;
  }
}

/* --- Weekly Ranks Button Styles --- */
.ranks-button {
  position: absolute;
  top: 80px;
  right: 15px;
  display: flex;
  align-items: center;
  background: rgba(255, 215, 0, 0.08);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 215, 0, 0.15);
  width: fit-content;
  z-index: 100;
  gap: 6px;
  box-shadow: 0 1px 4px rgba(255, 215, 0, 0.08);
}

.ranks-button:hover {
  background: rgba(255, 215, 0, 0.25);
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.25);
  border-color: rgba(255, 215, 0, 0.4);
}

.ranks-button:active {
  transform: scale(0.95);
}

.ranks-icon {
  font-size: 16px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.ranks-text {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ranks-rank {
  font-size: 12px;
  font-weight: 700;
  color: #FFD700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  line-height: 1;
}

.ranks-label {
  font-size: 10px;
  font-weight: 600;
  color: #FFA500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  line-height: 1;
}

/* Special styling for top ranks */
.ranks-button.rank-1 {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0.2));
  border-color: rgba(255, 215, 0, 0.8);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.3);
}

.ranks-button.rank-1 .ranks-rank {
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.ranks-button.rank-2 {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.4), rgba(192, 192, 192, 0.2));
  border-color: rgba(192, 192, 192, 0.8);
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.ranks-button.rank-2 .ranks-rank {
  color: #C0C0C0;
  text-shadow: 0 0 10px rgba(192, 192, 192, 0.8);
}

.ranks-button.rank-3 {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.4), rgba(205, 127, 50, 0.2));
  border-color: rgba(205, 127, 50, 0.8);
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.ranks-button.rank-3 .ranks-rank {
  color: #CD7F32;
  text-shadow: 0 0 10px rgba(205, 127, 50, 0.8);
}

/* Rank change animations */
@keyframes rankShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

@keyframes rankImproved {
  0% { 
    background: linear-gradient(90deg, #ffb347, #ff5e62, #36d1c4, #43cea2);
    box-shadow: 0 0 16px 0 rgba(0,0,0,0.18), 0 2px 8px 0 rgba(0,0,0,0.10);
  }
  50% { 
    background: linear-gradient(90deg, #4CAF50, #45a049, #4CAF50, #45a049);
    box-shadow: 0 0 20px 0 rgba(76, 175, 80, 0.4), 0 2px 8px 0 rgba(0,0,0,0.10);
  }
  100% { 
    background: linear-gradient(90deg, #ffb347, #ff5e62, #36d1c4, #43cea2);
    box-shadow: 0 0 16px 0 rgba(0,0,0,0.18), 0 2px 8px 0 rgba(0,0,0,0.10);
  }
}

@keyframes rankWorsened {
  0% { 
    background: linear-gradient(90deg, #ffb347, #ff5e62, #36d1c4, #43cea2);
    box-shadow: 0 0 16px 0 rgba(0,0,0,0.18), 0 2px 8px 0 rgba(0,0,0,0.10);
  }
  50% { 
    background: linear-gradient(90deg, #f44336, #d32f2f, #f44336, #d32f2f);
    box-shadow: 0 0 20px 0 rgba(244, 67, 54, 0.4), 0 2px 8px 0 rgba(0,0,0,0.10);
  }
  100% { 
    background: linear-gradient(90deg, #ffb347, #ff5e62, #36d1c4, #43cea2);
    box-shadow: 0 0 16px 0 rgba(0,0,0,0.18), 0 2px 8px 0 rgba(0,0,0,0.10);
  }
}

.ranks-button.rank-improved {
  animation: rankShake 0.5s ease-in-out, rankImproved 1s ease-in-out;
}

.ranks-button.rank-worsened {
  animation: rankShake 0.5s ease-in-out, rankWorsened 1s ease-in-out;
}


/* Make chat messages clickable */
.chat-message-text strong {
  cursor: pointer;
  transition: color 0.3s ease;
}

.chat-message-text strong:hover {
  color: var(--primary);
  text-decoration: underline;
}

.chat-profile-pic {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.chat-profile-pic:hover {
  transform: scale(1.1);
}

/* Reply button styles */
.user-profile-reply-btn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  margin-top: 15px;
  width: 100%;
}

.user-profile-reply-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.reply-icon {
  width: 20px;
  height: 20px;
}

/* Admin Mute Section Styles */
.admin-mute-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-mute-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  color: #ff6b6b;
  font-weight: 600;
  font-size: 14px;
}

.admin-icon {
  width: 18px;
  height: 18px;
}

.admin-mute-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.admin-mute-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.admin-mute-btn:active {
  transform: translateY(0);
}

.mute-icon {
  width: 16px;
  height: 16px;
}

/* --- Daily Treasure Box Button Styles --- */
.treasure-button {
  position: absolute;
  top: 130px;
  right: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: fit-content;
  z-index: 200; /* Higher than offline overlay */
  gap: 4px;
}

.treasure-button:hover {
  background: rgba(0, 0, 0, 0.5);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.treasure-button:active {
  transform: scale(0.95);
}

.treasure-box-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.treasure-box-icon:hover {
  transform: scale(1.1);
}

.treasure-box-icon:active {
  transform: scale(0.9);
}

.treasure-chest {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.treasure-label {
  font-size: 10px;
  font-weight: 600;
  color: #FFD700;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.treasure-button:hover .treasure-label {
  color: #FFA500;
}

/* Disabled state for treasure button */
.treasure-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.treasure-button.disabled:hover {
  transform: none;
  background: rgba(0, 0, 0, 0.3);
}

.treasure-button.disabled .treasure-box-icon {
  cursor: not-allowed;
}

.treasure-button.disabled .treasure-box-icon:hover {
  transform: none;
}

/* Ensure live-info has absolute positioning for proper layout */
.live-info {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  z-index: 100;
  text-shadow: 0 2px 8px #000c;
}

/* Join Notification Styles */
.join-notification {
  position: absolute;
  top: 50%;
  left: 30px;
  transform: translate(-100%, -50%);
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.9), rgba(139, 195, 74, 0.8));
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 150;
  opacity: 0;
  transform: translate(-100%, -50%) translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.join-notification.show {
  opacity: 1;
  transform: translate(0, -50%) translateY(0);
}

.join-notification.fade-out {
  opacity: 0;
  transform: translate(-100%, -50%) translateY(-20px);
}

.join-notification.with-modal {
  top: 110px;
}

@media (max-width: 600px) {
  .join-notification.with-modal {
    top: 90px;
  }
}

#join-notification-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

#join-notification-text::before {
  content: "👋";
  font-size: 14px;
}

/* Offline Overlay Styles */
#offline-overlay {
  position: absolute;
  top: 0; /* Cover from the very top */
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(15, 15, 35, 0.95), rgba(26, 26, 46, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50 !important; /* Below UI elements (100-200) but above stream background */
  backdrop-filter: none; /* no GPU-heavy blur */
  -webkit-backdrop-filter: none;
  animation: none; /* disable any overlay animations */
  pointer-events: auto !important;
}

.offline-content {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
  background: rgba(0,0,0,0.4);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none; /* remove heavy shadows */
  animation: none; /* no animations */
}

@keyframes offlineGlow {
  0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 30px rgba(138, 43, 226, 0.3); }
  50% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 50px rgba(138, 43, 226, 0.5); }
}

.offline-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: none; /* disable bounce */
  display: block;
}

@keyframes iconBounce {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.offline-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.offline-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
  font-weight: 500;
}

.offline-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.offline-feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.2), rgba(147, 112, 219, 0.1));
  border-radius: 12px;
  border: 1px solid rgba(138, 43, 226, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
}

.offline-feature:hover {
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.3), rgba(147, 112, 219, 0.2));
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(138, 43, 226, 0.3);
}

.feature-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.feature-text {
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.offline-cta {
  margin-top: 1.5rem;
}

.offline-cta p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-style: normal;
  animation: none; /* disable pulse */
}

@keyframes ctaPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
  .offline-content {
    padding: 1.5rem;
    max-width: 95%;
    margin: 1rem;
  }
  
  .offline-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  .offline-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }
  
  .offline-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
  }
  
  .offline-cta p {
    font-size: 0.85rem;
  }
}

/* Like Bar Styles */
#like-bar {
  position: relative;
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 501; /* Above .live-info (500) and stream container (1-2) */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: fit-content;
  transition: all 0.3s ease;
  transform-origin: center;
  opacity: 1;
  pointer-events: auto; /* Ensure clicks work - this is important for like functionality */
}





.like-bar-content {
  display: flex;
  align-items: center;
  gap: 4px;
  color: white;
  font-family: 'Inter', sans-serif;
}

.like-icon {
  font-size: 14px;
  animation: likePulse 2s ease-in-out infinite;
}

.like-count {
  font-weight: 700;
  font-size: 12px;
  color: #ff6b9d;
}

.like-text {
  font-size: 10px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}





@keyframes likePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}



@keyframes goalReached {
  0% { 
    transform: scale(1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
  25% { 
    transform: scale(1.3);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
  }
  50% { 
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
  }
  75% { 
    transform: scale(1.2);
    box-shadow: 0 0 35px rgba(255, 215, 0, 0.7);
  }
  100% { 
    transform: scale(1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  }
}

.like-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #ff6b9d, #ffd700);
  border-radius: 0 0 15px 15px;
  transition: width 0.3s ease;
  z-index: 1;
}

.like-goal {
  font-size: 9px;
  opacity: 0.6;
  color: #ffd700;
  margin-left: 4px;
  font-weight: 600;
}

#like-bar.goal-reached {
  animation: goalReached 1s ease-out;
}

/* Mobile responsive like bar */
@media (max-width: 600px) {
  #like-bar {
    margin-top: 6px;
    padding: 3px 8px;
  }

  .like-icon {
    font-size: 12px;
  }

  .like-count {
    font-size: 10px;
  }

  .like-text {
    font-size: 8px;
  }
}

/* TikTok-style Heart Animation Container */
#heart-animation-container {
  position: absolute;
  bottom: 80px; /* Above the toolbar */
  left: 0;
  right: 0;
  height: 60vh;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

/* TikTok-style Heart Animation */
.tiktok-heart {
  position: absolute;
  pointer-events: none;
  z-index: 1001;
  font-size: 20px;
  opacity: 0;
  animation: tiktokHeartFloat 4s ease-out forwards;
  filter: drop-shadow(0 0 10px rgba(255, 105, 180, 0.3));
}

@keyframes tiktokHeartFloat {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(0) translateX(0) rotate(0deg);
  }
  15% {
    opacity: 0.3;
    transform: scale(1.1) translateY(-40px) translateX(8px) rotate(5deg);
  }
  30% {
    opacity: 0.4;
    transform: scale(1) translateY(-80px) translateX(-12px) rotate(-3deg);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.9) translateY(-140px) translateX(18px) rotate(8deg);
  }
  70% {
    opacity: 0.2;
    transform: scale(0.8) translateY(-200px) translateX(-10px) rotate(-5deg);
  }
  85% {
    opacity: 0.1;
    transform: scale(0.7) translateY(-260px) translateX(15px) rotate(3deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.6) translateY(-320px) translateX(-8px) rotate(-2deg);
  }
}

/* Prevent text selection on interactive elements */
.live-info, .viewer-count, .ranks-button, .treasure-button, .taskbar-item, .panel-content, .auth-card, .slideup-panel {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Like Animation (original) */
.like-animation {
  position: absolute;
  pointer-events: none;
  z-index: 999;
  animation: likeFloat 1.5s ease-out forwards;
  font-size: 24px;
  opacity: 0;
}

@keyframes likeFloat {
  0% {
    opacity: 1;
    transform: scale(0.5) translateY(0);
  }
  20% {
    opacity: 1;
    transform: scale(1.2) translateY(-20px);
  }
  100% {
    opacity: 0;
    transform: scale(1) translateY(-60px);
  }
}

/* --- Coin Drop Panel Styles --- */
#coin-drop-panel .panel-content {
  background: linear-gradient(135deg, #0f0f23, #1a1a2e, #0f0f23);
  border: 2px solid rgba(255, 215, 0, 0.4);
  box-shadow: 0 25px 80px rgba(255, 215, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(25px);
  max-height: 75vh;
  overflow-y: auto;
  border-radius: 20px;
  position: relative;
  animation: modalFloat 6s ease-in-out infinite;
  overflow-x: hidden;
}

#coin-drop-panel .panel-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 215, 0, 0.03) 50%, transparent 70%);
  animation: backgroundFlow 8s linear infinite;
  pointer-events: none;
  overflow: hidden;
}

@keyframes modalFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

@keyframes backgroundFlow {
  0% { transform: translateX(-50%) translateY(-50%); }
  100% { transform: translateX(50%) translateY(50%); }
}

#coin-drop-panel .panel-title {
  background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700, #FFA500);
  color: #222;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  border-bottom: 2px solid rgba(255, 215, 0, 0.6);
  padding: 15px 20px;
  font-size: 18px;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  animation: titleGlow 4s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.5); }
}

#coin-drop-panel .panel-title::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.coin-drop-modal-content {
  padding: 20px;
  color: #fff;
  animation: contentFadeIn 0.8s ease-out;
  text-align: center;
}

@keyframes contentFadeIn {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.coin-drop-header {
  text-align: center;
  margin-bottom: 25px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.1), rgba(255, 215, 0, 0.05));
  border-radius: 18px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  position: relative;
  overflow: hidden;
  animation: headerFloat 5s ease-in-out infinite;
}

.coin-drop-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 215, 0, 0.08) 50%, transparent 70%);
  animation: headerGlow 4s ease-in-out infinite;
}

.coin-drop-header::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
  animation: headerPulse 6s ease-in-out infinite;
}

@keyframes headerFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

@keyframes headerGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

@keyframes headerPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(180deg); }
}

.coin-drop-icon {
  font-size: 48px;
  margin-bottom: 12px;
  color: #FFD700;
  animation: coinBounce 2s ease-in-out infinite;
  text-shadow: 0 4px 8px rgba(255, 215, 0, 0.4);
  position: relative;
  z-index: 2;
}

@keyframes coinBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.coin-drop-title {
  font-size: 1.8em;
  font-weight: 800;
  color: #FFD700;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  letter-spacing: 0.3px;
  animation: titlePulse 3s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.coin-drop-subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95em;
  margin-bottom: 0;
  font-weight: 500;
  line-height: 1.4;
  animation: subtitleFloat 4s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

@keyframes subtitleFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-2px); }
}

.coin-drop-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  animation: formSlideIn 1s ease-out 0.3s both;
  align-items: center;
}

@keyframes formSlideIn {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.amount-input-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 5px;
  animation: sectionFloat 7s ease-in-out infinite;
  align-items: center;
}

@keyframes sectionFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-1px); }
}

.amount-input-section label {
  color: #FFD700;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  animation: labelGlow 5s ease-in-out infinite;
}

@keyframes labelGlow {
  0%, 100% { text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
  50% { text-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 0 8px rgba(255, 215, 0, 0.4); }
}

.amount-input-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#coin-drop-amount {
  width: 100%;
  padding: 14px;
  border: 2px solid #FFD700;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 15px;
  text-align: center;
  transition: all 0.3s ease;
  font-weight: 600;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
  animation: inputPulse 8s ease-in-out infinite;
}

@keyframes inputPulse {
  0%, 100% { border-color: #FFD700; }
  50% { border-color: #FFA500; }
}

#coin-drop-amount:focus {
  outline: none;
  border-color: #FFA500;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.5), inset 0 2px 4px rgba(0,0,0,0.2);
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.02);
  animation: none;
}

.amount-slider {
  margin-top: 15px;
}

#coin-drop-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.3), rgba(255, 165, 0, 0.3));
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

#coin-drop-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

#coin-drop-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 16px rgba(255, 215, 0, 0.7), 0 0 0 3px rgba(255, 255, 255, 0.3);
}

#coin-drop-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
}

.coin-drop-preview {
  text-align: center;
  margin: 20px 0;
}

.preview-treasure-box {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 165, 0, 0.15), rgba(255, 215, 0, 0.08));
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 20px;
  padding: 20px;
  margin: 15px 0;
  animation: treasureBoxPulse 3s ease-in-out infinite;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(255, 215, 0, 0.2);
}

.preview-treasure-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.15), transparent);
  animation: treasureShine 4s linear infinite;
}

.preview-treasure-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255, 215, 0, 0.1) 0%, transparent 50%);
  animation: treasureGlow 6s ease-in-out infinite;
}

@keyframes treasureShine {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes treasureGlow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

@keyframes treasureBoxPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.05) rotate(1deg); }
}

.preview-icon {
  font-size: 44px;
  color: #FFD700;
  margin-bottom: 10px;
  text-shadow: 0 4px 8px rgba(255, 215, 0, 0.4);
  animation: iconFloat 2s ease-in-out infinite;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.preview-amount {
  font-size: 1.8em;
  font-weight: 800;
  color: #FFD700;
  margin-bottom: 6px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.preview-label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.coin-drop-info {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.06));
  border-radius: 16px;
  padding: 18px;
  margin: 20px 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  animation: infoFloat 9s ease-in-out infinite;
  position: relative;
  overflow: hidden;
}

.coin-drop-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 40%, rgba(255, 215, 0, 0.05) 50%, transparent 60%);
  animation: infoShine 7s linear infinite;
}

@keyframes infoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-1px); }
}

@keyframes infoShine {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(50%); }
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  padding: 4px 0;
  animation: itemSlideIn 0.6s ease-out both;
  justify-content: center;
}

.info-item:nth-child(1) { animation-delay: 0.1s; }
.info-item:nth-child(2) { animation-delay: 0.2s; }
.info-item:nth-child(3) { animation-delay: 0.3s; }

@keyframes itemSlideIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-icon {
  color: #FFD700;
  font-size: 16px;
  text-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
  animation: iconSpin 10s linear infinite;
}

@keyframes iconSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.info-text {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
  line-height: 1.3;
  animation: textGlow 8s ease-in-out infinite;
}

@keyframes textGlow {
  0%, 100% { text-shadow: none; }
  50% { text-shadow: 0 0 5px rgba(255, 255, 255, 0.3); }
}

.coin-drop-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
  animation: actionsSlideIn 1.2s ease-out 0.5s both;
  flex-wrap: wrap;
}

@keyframes actionsSlideIn {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.confirm-coin-drop-btn {
  background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700);
  color: #222;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
  animation: buttonPulse 4s ease-in-out infinite;
}

.confirm-coin-drop-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.confirm-coin-drop-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
  animation: buttonGlow 6s ease-in-out infinite;
}

@keyframes buttonPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes buttonGlow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.confirm-coin-drop-btn:hover::before {
  left: 100%;
}

.confirm-coin-drop-btn:hover {
  background: linear-gradient(135deg, #FFA500, #FFD700, #FFA500);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: none;
}

.confirm-coin-drop-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}



.btn-icon {
  font-size: 18px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cancel-coin-drop-btn {
  background: linear-gradient(135deg, #666, #444, #666);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  letter-spacing: 0.2px;
}

.cancel-coin-drop-btn:hover {
  background: linear-gradient(135deg, #777, #555, #777);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Mobile responsive for coin drop modal */
@media (max-width: 600px) {
  .coin-drop-modal-content {
    padding: 15px;
    max-height: 80vh;
  }
  
  .coin-drop-header {
    padding: 15px;
    margin-bottom: 20px;
  }
  
  .coin-drop-icon {
    font-size: 36px;
  }
  
  .coin-drop-title {
    font-size: 1.4em;
  }
  
  .coin-drop-subtitle {
    font-size: 0.9em;
  }
  
  .coin-drop-form {
    gap: 15px;
  }
  
  .preview-treasure-box {
    padding: 15px;
    margin: 10px 0;
  }
  
  .preview-icon {
    font-size: 36px;
  }
  
  .preview-amount {
    font-size: 1.6em;
  }
  
  .coin-drop-info {
    padding: 15px;
    margin: 15px 0;
  }
  
  .info-item {
    font-size: 12px;
    gap: 8px;
    margin-bottom: 8px;
  }
  
  .info-icon {
    font-size: 14px;
  }
  
  .coin-drop-actions {
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
  }
  
  .confirm-coin-drop-btn,
  .cancel-coin-drop-btn {
    width: 100%;
    max-width: 200px;
    padding: 12px 24px;
    font-size: 14px;
  }
  
  .btn-icon {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .coin-drop-modal-content {
    padding: 12px;
    max-height: 75vh;
  }
  
  .coin-drop-header {
    padding: 12px;
    margin-bottom: 15px;
  }
  
  .coin-drop-icon {
    font-size: 32px;
  }
  
  .coin-drop-title {
    font-size: 1.3em;
  }
  
  .coin-drop-subtitle {
    font-size: 0.85em;
  }
  
  .coin-drop-form {
    gap: 12px;
  }
  
  .preview-treasure-box {
    padding: 12px;
    margin: 8px 0;
  }
  
  .preview-icon {
    font-size: 32px;
  }
  
  .preview-amount {
    font-size: 1.5em;
  }
  
  .coin-drop-info {
    padding: 12px;
    margin: 12px 0;
  }
  
  .info-item {
    font-size: 11px;
    gap: 6px;
    margin-bottom: 6px;
  }
  
  .info-icon {
    font-size: 12px;
  }
  
  .coin-drop-actions {
    gap: 10px;
    margin-top: 12px;
  }
  
  .confirm-coin-drop-btn,
  .cancel-coin-drop-btn {
    max-width: 180px;
    padding: 10px 20px;
    font-size: 13px;
  }
  
  .btn-icon {
    font-size: 14px;
  }
  
  #coin-drop-amount {
    padding: 12px;
    font-size: 14px;
  }
  
  .slider-labels {
    font-size: 11px;
  }
}

/* Coin Drop Button for Gift Panel Footer */
.coin-drop-button {
  background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700);
  color: #222;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  width: auto;
  justify-content: center;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.2px;
}

.coin-drop-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.coin-drop-button:hover::before {
  left: 100%;
}

.coin-drop-button:hover {
  background: linear-gradient(135deg, #FFA500, #FFD700, #FFA500);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 215, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.coin-drop-button:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(255, 215, 0, 0.4);
}

/* Emoji Picker Styles */
.emoji-button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  margin-left: 8px;
}

#emoji-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

#emoji-button .icon {
  font-size: 24px;
  margin-bottom: 4px;
}

#emoji-button .tab-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
}

.emoji-button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.emoji-picker {
  position: absolute;
  bottom: 80px;
  right: 50px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1400;
  width: 320px;
  max-width: 320px;
  margin-bottom: 8px;
  pointer-events: auto;
}

.emoji-categories {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.emoji-category {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff;
}

.emoji-category:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.emoji-category.active {
  background: var(--primary);
  color: #fff;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.emoji-grid::-webkit-scrollbar {
  width: 6px;
}

.emoji-grid::-webkit-scrollbar-track {
  background: transparent;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.emoji-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.emoji-item {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Mobile responsiveness for emoji picker */
@media (max-width: 768px) {
  .emoji-picker {
    bottom: 140px;
    right: 30px;
    max-width: 280px;
    width: 280px;
  }
  
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
    max-height: 180px;
    gap: 4px;
  }
  
  .emoji-item {
    font-size: 18px;
    min-height: 35px;
    padding: 6px;
  }
}

.emoji-categories {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.emoji-category {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  opacity: 0.6;
}

.emoji-category:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.emoji-category.active {
  opacity: 1;
  background: var(--primary);
  color: white;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-grid::-webkit-scrollbar {
  width: 4px;
}

.emoji-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.emoji-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.emoji-item {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.2);
}

@media (max-width: 600px) {
  .emoji-picker {
    max-width: 280px;
    width: 280px;
    right: 10px;
    bottom: 70px;
  }
  
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
    max-height: 150px;
  }
}

/* Desktop optimizations for emoji picker */
@media (min-width: 769px) {
  .emoji-picker {
    width: 360px;
    max-width: 360px;
    bottom: 90px;
    right: 60px;
  }
  
  .emoji-grid {
    grid-template-columns: repeat(10, 1fr);
    max-height: 240px;
    gap: 8px;
  }
  
  .emoji-item {
    font-size: 22px;
    min-height: 45px;
    padding: 10px;
  }
}

/* Stream Container Styles */
#stream-container {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
  border: none;
  box-shadow: none;
}

.stream-header {
  display: none;
}

.stream-status {
  color: #ff4757;
  font-weight: bold;
  font-size: 1.1rem;
  animation: pulse 2s infinite;
}

.stream-title {
  color: #00ff88;
  font-weight: bold;
  font-size: 1.2rem;
}


.stream-video-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom));
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  background: #000;
  border-radius: 16px;
  touch-action: none; /* prevent drag/pan of the stream */
  z-index: 1; /* Behind UI elements (500+) */
  pointer-events: none; /* Allow clicks to pass through to UI elements */
}

/* Stream video display */
.stream-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;             /* fill container */
  object-position: center bottom; /* keep bottom HUD visible */
  display: block;
}

/* --- Force portrait display in the portal --- */
.stream-video-container.portrait-mode {
  aspect-ratio: 9 / 16;          /* make the box portrait */
}

.stream-video-container.portrait-mode .direct-stream-container {
  position: relative;
}

.stream-video-container.portrait-mode .direct-stream-container video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%) rotate(-90deg);
  transform-origin: center center;
  object-fit: contain !important;
  /* let JS set width/height — no max-width/height here */
}



.direct-stream-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
  border-radius: 15px;
  overflow: hidden;
  z-index: 1; /* Behind UI elements (500+) */
  pointer-events: none; /* Allow clicks to pass through to UI elements */
}

.direct-stream-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Mobile-specific fixes */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
  z-index: 2; /* Above container but below UI elements (500+) */
  pointer-events: auto; /* Video itself can be clicked for play */
  position: relative;
}

/* Mobile-specific stream container fixes */
@media (max-width: 768px) {
  .stream-video-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom));
    width: 100%;
    max-width: 100vw;
    margin: 0;
    border-radius: 0;
    touch-action: none;
    z-index: 1 !important; /* Behind UI elements (500+) */
    pointer-events: none !important; /* Allow clicks to pass through to UI elements */
  }
  
  .stream-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
    z-index: 2 !important; /* Above container but below UI */
    pointer-events: auto !important; /* Video itself can be clicked */
    position: relative !important;
  }
  
  .direct-stream-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
    z-index: 2 !important; /* Above container but below UI */
    pointer-events: auto !important; /* Video itself can be clicked */
    position: relative !important;
  }
}

.stream-controls-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid #00ff88;
  font-size: 14px;
  font-weight: bold;
  z-index: 10;
}

.stream-quality-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 10;
}

.stream-quality-controls button {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: 1px solid #00ff88;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
  padding: 8px 12px;
}

.stream-quality-controls button:hover {
  background: rgba(0, 255, 136, 0.2);
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Mobile safe areas, no side padding that narrows the stream */
@media (max-width:600px){
  #live-feed{
    padding: calc(env(safe-area-inset-top)) 0
             calc(var(--taskbar-h) + env(safe-area-inset-bottom)) 0 !important;
  }
}

/* hard kill any rounding around the stream */
.stream-video-container,
.direct-stream-container,
.twitch-player-container,
.twitch-player-container iframe {
  border-radius: 0 !important;
}

/* never crop the video (some earlier blocks set cover) */
.direct-stream-container video {
  object-fit: contain !important;
}

/* Ensure stream always stacks above offline overlay */
.stream-video-container,
.direct-stream-container,
.direct-stream-container video,
.twitch-player-container,
.twitch-player-container iframe {
  position: relative;
  z-index: 100 !important;
}

/* stream & taskbar share the same outer width cap */
#live-feed { max-width: var(--content-w); width: 100%; }
#taskbar   { max-width: var(--content-w); padding-left: 0; padding-right: 0; box-sizing: border-box; }

/* ensure bottom clearance above taskbar with safe area support */
#live-feed { 
  padding: 0 0 calc(var(--taskbar-h) + env(safe-area-inset-bottom) + 12px) 0; 
}


/* === MOBILE VIEW: keep the bottom of the stream visible ==============
   We allow top to crop more by using cover + bottom alignment.
====================================================================== */
@media (max-width: 600px) {
  .direct-stream-container video,
  .twitch-player-container video {
    object-fit: cover !important;         /* fill the box */
    object-position: bottom center !important; /* crop from the TOP first */
  }
}

/* --- Mobile: let toolbar push stream naturally (no overlap, no absolute fill) --- */
@media (max-width: 600px) {
  /* Ensure page content leaves space for fixed toolbar */
  #live-feed {
    padding-bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Stream container flows in document (not absolute), so toolbar doesn't eat it */
  .stream-video-container {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 0 !important;
  }

  /* Twitch wrapper also must not force fixed/100vh on mobile */
  .twitch-player-container {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .stream-video-container .direct-stream-container,
  .direct-stream-container {
    height: auto !important;
    min-height: 0 !important;
  }

  .stream-video-container video,
  .direct-stream-container video {
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center center !important;
  }
}

.stream-video-container.portrait-mode .direct-stream-container iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center center;
  border: 0;
  pointer-events: auto;
}

/* === APPLE PAY & GOOGLE PAY BUTTON STYLING ========================== */
#applepay-button,
#googlepay-button {
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
}

/* ---- MOBILE LAYOUT RESET (full-screen, no cut-off, ensures overlays visible above hotbar) ---- */
@media (max-width: 600px) {
  html, body {
    width: 100vw !important;
    height: 100dvh !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overscroll-behavior: none !important;
  }

  #live-feed {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: calc(env(safe-area-inset-top, 0px)) 0 calc(var(--taskbar-h, 54px) + env(safe-area-inset-bottom, 0px)) 0 !important;
    box-sizing: border-box !important;
    position: relative;
    z-index: 1;
  }

  .stream-video-container {
    position: absolute !important;
    top: calc(env(safe-area-inset-top, 0px)) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(var(--taskbar-h, 54px) + env(safe-area-inset-bottom, 0px)) !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #000 !important;
    box-sizing: border-box !important;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .stream-video-container .direct-stream-container {
    width: 100% !important;
    height: 100% !important;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
  }

  .stream-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* Ensure all content/overlays visible */
    object-position: center center !important;
    display: block !important;
    background: #000;
  }

  /* Portrait-mode video adjustment, if needed */
  .stream-video-container.portrait-mode .direct-stream-container video {
    position: absolute !important;
    top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%) rotate(-90deg) !important;
    transform-origin: center center !important;
    width: 100vh !important;
    height: 100vw !important;
    object-fit: contain !important;
  }

  #taskbar {
    position: fixed !important;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    height: auto !important;
    z-index: 10;
    background: transparent !important; /* invisible toolbar background */
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important; /* tighter icons */
    padding: 8px 12px !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Payment/utility button tweaks */
  #applepay-button,
  #googlepay-button,
  #paypal-button-container {
    margin-bottom: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #applepay-button .paypal-button,
  #googlepay-button .paypal-button,
  #paypal-button-container .paypal-button {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 40px !important;
  }

  #applepay-button:empty,
  #googlepay-button:empty {
    display: none !important;
  }
}

/* ============================================
   Spin Wheel Panel Styles  
   ============================================ */
.spin-panel-content {
  padding: 15px 20px 20px 20px;
  text-align: center;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.spin-header {
  margin-bottom: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.spin-header h2 {
  font-size: 1.3rem;
  margin: 0;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.spin-header-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.prizes-info-btn {
  background: rgba(255, 215, 0, 0.2);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: #FFD700;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.prizes-info-btn:hover {
  background: rgba(255, 215, 0, 0.3);
  border-color: rgba(255, 215, 0, 0.6);
  transform: translateY(-1px);
}

.topup-btn {
  background: rgba(76, 175, 80, 0.2);
  border: 1px solid rgba(76, 175, 80, 0.4);
  color: #4CAF50;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.topup-btn:hover {
  background: rgba(76, 175, 80, 0.3);
  border-color: rgba(76, 175, 80, 0.6);
  transform: translateY(-1px);
}

.spin-balance-display {
  margin: 8px 0;
  padding: 6px;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 8px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.spin-balance-display .balance-label {
  opacity: 0.8;
  margin-right: 6px;
}

.spin-balance-display .balance-value {
  font-weight: bold;
  color: #FFD700;
  font-size: 1.1rem;
}

.spin-animation-container {
  position: relative;
  width: 100%;
  height: 100px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.lottery-ball {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #FFD700, #FFA500);
  box-shadow: 
    0 10px 30px rgba(255, 215, 0, 0.5),
    inset 0 -5px 15px rgba(0, 0, 0, 0.3),
    inset 0 5px 15px rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s;
}

.lottery-ball.show {
  opacity: 1;
}

.lottery-ball.bouncing {
  animation: bounce 2s ease-in-out;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  10% { transform: translateY(-80px) scale(1.05); }
  20% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-50px) scale(1.03); }
  40% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.02); }
  60% { transform: translateY(0) scale(1); }
  70% { transform: translateY(-15px) scale(1.01); }
  80% { transform: translateY(0) scale(1); }
  90% { transform: translateY(-5px) scale(1); }
}

.spin-button {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #000;
  font-size: 1rem;
  font-weight: bold;
  padding: 10px 25px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 100%;
  flex-shrink: 0;
}

.spin-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.5);
}

.spin-button:active:not(:disabled) {
  transform: translateY(0);
}

.spin-button:disabled {
  background: #555;
  color: #999;
  cursor: not-allowed;
  box-shadow: none;
}

.spin-cost {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 4px;
  text-align: center;
  flex-shrink: 0;
}

.prize-display {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  border: 2px solid rgba(255, 215, 0, 0.5);
  opacity: 0;
  transition: opacity 0.5s;
  text-align: center;
  flex-shrink: 0;
}

.prize-display.show {
  opacity: 1;
}

.prize-amount {
  font-size: 1.8rem;
  font-weight: bold;
  color: #FFD700;
  margin: 4px 0;
}

.prize-label {
  font-size: 0.85rem;
  opacity: 0.9;
}

.jackpot-winner {
  animation: jackpot-pulse 1s infinite;
}

@keyframes jackpot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: #FFD700;
  position: absolute;
  animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

.prizes-info {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.prizes-info h3 {
  font-size: 0.9rem;
  margin: 0 0 8px 0;
  color: #FFD700;
  text-align: center;
}

.prize-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.prize-list li {
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  font-size: 0.75rem;
  text-align: center;
}

/* Ensure panel scrollbar is styled */
.spin-panel-content::-webkit-scrollbar {
  width: 6px;
}

.spin-panel-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.spin-panel-content::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.3);
  border-radius: 3px;
}

.spin-panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 215, 0, 0.5);
}

/* Spin wheel icon in toolbar */
.spin-wheel-icon {
  font-size: 24px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Mobile keyboard stability: keep layout unchanged --- */
@media (max-width: 600px) {
  html, body {
    position: static !important;
    height: auto !important;
    min-height: 100vh !important; /* fallback */
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  #live-feed {
    height: auto !important;
    min-height: 100vh !important; /* fallback */
  }
  @supports (height: 100svh) {
    html, body { min-height: 100svh !important; }
    #live-feed { min-height: 100svh !important; }
  }
}

