:root {
  --bg-overlay-1: rgba(88, 26, 128, 0.22);
  --bg-overlay-2: rgba(20, 8, 42, 0.42);

  --panel-main: rgba(119, 40, 173, 0.72);
  --panel-secondary: rgba(255, 79, 207, 0.18);
  --panel-dark: rgba(42, 12, 72, 0.8);
  --panel-deep: rgba(22, 8, 42, 0.88);

  --neon-pink: #ff4fcf;
  --hot-pink: #ff7bdf;
  --neon-purple: #9b5cff;
  --deep-purple: #6326b8;
  --mint-green: #49ffd8;
  --neon-green: #2dffb7;
  --neon-yellow: #ffe85b;
  --soft-cyan: #77eaff;
  --white: #ffffff;
  --soft-white: #fff7fe;
  --glass-line: rgba(255, 255, 255, 0.16);

  --shadow-pink: rgba(255, 79, 207, 0.34);
  --shadow-purple: rgba(155, 92, 255, 0.28);
  --shadow-green: rgba(73, 255, 216, 0.24);
  --shadow-yellow: rgba(255, 232, 91, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  font-family: "Press Start 2P", monospace;
  color: var(--white);
  background:
    linear-gradient(to bottom, var(--bg-overlay-1), var(--bg-overlay-2)),
    url("img/fondomamamoo.png") center center / cover no-repeat;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
  touch-action: manipulation;
  padding-bottom: 80px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(255, 105, 220, 0.16), transparent 28%),
    radial-gradient(circle at bottom left, rgba(73, 255, 216, 0.12), transparent 25%),
    radial-gradient(circle at bottom right, rgba(155, 92, 255, 0.15), transparent 28%);
  pointer-events: none;
  z-index: 0;
}

/* =========================
   CONTENEDOR GENERAL
========================= */
.game-wrapper {
  position: relative;
  z-index: 1;
  width: min(1360px, 95vw);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 14px 24px;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 10px;
  transform: scale(0.8);
  transform-origin: top center;
  margin-top: 10px;
}

.game-main {
  display: grid;
  gap: 10px;
  align-content: start;
}

/* =========================
   HEADER
========================= */
.game-header {
  background: linear-gradient(135deg, rgba(12, 12, 12, 0.86), rgba(0, 0, 0, 0.78));
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  text-align: center;
  padding: 24px 18px 18px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    inset 0 12px 20px rgba(255,255,255,0.05),
    0 0 20px var(--shadow-pink),
    0 0 36px rgba(155, 92, 255, 0.2);
  backdrop-filter: blur(10px);
}

.game-header h1 {
  font-size: clamp(24px, 2.2vw, 38px);
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: 2px;
  text-shadow:
    0 0 8px rgba(255,255,255,0.3),
    0 0 18px rgba(255, 79, 207, 0.4);
}

.game-header p {
  font-size: clamp(9px, 0.9vw, 12px);
  color: #ffffff;
  line-height: 1.8;
}

/* =========================
   HUD
========================= */
.hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.hud-box {
  min-height: 86px;
  background: linear-gradient(180deg, rgba(116, 42, 175, 0.86), rgba(61, 18, 112, 0.88));
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 20px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.04),
    inset 0 10px 18px rgba(255,255,255,0.04),
    0 0 14px rgba(255, 79, 207, 0.14),
    0 0 24px rgba(155, 92, 255, 0.12);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px 8px;
  text-align: center;
}

.hud-box span {
  font-size: clamp(9px, 0.88vw, 12px);
  color: #ffe4fa;
  margin-bottom: 10px;
  text-shadow: 0 0 6px rgba(255, 79, 207, 0.15);
}

.hud-box strong {
  font-size: clamp(18px, 1.45vw, 24px);
  color: #ffffff;
  text-shadow:
    0 0 8px rgba(255,255,255,0.22),
    0 0 12px rgba(73, 255, 216, 0.14);
}

/* =========================
   CONTENEDOR DEL JUEGO
========================= */
.game-container {
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

/* =========================
   ÁREA DEL JUEGO
========================= */
#game-area {
  position: relative;
  width: 740px;
  max-width: 92vw;
  height: 460px;
  margin: 0 auto;
  border-radius: 28px;
  overflow: hidden;
  background: rgba(26, 8, 60, 0.72);
  border: 3px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 0 18px rgba(180, 90, 255, 0.25),
    inset 0 0 30px rgba(255, 255, 255, 0.04);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

#game-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(255,255,255,0.04), transparent 18%),
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.03) 0px,
      rgba(255,255,255,0.03) 2px,
      transparent 2px,
      transparent 16px
    );
  pointer-events: none;
  z-index: 1;
}

/* =========================
   CARRILES
========================= */
.lane {
  position: relative;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(to bottom, rgba(255,255,255,0.015), rgba(255,255,255,0));
}

.lane::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(255, 95, 210, 0.14),
    rgba(170, 100, 255, 0.2),
    rgba(255, 95, 210, 0.14)
  );
  box-shadow:
    0 0 8px rgba(255, 79, 207, 0.15),
    0 0 16px rgba(155, 92, 255, 0.1);
  pointer-events: none;
}

.lane:last-child {
  border-right: none;
}

.lane:last-child::before {
  display: none;
}

.lane:nth-child(1) {
  background: linear-gradient(to bottom, rgba(255, 79, 207, 0.05), rgba(255,255,255,0));
}

.lane:nth-child(2) {
  background: linear-gradient(to bottom, rgba(73, 255, 216, 0.05), rgba(255,255,255,0));
}

.lane:nth-child(3) {
  background: linear-gradient(to bottom, rgba(255, 232, 91, 0.05), rgba(255,255,255,0));
}

.lane:nth-child(4) {
  background: linear-gradient(to bottom, rgba(112, 236, 255, 0.05), rgba(255,255,255,0));
}

.lane.active-hit::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.04),
    rgba(255, 79, 207, 0.07)
  );
  box-shadow:
    inset 0 0 18px rgba(255,255,255,0.07),
    inset 0 -40px 50px rgba(255, 79, 207, 0.08),
    0 0 18px rgba(255, 79, 207, 0.1);
  pointer-events: none;
  z-index: 3;
}

/* =========================
   LÍNEA DE JUICIO
========================= */
#judgment-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 58px;
  height: 6px;
  background: linear-gradient(
    90deg,
    #ff5fd2 0%,
    #ffffff 50%,
    #9f73ff 100%
  );
  box-shadow:
    0 0 10px rgba(255, 95, 210, 0.45),
    0 0 18px rgba(159, 115, 255, 0.35),
    0 0 26px rgba(255, 255, 255, 0.14);
  z-index: 10;
  transition: all 0.12s ease;
}

#judgment-line.line-flash {
  height: 8px;
  filter: brightness(1.15);
  box-shadow:
    0 0 14px rgba(255, 95, 210, 0.68),
    0 0 24px rgba(159, 115, 255, 0.52),
    0 0 34px rgba(255, 255, 255, 0.22);
}

/* =========================
   FLECHAS INTEGRADAS DENTRO DEL JUEGO
========================= */
.hit-zone-controls {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  z-index: 12;
}

.hit-btn {
  height: 42px;
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  line-height: 1;
  color: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 8, 42, 0.36);
  backdrop-filter: blur(6px);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 0 10px rgba(155, 92, 255, 0.08);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  touch-action: manipulation;
}

.hit-left {
  color: rgba(255, 210, 245, 0.95);
}

.hit-down {
  color: rgba(210, 255, 247, 0.95);
}

.hit-up {
  color: rgba(255, 245, 190, 0.96);
}

.hit-right {
  color: rgba(220, 245, 255, 0.96);
}

.hit-btn:active,
.hit-btn.active {
  transform: scale(0.95);
  filter: brightness(1.18);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    0 0 12px rgba(255,255,255,0.16),
    0 0 18px rgba(255, 79, 207, 0.16);
}

.hit-left.active {
  background: linear-gradient(135deg, rgba(255, 73, 190, 0.45), rgba(204, 88, 255, 0.35));
}

.hit-down.active {
  background: linear-gradient(135deg, rgba(73, 255, 216, 0.4), rgba(117, 234, 255, 0.34));
}

.hit-up.active {
  background: linear-gradient(135deg, rgba(255, 232, 91, 0.42), rgba(255, 176, 71, 0.34));
}

.hit-right.active {
  background: linear-gradient(135deg, rgba(112, 236, 255, 0.4), rgba(113, 184, 255, 0.34));
}

/* =========================
   NOTAS
========================= */
.note {
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  top: 0;
  z-index: 6;
  will-change: transform;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: bold;
  color: white;
  box-shadow:
    0 0 12px rgba(255,255,255,0.25),
    0 0 20px rgba(255,110,220,0.35);
  border: 2px solid rgba(255,255,255,0.22);
  backdrop-filter: blur(4px);
}

.note.left {
  background: linear-gradient(180deg, #ff6adf, #d94dff);
}

.note.down {
  background: linear-gradient(180deg, #7ef6ef, #63cfff);
}

.note.up {
  background: linear-gradient(180deg, #ffd95e, #ffb84d);
}

.note.right {
  background: linear-gradient(180deg, #7dc8ff, #7a8cff);
}

.note::before {
  content: "✦";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.82);
  font-size: 14px;
  text-shadow:
    0 0 8px rgba(255,255,255,0.35),
    0 0 12px rgba(255, 79, 207, 0.22);
}

.note.missed {
  background: linear-gradient(180deg, #ff6b6b, #ff2e63) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  box-shadow:
    0 0 10px rgba(255, 80, 80, 0.5),
    0 0 22px rgba(255, 40, 40, 0.65) !important;
  transform: scale(1.08);
}

.note.hit-bad {
  background: linear-gradient(180deg, #ff8a8a, #ff3d3d) !important;
  border-color: rgba(255,255,255,0.35) !important;
  box-shadow:
    0 0 8px rgba(255, 70, 70, 0.45),
    0 0 18px rgba(255, 50, 50, 0.55) !important;
}

/* =========================
   BOTONES
========================= */
.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 2px;
  padding-bottom: 0;
}

.actions button,
.claim-btn {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(9px, 0.82vw, 11px);
  padding: 12px 16px;
  min-width: 180px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.18);
  cursor: pointer;
  text-transform: uppercase;
  transition: 0.16s ease;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

#start-btn,
#restart-btn,
.claim-btn {
  background: linear-gradient(135deg, rgba(255, 89, 198, 0.96), rgba(124, 88, 255, 0.92));
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    inset 0 10px 14px rgba(255,255,255,0.05),
    0 0 14px rgba(255, 79, 207, 0.24),
    0 0 24px rgba(155, 92, 255, 0.14);
  text-shadow: 0 0 8px rgba(255,255,255,0.18);
}

#start-btn:hover,
#restart-btn:hover,
.claim-btn:hover {
  transform: translateY(-2px) scale(1.01);
  filter: brightness(1.08);
}

/* =========================
   FEEDBACK
========================= */
.message-area {
  display: flex;
  justify-content: center;
  align-items: center;
}

#live-feedback {
  width: min(760px, 92vw);
  min-height: 56px;
  background: linear-gradient(180deg, rgba(70, 20, 122, 0.88), rgba(30, 8, 60, 0.88));
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  color: var(--soft-white);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 16px;
  font-size: clamp(10px, 0.88vw, 12px);
  text-transform: uppercase;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 0 14px rgba(255, 79, 207, 0.1);
  backdrop-filter: blur(8px);
}

/* =========================
   RESULTADO
========================= */
.result-panel {
  width: min(760px, 92vw);
  margin: 0 auto;
  background:
    linear-gradient(135deg, rgba(255, 77, 196, 0.18), rgba(111, 78, 255, 0.24)),
    rgba(54, 16, 98, 0.84);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 18px 16px;
  text-align: center;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 0 18px rgba(255, 79, 207, 0.14),
    0 0 28px rgba(155, 92, 255, 0.12);
  backdrop-filter: blur(10px);
}

.result-panel h2 {
  font-size: clamp(12px, 1vw, 15px);
  margin-bottom: 14px;
  color: #fff4fd;
  text-shadow: 0 0 8px rgba(255, 79, 207, 0.18);
}

.result-panel p {
  font-size: clamp(9px, 0.82vw, 11px);
  line-height: 1.8;
  color: #fff;
  margin-bottom: 8px;
}

.result-panel strong {
  color: var(--neon-yellow);
  text-shadow: 0 0 10px rgba(255, 232, 91, 0.2);
}

.hidden {
  display: none !important;
}

/* =========================
   FEEDBACKS DE TEXTO
========================= */
.feedback-perfect {
  color: #5fffe0 !important;
  text-shadow: 0 0 10px rgba(95, 255, 224, 0.4);
}

.feedback-good {
  color: #ffe97c !important;
  text-shadow: 0 0 10px rgba(255, 233, 124, 0.34);
}

.feedback-miss {
  color: #ffb9ef !important;
  text-shadow: 0 0 8px rgba(255, 185, 239, 0.28);
}

/* =========================
   FOOTER
========================= */
.disclaimer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 10px;
  line-height: 1.4;
  color: #d8cfe6;
  font-family: Arial, sans-serif;
  padding: 8px 14px;
  background: rgba(0,0,0,0.45);
  box-sizing: border-box;
  z-index: 999;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px) {
  .game-wrapper {
    width: 97vw;
    gap: 10px;
    padding: 12px 10px 24px;
  }

  .hud {
    gap: 10px;
  }

  #game-area,
  #live-feedback,
  .result-panel {
    width: min(94vw, 700px);
  }
}

@media (max-width: 900px) {
  .game-wrapper {
    transform: scale(0.78);
  }

  .game-header h1 {
    font-size: clamp(20px, 2.1vw, 30px);
  }

  .game-header p {
    font-size: clamp(8px, 0.9vw, 10px);
  }

  .hud {
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .hud-box {
    min-height: 76px;
  }

  .hud-box strong {
    font-size: clamp(15px, 1.2vw, 20px);
  }

  #game-area {
    height: 420px;
    min-height: 360px;
  }

  #judgment-line {
    bottom: 54px;
  }

  .hit-zone-controls {
    gap: 8px;
  }

  .hit-btn {
    height: 40px;
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow-y: auto;
  }

  body {
    display: block;
    padding-bottom: 70px;
  }

  .game-wrapper {
    transform: none;
    width: 100%;
    min-height: 100vh;
    padding: 10px 8px 30px;
    gap: 8px;
    margin-top: 0;
  }

  .game-header,
  .hud-box,
  #live-feedback,
  .result-panel,
  .actions button,
  .claim-btn,
  .hit-btn {
    border-width: 2px;
  }

  .game-header {
    padding: 18px 12px 14px;
    border-radius: 18px;
  }

  .game-header h1 {
    font-size: clamp(16px, 5vw, 24px);
    letter-spacing: 1px;
  }

  .game-header p {
    font-size: 8px;
    line-height: 1.7;
  }

  .hud {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  #game-area,
  #live-feedback,
  .result-panel {
    width: min(96vw, 420px);
  }

  #game-area {
    height: 320px;
    min-height: 280px;
    border-width: 2px;
    border-radius: 18px;
  }

  #judgment-line {
    bottom: 54px;
    height: 5px;
  }

  #judgment-line.line-flash {
    height: 7px;
  }

  .hit-zone-controls {
    left: 8px;
    right: 8px;
    bottom: 8px;
    gap: 6px;
  }

  .hit-btn {
    height: 38px;
    border-radius: 10px;
    font-size: 15px;
  }

  .actions {
    margin-top: 8px;
    padding-bottom: 10px;
  }

  .actions button,
  .claim-btn {
    min-width: 150px;
    padding: 10px 12px;
    font-size: 8px;
  }

  #live-feedback {
    min-height: 48px;
    font-size: 8px;
    padding: 10px;
  }

  .result-panel h2 {
    font-size: 10px;
  }

  .result-panel p {
    font-size: 8px;
  }

  .note {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .note::before {
    font-size: 12px;
  }

  .disclaimer {
    font-size: 8px;
    padding: 6px 10px;
  }
}

@media (max-width: 420px) {
  .hud {
    grid-template-columns: repeat(2, 1fr);
  }

  .hud-box {
    min-height: 68px;
    padding: 8px 6px;
  }

  .hud-box span {
    font-size: 8px;
    margin-bottom: 8px;
  }

  .hud-box strong {
    font-size: 14px;
  }

  #game-area {
    height: 280px;
  }

  #judgment-line {
    bottom: 50px;
  }

  .hit-zone-controls {
    gap: 5px;
  }

  .hit-btn {
    height: 34px;
    font-size: 13px;
  }
}

#judgment-line.error {
  height: 7px;
  background: linear-gradient(90deg, #ff2e63 0%, #ff8a8a 50%, #ff2e63 100%);
  box-shadow:
    0 0 10px rgba(255, 46, 99, 0.75),
    0 0 22px rgba(255, 80, 80, 0.55),
    0 0 34px rgba(255, 255, 255, 0.2);
  filter: brightness(1.08);
}