:root{
  --bg:#04050a;
  --panel:rgba(9,14,28,.86);
  --cyan:#31f4ff;
  --magenta:#ff4ad8;
  --lime:#9eff5a;
  --yellow:#ffe15d;
  --red:#ff5f6c;
  --text:#eef6ff;
  --muted:#97aac5;
  --border:1px solid rgba(125,170,255,.18);
  --shadow:0 0 18px rgba(49,244,255,.28), 0 0 34px rgba(255,74,216,.14);
}

*{box-sizing:border-box}
html,body{
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  background:radial-gradient(circle at center,#101a3a 0%, #05060d 50%, #020208 100%);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

#app{
  position:relative;
  width:100%;
  height:100%;
}

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

#ui{
  position:absolute;
  inset:0;
  pointer-events:none;
}

.panel{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  text-align:center;
  padding:24px;
  background:linear-gradient(180deg,rgba(4,5,10,.78),rgba(4,5,10,.92));
  pointer-events:auto;
}

.panel.visible{display:flex}

.titleWrap{
  text-align:center;
  margin-bottom:10px;
}

h1,h2{
  margin:0;
  text-transform:uppercase;
  letter-spacing:.16em;
  text-shadow:var(--shadow);
}

h1{
  font-size:clamp(2.4rem,6vw,5.2rem);
  color:var(--text);
}

h2{
  font-size:clamp(1.9rem,4vw,3rem);
  color:var(--yellow);
}

.subtitle{
  margin:10px 0 22px;
  color:var(--muted);
  letter-spacing:.08em;
}

.menuCard,.infoCard{
  width:min(640px,92vw);
  border:var(--border);
  border-radius:18px;
  padding:16px;
  background:var(--panel);
  box-shadow:var(--shadow);
  backdrop-filter:blur(8px);
}

.menuCard{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.menuBtn{
  cursor:pointer;
  border:var(--border);
  border-radius:14px;
  padding:14px 16px;
  background:linear-gradient(180deg,rgba(32,42,74,.96),rgba(13,16,32,.96));
  color:var(--text);
  font-weight:700;
  letter-spacing:.06em;
  box-shadow:var(--shadow);
  transition:transform .15s ease, border-color .15s ease, background .15s ease;
}

.menuBtn:hover{
  transform:translateY(-2px);
  border-color:rgba(49,244,255,.55);
}
.difficultyBtn.active,
.controlBtn.active{
  border-color:rgba(49,244,255,.75);
  background:linear-gradient(180deg,rgba(49,244,255,.18),rgba(13,16,32,.96));
  box-shadow:0 0 12px rgba(49,244,255,.35);
}
.infoCard{
  margin-top:16px;
  color:var(--muted);
  line-height:1.55;
}

.infoCard strong{color:var(--cyan)}

.footerHint{
  margin-top:16px;
  color:var(--muted);
}

#hud{
  position:absolute;
  left:0;
  top:0;
  width:100%;
  padding:12px;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  pointer-events:none;
  text-shadow:0 0 8px rgba(0,0,0,.8);
}

.hudBlock{
  min-width:240px;
  border:var(--border);
  border-radius:14px;
  padding:10px 12px;
  background:linear-gradient(180deg,rgba(9,14,28,.58),rgba(9,14,28,.18));
  box-shadow:var(--shadow);
  backdrop-filter:blur(8px);
}

.playerHud{
  display:none;
  min-width:300px;
  margin-bottom:10px;
}

.playerHud.visible{display:block}

.hudName{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  font-weight:700;
  margin-bottom:6px;
}

.bar{
  height:12px;
  border-radius:999px;
  overflow:hidden;
  background:rgba(255,255,255,.08);
  margin:5px 0;
  border:1px solid rgba(255,255,255,.12);
}

.fill{
  width:50%;
  height:100%;
  background:linear-gradient(90deg,var(--cyan),var(--lime));
}

.energy .fill{
  background:linear-gradient(90deg,var(--magenta),var(--yellow));
}

.ammo .fill{
  background:linear-gradient(90deg,#65b8ff,#ffffff);
}

.small{
  font-size:.82rem;
  color:var(--muted);
  line-height:1.35;
}

.abilityRow{
  display:grid;
  grid-template-columns:repeat(5,1fr);
  gap:8px;
  margin-top:8px;
}

.ability{
  position:relative;
  height:52px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.05);
  overflow:hidden;
}

.ability .icon{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  letter-spacing:.05em;
  font-size:.95rem;
  color:#fff;
  text-shadow:0 0 10px rgba(0,0,0,.8);
}

.ability .cool{
  position:absolute;
  left:0;
  bottom:0;
  width:100%;
  height:100%;
  transform-origin:bottom;
  background:rgba(0,0,0,.6);
  pointer-events:none;
}

.ability.ready{
  border-color:rgba(49,244,255,.75);
  box-shadow:0 0 10px rgba(49,244,255,.28);
}

.ability.ready .cool{
  opacity:0;
}

.ability.cooling .icon{
  opacity:.7;
}

.abilityLabel{
  position:absolute;
  left:6px;
  top:5px;
  font-size:.68rem;
  color:rgba(255,255,255,.72);
}

#toast{
  position:absolute;
  left:50%;
  bottom:26px;
  transform:translateX(-50%);
  padding:10px 16px;
  border-radius:999px;
  border:var(--border);
  background:rgba(0,0,0,.48);
  color:var(--text);
  font-weight:700;
  letter-spacing:.08em;
  opacity:0;
  transition:opacity .2s ease, transform .2s ease;
  box-shadow:var(--shadow);
}

#toast.show{
  opacity:1;
  transform:translateX(-50%) translateY(-8px);
}
.controlsDialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 0;
  color: #ffffff;
  background: rgba(8, 12, 30, 0.98);
  border: 1px solid rgba(49, 244, 255, 0.65);
  border-radius: 14px;
  box-shadow:
    0 0 30px rgba(49, 244, 255, 0.25),
    0 20px 70px rgba(0, 0, 0, 0.65);
}

.controlsDialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(4px);
}

.controlsDialogHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.controlsDialogHeader h2 {
  margin: 0;
}

.closeBtn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.closeBtn:hover {
  background: rgba(255, 80, 110, 0.35);
}

.controlsTabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 20px 0;
}

.dialogTab.active {
  border-color: #31f4ff;
  background: rgba(49, 244, 255, 0.22);
  box-shadow: 0 0 12px rgba(49, 244, 255, 0.3);
}

.dialogControls {
  padding: 18px 20px 22px;
  line-height: 1.7;
}

.dialogControls h3 {
  margin-top: 0;
  color: #31f4ff;
}

.controlsDivider {
  height: 1px;
  margin: 16px 0;
  background: rgba(255, 255, 255, 0.14);
}

@media (max-width: 600px) {
  .controlsDialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .dialogControls {
    font-size: 13px;
  }
}
#mainMenu {
  overflow-y: auto;
  overflow-x: hidden;
  justify-content: flex-start;
  padding-top: 24px;
  padding-bottom: 24px;
}

#mainMenu::-webkit-scrollbar {
  width: 10px;
}

#mainMenu::-webkit-scrollbar-track {
  background: rgba(255,255,255,.06);
}

#mainMenu::-webkit-scrollbar-thumb {
  background: rgba(49,244,255,.65);
  border-radius: 10px;
}

#mainMenu::-webkit-scrollbar-thumb:hover {
  background: rgba(49,244,255,.95);
}
.aboutDialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  color: #fff;
  background: rgba(8, 12, 30, .98);
  border: 1px solid rgba(49, 244, 255, .65);
  border-radius: 14px;
  box-shadow:
    0 0 30px rgba(49, 244, 255, .25),
    0 20px 70px rgba(0, 0, 0, .65);
}

.aboutDialog::backdrop {
  background: rgba(0, 0, 0, .76);
  backdrop-filter: blur(4px);
}

.aboutDialogHeader {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
  background: rgba(8, 12, 30, .98);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.aboutDialogHeader h2 {
  margin: 0;
}

.aboutContent {
  padding: 18px 20px 24px;
  text-align: left;
  line-height: 1.6;
}

.aboutContent section + section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}

.aboutContent h3 {
  margin: 0 0 8px;
  color: var(--cyan);
}

.aboutContent p {
  margin: 0;
  color: var(--muted);
}

.aboutDialog::-webkit-scrollbar {
  width: 10px;
}

.aboutDialog::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .06);
}

.aboutDialog::-webkit-scrollbar-thumb {
  background: rgba(49, 244, 255, .65);
  border-radius: 10px;
}

.aboutDialog::-webkit-scrollbar-thumb:hover {
  background: rgba(49, 244, 255, .95);
}

@media (max-width: 600px) {
  .aboutDialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .aboutContent {
    padding: 14px 16px 20px;
    font-size: 14px;
  }
}
.menuActions {
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: min(640px, 92vw);
  margin-top: 10px;
}

.menuActions .menuBtn {
  flex: 1;
  margin-top: 0 !important;
}
.menuBtn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(.6);
}

.menuBtn:disabled:hover {
  transform: none;
  border-color: var(--border);
}
.mobileHud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  z-index: 20;
  color: var(--text);
  pointer-events: none;
}

.mobileHudTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobileHealth {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  padding: 8px 10px;
  border: var(--border);
  border-radius: 12px;
  background: rgba(9, 14, 28, .8);
  box-shadow: var(--shadow);
  font-size: clamp(12px, 2.5vw, 18px);
  font-weight: 800;
}

.mobileHealthBar {
  flex: 1;
  height: clamp(10px, 2vw, 16px);
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}

#mobileHealthFill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--lime));
  transition: width .15s linear;
}

.touchPauseBtn,
.mobilePauseBtn {
  position: absolute;
  z-index: 100;

  width: 42px;
  height: 42px;

  padding: 0;

  border: 2px solid rgba(255, 255, 255, .55);
  border-radius: 10px;

  color: #fff;
  background: rgba(9, 14, 28, .95);

  font-size: 15px;
  font-weight: 900;

  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
}

.touchPauseBtn {
  right: max(10px, env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom));
}

.mobilePauseBtn {
  position: static;
  flex: 0 0 42px;
}

.touchPauseBtn:active,
.mobilePauseBtn:active {
  transform: scale(.9);
  background: rgba(49, 244, 255, .8);
}

.mobileStats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 10px;
  border: var(--border);
  border-radius: 10px;
  background: rgba(9, 14, 28, .68);
  font-size: clamp(10px, 2.4vw, 16px);
}
#touchControls {
  position: absolute;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
  touch-action: none;
  user-select: none;
}

.touchJoystick {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: clamp(110px, 22vw, 190px);
  height: clamp(110px, 22vw, 190px);
  border: 3px solid rgba(255, 255, 255, .35);
  border-radius: 50%;
  background: rgba(20, 30, 60, .58);
  box-shadow: 0 0 18px rgba(49, 244, 255, .25);
  pointer-events: auto;
  touch-action: none;
}

#touchJoystickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44%;
  height: 44%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, .6);
  border-radius: 50%;
  background: rgba(49, 244, 255, .78);
  box-shadow: 0 0 18px rgba(49, 244, 255, .65);
  pointer-events: none;
}

.touchActions {
  position: absolute;
  right: max(10px, env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));

  display: grid;
  grid-template-columns: repeat(2, 58px);
  gap: 6px;

  pointer-events: auto;
}

.touchAction {
  width: 58px;
  height: 42px;

  padding: 0;

  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 10px;

  color: #fff;
  background: rgba(25, 35, 70, .88);

  font-size: 9px;
  font-weight: 900;

  touch-action: none;
  user-select: none;
}

.touchAction.fireTouch {
  grid-column: span 2;

  width: 122px;
  height: 48px;

  font-size: 13px;
  background: rgba(190, 45, 65, .9);
}

.touchAction:active {
  transform: scale(.92);
  filter: brightness(1.3);
}

.touchPauseBtn,
.mobilePauseBtn {
  width: 38px;
  height: 38px;

  padding: 0;

  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 9px;

  color: #fff;
  background: rgba(9, 14, 28, .88);

  font-size: 14px;
}
#touchControls[hidden],
#mobileHud[hidden] {
  display: none !important;
}
#touchControls {
  touch-action: none;
  user-select: none;
}

.touchJoystick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: calc(20px + env(safe-area-inset-bottom));

  width: 150px;
  height: 150px;

  border: 3px solid rgba(255, 255, 255, .35);
  border-radius: 50%;

  background: rgba(20, 35, 75, .72);
  box-shadow:
    0 0 18px rgba(49, 244, 255, .3),
    inset 0 0 20px rgba(49, 244, 255, .12);

  pointer-events: auto;
  touch-action: none;
}

#touchJoystickKnob {
  position: absolute;
  left: 50%;
  top: 50%;

  width: 66px;
  height: 66px;

  transform: translate(-50%, -50%);

  border: 2px solid rgba(255, 255, 255, .7);
  border-radius: 50%;

  background: rgba(49, 244, 255, .82);
  box-shadow: 0 0 20px rgba(49, 244, 255, .8);

  pointer-events: none;
  touch-action: none;
}

@media (max-width: 600px) {
  .touchJoystick {
    width: 130px;
    height: 130px;
  }

  #touchJoystickKnob {
    width: 58px;
    height: 58px;
  }
}
#mobileHud[hidden],
#touchControls[hidden] {
  display: none !important;
}

#touchControls:not(.isVisible),
#mobileHud:not(.isVisible) {
  display: none !important;
}

body.cellphoneMode #hud {
  display: none !important;
}

body.cellphoneMode #mobileHud.isVisible {
  display: block !important;
}

body.cellphoneMode #touchControls.isVisible {
  display: block !important;
}
/* Oculta el HUD normal en modo celular */
body.cellphoneMode #hud {
  display: none !important;
}

/* Oculta el HUD y controles móviles cuando corresponda */
#mobileHud[hidden],
#touchControls[hidden] {
  display: none !important;
}
.turboTouch {
  color: #111;
  background: #ffe15d;
  border-color: #fff0a3;
  box-shadow: 0 0 12px rgba(255, 225, 93, .45);
}

.turboTouch:active {
  background: #fff1a8;
  box-shadow: 0 0 20px rgba(255, 225, 93, .9);
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

#app,
#game,
#ui,
#touchControls {
  touch-action: none;
}
#touchPauseBtn {
  display: none !important;
}
.abilityTouch {
  position: relative;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 3px;
}

.abilityTouch span {
  font-size: 9px;
  font-weight: 900;
}

.abilityTouch small {
  color: #9eff5a;
  font-size: 10px;
  font-weight: 900;
}

.abilityTouch.cooling {
  filter: grayscale(.65);
  opacity: .65;
}

.abilityTouch.cooling small {
  color: #ffe15d;
}

.abilityTouch.ready {
  box-shadow:
    0 0 10px rgba(158, 255, 90, .35);
}
