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

body {
  background: radial-gradient(circle at center, #1b0f38 0%, #070412 100%);
  color: #ffffff;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 16px;
  overflow: hidden;
}

body.obs-mode {
  padding: 0;
  background: transparent;
}
body.obs-mode #control-panel {
  display: none !important;
}
body.obs-mode #phone-stage {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* ============================================================================
   PANTALLA DE CELULAR VERTICAL 9:16 (100% Limpia: Solo Barra de Sangre y Memes)
   ============================================================================ */
#phone-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  height: min(94vh, 880px);
  background: #0d0620;
  border-radius: 28px;
  border: 3px solid rgba(255, 43, 214, 0.55);
  box-shadow: 0 0 45px rgba(255, 43, 214, 0.28), 0 18px 50px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  flex-shrink: 0;
  contain: layout style paint;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Modo Cabina Eco (Solo en panel del Streamer, JAMÁS en ?obs=1) */
#eco-cabin-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 12;
  background: radial-gradient(circle at 50% 35%, #23114d 0%, #090418 100%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26px;
  gap: 12px;
}
#eco-cabin-overlay.active {
  display: flex;
}
body.obs-mode #eco-cabin-overlay {
  display: none !important;
}
.eco-cabin-icon {
  font-size: 46px;
  line-height: 1;
}
.eco-cabin-title {
  font-size: 16px;
  font-weight: 900;
  color: #38ff9c;
  letter-spacing: 0.4px;
}
.eco-cabin-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: #d7faff;
  max-width: 280px;
}
.eco-cabin-resume-btn {
  margin-top: 6px;
  background: linear-gradient(135deg, #00f5ff, #38ff9c);
  color: #090418;
  border: none;
  border-radius: 11px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
}

/* Reproductor de Video Cinemático (solo regalos >= 98 monedas: pausa juego -> video -> poder) */
#gift-video-overlay {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000000;
  z-index: 48;
  pointer-events: none;
}
#gift-video-overlay.playing {
  display: block;
}

/* Flash suave Anime anti-fotosensibilidad (Cumplimiento Normas TikTok LIVE) */
#white-flash {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
}
#white-flash.flash {
  animation: animeWhiteFlash 0.55s ease-out forwards;
}
@keyframes animeWhiteFlash {
  0% { opacity: 0.38; }
  25% { opacity: 0.26; }
  100% { opacity: 0; }
}

/* ============================================================================
   ÚNICO ELEMENTO DE HUD: BARRA DE SANGRE / VIDA ARRIBA
   ============================================================================ */
.hud-top {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 15;
  pointer-events: none;
}

.hp-box {
  background: linear-gradient(180deg, rgba(20, 10, 44, 0.92), rgba(10, 5, 24, 0.94));
  border: 2px solid #ff2b6b;
  border-radius: 14px;
  padding: 6px 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.hp-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
  color: #ffb3c9;
}

.hp-track {
  height: 11px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  overflow: hidden;
}

#waifu-hp-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff1e56, #ff2bd6, #00f5ff);
  transition: width 0.22s ease;
}

/* ============================================================================
   MEME FLOTANTE SIN BURBUJA DE DIÁLOGO NI TEXTO (Solo el Meme / GIF limpio)
   ============================================================================ */
#waifu-meme-bubble {
  position: absolute;
  left: 78%;
  top: 19%;
  transform: translate(-50%, -50%) scale(0);
  background: transparent;
  border: none;
  padding: 0;
  z-index: 22;
  pointer-events: none;
  transition: opacity 0.18s ease, left 0.22s ease, top 0.22s ease;
  opacity: 0;
}
#waifu-meme-bubble.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
#waifu-meme-bubble.pop {
  animation: memeBounce 0.3s cubic-bezier(0.2, 1.5, 0.4, 1);
}
@keyframes memeBounce {
  0% { transform: translate(-50%, -45%) scale(0.35); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

#meme-top,
#meme-bottom {
  display: none !important;
}
#meme-emoji {
  font-size: 46px;
  line-height: 1;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.72);
}
#meme-custom-img {
  display: none;
  width: 118px;
  height: 118px;
  object-fit: contain;
  border-radius: 14px;
}

/* Textos de golpe estilo cómic (BONK!, POW!, PA CASA!) */
#floating-fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: hidden;
  contain: layout style paint;
}
.comic-hit-text {
  position: absolute;
  font-family: Impact, 'Arial Black', sans-serif;
  font-size: 21px;
  font-weight: 900;
  text-shadow: -2px -2px 0 #120924, 2px -2px 0 #120924, -2px 2px 0 #120924, 2px 2px 0 #120924;
  animation: floatUpComic 0.82s ease-out forwards;
  white-space: nowrap;
}
@keyframes floatUpComic {
  0% { opacity: 1; margin-top: 0; }
  100% { opacity: 0; margin-top: -54px; }
}

/* ============================================================================
   PANEL DE CONTROL Y SIMULADOR (Lado derecho en tu PC, invisible en OBS)
   ============================================================================ */
#control-panel {
  width: 390px;
  max-height: 94vh;
  overflow-y: auto;
  background: rgba(18, 11, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
}

.panel-header h1 {
  font-size: 18px;
  background: linear-gradient(90deg, #ff4db8, #00f5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.panel-header p {
  font-size: 12px;
  color: #b7aed4;
  margin-top: 3px;
}

.status-badge {
  font-size: 11.5px;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
}
.status-badge.offline {
  background: rgba(255, 255, 255, 0.08);
  color: #d8d1f0;
}
.status-badge.live {
  background: rgba(56, 255, 156, 0.18);
  border: 1px solid #38ff9c;
  color: #38ff9c;
}

.tiktok-connect-box {
  display: flex;
  gap: 6px;
}
.tiktok-connect-box input,
.tiktok-connect-box select {
  flex: 1;
  background: #0d0720;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  padding: 7px 10px;
  color: #ffffff;
  font-size: 12.5px;
}
.tiktok-connect-box button {
  background: #00f5ff;
  color: #0b061a;
  border: none;
  border-radius: 10px;
  padding: 7px 12px;
  font-weight: 800;
  cursor: pointer;
}

.sim-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #9f93c4;
  font-weight: 800;
}

.expr-buttons-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.expr-btn {
  background: linear-gradient(145deg, #2b1a54, #190e36);
  border: 1px solid rgba(0, 245, 255, 0.28);
  color: #ffffff;
  border-radius: 10px;
  padding: 6px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font-size: 16px;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}
.expr-btn span {
  font-size: 10px;
  font-weight: 700;
  color: #d7faff;
}
.expr-btn:hover {
  border-color: #ff4db8;
  background: linear-gradient(145deg, #3c2273, #24134d);
  transform: translateY(-2px);
}
.expr-btn:active {
  transform: scale(0.95);
}

.sim-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.sim-btn {
  background: linear-gradient(135deg, #2b1a54, #1e123d);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-radius: 11px;
  padding: 8px 9px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease;
  font-size: 12px;
}
.sim-btn:hover {
  border-color: #ff4db8;
  transform: translateY(-2px);
}
.sim-btn:active {
  transform: scale(0.96);
}
.sim-btn strong {
  display: block;
  font-size: 12.5px;
  margin-bottom: 1px;
}
.sim-btn small {
  color: #bdb3de;
  font-size: 10.5px;
}
.sim-btn.ultimate {
  grid-column: span 2;
  background: linear-gradient(135deg, #ff2bd6, #3d2bff);
  border-color: #ffd54a;
}
.sim-btn.ultimate small {
  color: #fff2b2;
}

.utility-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bgm-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0d0720;
  border: 1px solid rgba(0, 245, 255, 0.22);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 11.5px;
  color: #d7faff;
}
.bgm-volume-row label {
  min-width: 90px;
  font-weight: 700;
}
.bgm-volume-row input[type='range'] {
  flex: 1;
  accent-color: #ff2bd6;
  cursor: pointer;
}
.bgm-volume-row span {
  min-width: 34px;
  text-align: right;
  font-weight: 800;
  color: #ffd54a;
}

.streamer-perf-box {
  background: linear-gradient(145deg, rgba(18, 34, 48, 0.95), rgba(11, 14, 34, 0.98));
  border: 1px solid rgba(56, 255, 156, 0.42);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.eco-render-btn {
  width: 100%;
  background: linear-gradient(135deg, #172b3d, #111933);
  border: 1.5px solid rgba(0, 245, 255, 0.48);
  color: #d7faff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11.8px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.eco-render-btn:hover {
  border-color: #38ff9c;
  background: linear-gradient(135deg, #1d3a4f, #162244);
}
.eco-render-btn.eco-active {
  background: linear-gradient(135deg, #38ff9c, #00f5ff);
  color: #07121a;
  border-color: #ffffff;
}
.perf-watchdog-pill {
  font-size: 10.8px;
  font-weight: 700;
  color: #b7f7d8;
  background: rgba(56, 255, 156, 0.1);
  border: 1px solid rgba(56, 255, 156, 0.28);
  border-radius: 8px;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.perf-watchdog-pill.shield-engaged {
  color: #fff3b0;
  background: rgba(255, 196, 0, 0.16);
  border-color: rgba(255, 213, 74, 0.55);
}

.streamer-audio-box {
  background: linear-gradient(145deg, rgba(28, 16, 58, 0.96), rgba(14, 7, 32, 0.98));
  border: 1px solid rgba(0, 245, 255, 0.32);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.talkover-btn {
  width: 100%;
  background: linear-gradient(135deg, #27184d, #190e36);
  border: 1.5px solid rgba(255, 213, 74, 0.55);
  color: #fff5cc;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.talkover-btn:hover {
  border-color: #ffd54a;
  background: linear-gradient(135deg, #352069, #22134a);
}
.talkover-btn.active-talkover {
  background: linear-gradient(135deg, #ffb300, #ff2bd6);
  color: #0b0518;
  border-color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 196, 0, 0.55);
}

.audio-toggle-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.util-btn.audio-on {
  background: rgba(0, 245, 255, 0.14);
  border-color: rgba(0, 245, 255, 0.5);
  color: #d7faff;
}
.util-btn.audio-off {
  background: rgba(255, 77, 109, 0.18);
  border-color: rgba(255, 77, 109, 0.55);
  color: #ffb8c6;
}
.util-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.util-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.util-btn.active-crowd {
  background: rgba(255, 43, 214, 0.2);
  border-color: #ff4db8;
  color: #ffd6f5;
}

.compliance-tip-box {
  background: rgba(56, 255, 156, 0.08);
  border: 1px solid rgba(56, 255, 156, 0.38);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.42;
  color: #dcffef;
}
.compliance-tip-box strong {
  color: #38ff9c;
  display: block;
  margin-bottom: 3px;
}
.compliance-tip-box ul {
  padding-left: 15px;
  margin: 0;
}

.obs-tip-box {
  background: rgba(0, 245, 255, 0.08);
  border: 1px dashed rgba(0, 245, 255, 0.45);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.4;
  color: #d7faff;
}
.obs-tip-box code {
  display: block;
  margin-top: 4px;
  padding: 4px 7px;
  background: #090417;
  border-radius: 6px;
  color: #ffd54a;
  user-select: all;
}

@media (max-width: 860px) {
  body {
    flex-direction: column;
    overflow-y: auto;
  }
  #control-panel {
    width: min(94vw, 420px);
    max-height: none;
  }
}
