/* ==========================================================================
   AETHERIA | SENSORY FLUID & ART STUDIO DESIGN SYSTEM (WCAG 2.2 AA OPTIMIZED)
   Mobile-First, Top-Bar Navigation, Zen Mode, Thematic Avatars, Swarm & Audio
   ========================================================================== */

:root {
  --bg-dark: #07090e;
  --bg-panel: rgba(12, 16, 26, 0.88);
  --bg-drawer: rgba(10, 14, 24, 0.94);
  --bg-btn: rgba(255, 255, 255, 0.08);
  --bg-btn-hover: rgba(255, 255, 255, 0.16);
  --bg-btn-active: rgba(255, 221, 0, 0.25);

  --border-glass: rgba(255, 255, 255, 0.14);
  --border-glow: rgba(221, 64, 39, 0.45);
  --border-glow-active: #ffdd00;

  --accent-primary: #dd4027;
  --accent-active: #ffdd00;
  
  --accent-gold: #ffbe0b;
  --accent-green: #00f5d4;
  --accent-purple: #9d4edd;
  --accent-danger: #ff4757;

  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;

  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --shadow-glass: 0 12px 36px 0 rgba(0, 0, 0, 0.55), inset 0 1px 1px 0 rgba(255, 255, 255, 0.15);
  --shadow-active: 0 0 20px rgba(255, 221, 0, 0.5);
}

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

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  touch-action: none;
  cursor: default !important;
}

/* Accessible Focus Indicators */
button:focus-visible,
input[type="range"]:focus-visible {
  outline: 2px solid var(--accent-active) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 14px var(--accent-active) !important;
}

/* ==========================================================================
   CANVAS & BACKGROUND LAYERS
   ========================================================================== */

#background-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  background-color: var(--bg-dark);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.35s ease-in-out;
  will-change: opacity, background-image;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  cursor: default !important;
}

#gl-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  touch-action: none;
  cursor: default !important;
}

#particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  cursor: default !important;
}

#cursor-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  cursor: default !important;
}

/* Hide OS pointer ONLY when a custom floating avatar is active */
body.avatar-active,
body.avatar-active #canvas-container,
body.avatar-active #gl-canvas,
body.avatar-active #cursor-overlay,
body.avatar-active #particle-canvas {
  cursor: none !important;
}

/* Dynamic Cursor Avatar Container */
.cursor-mirror-point {
  position: absolute;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  pointer-events: none;
  transition: opacity 0.12s ease;
  will-change: transform, left, top;
}

.swarm-avatar {
  filter: drop-shadow(0 0 12px rgba(221, 64, 39, 0.8));
}

.cursor-svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 8px rgba(221, 64, 39, 0.7));
  pointer-events: none;
}

.nyan-svg {
  width: 44px;
  height: 30px;
  filter: drop-shadow(0 0 10px rgba(221, 64, 39, 0.7));
  animation: nyanWiggle 0.4s infinite alternate ease-in-out;
}

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

.rocket-svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 8px rgba(255, 190, 11, 0.8));
}

.comet-svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 10px rgba(221, 64, 39, 0.9));
}

.clownfish-svg {
  width: 36px;
  height: 28px;
  filter: drop-shadow(0 0 8px rgba(255, 107, 0, 0.85));
  animation: fishWiggle 0.45s infinite alternate ease-in-out;
}

@keyframes fishWiggle {
  0% { transform: scaleY(0.96) rotate(-2deg); }
  100% { transform: scaleY(1.04) rotate(2deg); }
}

.miku-svg {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 0 10px rgba(57, 197, 187, 0.9)) drop-shadow(0 0 4px rgba(221, 64, 39, 0.6));
  animation: mikuFloat 0.6s infinite alternate ease-in-out;
}

@keyframes mikuFloat {
  0% { transform: translateY(-1.5px); }
  100% { transform: translateY(1.5px); }
}

.cursor-custom-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent-primary);
  box-shadow: 0 0 12px rgba(221, 64, 39, 0.8);
}

/* ==========================================================================
   TOP BAR (CLEAN, 3-ZONE RESPONSIVE WITH TOUCH SCROLL & DOCKING)
   ========================================================================== */

#top-bar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), top 0.3s ease, bottom 0.3s ease;
  cursor: default !important;
  contain: layout style;
}

#top-bar.pos-bottom {
  top: auto !important;
  bottom: 12px !important;
}

#top-bar.zen-hidden {
  opacity: 0;
  transform: translateY(-24px);
  pointer-events: none !important;
}

#top-bar.pos-bottom.zen-hidden {
  transform: translateY(24px);
}

#top-bar.zen-hidden:hover {
  opacity: 0.95;
  transform: translateY(0);
  pointer-events: auto !important;
}

/* 1. Left Zone: Brand Capsule */
.top-bar-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  pointer-events: auto;
}

.brand-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-panel);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  box-shadow: var(--shadow-glass);
  cursor: pointer;
}

.brand-title {
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 1.5px;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-primary) 60%, var(--accent-active) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.mode-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 7px;
  background: rgba(221, 64, 39, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(221, 64, 39, 0.35);
  border-radius: 10px;
  white-space: nowrap;
}

/* 2. Center Zone: Smooth Touch Scrollable Fidgets */
.top-bar-center-scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  max-width: 520px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  pointer-events: auto;
  scrollbar-width: none;
  padding: 2px 4px;
}

.top-bar-center-scroll::-webkit-scrollbar {
  display: none;
}

/* 3. Right Zone: Fixed Priority Controls */
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  pointer-events: auto;
}

/* Button Base */
button {
  cursor: pointer !important;
  outline: none;
  font-family: inherit;
  border: none;
}

.icon-btn, .hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  min-width: 42px;
  padding: 0 12px;
  background: var(--bg-panel);
  color: var(--text-main);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-glass);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  white-space: nowrap;
  touch-action: manipulation;
}

.icon-btn:hover, .hamburger-btn:hover {
  background: var(--bg-btn-hover);
  border-color: var(--border-glow);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glass), 0 0 16px rgba(221, 64, 39, 0.3);
}

.icon-btn:active, .hamburger-btn:active {
  transform: scale(0.92);
}

.hamburger-btn {
  padding: 0 14px;
  background: rgba(221, 64, 39, 0.18);
  border-color: rgba(221, 64, 39, 0.5);
  color: #ffffff;
  font-weight: 700;
}

.hamburger-btn:hover {
  background: rgba(221, 64, 39, 0.32);
  box-shadow: 0 0 20px rgba(221, 64, 39, 0.6);
}

.hamburger-icon {
  font-size: 1.15rem;
}

/* Fidget Glows */
.pulse-glow:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 18px rgba(221, 64, 39, 0.6);
}

.vortex-glow:hover {
  border-color: var(--accent-green);
  box-shadow: 0 0 18px rgba(0, 245, 212, 0.6);
}

.gravity-glow:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 0 18px rgba(255, 190, 11, 0.6);
}

.swarm-glow:hover {
  border-color: var(--accent-purple);
  box-shadow: 0 0 18px rgba(157, 78, 221, 0.6);
}

.active-gravity {
  background: rgba(255, 190, 11, 0.25) !important;
  border-color: var(--accent-gold) !important;
  color: #ffe082 !important;
  box-shadow: 0 0 20px rgba(255, 190, 11, 0.6) !important;
  animation: gravityPulse 1.8s infinite ease-in-out;
}

.active-swarm {
  background: rgba(157, 78, 221, 0.25) !important;
  border-color: var(--accent-purple) !important;
  color: #e0aaff !important;
  box-shadow: 0 0 20px rgba(157, 78, 221, 0.6) !important;
  animation: gravityPulse 1.5s infinite ease-in-out;
}

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

.danger-hover:hover {
  background: rgba(255, 71, 87, 0.2);
  border-color: var(--accent-danger);
}

/* ==========================================================================
   HAMBURGER SETTINGS DRAWER
   ========================================================================== */

#drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

#settings-drawer {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  width: 92%;
  max-width: 720px;
  max-height: 82vh;
  overflow-y: auto;
  background: rgba(10, 14, 24, 0.96);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  z-index: 1000;
  padding: 22px 26px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  cursor: default !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#settings-drawer.open {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-action-mini {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drawer-action-mini:hover {
  color: var(--accent-primary);
  background: rgba(221, 64, 39, 0.12);
  border-color: rgba(221, 64, 39, 0.3);
}

.close-drawer-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.close-drawer-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.drawer-body {
  overflow-y: auto;
  max-height: calc(80vh - 80px);
  padding: 4px 4px 10px 0;
}

/* Scrollbar personalizada */
.drawer-body::-webkit-scrollbar,
#settings-drawer::-webkit-scrollbar {
  width: 5px;
}
.drawer-body::-webkit-scrollbar-track,
#settings-drawer::-webkit-scrollbar-track {
  background: transparent;
}
.drawer-body::-webkit-scrollbar-thumb,
#settings-drawer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.drawer-section {
  margin-bottom: 12px;
}

/* Acordeones Desplegables de Configuración (Drawer Collapsible Bars) */
.drawer-accordion {
  margin-bottom: 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.drawer-accordion[open] {
  background: rgba(15, 23, 42, 0.75);
  border-color: var(--accent-active);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background 0.2s ease;
}

.accordion-header::-webkit-details-marker,
.accordion-header::marker {
  display: none;
  content: "";
}

.accordion-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.accordion-header:focus-visible {
  outline: 2px solid var(--accent-active);
  outline-offset: -2px;
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.accordion-title h4 {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--accent-primary);
  text-transform: uppercase;
  margin: 0;
}

.acc-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.acc-chevron {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease;
}

.drawer-accordion[open] .acc-chevron {
  transform: rotate(180deg);
  color: var(--accent-active);
}

.accordion-content {
  padding: 0 14px 14px 14px;
}

.drawer-section h4 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent-primary);
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* Mode Button Grid (4 Sensory Modes) */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  min-height: 52px;
  background: var(--bg-btn);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 700;
  transition: all 0.2s;
}

.mode-btn .mode-icon {
  font-size: 1.2rem;
}

.mode-btn:hover {
  background: var(--bg-btn-hover);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
}

.mode-btn.active {
  background: var(--bg-btn-active);
  border-color: var(--border-glow-active);
  box-shadow: var(--shadow-active);
  color: #ffffff;
}

/* Avatar Buttons Grid (Modern Glassmorphic Cards) */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.avatar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 52px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--text-main);
  text-align: left;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-btn .avatar-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.avatar-btn .avatar-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.avatar-btn .avatar-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.avatar-btn .avatar-tag {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.avatar-btn:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.avatar-btn:hover .avatar-icon-wrap {
  transform: scale(1.12);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.avatar-btn.active {
  background: linear-gradient(135deg, rgba(255, 221, 0, 0.18) 0%, rgba(221, 64, 39, 0.08) 100%);
  border-color: var(--accent-active);
  box-shadow: 0 0 16px rgba(255, 221, 0, 0.3), inset 0 0 12px rgba(255, 221, 0, 0.12);
}

.avatar-btn.active .avatar-icon-wrap {
  background: rgba(255, 221, 0, 0.25);
  border-color: rgba(255, 221, 0, 0.5);
  box-shadow: 0 0 12px rgba(255, 221, 0, 0.6);
  transform: scale(1.08);
}

.avatar-btn.active .avatar-name {
  color: var(--accent-active);
  font-weight: 800;
}

.avatar-btn.active .avatar-tag {
  color: #a5f3fc;
}

.avatar-btn.active::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--accent-active);
  filter: drop-shadow(0 0 4px rgba(255, 221, 0, 0.8));
}

.upload-avatar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px dashed rgba(221, 64, 39, 0.35);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
}

.upload-avatar-btn:hover {
  background: rgba(221, 64, 39, 0.12);
  border-color: var(--accent-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(221, 64, 39, 0.25);
}

/* Background Selector Grid */
.bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.bg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  min-height: 50px;
  background: var(--bg-btn);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 700;
  transition: all 0.2s;
}

.bg-btn .bg-icon {
  font-size: 1.2rem;
}

.bg-btn:hover {
  background: var(--bg-btn-hover);
  border-color: var(--border-glow);
  transform: translateY(-1px);
}

.bg-btn.active {
  background: var(--bg-btn-active);
  border-color: var(--border-glow-active);
  color: #ffffff;
  box-shadow: var(--shadow-active);
}

/* Symmetry 4x2 Grid (8 Recuadros) */
.sym-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.sym-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  min-height: 54px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--text-main);
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sym-card .sym-multiplier {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.5px;
}

.sym-card .sym-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sym-card:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.sym-card:hover .sym-multiplier {
  color: var(--accent-primary);
}

.sym-card.active {
  background: linear-gradient(135deg, rgba(255, 221, 0, 0.2) 0%, rgba(221, 64, 39, 0.08) 100%);
  border-color: var(--accent-active);
  box-shadow: 0 0 16px rgba(255, 221, 0, 0.35), inset 0 0 10px rgba(255, 221, 0, 0.15);
}

.sym-card.active .sym-multiplier {
  color: var(--accent-active);
  text-shadow: 0 0 8px rgba(255, 221, 0, 0.6);
}

.sym-card.active .sym-label {
  color: #a5f3fc;
  font-weight: 700;
}

.sym-card.active::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-active);
  box-shadow: 0 0 6px var(--accent-active);
}

/* Compatibilidad con sym-row y sym-btn para sliders */
.sym-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.sym-btn {
  padding: 8px 0;
  min-height: 38px;
  background: var(--bg-btn);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.82rem;
  transition: all 0.2s;
  cursor: pointer;
}

.sym-btn:hover {
  background: var(--bg-btn-hover);
}

.sym-btn.active {
  background: var(--bg-btn-active);
  border-color: var(--border-glow-active);
  color: #ffffff;
  box-shadow: var(--shadow-active);
}

/* ============================================ */
/* 2.1 Estructura de Subgrupos                  */
/* ============================================ */
#action-grid-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

.action-subgroup {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.subgroup-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 8px;
  padding-left: 2px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 8px;
}

/* ============================================ */
/* 2.2 Botones de acción y efecto de destello   */
/* ============================================ */
.action-btn {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 4px;
  color: #eee;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 52px;
}

.action-btn .icon {
  font-size: 20px;
  line-height: 1.2;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.15));
  transition: transform 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.action-btn:hover .icon {
  transform: scale(1.15);
}

.action-btn:active {
  transform: scale(0.92);
}

.action-btn.active {
  background: rgba(255, 221, 0, 0.22);
  border-color: var(--accent-active);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(255, 221, 0, 0.35);
}

/* --- Destello de Supernova / Vórtice al hacer clic --- */
.action-btn.supernova-flash {
  box-shadow: 0 0 30px var(--accent-active), 0 0 60px rgba(255, 221, 0, 0.4);
  border-color: var(--accent-active) !important;
  background: rgba(255, 221, 0, 0.25) !important;
}

.action-btn.vortex-flash {
  box-shadow: 0 0 30px var(--accent-active), 0 0 60px rgba(255, 221, 0, 0.4);
  border-color: var(--accent-active) !important;
  background: rgba(255, 221, 0, 0.25) !important;
}

/* ============================================ */
/* 2.3 Estado de Grabación (Pulso cardiaco)     */
/* ============================================ */
.action-btn.recording-active {
  background: rgba(255, 0, 0, 0.2) !important;
  border-color: #ff3333 !important;
  color: #ffffff !important;
  animation: pulse-recording 1.2s ease-in-out infinite;
}

.record-timer {
  font-size: 10px;
  font-weight: 700;
  color: #ff5555;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

@keyframes pulse-recording {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 0, 0, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.7); }
}

/* ============================================ */
/* Parámetros de Física & Auto-Piloto (Cards)  */
/* ============================================ */
.params-group {
  margin-bottom: 18px;
}

.params-group:last-child {
  margin-bottom: 6px;
}

.params-group-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.param-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.param-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.param-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(221, 64, 39, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.param-card label {
  flex: 1;
  font-size: 0.78rem;
  color: #cbd5e1;
  font-weight: 600;
  margin: 0;
  cursor: pointer;
}

.param-card input[type="number"] {
  width: 68px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 23, 42, 0.8);
  color: #dd4027;
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.param-card input[type="number"]:focus {
  outline: none;
  border-color: var(--accent-active);
  box-shadow: 0 0 10px rgba(255, 221, 0, 0.4);
  background: rgba(15, 23, 42, 0.95);
}

.param-help {
  cursor: help;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-left: 2px;
  position: relative;
  transition: color 0.2s;
}

.param-help:hover {
  color: var(--accent-primary);
}

.param-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Sliders & Interactive Tooltips (Retrocompatibilidad) */
.slider-control {
  position: relative;
  margin-bottom: 16px;
}

.slider-control label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.slider-control label span {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-weight: 700;
}

.slider-tooltip {
  display: block;
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 3px;
  font-style: italic;
  line-height: 1.3;
}

.slider-control input[type="range"] {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  outline: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
  cursor: pointer;
  transition: transform 0.1s;
}

.slider-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Palette grid */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.palette-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.palette-card:hover {
  border-color: var(--border-glow);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.palette-card.active {
  border-color: var(--border-glow-active);
  background: rgba(255, 221, 0, 0.15);
  box-shadow: 0 0 12px rgba(255, 221, 0, 0.3);
}

.palette-swatches {
  display: flex;
  gap: 3px;
}

.palette-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.palette-title {
  font-size: 0.72rem;
  font-weight: 600;
}

/* Explanations Guide Section */
.guide-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 14px;
}

.guide-item {
  margin-bottom: 10px;
}

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

.guide-item p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.guide-item strong {
  color: var(--text-main);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(12, 16, 26, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  color: var(--text-main);
  padding: 8px 18px;
  border-radius: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 14px rgba(221, 64, 39, 0.3);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.25s 1.75s forwards ease-in;
}

@keyframes toastIn {
  0% { opacity: 0; transform: translateY(12px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

/* Reduced Motion Support (WCAG 2.2 AA) */
@media (prefers-reduced-motion: reduce) {
  .cursor-mirror-point,
  .active-gravity,
  .active-swarm,
  .nyan-svg {
    animation: none !important;
  }
  #top-bar,
  #settings-drawer,
  .icon-btn,
  .mode-btn,
  .avatar-btn,
  .toast {
    transition: none !important;
  }
}

/* Mobile & Tablet Responsive Queries */
@media (max-width: 768px) {
  .btn-text-desktop {
    display: none;
  }
  
  #top-bar {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 6px;
  }

  #top-bar.pos-bottom {
    bottom: 8px !important;
  }

  .icon-btn, .hamburger-btn {
    height: 42px;
    min-width: 42px;
    padding: 0 10px;
  }

  .top-bar-center-scroll {
    gap: 4px;
    padding: 0 2px;
  }
}

@media (max-width: 480px) {
  .brand-title, .mode-pill {
    display: none;
  }

  .brand-capsule {
    padding: 6px 8px;
    border-radius: 14px;
  }

  .brand-icon {
    font-size: 1.1rem;
  }

  .hamburger-text {
    display: none;
  }

  .hamburger-btn {
    padding: 0 12px;
    min-width: 42px;
  }

  #settings-drawer {
    width: 88vw;
    max-width: 340px;
  }

  .avatar-grid, .bg-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .avatar-btn, .bg-btn {
    padding: 6px 2px;
    min-height: 46px;
    font-size: 0.68rem;
  }
}
