:root {
  --accent-cyan: #00f0b5;
  --accent-shout: #ff2a55;
  --text-main: #f0f7f6;
  --text-muted: #86a29f;
  --panel-bg: rgba(13, 20, 24, 0.88);
  --panel-border: rgba(0, 240, 181, 0.25);
  --glass-blur: blur(16px);
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  color: var(--text-main);
  background: transparent !important;
  background-color: transparent !important;
}

/* Pleasant dark background ONLY when previewing directly in standard browser */
html:not(.obs-mode) body:not(.obs-mode) {
  background: #090e11 !important;
  background-color: #090e11 !important;
}

/* In OBS mode, guarantee 100% pure transparency on html and body */
html.obs-mode,
body.obs-mode,
html.obs-mode body {
  background: transparent !important;
  background-color: transparent !important;
}

/* In OBS mode, quickBar is invisible on stream (opacity 0), but smoothly reveals when user hovers mouse in OBS Interact window */
body.obs-mode #quickBar,
html.obs-mode #quickBar {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

body.obs-mode:hover #quickBar,
html.obs-mode:hover #quickBar,
body.obs-mode.show-quickbar #quickBar {
  opacity: 1;
  pointer-events: auto;
}

/* Mic Alert Banner */
.mic-alert-banner {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 18, 22, 0.96);
  border: 1px solid rgba(255, 71, 87, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 71, 87, 0.3);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 12px;
  max-width: 92%;
  z-index: 200;
  display: none;
  line-height: 1.5;
  text-align: center;
  backdrop-filter: blur(10px);
}

.mic-alert-banner.active {
  display: block;
  animation: fadeInBanner 0.3s ease;
}

@keyframes fadeInBanner {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.mic-alert-banner code {
  background: rgba(255, 71, 87, 0.2);
  color: #ff7675;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ================= STAGE ================= */
.stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: auto;
}

/* Character Container - Responsive to fit ANY OBS window (480px, 600px, 720px, 1080px) without cutting head! */
.character-container {
  position: relative;
  height: 98%;
  max-height: 100%;
  aspect-ratio: 896 / 1200;
  max-width: 98%;
  margin-bottom: -5px;
  transform-origin: center bottom;
  will-change: transform;
}

/* Sprites Stack - Solid Base Layer + Overlay States (Zero Flicker / No Blinking!) */
.sprite {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  will-change: opacity;
}

/* Idle Sprite is the permanently opaque solid base (never drops opacity -> zero flash!) */
#spriteIdle {
  z-index: 1;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Talk Sprite overlays directly on top of base */
#spriteTalk {
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.08s ease-out;
}

#spriteTalk.active {
  opacity: 1;
  visibility: visible;
}

/* Shout Sprite overlays on top of everything during scream */
#spriteShout {
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.08s ease-out;
}

#spriteShout.active {
  opacity: 1;
  visibility: visible;
}


/* ================= SLEEK QUICK PILL ================= */
.quick-bar {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 23, 28, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(0, 240, 181, 0.25);
  border-radius: 30px;
  padding: 7px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 240, 181, 0.1);
  z-index: 99;
  transition: all 0.25s ease;
}

.btn-quick-pill {
  background: none;
  border: none;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  transition: all 0.2s;
}

.btn-quick-pill:hover {
  color: var(--accent-cyan);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4757;
  display: inline-block;
  transition: background 0.3s;
}

.btn-quick-pill.active .pill-dot {
  background: #00f0b5;
  box-shadow: 0 0 8px #00f0b5;
}

.quick-volume-wrap {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.quick-volume-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00f0b5, #ffbb00);
  border-radius: 3px;
  transition: width 0.05s linear;
}

.btn-quick-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-quick-icon:hover {
  background: rgba(0, 240, 181, 0.25);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ================= SETTINGS PANEL ================= */
.controls-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 360px;
  max-height: calc(100vh - 40px);
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 240, 181, 0.15);
  border-radius: 20px;
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.controls-panel.minimized {
  transform: translateX(430px);
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(0, 240, 181, 0.15) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  background: var(--accent-cyan);
  color: #031512;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 3px;
}

.brand h2 {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #fff;
}

.accent-text {
  color: var(--accent-cyan);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(0, 240, 181, 0.25);
  border-color: var(--accent-cyan);
}

.panel-body {
  padding: 14px 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 13px;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fff;
}

.group-title svg {
  stroke: var(--accent-cyan);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, #00f0b5 0%, #009e75 100%);
  color: #031814;
  border: none;
  border-radius: 9px;
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 240, 181, 0.35);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 240, 181, 0.55);
}

.btn-primary.active {
  background: linear-gradient(135deg, #2af5d2 0%, #00d29d 100%);
  box-shadow: 0 4px 15px rgba(42, 245, 210, 0.5);
}

.btn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #031814;
  display: inline-block;
}

/* Test Buttons */
.test-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-secondary {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover, .btn-secondary:active {
  background: rgba(0, 240, 181, 0.25);
  border-color: var(--accent-cyan);
  color: #fff;
}

.btn-secondary.danger:hover, .btn-secondary.danger:active {
  background: rgba(255, 42, 85, 0.3);
  border-color: #ff2a55;
}

/* Audio Meter */
.meter-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meter-bar-bg {
  position: relative;
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.meter-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00f0b5 0%, #ffbb00 65%, #ff2a55 100%);
  border-radius: 6px;
  transition: width 0.04s linear;
}

.marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  pointer-events: none;
}

.marker-calm {
  background: #00f0b5;
  left: 15%;
  box-shadow: 0 0 6px #00f0b5;
}

.marker-shout {
  background: #ff2a55;
  left: 60%;
  box-shadow: 0 0 6px #ff2a55;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-family: var(--font-mono);
}

.label-calm {
  color: #00f0b5;
}

.label-shout {
  color: #ff5577;
}

.label-cur {
  color: #fff;
  font-weight: 700;
}

/* Sliders */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.slider-row label {
  flex: 1.4;
  color: var(--text-muted);
}

.slider-row input[type="range"] {
  flex: 2;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.val-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.val-badge.cyan {
  color: #00f0b5;
  border: 1px solid rgba(0, 240, 181, 0.3);
}

.val-badge.red {
  color: #ff5577;
  border: 1px solid rgba(255, 85, 119, 0.3);
}

/* Toggles */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-main);
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--accent-cyan);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}

/* OBS Section */
.obs-section {
  border-color: rgba(0, 240, 181, 0.35);
  background: linear-gradient(180deg, rgba(0, 240, 181, 0.1) 0%, rgba(0, 0, 0, 0.35) 100%);
}

.obs-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.obs-desc code {
  background: rgba(0, 0, 0, 0.5);
  padding: 1px 4px;
  border-radius: 3px;
  color: #00f0b5;
  font-family: var(--font-mono);
}

.btn-obs {
  width: 100%;
  padding: 9px;
  background: rgba(0, 240, 181, 0.2);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-obs:hover {
  background: var(--accent-cyan);
  color: #031512;
}

.obs-hint {
  font-size: 10px;
  color: #86a29f;
  text-align: center;
}
