/* ==========================================================================
   FS LIGHT UP - ELECTRIC CIRCUIT & BULB RADIANCE STYLESHEET
   Unified Scaled Viewport Standard (Mobile, iPad, PC)
   ========================================================================== */

:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --bg-dark: #050711;
  --bg-card: rgba(12, 17, 33, 0.85);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-active: rgba(255, 215, 0, 0.5);

  --text-main: #f0f4fc;
  --text-muted: #8ca0be;

  --neon-gold: #ffd700;
  --glow-gold: rgba(255, 215, 0, 0.5);
  --neon-cyan: #00f3ff;
  --glow-cyan: rgba(0, 243, 255, 0.45);
  --neon-emerald: #00e626;

  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.65);
}

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

body {
  font-family: var(--font-body);
  background: radial-gradient(circle at 50% 20%, #101932 0%, #04060d 100%);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8px 6px 16px;
  overflow-x: hidden;
  touch-action: manipulation;
  transition: background 0.8s ease;
}

/* Background shifts to warm radiance on victory */
body.all-lit {
  background: radial-gradient(circle at 50% 30%, #2a3418 0%, #080c14 100%);
}

.game-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==========================================================================
   Compact Single-Row Header
   ========================================================================== */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 0.35rem 0.6rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.nav-btn {
  text-decoration: none;
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--neon-gold);
}

.game-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--neon-gold);
}

.icon-btn.active {
  background: rgba(255, 215, 0, 0.2);
  border-color: var(--neon-gold);
}

.donate-pill-btn {
  background: rgba(0, 229, 163, 0.12);
  border: 1px solid rgba(0, 229, 163, 0.4);
  color: #00e5a3;
  border-radius: 16px;
  padding: 0 0.55rem;
  height: 30px;
  font-size: 0.72rem;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.donate-pill-btn:hover {
  background: rgba(0, 229, 163, 0.25);
  border-color: #00e5a3;
}

/* ==========================================================================
   Level Selector Bar (4 Levels)
   ========================================================================== */
.level-selector-strip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 0.35rem 0.6rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  overflow-x: auto;
  scrollbar-width: none;
}

.level-selector-strip::-webkit-scrollbar {
  display: none;
}

.stage-tag {
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.35);
  color: var(--neon-gold);
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  font-family: var(--font-heading);
  white-space: nowrap;
}

.level-pills-list {
  display: flex;
  gap: 0.35rem;
  flex: 1;
}

.level-pill {
  flex: 1;
  min-width: 68px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.3rem 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.level-pill:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.level-pill.active {
  border-color: var(--neon-gold);
  background: rgba(255, 215, 0, 0.18);
  color: #fff;
  box-shadow: 0 0 12px var(--glow-gold);
}

/* ==========================================================================
   Power & Lamp Status Bar
   ========================================================================== */
.power-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 0.35rem 0.65rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  font-weight: 700;
}

.status-lamps-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.status-lamps-info strong {
  color: var(--neon-gold);
  font-family: var(--font-heading);
  font-size: 0.88rem;
}

.status-hint {
  color: var(--neon-cyan);
  font-size: 0.68rem;
}

/* ==========================================================================
   Maximized Canvas Play Area (55vh - 65vh)
   ========================================================================== */
.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 480px;
  height: 60vh;
  height: 60dvh;
  max-height: 580px;
  background: radial-gradient(circle at 50% 40%, #111a33 0%, #03050c 100%);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none;
  cursor: pointer;
}

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

/* Radiance overlay when all bulbs light up */
.radiance-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 230, 120, 0.85) 0%, rgba(255, 215, 0, 0) 80%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 10;
}

.radiance-flash.active {
  opacity: 1;
}

/* ==========================================================================
   Result Modal Overlay
   ========================================================================== */
.result-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 16, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 25;
  transition: opacity 0.3s ease;
}

.result-modal-overlay.active {
  display: flex;
}

.result-modal-box {
  background: rgba(13, 19, 36, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 1.35rem 1.1rem;
  width: 100%;
  max-width: 350px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.light-badge-circle {
  width: 86px;
  height: 86px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, rgba(13, 19, 36, 0.85) 100%);
  border: 2px solid var(--neon-gold);
  box-shadow: 0 0 28px var(--glow-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  animation: pulseBulb 1.8s infinite ease-in-out;
}

@keyframes pulseBulb {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px var(--glow-gold); }
  50% { transform: scale(1.08); box-shadow: 0 0 35px var(--neon-gold); }
}

.result-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.result-feedback-msg {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.result-action-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.3rem;
}

.btn-res {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.btn-res.next {
  background: linear-gradient(135deg, #ffd700, #ff8531);
  color: #040814;
  border: none;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4);
}

.btn-res.next:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

.btn-res.retry {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-res.retry:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--neon-gold);
}

/* ==========================================================================
   Dedicated Touch Bar (Anti-Occlusion Directives)
   ========================================================================== */
.touch-control-strip {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  padding: 0.35rem 0.6rem;
  align-items: center;
  gap: 0.5rem;
  touch-action: none;
}

.touch-helper-strip {
  flex: 1;
  height: 48px;
  background: rgba(0, 0, 0, 0.4);
  border: 1.5px dashed rgba(255, 215, 0, 0.45);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0 0.8rem;
  transition: all 0.2s ease;
}

.helper-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.helper-text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.helper-main-txt {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff4cc;
}

.helper-sub-txt {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.btn-restart-action {
  width: 58px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.btn-restart-action:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--neon-gold);
}

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

/* ==========================================================================
   Responsive Scaling for Tablet / iPad & PC
   ========================================================================== */
@media (min-width: 651px) and (max-width: 1024px) {
  body {
    padding: 12px 10px;
  }
  .game-container {
    max-width: 680px;
    gap: 8px;
  }
  .canvas-wrapper {
    height: 560px;
    height: 64vh;
    height: 64dvh;
    max-height: 680px;
  }
}

@media (min-width: 1025px) {
  body {
    padding: 16px 12px;
  }
  .game-container {
    max-width: 680px;
    gap: 8px;
  }
  .canvas-wrapper {
    height: 580px;
    height: 65vh;
    height: 65dvh;
    max-height: 720px;
  }
}
