/* app/assets/stylesheets/syllable_combo.css */

:root {
  --combo-bg: #f0f4f8;
  --tile-bg: #ffffff;
  --tile-border: #d1dce5;
  --tile-text: #334e68;
  --tile-hover-bg: #e0e8f0;
  --selected-bg: #fcd104;
  --selected-text: #07379d;
  --correct-bg: #5cb85c;
  --error-bg: #d9534f;
  --found-word-bg: #f7fafc;
  --header-text: #102a43;
}

.syllable-combo-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--combo-bg);
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-shadow: 0 10px 20px rgba(0,0,0,0.05), 0 6px 6px rgba(0,0,0,0.1);
}

/* Difficulty Selector */
.difficulty-selector-container {
  margin-bottom: 1.5rem;
}

.difficulty-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: rgba(209, 220, 229, 0.4);
  padding: 0.35rem;
  border-radius: 10px;
}

.difficulty-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.5rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--tile-text);
  background: #ffffff;
  border: 1.5px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.difficulty-tab:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.difficulty-tab .diff-icon {
  font-size: 1.25rem;
  margin-bottom: 0.15rem;
}

.difficulty-tab .diff-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.1;
}

.difficulty-tab .diff-count {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.difficulty-tab.active.easy {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}
.difficulty-tab.active.easy .diff-count {
  color: #059669;
  font-weight: 600;
}

.difficulty-tab.active.normal {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}
.difficulty-tab.active.normal .diff-count {
  color: #d97706;
  font-weight: 600;
}

.difficulty-tab.active.hard {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.difficulty-tab.active.hard .diff-count {
  color: #dc2626;
  font-weight: 600;
}

.game-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.difficulty-current-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  width: fit-content;
}
.difficulty-current-badge.easy {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.difficulty-current-badge.normal {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.difficulty-current-badge.hard {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  color: var(--header-text);
}

.game-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}

.score {
  font-size: 1.35rem;
  font-weight: 600;
}

.current-word-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    min-height: 50px;
}

.current-word {
  flex-grow: 1;
  background-color: #fff;
  border: 2px dashed var(--tile-border);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 40px;
}

.current-word .syllable-tile {
  cursor: pointer;
  background-color: var(--selected-bg);
  color: var(--selected-text);
  border-color: var(--selected-bg);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.current-word .syllable-tile:hover {
  transform: scale(0.95);
  background-color: #fef08a;
}

.current-word-actions {
    display: flex;
    margin-left: 1rem;
    gap: 0.5rem;
}

.button-clear, .button-submit {
    border: none;
    background: #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.button-clear:hover, .button-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.button-clear { color: var(--error-bg); }
.button-submit { color: var(--correct-bg); }

/* Aguijón Powerup Button */
.button-stinger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: 1.5px solid #fde68a;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.button-stinger:hover:not(.disabled) {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, #fbbf24 0%, #ea580c 100%);
}

.button-stinger.disabled {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

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

.button-stinger .stinger-count-badge {
  background: #ffffff;
  color: #b45309;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.button-stinger.disabled .stinger-count-badge {
  background: #cbd5e1;
  color: #64748b;
}

@keyframes stingerSpark {
  0% { transform: scale(0.8); box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
  50% { transform: scale(1.2); box-shadow: 0 0 25px rgba(245, 158, 11, 0.9); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
}

.syllable-tile.stinger-solved {
  animation: stingerSpark 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  background-color: #fef08a !important;
  border-color: #f59e0b !important;
  color: #b45309 !important;
}


.syllable-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.syllable-grid.grid-hard {
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.65rem;
}

.syllable-grid.grid-hard .syllable-tile {
  padding: 0.75rem 0.5rem;
  font-size: 1.05rem;
}

.syllable-tile {
  background-color: var(--tile-bg);
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--tile-text);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s ease, opacity 0.2s ease;
  user-select: none;
}

.syllable-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.syllable-tile.selected {
  opacity: 0.45;
  transform: scale(0.92);
  border-color: #f59e0b;
  background-color: #fef3c7;
}

.syllable-tile.used,
.syllable-tile.fly-out {
  pointer-events: none !important;
  user-select: none !important;
  cursor: default !important;
}

.found-words-container {
  margin-top: 2rem;
}

.found-words-container h2 {
  font-size: 1.2rem;
  color: var(--header-text);
  margin-bottom: 1rem;
}

#words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.found-word {
  background-color: var(--found-word-bg);
  border: 1px solid var(--tile-border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 500;
  color: var(--tile-text);
}

.new-game-button {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--selected-bg);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s;
}
.new-game-button:hover {
    background-color: #3a7ac2;
}

.game-instructions-collapsible {
  margin-bottom: 1.5rem;
  background: #ffffff;
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.game-instructions-collapsible[open] {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.game-instructions-collapsible summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--header-text);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  background-color: #f8fafc;
}

.game-instructions-collapsible summary::-webkit-details-marker {
  display: none;
}

.game-instructions-collapsible .arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  color: var(--selected-bg);
}

.game-instructions-collapsible[open] .arrow {
  transform: rotate(180deg);
}

.instructions-content {
  padding: 1rem;
  border-top: 1px solid var(--tile-border);
}

.instructions-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.instructions-content li {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--tile-text);
  line-height: 1.4;
}

.instructions-content li strong {
  color: var(--header-text);
}

.instructions-content li.goal-highlight {
  background-color: #fffbeb;
  border: 1px dashed #fbbf24;
  padding: 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.instructions-content li.goal-highlight strong {
  color: #92400e;
}


/* Animations */
.current-word.shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

.syllable-tile.fly-out {
  animation: fly-out 0.6s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes fly-out {
  to {
    transform: translateY(-100px) scale(0.5);
    opacity: 0;
  }
}

.score.pop {
    animation: pop 0.3s ease-in-out;
}

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

@media (max-width: 600px) {
  .current-word-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .current-word-actions {
    margin-left: 0;
    margin-top: 1rem;
    justify-content: center;
  }
}

/* ==========================================================================
   Radar Sonar Powerup Styles & Animations
   ========================================================================== */

.button-sonar {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #06b6d4 0%, #0284c7 100%);
  color: #ffffff;
  border: 1.5px solid #67e8f9;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.button-sonar:hover:not(.disabled) {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px rgba(6, 182, 212, 0.5);
  background: linear-gradient(135deg, #22d3ee 0%, #0369a1 100%);
}

.button-sonar.disabled {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.sonar-count-badge {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
}

/* Radar Sonar Wave Pulse Effect on Grid */
.syllable-grid.sonar-pulse-wave {
  position: relative;
  overflow: hidden;
  animation: sonarGridFlash 1.2s ease-out;
}

@keyframes sonarGridFlash {
  0% { box-shadow: inset 0 0 0px 0px rgba(6, 182, 212, 0.8); }
  50% { box-shadow: inset 0 0 40px 10px rgba(6, 182, 212, 0.4), 0 0 25px rgba(6, 182, 212, 0.6); }
  100% { box-shadow: inset 0 0 0px 0px rgba(6, 182, 212, 0); }
}

/* Sonar Highlighted Tiles */
.syllable-tile.sonar-highlighted {
  border-color: #06b6d4 !important;
  background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%) !important;
  color: #0891b2 !important;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.85), inset 0 0 10px rgba(6, 182, 212, 0.5) !important;
  animation: sonarTilePulse 1.2s ease-in-out infinite alternate !important;
  transform: scale(1.06);
  z-index: 5;
}

@keyframes sonarTilePulse {
  0% {
    transform: scale(1.02);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.6);
  }
  100% {
    transform: scale(1.08);
    box-shadow: 0 0 24px rgba(6, 182, 212, 0.95), 0 0 8px #0891b2;
  }
}

/* ==========================================================================
   Glaciar Ártico (Frost Theme) Skin for Syllable Combo
   ========================================================================== */

.theme-toggle-box {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

.btn-frost-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(224, 242, 254, 0.8);
  border: 1.5px solid #7dd3fc;
  color: #0369a1;
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.btn-frost-theme-toggle:hover {
  background: #bae6fd;
  transform: translateY(-1px);
}

.btn-frost-theme-toggle.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.btn-galaxy-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid rgba(168, 85, 247, 0.4);
  border-radius: 9999px;
  color: #e9d5ff;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}

.btn-galaxy-theme-toggle:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: #c084fc;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
  transform: translateY(-1px);
}

.btn-galaxy-theme-toggle.active {
  background: linear-gradient(135deg, #7e22ce 0%, #4338ca 100%);
  color: #ffffff;
  border-color: #c084fc;
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.6);
}

.syllable-combo-container.theme-frost {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #bae6fd 100%);
  border: 2px solid #7dd3fc;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.25);
  border-radius: 1rem;
}

.syllable-combo-container.theme-frost .syllable-tile {
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  border: 2px solid #7dd3fc;
  color: #0369a1;
  box-shadow: 0 4px 12px rgba(186, 230, 253, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
}

.syllable-combo-container.theme-frost .syllable-tile:hover:not(.used) {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  border-color: #38bdf8;
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.45);
  transform: translateY(-3px) scale(1.03);
}

.syllable-combo-container.theme-frost .syllable-tile.selected {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  border-color: #0ea5e9;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.7);
}

.syllable-combo-container.theme-frost .current-word {
  background: rgba(255, 255, 255, 0.85);
  border: 2px dashed #7dd3fc;
}

.syllable-combo-container.theme-frost .found-word {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  border: 1px solid #7dd3fc;
  color: #0369a1;
}

/* ==========================================================================
   Skin Galaxia Profunda (Deep Space Cosmic Theme)
   ========================================================================== */
@keyframes nebulaMorph {
  0% {
    transform: rotate(0deg) scale(1) translate(0, 0);
    filter: hue-rotate(0deg) brightness(1.05);
    opacity: 0.85;
  }
  33% {
    transform: rotate(120deg) scale(1.2) translate(30px, -20px);
    filter: hue-rotate(45deg) brightness(1.25);
    opacity: 1;
  }
  66% {
    transform: rotate(240deg) scale(1.1) translate(-25px, 25px);
    filter: hue-rotate(-30deg) brightness(1.15);
    opacity: 0.92;
  }
  100% {
    transform: rotate(360deg) scale(1) translate(0, 0);
    filter: hue-rotate(0deg) brightness(1.05);
    opacity: 0.85;
  }
}

@keyframes nebulaCounterFlow {
  0% {
    transform: rotate(360deg) scale(1.15);
    opacity: 0.7;
  }
  50% {
    transform: rotate(180deg) scale(0.95);
    opacity: 0.95;
  }
  100% {
    transform: rotate(0deg) scale(1.15);
    opacity: 0.7;
  }
}

@keyframes starTwinkleGlow {
  0%, 100% { 
    opacity: 0.2; 
    transform: scale(0.7) translateY(0); 
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
  }
  50% { 
    opacity: 1; 
    transform: scale(1.4) translateY(-4px); 
    filter: drop-shadow(0 0 12px #ffffff) drop-shadow(0 0 20px #c084fc);
  }
}

@keyframes shootingMeteor1 {
  0% {
    transform: translate(-100px, -50px) rotate(40deg);
    opacity: 0;
  }
  6% {
    opacity: 1;
  }
  20% {
    transform: translate(750px, 450px) rotate(40deg);
    opacity: 0;
  }
  100% {
    transform: translate(750px, 450px) rotate(40deg);
    opacity: 0;
  }
}

@keyframes shootingMeteor2 {
  0% {
    transform: translate(100px, -50px) rotate(-35deg);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  22% {
    transform: translate(-650px, 400px) rotate(-35deg);
    opacity: 0;
  }
  100% {
    transform: translate(-650px, 400px) rotate(-35deg);
    opacity: 0;
  }
}

@keyframes lunarPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(168, 85, 247, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.3); }
  50% { box-shadow: 0 0 30px rgba(232, 121, 249, 0.8), inset 0 1px 3px rgba(255, 255, 255, 0.6); }
}

.syllable-combo-container.theme-galaxy {
  background: radial-gradient(circle at 50% 50%, #150d2a 0%, #0c071a 50%, #050210 100%);
  border: 2px solid #a855f7;
  box-shadow: 0 15px 50px rgba(147, 51, 234, 0.45), 0 0 80px rgba(59, 130, 246, 0.3);
  border-radius: 1.25rem;
  color: #f3e8ff;
  position: relative;
  overflow: hidden;
}

/* Layer 1: Fast Animated Glowing Cosmic Nebula */
.syllable-combo-container.theme-galaxy::before {
  content: '';
  position: absolute;
  top: -150%;
  left: -150%;
  width: 400%;
  height: 400%;
  transform-origin: center center;
  background: 
    radial-gradient(circle at 25% 30%, rgba(147, 51, 234, 0.6) 0%, transparent 45%),
    radial-gradient(circle at 75% 65%, rgba(236, 72, 153, 0.5) 0%, transparent 45%),
    radial-gradient(circle at 45% 85%, rgba(56, 189, 248, 0.45) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.55) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(192, 132, 252, 0.4) 0%, transparent 55%);
  animation: nebulaMorph 7.5s infinite ease-in-out;
  pointer-events: none;
  z-index: 0;
}

/* Layer 2: Cosmic Star Cluster Background Texture */
.syllable-combo-container.theme-galaxy::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 90px 75px, #c084fc, rgba(0,0,0,0)),
    radial-gradient(2.5px 2.5px at 180px 140px, #38bdf8, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 270px 50px, #f472b6, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 340px 220px, #fef08a, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 60px 190px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 230px 290px, #c084fc, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 310px 130px, #38bdf8, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 130px 280px, #ffffff, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 360px 360px;
  pointer-events: none;
  opacity: 0.85;
  z-index: 0;
}

/* Elevate game elements above galaxy background */
.syllable-combo-container.theme-galaxy > * {
  position: relative;
  z-index: 1;
}

/* Floating Stars and Shooting Meteor Particles */
.galaxy-stars-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
  z-index: 0;
}

.galaxy-stars-overlay .g-star {
  position: absolute;
  color: #ffffff;
  animation: starTwinkleGlow 2.5s infinite ease-in-out;
  pointer-events: none;
  user-select: none;
}

.galaxy-stars-overlay .g-star.s1 { top: 8%; left: 7%; animation-delay: 0s; font-size: 1.3rem; color: #ffffff; }
.galaxy-stars-overlay .g-star.s2 { top: 16%; right: 10%; animation-delay: 0.7s; font-size: 0.9rem; color: #bae6fd; }
.galaxy-stars-overlay .g-star.s3 { top: 66%; left: 5%; animation-delay: 1.4s; font-size: 1.15rem; color: #fbcfe8; }
.galaxy-stars-overlay .g-star.s4 { top: 80%; right: 8%; animation-delay: 1.9s; font-size: 1.35rem; color: #e0e7ff; }
.galaxy-stars-overlay .g-star.s5 { top: 38%; left: 14%; animation-delay: 0.4s; font-size: 0.8rem; color: #fef08a; }
.galaxy-stars-overlay .g-star.s6 { top: 48%; right: 4%; animation-delay: 1.6s; font-size: 1.05rem; color: #c084fc; }
.galaxy-stars-overlay .g-star.s7 { top: 90%; left: 28%; animation-delay: 2.2s; font-size: 0.9rem; color: #38bdf8; }
.galaxy-stars-overlay .g-star.s8 { top: 5%; right: 35%; animation-delay: 1.1s; font-size: 1rem; color: #f472b6; }
.galaxy-stars-overlay .g-star.s9 { top: 28%; left: 32%; animation-delay: 0.6s; font-size: 0.85rem; color: #ffffff; }
.galaxy-stars-overlay .g-star.s10 { top: 72%; left: 22%; animation-delay: 1.8s; font-size: 1.1rem; color: #fde047; }
.galaxy-stars-overlay .g-star.s11 { top: 24%; right: 28%; animation-delay: 1.3s; font-size: 0.75rem; color: #a78bfa; }
.galaxy-stars-overlay .g-star.s12 { top: 84%; left: 48%; animation-delay: 0.3s; font-size: 1rem; color: #67e8f9; }
.galaxy-stars-overlay .g-star.s13 { top: 58%; right: 22%; animation-delay: 2.1s; font-size: 0.95rem; color: #f43f5e; }
.galaxy-stars-overlay .g-star.s14 { top: 12%; left: 22%; animation-delay: 1.5s; font-size: 0.7rem; color: #e9d5ff; }
.galaxy-stars-overlay .g-star.s15 { top: 92%; right: 32%; animation-delay: 0.8s; font-size: 1.2rem; color: #ffffff; }
.galaxy-stars-overlay .g-star.s16 { top: 44%; left: 4%; animation-delay: 2.4s; font-size: 0.85rem; color: #fcd34d; }
.galaxy-stars-overlay .g-star.s17 { top: 32%; right: 15%; animation-delay: 1.0s; font-size: 1.05rem; color: #38bdf8; }
.galaxy-stars-overlay .g-star.s18 { top: 76%; right: 40%; animation-delay: 1.7s; font-size: 0.8rem; color: #ec4899; }
.galaxy-stars-overlay .g-star.s19 { top: 20%; left: 45%; animation-delay: 0.2s; font-size: 0.9rem; color: #fef08a; }
.galaxy-stars-overlay .g-star.s20 { top: 62%; right: 12%; animation-delay: 2.5s; font-size: 1.25rem; color: #c084fc; }
.galaxy-stars-overlay .g-star.s21 { top: 35%; left: 25%; animation-delay: 1.2s; font-size: 0.7rem; color: #bae6fd; }
.galaxy-stars-overlay .g-star.s22 { top: 88%; right: 18%; animation-delay: 0.5s; font-size: 1.1rem; color: #f472b6; }
.galaxy-stars-overlay .g-star.s23 { top: 15%; right: 48%; animation-delay: 2.0s; font-size: 0.85rem; color: #ffffff; }
.galaxy-stars-overlay .g-star.s24 { top: 52%; left: 10%; animation-delay: 0.9s; font-size: 1.15rem; color: #38bdf8; }
.galaxy-stars-overlay .g-star.s25 { top: 95%; left: 12%; animation-delay: 1.6s; font-size: 0.95rem; color: #e0e7ff; }
.galaxy-stars-overlay .g-star.s26 { top: 4%; left: 42%; animation-delay: 2.3s; font-size: 0.8rem; color: #fde047; }
.galaxy-stars-overlay .g-star.s27 { top: 68%; right: 28%; animation-delay: 0.7s; font-size: 1rem; color: #a78bfa; }
.galaxy-stars-overlay .g-star.s28 { top: 26%; left: 8%; animation-delay: 1.9s; font-size: 0.75rem; color: #67e8f9; }
.galaxy-stars-overlay .g-star.s29 { top: 40%; right: 36%; animation-delay: 1.4s; font-size: 1.2rem; color: #fbcfe8; }
.galaxy-stars-overlay .g-star.s30 { top: 82%; left: 38%; animation-delay: 2.7s; font-size: 0.9rem; color: #ffffff; }

.galaxy-stars-overlay .g-meteor.m1 {
  position: absolute;
  top: -5%;
  left: 12%;
  width: 150px;
  height: 2.5px;
  background: linear-gradient(90deg, #ffffff, rgba(192,132,252,0.9), transparent);
  box-shadow: 0 0 12px #ffffff, 0 0 24px #a855f7;
  border-radius: 9999px;
  transform-origin: left;
  animation: shootingMeteor1 5.5s infinite ease-in-out;
  opacity: 0;
}

.galaxy-stars-overlay .g-meteor.m2 {
  position: absolute;
  top: -5%;
  right: 15%;
  width: 140px;
  height: 2px;
  background: linear-gradient(90deg, #ffffff, rgba(56,189,248,0.9), transparent);
  box-shadow: 0 0 12px #ffffff, 0 0 24px #0284c7;
  border-radius: 9999px;
  transform-origin: right;
  animation: shootingMeteor2 7s 2.8s infinite ease-in-out;
  opacity: 0;
}

/* Baldosas de Cristal Lunar Transparente */
.syllable-combo-container.theme-galaxy .syllable-tile {
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(192, 132, 252, 0.5);
  color: #f3e8ff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), inset 0 1px 2px rgba(255, 255, 255, 0.35), 0 0 18px rgba(168, 85, 247, 0.3);
  text-shadow: 0 0 10px rgba(192, 132, 252, 0.9);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.syllable-combo-container.theme-galaxy .syllable-tile:hover:not(.used) {
  background: rgba(168, 85, 247, 0.28);
  border-color: #e879f9;
  color: #ffffff;
  box-shadow: 0 0 28px rgba(192, 132, 252, 0.75), inset 0 1px 2px rgba(255, 255, 255, 0.7);
  transform: translateY(-3px) scale(1.05);
}

.syllable-combo-container.theme-galaxy .syllable-tile.selected {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.9) 0%, rgba(99, 102, 241, 0.9) 100%);
  border-color: #f472b6;
  color: #ffffff;
  box-shadow: 0 0 32px rgba(244, 114, 182, 0.9), inset 0 1px 2px rgba(255, 255, 255, 0.9);
  animation: lunarPulse 1.4s infinite alternate;
}

.syllable-combo-container.theme-galaxy .current-word {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(14px);
  border: 2px dashed #c084fc;
  color: #f3e8ff;
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.35);
}

.syllable-combo-container.theme-galaxy .found-word {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.35) 0%, rgba(99, 102, 241, 0.35) 100%);
  border: 1.5px solid rgba(192, 132, 252, 0.6);
  color: #f5d0fe;
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.4);
}

/* ==========================================================================
   Mobile Galaxy Background Performance Optimizer Toggle Button in Syllable Combo
   ========================================================================== */
.mobile-galaxy-optimizer-container.syllable-optimizer {
  display: none;
}

@media (max-width: 768px) {
  .mobile-galaxy-optimizer-container.syllable-optimizer {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .btn-galaxy-perf-toggle {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.85) 0%, rgba(88, 28, 135, 0.65) 50%, rgba(15, 23, 42, 0.9) 100%);
    border: 1.5px solid rgba(192, 132, 252, 0.65);
    color: #f5d0fe;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    padding: 0.55rem 1.35rem;
    border-radius: 9999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 18px rgba(126, 34, 206, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.25), 0 0 12px rgba(168, 85, 247, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.8);
    user-select: none;
  }

  .btn-galaxy-perf-toggle:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: #e879f9;
    box-shadow: 0 6px 24px rgba(168, 85, 247, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.4), 0 0 20px rgba(232, 121, 249, 0.4);
    color: #ffffff;
  }

  .btn-galaxy-perf-toggle:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 2px 10px rgba(126, 34, 206, 0.4);
  }

  .btn-galaxy-perf-toggle .perf-status-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 6px #fde047);
    transition: transform 0.25s ease;
  }

  .btn-galaxy-perf-toggle:hover .perf-status-icon {
    transform: scale(1.15) rotate(10deg);
  }

  .btn-galaxy-perf-toggle.is-optimized {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.9) 0%, rgba(13, 148, 136, 0.75) 50%, rgba(15, 23, 42, 0.95) 100%);
    border-color: #34d399;
    color: #a7f3d0;
    box-shadow: 0 0 22px rgba(52, 211, 153, 0.5), 0 4px 18px rgba(0, 0, 0, 0.6), inset 0 1px 3px rgba(255, 255, 255, 0.35);
    text-shadow: 0 0 12px rgba(52, 211, 153, 0.9);
  }

  .btn-galaxy-perf-toggle.is-optimized .perf-status-icon {
    filter: drop-shadow(0 0 8px #34d399);
  }
}

/* ==========================================================================
   Galaxy Skin High-Performance / Low-Lag Engine for Syllable Combo (.galaxy-optimized)
   ========================================================================== */
.syllable-combo-container.theme-galaxy.galaxy-optimized {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* 1. Nebula Layer: Replaces heavy rotating 400% repaint with static vibrant multi-nebula canvas */
.syllable-combo-container.theme-galaxy.galaxy-optimized::before {
  animation: none !important;
  transform: none !important;
  width: 100% !important;
  height: 100% !important;
  top: 0 !important;
  left: 0 !important;
  background: 
    radial-gradient(circle at 20% 25%, rgba(147, 51, 234, 0.55) 0%, transparent 55%),
    radial-gradient(circle at 80% 65%, rgba(236, 72, 153, 0.5) 0%, transparent 55%),
    radial-gradient(circle at 45% 85%, rgba(56, 189, 248, 0.45) 0%, transparent 55%),
    radial-gradient(circle at 75% 20%, rgba(99, 102, 241, 0.55) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(192, 132, 252, 0.4) 0%, transparent 60%) !important;
  will-change: auto !important;
}

/* 2. Star field texture: Static hardware-accelerated star pattern */
.syllable-combo-container.theme-galaxy.galaxy-optimized::after {
  opacity: 0.9 !important;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* 3. 30 Constellation Stars: Kept 100% intact, using efficient opacity pulse */
.syllable-combo-container.theme-galaxy.galaxy-optimized .galaxy-stars-overlay .g-star {
  text-shadow: 0 0 6px currentColor;
  animation: starTwinkleOptimized 3s infinite ease-in-out !important;
  will-change: opacity;
}

/* 4. Meteors: Smooth lightweight trajectories */
.syllable-combo-container.theme-galaxy.galaxy-optimized .galaxy-stars-overlay .g-meteor {
  box-shadow: 0 0 8px #ffffff, 0 0 14px #a855f7 !important;
}

/* 5. Glassmorphism tiles and current-word: Solid dark glass eliminating per-frame backdrop-blur GPU thrashing */
.syllable-combo-container.theme-galaxy.galaxy-optimized .syllable-tile {
  background: rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: rgba(192, 132, 252, 0.6) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3) !important;
}

.syllable-combo-container.theme-galaxy.galaxy-optimized .current-word {
  background: rgba(15, 23, 42, 0.92) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: #c084fc !important;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.3) !important;
}

