* {
  box-sizing:border-box;
  margin:0;
  padding:0
}

:root {
  --bg:#06050c;
  --purple:#a55cff;
  --yellow:#ffd719;
  --green:#63ff79;
  --cyan:#23dfdf;
  --text:#fff;
  --muted:rgba(255,255,255,.62)
}

html,body {
  width:100%;
  min-height:100%;
  overflow-x:hidden
}
body {
  min-height:100svh;
  color:var(--text);
  background-color:var(--bg);
  background-position:center;
  background-size:cover;
  background-attachment:fixed;
  font-family:"Segoe UI",system-ui,-apple-system,Arial,sans-serif
}
body::before {
  content:"";
  position:fixed;
  inset:0;
  z-index:-1;
  pointer-events:none;
  background:radial-gradient(circle at 50% 34%,rgba(25,18,54,.16),rgba(4,3,10,.7) 82%),rgba(3,2,8,.35)
}
button,a {
  -webkit-tap-highlight-color:transparent
}
button {
  font:inherit
}


.arcade-nav {
  position:relative;
  z-index:20;
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height:78px;
  padding:14px max(30px,7vw);
  border-bottom:1px solid rgba(255,255,255,.08);
  background:rgba(4,3,11,.38);
  backdrop-filter:blur(8px)
}
.arcade-brand {
  display:inline-flex;
  align-items:center;
  gap:12px;
  color:#fff;
  text-decoration:none;
  font-size:20px;
  font-weight:900;
  letter-spacing:.035em;
  white-space:nowrap
}
.brand-code {
  color:var(--purple);
  font-size:28px;
  letter-spacing:-.12em
}
.arcade-nav-links {
  display:flex;
  align-items:center;
  gap:3px;
  padding:6px;
  border:1px solid rgba(255,255,255,.11);
  border-radius:999px;
  background:rgba(15,12,29,.78)
}
.arcade-nav-links a {
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 15px;
  color:rgba(255,255,255,.78);
  border-radius:999px;
  text-decoration:none;
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  transition:.2s ease
}
.arcade-nav-links a:hover {
  color:#fff;
  background:rgba(123,92,255,.18);
  transform:translateY(-1px)
}
.arcade-nav-links i {
  width:17px;
  color:var(--purple);
  text-align:center
}


.invasion-page {
  width:min(1400px,94vw);
  margin:0 auto;
  padding-bottom:26px
}
.game-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-height:56px;
  padding:0 4px
}
.toolbar-link {
  color:var(--purple);
  text-decoration:none;
  font-size:13px;
  font-weight:850;
  letter-spacing:.06em
}
.toolbar-button {
  border:0;
  background:none;
  cursor:pointer
}
.toolbar-link:hover {
  color:#d3a7ff
}
.arcade-shell {
  display:grid;
  grid-template-columns:minmax(0,1.55fr) minmax(330px,.95fr);
  min-height:calc(100svh - 160px);
  overflow:hidden;
  border:1px solid rgba(181,108,255,.48);
  border-radius:28px;
  background:linear-gradient(135deg,rgba(11,8,25,.92),rgba(5,4,14,.9));
  box-shadow:0 35px 100px rgba(0,0,0,.62),inset 0 1px rgba(255,255,255,.04);
  backdrop-filter:blur(9px)
}
.board-column {
  display:flex;
  min-width:0;
  flex-direction:column;
  padding:18px 26px 20px;
  border-right:1px solid rgba(255,255,255,.08)
}


.invasion-logo {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:15px;
  min-height:70px;
  margin:0 auto 7px;
  color:#65ff72;
  font-family:"Courier New",ui-monospace,monospace;
  font-size:clamp(29px,3.2vw,48px);
  font-weight:1000;
  line-height:1;
  letter-spacing:.035em;
  text-shadow:2px 0 #17d8d8,0 3px #167a82,0 0 15px rgba(65,255,123,.36)
}
.invader-mark {
  width:clamp(25px,2.8vw,40px);
  height:auto;
  fill:#65ff72;
  filter:drop-shadow(2px 2px 0 #138c9b) drop-shadow(0 0 7px rgba(66,255,124,.5));
  shape-rendering:crispEdges
}


.game-frame {
  display:flex;
  min-height:0;
  flex:1;
  flex-direction:column;
  gap:8px
}
.game-bezel {
  position:relative;
  width:100%;
  min-height:420px;
  flex:1;
  overflow:hidden;
  border:2px solid rgba(18,104,255,.9);
  border-radius:16px;
  background:url("../sources/img/fondoSpace2.jpg") center/cover no-repeat;
  box-shadow:0 0 28px rgba(32,70,255,.22),inset 0 0 28px rgba(0,0,0,.7)
}
.game-bezel::after {
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:linear-gradient(180deg,rgba(0,0,0,.15),rgba(0,0,0,.30));
  pointer-events:none
}
#gameCanvas {
  position:relative;
  z-index:1;
  display:block;
  width:100%;
  height:100%;
  min-height:420px;
  border-radius:14px;
  background:transparent;
  touch-action:none
}
.game-hint {
  position:absolute;
  inset:0;
  z-index:2;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:12px;
  padding:20px;
  border-radius:14px;
  color:#fff;
  text-align:center;
  pointer-events:none;
  opacity:1;
  transition:opacity .25s ease;
  backdrop-filter:blur(6px)
}
.game-hint.hidden {
  opacity:0
}
.hint-title {
  font-size:26px;
  font-weight:800
}
.hint-sub {
  font-size:13px;
  line-height:1.5;
  opacity:.87
}
.game-footnote {
  padding:2px 5px;
  color:rgba(255,255,255,.6);
  font-size:11px
}


.control-column {
  display:flex;
  min-width:0;
  flex-direction:column;
  padding:24px 28px 22px
}
.desktop-stats,.mobile-stats {
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px
}
.mobile-stats {
  display:none
}
.stat-card {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  min-width:0;
  padding:12px 9px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:16px;
  background:rgba(255,255,255,.035);
  box-shadow:inset 0 1px rgba(255,255,255,.04);
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em
}
.stat-card span:last-child {
  display:flex;
  min-width:0;
  flex-direction:column;
  gap:2px
}
.stat-card b {
  color:var(--yellow);
  font-size:19px;
  line-height:1
}
.stat-icon {
  color:var(--yellow);
  font-size:22px
}
.stat-icon.green {
  color:var(--green)
}

.controls-block {
  display:grid;
  grid-template-columns:1fr 175px;
  align-items:center;
  gap:18px;
  margin:30px 0 26px
}
.control-copy h2,.score-preview h2 {
  margin-bottom:17px;
  color:var(--purple);
  font-size:15px;
  font-weight:900;
  letter-spacing:.045em
}
.control-copy p {
  margin:10px 0;
  color:rgba(255,255,255,.7);
  font-size:12px;
  line-height:1.45
}
.control-copy strong {
  color:var(--green)
}
.target-reticle {
  position:relative;
  width:150px;
  aspect-ratio:1;
  margin:auto;
  border:2px solid var(--green);
  border-radius:50%;
  box-shadow:0 0 18px rgba(48,255,132,.22),inset 0 0 16px rgba(48,255,132,.1)
}
.target-reticle::before,.target-reticle::after {
  content:"";
  position:absolute;
  background:var(--cyan);
  box-shadow:0 0 7px var(--cyan)
}
.target-reticle::before {
  top:-15px;
  bottom:-15px;
  left:50%;
  width:2px;
  transform:translateX(-50%)
}
.target-reticle::after {
  left:-15px;
  right:-15px;
  top:50%;
  height:2px;
  transform:translateY(-50%)
}
.target-reticle span {
  position:absolute;
  inset:30%;
  border:1px solid rgba(59,255,143,.75);
  border-radius:50%
}
.target-reticle span::after {
  content:"";
  position:absolute;
  inset:36%;
  border:2px solid var(--cyan);
  border-radius:50%;
  background:rgba(35,223,223,.25)
}

.action-row {
  display:grid;
  grid-template-columns:1fr;
  gap:12px
}
.arcade-action {
  min-height:48px;
  cursor:pointer;
  border:1px solid rgba(181,108,255,.45);
  border-radius:13px;
  color:var(--purple);
  background:rgba(123,92,255,.08);
  font-size:12px;
  font-weight:900;
  letter-spacing:.035em;
  transition:.2s ease
}
.arcade-action:hover {
  color:#fff;
  background:rgba(123,92,255,.19)
}
.arcade-action:active {
  transform:scale(.98)
}
.score-preview {
  margin-top:25px
}
.ranking-preview {
  overflow:hidden;
  list-style:none;
  border:1px solid rgba(255,255,255,.13);
  border-radius:13px;
  background:rgba(255,255,255,.025)
}
.ranking-preview li {
  display:grid;
  grid-template-columns:30px 1fr auto;
  gap:8px;
  padding:11px 14px;
  border-bottom:1px solid rgba(255,255,255,.1);
  font-size:13px
}
.ranking-preview li:last-child {
  border-bottom:0
}
.rank-position {
  color:var(--purple);
  font-weight:900
}
.ranking-preview li:first-child .rank-position {
  color:var(--yellow)
}
.rank-name {
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap
}
.rank-score {
  color:var(--yellow);
  font-weight:900
}
.ranking-loading,.ranking-empty {
  display:block!important;
  color:var(--muted);
  text-align:center
}


.btn-start-invasion {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:15px;
  width:100%;
  min-height:68px;
  margin-top:auto;
  padding:12px 20px;
  cursor:pointer;
  border:2px solid var(--cyan);
  border-radius:12px;
  color:var(--green);
  background:linear-gradient(180deg,rgba(10,42,45,.9),rgba(3,18,24,.96));
  box-shadow:0 0 14px rgba(35,223,223,.28),inset 0 0 22px rgba(35,223,223,.08);
  font-family:"Courier New",ui-monospace,monospace;
  font-size:25px;
  font-weight:1000;
  letter-spacing:.075em;
  text-shadow:2px 2px 0 #087b83,0 0 9px rgba(99,255,121,.55);
  transition:transform .15s ease,filter .2s ease,box-shadow .2s ease
}
.btn-start-invasion svg {
  width:31px;
  fill:var(--green);
  filter:drop-shadow(2px 2px 0 #087b83)
}
.btn-start-invasion:hover {
  filter:brightness(1.16);
  box-shadow:0 0 24px rgba(35,223,223,.43),inset 0 0 25px rgba(35,223,223,.12)
}
.btn-start-invasion:active {
  transform:scale(.985)
}


@media(max-width:1050px) {
  .invasion-page {
    width:min(96vw,850px)
  }
  .arcade-shell {
    grid-template-columns:1fr;
    overflow:visible
  }
  .board-column {
    border-right:0;
    border-bottom:1px solid rgba(255,255,255,.08)
  }
  .game-bezel,#gameCanvas {
    height:min(72vw,650px);
    min-height:520px
  }
  .control-column {
    padding:22px 30px 28px
  }
  .controls-block {
    max-width:560px;
    width:100%;
    margin:24px auto 20px
  }

}

@media(max-width:700px) {
  body {
    background-attachment:scroll
  }
  .arcade-nav {
    min-height:76px;
    padding:12px 16px
  }
  .arcade-brand {
    gap:8px;
    font-size:15px
  }
  .brand-code {
    font-size:22px
  }
  .arcade-nav-links {
    gap:0;
    padding:5px
  }
  .arcade-nav-links a {
    padding:9px 10px
  }
  .arcade-nav-links a span {
    display:none
  }
  .invasion-page {
    width:100%;
    padding-bottom:0
  }
  .game-toolbar {
    min-height:58px;
    padding:0 20px
  }
  .arcade-shell {
    min-height:0;
    border-right:0;
    border-left:0;
    border-radius:0;
    background:rgba(7,5,17,.83)
  }
  .board-column {
    padding:18px 12px 16px
  }
  .invasion-logo {
    min-height:52px;
    gap:8px;
    margin-bottom:10px;
    font-size:clamp(22px,7vw,34px)
  }
  .invader-mark {
    width:24px
  }
  .desktop-stats {
    display:none
  }
  .mobile-stats {
    display:grid;
    gap:8px;
    margin-bottom:16px
  }
  .stat-card {
    padding:10px 6px;
    border-radius:13px;
    font-size:9px
  }
  .stat-card b {
    font-size:15px
  }
  .stat-icon {
    font-size:17px
  }
  .game-bezel,#gameCanvas {
    height:82vh;
    min-height:82vh
  }
  .game-bezel {
    border-radius:13px;
    background-image:url("../sources/img/invasionMovil.png")
  }
  .control-column {
    padding:22px 16px 34px
  }
  .controls-block {
    grid-template-columns:1fr 135px;
    width:100%;
    margin:0 0 22px
  }
  .target-reticle {
    width:112px
  }
  .action-row,.score-preview {
    width:100%
  }
  .score-preview {
    margin-top:22px
  }

}

@media(max-width:390px) {
  .arcade-nav {
    padding-inline:11px
  }
  .arcade-brand {
    font-size:14px
  }
  .arcade-nav-links a {
    padding:8px
  }
  .game-toolbar {
    padding-inline:15px
  }
  .board-column {
    padding-inline:9px
  }
  .invasion-logo {
    font-size:21px
  }
  .invader-mark {
    width:20px
  }
  .controls-block {
    grid-template-columns:1fr 100px
  }
  .target-reticle {
    width:88px
  }
  .arcade-action {
    font-size:10px
  }

}

@media(max-height:800px) and (min-width:1051px) {
  .arcade-nav {
    min-height:68px;
    padding-block:9px
  }
  .game-toolbar {
    min-height:46px
  }
  .invasion-page {
    width:min(1280px,93vw)
  }
  .arcade-shell {
    min-height:calc(100svh - 128px)
  }
  .board-column {
    padding-top:10px
  }
  .invasion-logo {
    min-height:50px;
    font-size:34px
  }
  .control-column {
    padding-block:18px
  }
  .controls-block {
    margin:18px 0 14px
  }
  .target-reticle {
    width:120px
  }
  .score-preview {
    margin-top:17px
  }

}
