/* Web page: gamebox container */
.ct-gamebox {
  position: relative;
  min-height: 560px;
  width: 100%;
  aspect-ratio: 3 / 2;
  margin-bottom: 56px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 90%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 100% 100% at 50% 30%, rgba(34, 197, 94, 0.04) 0%, transparent 45%),
    radial-gradient(ellipse 100% 100% at 50% 50%, rgba(30, 58, 138, 0.15) 0%, transparent 65%),
    linear-gradient(180deg, #0c1222 0%, #1e293b 40%, #0f172a 70%, #0c1222 100%);
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    inset 0 0 150px rgba(0, 0, 0, 0.25),
    0 8px 32px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(148, 163, 184, 0.1);
}

.ct-gamebox::before {
  content: "Character World";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #e7efff;
  background: rgba(34, 211, 238, 0.18);
  border: 1px solid rgba(34, 211, 238, 0.4);
  pointer-events: none;
  z-index: 3;
}

.ct-gamebox #ctgm-root-container-ct {
  position: absolute;
  inset: 0;
  z-index: 1;
}

:host, #ctgm-root-container-ct { all: initial; }

#ctgm-root-container-ct {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.ct-gamebox #ctgm-root-container-ct {
  position: absolute;
  z-index: 1;
}

#cs-stage {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 50% 30%, rgba(59, 130, 246, 0.03) 0%, transparent 60%);
}

/* Shooter + UI clickable */
.cs-interactive { pointer-events: auto; }

/* Shooter area — premium launcher ring */
#cs-shootarea {
  position: absolute;
  left: 200px;
  bottom: 0;
  width: 400px;
  height: 400px;
  transform: translateX(-50%) rotate(0deg);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.15) 100%),
    radial-gradient(ellipse 75% 75% at 50% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 65%),
    radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.92) 100%);
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.2),
    0 0 50px rgba(59, 130, 246, 0.12),
    inset 0 0 80px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

#cs-shootarea::before {
  content: '';
  position: absolute;
  inset: 20px;
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.2);
  pointer-events: none;
}

#cs-shooter {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 999px;
  background: linear-gradient(145deg, #334155 0%, #1e293b 40%, #0f172a 100%);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 0 24px rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Shooter barrel */
#cs-shooter::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 88px;
  background: linear-gradient(to top, #60a5fa 0%, #3b82f6 40%, #2563eb 100%);
  top: -88px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 3px;
  box-shadow:
    0 0 12px rgba(59, 130, 246, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
#cs-shooter::before {
  content: '';
  position: absolute;
  top: -104px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid #60a5fa;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
}

/* Next character to launch — premium frame */
#cs-next-char-preview {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  pointer-events: none;
  padding: 6px;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-radius: 14px;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#cs-next-char-preview img {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  display: block;
}

/* Close button near shooter - hidden on web page */
#cs-close {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(75, 85, 99, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: transparent;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  user-select: none;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

#cs-close::before {
  content: '×';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
}

#cs-close:hover {
  background: rgba(107, 114, 128, 0.85);
  transform: translate(-50%, -50%) scale(1.08);
}

/* Status panel above energy bar */
#cs-status {
  position: absolute;
  left: 8px;
  bottom: 340px;
  transform: none;
  display: grid;
  gap: 8px;
  text-align: left;
  pointer-events: none;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#cs-level, #cs-score, #cs-remaining-shootarea {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 10px;
  letter-spacing: 0.4px;
  min-width: 108px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#cs-level { color: #93c5fd; }
#cs-score { color: #fde047; }
#cs-remaining-shootarea {
  color: rgba(167, 243, 208, 0.95);
  border-color: rgba(34, 197, 94, 0.2);
}

/* Projectiles */
.cs-balloon {
  position: absolute;
  width: 50px; height: 50px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Characters (GIFs) */
.cs-gif {
  position: absolute;
  width: 100px; height: 100px;
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  touch-action: none;
}

/* Game over panel */
#cs-gameover {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: auto;
  background: rgba(15, 20, 35, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 28px 36px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  z-index: 20;
}

#cs-gameover .cs-g-title.success {
  font-size: 22px;
  font-weight: 700;
  color: #4ade80;
  margin: 0 0 10px;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

#cs-gameover .cs-g-title.fail {
  font-size: 22px;
  font-weight: 700;
  color: #f87171;
  margin: 0 0 10px;
  text-shadow: 0 0 20px rgba(248, 113, 113, 0.3);
}

#cs-gameover .cs-g-score,
#cs-gameover .cs-g-rate,
#cs-gameover .cs-g-time {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.75);
  margin: 6px 0;
  font-weight: 500;
}

/* Start Over (Level 1) - web only */
#cs-gameover .cs-reset-level1 {
  display: inline-block;
  margin: 14px 0 4px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  background: rgba(100, 116, 139, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

#cs-gameover .cs-reset-level1:hover {
  background: rgba(100, 116, 139, 0.6);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

#cs-gameover .cs-reset-level1:active {
  transform: translateY(0);
}

/* Action buttons (Restart, Add Characters) */
#cs-restart, #cs-addchar {
  position: absolute;
  left: 200px;
  transform: translateX(-50%);
  width: 220px;
  text-align: center;
  color: #fff;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  display: none;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  user-select: none;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#cs-restart:hover, #cs-addchar:hover {
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#cs-restart:active, #cs-addchar:active {
  transform: translateX(-50%) translateY(0);
}

#cs-addchar {
  bottom: 100px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

#cs-restart {
  bottom: 60px;
  width: 160px;
  padding: 8px 16px;
  font-size: 13px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
  color: #fff;
}

#cs-restart:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

/* +score popup */
#cs-addscore {
  position: absolute;
  left: calc(50% + 200px);
  bottom: 100px;
  font-size: 22px;
  color: #4ade80;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

/* Confetti container */
#cs-confetti { position: absolute; inset: 0; pointer-events: none; }

/* Wait banner */
#cs-wait-banner {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 20px;
  background: rgba(15, 20, 35, 0.85);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  pointer-events: auto;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Power bar */
#cs-power-bar-bg {
  position: absolute;
  left: 52px;
  bottom: 110px;
  width: 16px;
  height: 180px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.8) 100%);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  pointer-events: none;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.3);
}

#cs-power-bar-bg::before {
  content: 'HOLD';
  position: absolute;
  left: 50%;
  top: -24px;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #93c5fd;
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#cs-power-bar-bg::after {
  content: 'POWER';
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: #93c5fd;
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#cs-power-bar {
  position: absolute;
  left: 52px;
  bottom: 110px;
  width: 16px;
  height: 0;
  background: linear-gradient(to top, #1d4ed8 0%, #3b82f6 40%, #60a5fa 100%);
  border-radius: 0 0 10px 10px;
  pointer-events: none;
  box-shadow:
    0 0 16px rgba(59, 130, 246, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: height 0.05s ease-out;
}

/* Platform - target styling */
#cs-platform {
  position: absolute;
  width: 180px;
  height: 24px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 8px,
      rgba(255, 255, 255, 0.08) 8px,
      rgba(255, 255, 255, 0.08) 10px
    ),
    linear-gradient(135deg, #4ade80 0%, #22c55e 25%, #16a34a 50%, #15803d 75%, #166534 100%);
  border-radius: 12px;
  box-shadow:
    0 0 32px rgba(34, 197, 94, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 6px 20px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(74, 222, 128, 0.6);
  pointer-events: none;
  animation: ct-platform-pulse 2.5s ease-in-out infinite;
}

@keyframes ct-platform-pulse {
  0%, 100% { box-shadow: 0 0 32px rgba(34, 197, 94, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.45); }
  50% { box-shadow: 0 0 40px rgba(34, 197, 94, 0.65), inset 0 2px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.45); }
}

/* Character picker modal (merged from power-ups) */
#ct-char-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483648;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

#ct-char-picker-modal {
  background: rgba(15, 20, 35, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

#ct-char-picker-modal h3 {
  color: #fff;
  margin: 0 0 12px;
  font-size: 18px;
}

#ct-char-picker-modal p {
  color: rgba(255, 255, 255, 0.8);
  margin: 8px 0;
  font-size: 14px;
}

#ct-current-characters,
#ct-select-characters {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 12px 0;
}

#ct-current-characters > div,
#ct-select-characters > div {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

#ct-select-characters > div:hover {
  border-color: #2196F3;
  transform: scale(1.05);
}

#ct-select-characters > div.selected {
  border: 3px solid #4CAF50;
  background-color: rgba(76, 175, 80, 0.2);
}

#ct-current-characters img,
#ct-select-characters img {
  width: 100%;
  max-width: 70px;
  height: auto;
  display: block;
  border-radius: 6px;
}

#ct-select-characters img {
  max-width: 80px;
}

#ct-addchars-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

#ct-addchars-btn:disabled {
  background: gray;
  cursor: not-allowed;
  pointer-events: none;
}

#ct-addchars-btn:not(:disabled) {
  background: #22c55e;
  color: white;
  cursor: pointer;
}
