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


*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:             #0d0d0d;
  --frame-bg:       #12122a;
  --frame-border:   #2a2a5a;
  --screen-bg:      #050510;

  --text-bright:    #00ff88;
  --text-mid:       #006644;
  --text-dim:       #1a4433;
  --text-accent:    #00ffcc;

  --red:            #991111;
  --red-lit:        #ff2222;
  --red-glow:       rgba(255, 34, 34, 0.75);
  --red-border:     #550000;

  --blue:           #111499;
  --blue-lit:       #2244ff;
  --blue-glow:      rgba(34, 68, 255, 0.75);
  --blue-border:    #000055;

  --green:          #116611;
  --green-lit:      #22ff22;
  --green-glow:     rgba(34, 255, 34, 0.75);
  --green-border:   #004400;

  --yellow:         #998800;
  --yellow-lit:     #ffee00;
  --yellow-glow:    rgba(255, 238, 0, 0.75);
  --yellow-border:  #554400;

  --font:           'Press Start 2P', monospace;
  --radius-frame:   8px 8px 36px 36px;
  --shadow-px:      4px 4px 0 #000;
}

html, body {
  min-height: 100%;
  font-family: var(--font);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(0,255,100,0.04) 0%, transparent 60%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 4px);
  color: var(--text-bright);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  justify-content: center;
  align-items: center;
  padding: 20px 12px;
}

.screen--active {
  display: flex;
  animation: screenFadeIn 0.35s ease-out forwards;
}

@keyframes screenFadeIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.game-boy-frame {
  background: var(--frame-bg);
  border: 3px solid var(--frame-border);
  border-radius: var(--radius-frame);
  box-shadow:
    var(--shadow-px),
    6px 6px 0 #080808,
    0 0 0 1px #0a0a1a,
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 0 40px rgba(0, 255, 136, 0.06);
  width: 100%;
  max-width: 400px;
  padding: 22px 18px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.game-boy-frame::before {
  content: '';
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--text-accent), transparent);
  opacity: 0.3;
  border-radius: 0 0 2px 2px;
}

.frame-header {
  text-align: center;
}

.game-title {
  font-size: clamp(1.4rem, 5.5vw, 2rem);
  color: var(--text-accent);
  text-shadow:
    0 0 12px var(--text-accent),
    0 0 28px rgba(0, 255, 204, 0.4),
    3px 3px 0 #005540,
    var(--shadow-px);
  line-height: 1.7;
  letter-spacing: 6px;
}

.game-subtitle {
  font-size: 0.4rem;
  color: var(--text-dim);
  margin-top: 8px;
  letter-spacing: 2px;
}

.game-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.info-pseudo {
  font-size: 0.5rem;
  color: var(--text-accent);
  text-shadow: 0 0 8px var(--text-accent);
  text-transform: uppercase;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.difficulty-badge {
  font-size: 0.38rem;
  background: rgba(0, 255, 136, 0.07);
  color: var(--text-bright);
  border: 2px solid var(--text-mid);
  padding: 3px 7px;
  box-shadow: 1px 1px 0 #000;
  letter-spacing: 1px;
  text-shadow: 0 0 6px var(--text-bright);
}

.frame-screen {
  background: var(--screen-bg);
  border: 3px solid #0a0a22;
  border-radius: 3px;
  padding: 14px 16px;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.9),
    inset 0 0 6px rgba(0, 255, 80, 0.04);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.score-screen {
  padding: 10px 16px;
}

.score-divider {
  font-size: 0.8rem;
  color: var(--text-dim);
  opacity: 0.5;
}

.score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.score-label {
  font-size: 0.38rem;
  color: var(--text-mid);
  letter-spacing: 1px;
}

.score-value {
  font-size: 1rem;
  color: var(--text-bright);
  text-shadow: 0 0 10px var(--text-bright);
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
}

.score-value--big {
  font-size: 1.2rem;
}

.status-bar {
  min-height: 1.4em;
  text-align: center;
}

.status-message {
  font-size: 0.42rem;
  color: var(--text-accent);
  text-shadow: 0 0 8px var(--text-accent);
  letter-spacing: 2px;
  animation: blink 1.2s step-end infinite;
}

.status-message.static {
  animation: none;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 4px;
}

.color-btn {
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  cursor: pointer;
  border: 3px solid transparent;
  outline: none;
  transition: transform 0.06s ease, box-shadow 0.1s ease;
  min-height: 78px;
  position: relative;
}

.color-btn::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  pointer-events: none;
}

.color-btn:focus-visible {
  outline: 3px solid white;
  outline-offset: 3px;
}

.color-btn--red {
  background: var(--red);
  border-color: var(--red-border);
  box-shadow: var(--shadow-px), 0 0 6px rgba(153,17,17,0.4);
}
.color-btn--red.lit,
.color-btn--red:active {
  background: var(--red-lit);
  border-color: #880000;
  box-shadow:
    2px 2px 0 #440000,
    0 0 18px var(--red-glow),
    0 0 40px rgba(255,34,34,0.35);
  transform: translateY(3px) scale(0.97);
}

.color-btn--blue {
  background: var(--blue);
  border-color: var(--blue-border);
  box-shadow: var(--shadow-px), 0 0 6px rgba(17,20,153,0.4);
}
.color-btn--blue.lit,
.color-btn--blue:active {
  background: var(--blue-lit);
  border-color: #001188;
  box-shadow:
    2px 2px 0 #000044,
    0 0 18px var(--blue-glow),
    0 0 40px rgba(34,68,255,0.35);
  transform: translateY(3px) scale(0.97);
}

.color-btn--green {
  background: var(--green);
  border-color: var(--green-border);
  box-shadow: var(--shadow-px), 0 0 6px rgba(17,102,17,0.4);
}
.color-btn--green.lit,
.color-btn--green:active {
  background: var(--green-lit);
  border-color: #007700;
  box-shadow:
    2px 2px 0 #003300,
    0 0 18px var(--green-glow),
    0 0 40px rgba(34,255,34,0.35);
  transform: translateY(3px) scale(0.97);
}

.color-btn--yellow {
  background: var(--yellow);
  border-color: var(--yellow-border);
  box-shadow: var(--shadow-px), 0 0 6px rgba(153,136,0,0.4);
}
.color-btn--yellow.lit,
.color-btn--yellow:active {
  background: var(--yellow-lit);
  border-color: #886600;
  box-shadow:
    2px 2px 0 #553300,
    0 0 18px var(--yellow-glow),
    0 0 40px rgba(255,238,0,0.35);
  transform: translateY(3px) scale(0.97);
}

.color-btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}
.color-btn:disabled.lit {
  cursor: default;
}

.frame-footer {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

.speaker-dots {
  display: grid;
  grid-template-columns: repeat(3, 8px);
  gap: 6px;
}

.speaker-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0a0a1e;
  border: 1px solid #1a1a3e;
  box-shadow: inset 1px 1px 2px #000;
}

.keyboard-hints {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.hint-key {
  font-size: 0.42rem;
  background: #111130;
  border: 2px solid #2a2a55;
  padding: 3px 6px;
  color: #7777bb;
  box-shadow: 1px 1px 0 #000;
  line-height: 1;
}

.hint-color {
  font-size: 0.75rem;
  margin-right: 4px;
}

.hint-red    { color: var(--red-lit);    text-shadow: 0 0 6px var(--red-glow); }
.hint-blue   { color: var(--blue-lit);   text-shadow: 0 0 6px var(--blue-glow); }
.hint-green  { color: var(--green-lit);  text-shadow: 0 0 6px var(--green-glow); }
.hint-yellow { color: var(--yellow-lit); text-shadow: 0 0 6px var(--yellow-glow); }

.home-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.42rem;
  color: var(--text-mid);
  letter-spacing: 2px;
}

.form-input,
.form-select {
  font-family: var(--font);
  font-size: 0.58rem;
  background: #060611;
  color: var(--text-bright);
  border: 3px solid var(--text-mid);
  padding: 10px 12px;
  outline: none;
  width: 100%;
  box-shadow: var(--shadow-px);
  appearance: none;
  -webkit-appearance: none;
  text-transform: uppercase;
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--text-bright);
  box-shadow: var(--shadow-px), 0 0 12px rgba(0, 255, 136, 0.18);
}

.select-wrapper {
  position: relative;
  display: block;
}

.select-wrapper .form-select {
  padding-right: 36px;
  cursor: pointer;
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.5rem;
  color: var(--text-mid);
  pointer-events: none;
}

.btn {
  font-family: var(--font);
  font-size: 0.6rem;
  padding: 13px 18px;
  border: 3px solid;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 100%;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.1s;
  line-height: 1;
}

.btn--primary {
  background: #002211;
  color: var(--text-bright);
  border-color: var(--text-bright);
  box-shadow: var(--shadow-px), 0 0 12px rgba(0, 255, 136, 0.12);
  text-shadow: 0 0 8px var(--text-bright);
}

.btn--primary:hover {
  background: #003318;
  box-shadow: var(--shadow-px), 0 0 20px rgba(0, 255, 136, 0.25);
}

.btn--primary:active {
  transform: translateY(4px);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.12);
}

.btn--secondary {
  background: #0a0a20;
  color: var(--text-accent);
  border-color: #335577;
  box-shadow: var(--shadow-px);
}

.btn--secondary:hover {
  background: #111133;
  border-color: var(--text-accent);
  box-shadow: var(--shadow-px), 0 0 14px rgba(0, 255, 204, 0.15);
}

.btn--secondary:active {
  transform: translateY(4px);
  box-shadow: none;
}

.gameover-title {
  font-size: clamp(1.3rem, 5.5vw, 1.9rem);
  color: #ff2222;
  text-shadow:
    0 0 16px #ff2222,
    0 0 32px rgba(255, 34, 34, 0.5),
    3px 3px 0 #660000,
    var(--shadow-px);
  line-height: 1.7;
  letter-spacing: 5px;
  animation: glitch 3s infinite;
  text-align: center;
}

@keyframes glitch {
  0%, 88%, 100% { transform: translate(0, 0); filter: none; }
  90%  { transform: translate(-3px, 1px);  filter: hue-rotate(10deg); }
  92%  { transform: translate(3px, -1px);  filter: hue-rotate(-10deg); }
  94%  { transform: translate(-2px, 2px);  filter: brightness(1.3); }
  96%  { transform: translate(2px, -2px);  filter: none; }
}

.gameover-screen {
  flex-direction: column;
  gap: 14px;
}

.gameover-pseudo {
  font-size: 0.55rem;
  color: var(--text-accent);
  text-shadow: 0 0 8px var(--text-accent);
  text-align: center;
  text-transform: uppercase;
}

.gameover-scores {
  display: flex;
  justify-content: space-around;
  width: 100%;
  gap: 12px;
}

.gameover-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px;
}

.new-record {
  font-size: 0.42rem;
  color: var(--yellow-lit);
  text-shadow: 0 0 10px var(--yellow-glow);
  text-align: center;
  letter-spacing: 2px;
  animation: pulse 0.8s ease-in-out infinite alternate;
}

.new-record.hidden {
  visibility: hidden;
}

@keyframes pulse {
  from { opacity: 0.6; transform: scale(0.97); }
  to   { opacity: 1;   transform: scale(1.03); }
}

@media (max-width: 480px) {
  .game-boy-frame {
    max-width: 100%;
    padding: 18px 14px 22px;
    border-radius: 6px 6px 28px 28px;
    gap: 12px;
  }

  .color-btn {
    min-height: 68px;
  }

  .buttons-grid {
    gap: 8px;
    padding: 0;
  }

  .game-title {
    font-size: 1.3rem;
  }

  .score-value {
    font-size: 0.85rem;
  }

  .score-value--big {
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  .color-btn {
    min-height: 60px;
  }

  .game-title {
    font-size: 1.1rem;
  }

  .btn {
    font-size: 0.52rem;
    padding: 11px 14px;
  }
}

.buttons-grid {
  user-select: none;
  -webkit-user-select: none;
}
