@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
    font-family: 'Press Start 2P', system-ui;
    background-size: auto 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #111;
    color: #eee;
    text-align: center;
    margin: 0;
    padding: 10px;
    min-height: 100vh;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Makes level backgrounds 85% opaque */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);  /* 15% white overlay = image looks 80% opaque */
    pointer-events: none;
    z-index: -1;
}

h1 {
    font-size: 1.5rem;
    margin: 8px 0;
	font-family: 'Press Start 2P', system-ui;
}

canvas {
    border: 2px solid #0ad;
	border-radius: 12px;
    background: #000;
    image-rendering: pixelated;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
	opacity: 0.6;
}

#status {
    margin: 10px 0;
    font-size: 1.2rem;
    font-weight: bold;
}

/* D-pad */
#dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    margin: 16px auto 0;
    max-width: 260px;
}

.dpad-middle {
    display: flex;
    gap: 1px;
}

.dpad-btn {
    width: 125px;
    height: 80px;
    font-size: 28px;
    background: #069;
    color: #fff;
    border: 3px solid #0ad;
    border-radius: 8px;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
	opacity: 0.6;
}

.dpad-btn:active,
.dpad-btn.active {
    background: #777;
    border-color: #333;
	opacity: 0.3;
}

#restartBtn {
	font-family: 'Press Start 2P', system-ui;
    margin-top: 16px;
    padding: 12px 28px;
    font-size: 1.25rem;
    background: #08a;
    color: white;
    border: 3px solid #0ad;
    border-radius: 8px;
    cursor: pointer;
	opacity: 0.85;
}

#restartBtn:active {
    background: #0ac;
}

/* Challenge overlay */
#challenge {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.challenge-box {
    background: #222;
    border: 3px solid #c44;
    border-radius: 16px;
    padding: 24px 30px;
    text-align: center;
    max-width: 320px;
    color: #fff;
}

.challenge-box p {
    margin: 8px 0;
    font-size: 1.2rem;
}

.challenge-box .hint {
    font-size: 0.95rem;
    opacity: 0.8;
}

.pass-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 18px 0;
}

.pass-btn {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    font-weight: bold;
    background: #444;
    color: white;
    border: 2px solid #777;
    border-radius: 10px;
    cursor: pointer;
}

.pass-btn:active {
    background: #666;
}

#challenge-msg {
    min-height: 24px;
    font-weight: bold;
    color: #f88;
}

/* ========== TITLE SCREEN ========== */
#titleScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('bg.jpg');
    background-size: auto 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #111;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 20px 20px 40px 20px;
    box-sizing: border-box;
}

#titleScreen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.05);
    z-index: -1;
	animation: pulse 0.4s infinite;
}

.title-box {
    text-align: center;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
	font-weight: bold;
	margin: 0;
}

.title-box h1 {
    font-size: 2rem;
    margin: 0;
    color: #fff;
	animation: pulse 0.2s infinite;
    text-shadow: 0 20px 30px rgba(0,0,0,0.8);
}

/* ========== INSTRUCTIONS SCREEN ========== */
#instructionsScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('bg.jpg');
    background-size: auto 100%;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #111;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#instructionsScreen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: -1;
}

.start-box {
    background: rgba(20, 20, 20, 0.65);
    border: 3px solid #069;
    border-radius: 16px;
    padding: 28px 32px;
    max-width: 420px;
    text-align: center;
    color: #eee;
    position: relative;
    z-index: 1;
}

.start-box h2 {
    margin: 0 0 16px;
    color: #069;
    font-size: 1.3rem;
	animation: pulse 0.2s infinite;
    text-shadow: 0 10px 15px rgba(0,0,0,0.8);
}

.instructions {
	font-family: system-ui, sans-serif;
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.start-prompt {
	font-family: 'Press Start 2P', system-ui;
    font-size: 1rem;
    font-weight: bold;
    margin-top: 10px;
	word-spacing: -6px;
	letter-spacing: -1px;
	/* Base color of the unlit/low-lit bulb text */
	color: #000; 
	/* Webkit text stroke helps define the bulb shape */
	-webkit-text-stroke: 1px #333; 
	/* Apply the animation */
	animation: neonFlicker 3s infinite alternate;
}

/* Neon flicker keyframes mimicking a faulty transformer */
@keyframes neonFlicker {
  /* Fully illuminated state with deep glowing text-shadows */
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow:
      0 0 2px #c60,
      0 0 3px #c60,
      0 0 4px #c30,
      0 0 6px #c30,
      0 0 9px #c30,
      0 0 11px #c30;
    color: #000;
  }
  
  /* Instantly drops to a dim, "off" state */
  20%, 24%, 55% {    
    text-shadow:
      0 0 2px rgba(210, 66, 0, 0.3),
      0 0 5px rgba(210, 33, 0, 0.1);
    color: rgba(210, 33, 0, 0.3);
  }
}

@keyframes pulse {
    0%, 100% { opacity: 0.9; }
    20% { opacity: 0.75; }
}	