/* ============================================================
   NEURONS NOT INCLUDED — style.css
   Retro pixel aesthetic. Press Start 2P font.
   No rounded corners. CRT scanlines. Full brain damage.
============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
  background: #0a0a0f;
  color: #e0e0e0;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
}

/* ---------- CRT Scanlines Overlay ---------- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ---------- Screen Management ---------- */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  gap: 18px;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   MENU SCREEN
============================================================ */
#logo-art {
  font-size: 11px;
  line-height: 1.35;
  color: #00f5ff;
  text-shadow: 0 0 8px rgba(0, 245, 255, 0.6);
  letter-spacing: 1px;
  text-align: center;
}

#menu-title {
  font-size: 16px;
  color: #ff2d78;
  text-shadow: 3px 3px 0 #7a0035, 0 0 20px rgba(255, 45, 120, 0.5);
  text-align: center;
  letter-spacing: 2px;
  line-height: 1.6;
}

#menu-tagline {
  font-size: 9px;
  color: #888;
  text-align: center;
  margin-top: -10px;
  letter-spacing: 1px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  margin-top: 8px;
}

/* ============================================================
   HOW TO PLAY SCREEN
============================================================ */
.screen-title {
  font-size: 13px;
  color: #00f5ff;
  text-shadow: 2px 2px 0 #005566;
  letter-spacing: 2px;
  text-align: center;
}

.instructions-list {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  width: 100%;
}

.instructions-list li {
  counter-increment: step;
  padding-left: 30px;
  position: relative;
  font-size: 8px;
  line-height: 1.9;
  color: #c0c0c0;
}

.instructions-list li::before {
  content: counter(step) ".";
  position: absolute;
  left: 0;
  color: #ff2d78;
  font-size: 8px;
}

.instructions-list em {
  color: #00f5ff;
  font-style: normal;
}

.science-box,
.scoring-box {
  border: 2px solid #00f5ff;
  padding: 14px 18px;
  max-width: 520px;
  width: 100%;
  background: rgba(0, 245, 255, 0.04);
}

.science-box h3,
.scoring-box h3 {
  font-size: 9px;
  color: #00f5ff;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.science-box p,
.scoring-box p {
  font-size: 7px;
  line-height: 2;
  color: #b0b0b0;
  margin-bottom: 6px;
}

.science-box p:last-child,
.scoring-box p:last-child {
  margin-bottom: 0;
}

.science-sub {
  color: #666 !important;
  font-size: 6.5px !important;
}

.accent-cyan { color: #00f5ff; }
.accent-pink { color: #ff2d78; }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 12px 20px;
  border: none;
  cursor: pointer;
  letter-spacing: 1px;
  position: relative;
  transition: transform 0.05s, box-shadow 0.05s;
  outline: none;
  text-transform: uppercase;
}

.btn-primary {
  background: #ff2d78;
  color: #fff;
  box-shadow: 4px 4px 0 #7a0035;
}

.btn-primary:hover {
  background: #ff4d8e;
  box-shadow: 5px 5px 0 #7a0035;
  transform: translate(-1px, -1px);
}

.btn-primary:active {
  box-shadow: 1px 1px 0 #7a0035;
  transform: translate(3px, 3px);
}

.btn-secondary {
  background: #111122;
  color: #00f5ff;
  border: 2px solid #00f5ff;
  box-shadow: 4px 4px 0 #003344;
}

.btn-secondary:hover {
  background: #00f5ff;
  color: #0a0a0f;
  box-shadow: 5px 5px 0 #003344;
  transform: translate(-1px, -1px);
}

.btn-secondary:active {
  box-shadow: 1px 1px 0 #003344;
  transform: translate(3px, 3px);
}

/* ============================================================
   GAME SCREEN — HUD
============================================================ */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  border: 2px solid #222244;
  background: rgba(0, 0, 0, 0.4);
}

#hud-level {
  font-size: 9px;
  color: #00f5ff;
}

#hud-level-val {
  color: #fff;
}

#hud-lives {
  display: flex;
  gap: 6px;
}

.life {
  font-size: 16px;
  transition: filter 0.3s, opacity 0.3s;
}

.life.dead {
  filter: grayscale(1);
  opacity: 0.25;
}

#hud-score {
  font-size: 9px;
  color: #ff2d78;
}

#hud-score-val {
  color: #fff;
}

/* ============================================================
   POPUP MESSAGE
============================================================ */
.popup {
  position: relative;
  padding: 10px 16px;
  font-size: 8px;
  line-height: 1.8;
  text-align: center;
  border: 2px solid #00f5ff;
  background: rgba(0, 0, 0, 0.85);
  color: #00f5ff;
  max-width: 300px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.2s ease;
  letter-spacing: 0.5px;
}

.popup.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  /* keep layout space */
}

.popup.info {
  border-color: #00f5ff;
  color: #00f5ff;
}

.popup.success {
  border-color: #00ff88;
  color: #00ff88;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.popup.error {
  border-color: #ff2d78;
  color: #ff2d78;
  text-shadow: 0 0 8px rgba(255, 45, 120, 0.4);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ============================================================
   TILE GRID
============================================================ */
#grid {
  display: grid;
  grid-template-columns: repeat(3, 88px);
  grid-template-rows: repeat(3, 88px);
  gap: 8px;
}

.tile {
  width: 88px;
  height: 88px;
  background: var(--dim-color, #1a1a2e);
  border: 2px solid #333355;
  cursor: pointer;
  position: relative;
  transition: background 0.07s;
  overflow: hidden;
}

/* Pixel-art highlight square in top-left corner */
.tile::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

/* Lit state — tile is flashing or just clicked */
.tile.lit {
  background: var(--bright) !important;
  border-color: var(--bright);
  box-shadow:
    0 0 12px var(--bright),
    0 0 28px var(--bright),
    inset 0 0 8px rgba(255, 255, 255, 0.2);
}

.tile.lit::before {
  background: rgba(255, 255, 255, 0.45);
}

/* Error state — wrong answer red shake */
.tile.error {
  background: #ff2d78 !important;
  border-color: #ff2d78;
  box-shadow: 0 0 16px #ff2d78;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(4px); }
  75%  { transform: translateX(-2px); }
  90%  { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

/* Non-clickable state */
.tile.no-click {
  cursor: default;
  pointer-events: none;
}

/* ============================================================
   STATUS BAR & MULTIPLIER
============================================================ */
#status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  border: 2px solid #222244;
  background: rgba(0, 0, 0, 0.3);
}

#status-text {
  font-size: 7px;
  color: #888;
  letter-spacing: 1px;
}

#status-seq {
  font-size: 7px;
  color: #444;
}

#seq-len {
  color: #00f5ff;
}

#mult-display {
  font-size: 7px;
  color: #ff2d78;
  letter-spacing: 1px;
  opacity: 0.7;
}

/* ============================================================
   GAME OVER SCREEN
============================================================ */
#skull-emoji {
  font-size: 56px;
  animation: skullBounce 1s ease infinite alternate;
}

@keyframes skullBounce {
  from { transform: translateY(0) rotate(-5deg); }
  to   { transform: translateY(-8px) rotate(5deg); }
}

#over-headline {
  font-size: 13px;
  color: #ff2d78;
  text-shadow: 3px 3px 0 #7a0035;
  text-align: center;
  letter-spacing: 1px;
  line-height: 1.7;
}

.over-diagnosis {
  font-size: 7.5px;
  color: #888;
  text-align: center;
  max-width: 340px;
  line-height: 2;
}

.over-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  border: 2px solid #222244;
  padding: 12px 16px;
  background: rgba(0,0,0,0.3);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 7px;
  color: #555;
  letter-spacing: 1px;
}

.stat-val {
  font-size: 10px;
}

.over-tip {
  font-size: 6.5px;
  color: #444;
  text-align: center;
  max-width: 320px;
  line-height: 2;
  font-style: italic;
}

/* ============================================================
   RESPONSIVE
============================================================ */

/* Tablets / small screens */
@media (max-width: 480px) {
  #grid {
    grid-template-columns: repeat(3, 72px);
    grid-template-rows: repeat(3, 72px);
    gap: 6px;
  }

  .tile {
    width: 72px;
    height: 72px;
  }

  #menu-title {
    font-size: 12px;
  }

  #hud, #status-bar {
    max-width: 240px;
  }

  .over-stats {
    max-width: 260px;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  #grid {
    grid-template-columns: repeat(3, 58px);
    grid-template-rows: repeat(3, 58px);
    gap: 5px;
  }

  .tile {
    width: 58px;
    height: 58px;
  }

  #menu-title {
    font-size: 10px;
  }

  .btn {
    font-size: 7px;
    padding: 10px 14px;
  }
}

/* Short screens — hide the logo art */
@media (max-height: 700px) {
  #logo-art {
    display: none;
  }
}
