:root {
  --bg: #050816;
  --bg-2: #0b1026;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.13);
  --text: #f8fbff;
  --muted: #aab7d4;
  --cyan: #28e7ff;
  --blue: #3b82f6;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --gold: #fbbf24;
  --line: rgba(255, 255, 255, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(40, 231, 255, 0.20), transparent 32%),
    radial-gradient(circle at 85% 12%, rgba(139, 92, 246, 0.22), transparent 34%),
    radial-gradient(circle at 70% 85%, rgba(236, 72, 153, 0.15), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.page {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 34px;
  z-index: 1;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(5, 8, 22, 0.55);
  backdrop-filter: blur(18px);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: white;
  font-weight: 950;
  font-size: 26px;
  box-shadow: 0 0 32px rgba(40, 231, 255, 0.35);
}

.brand strong {
  display: block;
  letter-spacing: -0.03em;
  font-size: 20px;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border-radius: 999px;
  color: #dffcff;
  border: 1px solid rgba(40, 231, 255, 0.35);
  background: rgba(40, 231, 255, 0.09);
  font-size: 13px;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 rgba(40, 231, 255, 0.7);
  animation: pulse 1.5s infinite;
}

.hero {
  min-height: 660px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 36px;
  padding: 70px 0 42px;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 999px;
  color: #e9ddff;
  background: rgba(139, 92, 246, 0.13);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
}

h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(42px, 7vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  word-spacing: 0.08em;
}

h1 span,
h2 span {
  background: linear-gradient(90deg, var(--cyan), var(--blue), var(--violet), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy > p,
.lead-card p {
  max-width: 680px;
  margin: 26px 0 0;
  font-size: 19px;
  line-height: 1.75;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

.button {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  color: white;
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.button:hover { transform: translateY(-2px); }

.primary {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 14px 44px rgba(59, 130, 246, 0.35);
}

.secondary,
.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 34px;
}

.cards article,
.terminal-card,
.game-panel,
.mission-card,
.lead-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, var(--card-strong), var(--card));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.cards article { padding: 18px; }

.cards strong {
  display: block;
  font-size: 16px;
  margin-bottom: 8px;
}

.cards p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.hero-visual { display: grid; place-items: center; }

.terminal-card {
  width: min(100%, 430px);
  overflow: hidden;
  transform: rotate(2deg);
}

.terminal-top {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.terminal-top span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-top span:nth-child(1) { background: #ff5f57; }
.terminal-top span:nth-child(2) { background: #ffbd2e; }
.terminal-top span:nth-child(3) { background: #28c840; }

pre {
  margin: 0;
  padding: 24px;
  color: #d9fbff;
  font-size: 16px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.lead-section {
  padding: 16px 0 54px;
}

.lead-card {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 26px;
  padding: 28px;
}

h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
  letter-spacing: -0.035em;
  word-spacing: 0.05em;
}

.lead-form {
  display: grid;
  gap: 12px;
}

input,
select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  padding: 0 16px;
  font-size: 15px;
}

select option {
  background: #11172f;
}

.form-message {
  min-height: 26px;
  color: var(--muted);
  font-weight: 700;
}

.game-section { padding: 20px 0 50px; }

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.section-title p {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.7;
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.game-panel { padding: 18px; }

.player-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.scoreboard div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--line);
}

.scoreboard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.scoreboard strong { font-size: 30px; }

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 22px;
  border: 1px solid rgba(40, 231, 255, 0.18);
  background:
    radial-gradient(circle at 50% 50%, rgba(40, 231, 255, 0.10), transparent 38%),
    linear-gradient(135deg, rgba(5,8,22,0.96), rgba(13,19,45,0.96));
}

.mission-card { padding: 22px; }

.mission-card h3 {
  margin: 0 0 12px;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.mission-card p,
.mission-card li {
  color: var(--muted);
  line-height: 1.65;
}

.mission-card ul { padding-left: 20px; }

.message {
  margin-top: 18px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(40, 231, 255, 0.25);
  background: rgba(40, 231, 255, 0.08);
  color: #e6fdff;
  font-weight: 750;
}

.ranking {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.ranking h4 {
  margin: 0 0 12px;
  font-size: 18px;
}

.ranking ol {
  padding-left: 22px;
  margin: 0;
  color: var(--muted);
}

.ranking li {
  margin-bottom: 8px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 30px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.orb {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(22px);
  opacity: .28;
  pointer-events: none;
}

.orb-a {
  left: -70px;
  top: 140px;
  background: var(--cyan);
  animation: float 8s ease-in-out infinite;
}

.orb-b {
  right: -90px;
  top: 120px;
  background: var(--violet);
  animation: float 10s ease-in-out infinite reverse;
}

.orb-c {
  right: 20%;
  bottom: -120px;
  background: var(--pink);
  animation: float 11s ease-in-out infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 13px rgba(40, 231, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(40, 231, 255, 0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-28px) scale(1.06); }
}

@media (max-width: 980px) {
  .hero,
  .game-shell,
  .lead-card {
    grid-template-columns: 1fr;
  }

  .hero { min-height: auto; }

  .section-title {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .cards,
  .scoreboard,
  .player-row {
    grid-template-columns: 1fr;
  }

  .navbar,
  footer {
    flex-direction: column;
    align-items: start;
  }

  h1 {
    font-size: 46px;
    line-height: 1.02;
    letter-spacing: -0.035em;
  }
}

/* Ajustes visuais v2 */
.lead-card {
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.lead-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: radial-gradient(circle at 80% 10%, rgba(40, 231, 255, 0.18), transparent 35%),
              radial-gradient(circle at 15% 90%, rgba(236, 72, 153, 0.14), transparent 35%);
  pointer-events: none;
}

.lead-card > * {
  position: relative;
  z-index: 1;
}

.lead-form {
  align-self: center;
}

.lead-form input,
.lead-form select,
.player-row input {
  min-height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.095);
  color: #f8fbff;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.lead-form input::placeholder,
.player-row input::placeholder {
  color: rgba(248, 251, 255, 0.56);
}

.lead-form select {
  cursor: pointer;
}

.form-message {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(40, 231, 255, 0.07);
  border: 1px solid rgba(40, 231, 255, 0.14);
}

.player-row {
  align-items: center;
}

.player-row input {
  width: 100%;
}

.ranking {
  max-height: 260px;
  overflow: auto;
}

.ranking li strong {
  color: #f8fbff;
}

@media (max-width: 700px) {
  .lead-form .button,
  .player-row .button {
    width: 100%;
  }
}

/* Arcade selector v3 */
.game-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.game-choice {
  position: relative;
  text-align: left;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.075);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.game-choice::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: radial-gradient(circle at 85% 15%, rgba(40, 231, 255, 0.16), transparent 36%),
              radial-gradient(circle at 15% 85%, rgba(236, 72, 153, 0.13), transparent 36%);
  opacity: 0;
  transition: opacity .2s ease;
}

.game-choice:hover {
  transform: translateY(-2px);
  border-color: rgba(40,231,255,0.28);
}

.game-choice.active {
  border-color: rgba(40,231,255,0.52);
  background: rgba(40,231,255,0.10);
}

.game-choice.active::before {
  opacity: 1;
}

.game-choice span,
.game-choice strong,
.game-choice small {
  position: relative;
  z-index: 1;
}

.game-choice span {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--cyan);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.game-choice strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.game-choice small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.game-mode {
  display: none;
}

.game-mode.active {
  display: block;
}

.control-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.touch-controls {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.touch-controls button {
  min-height: 48px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.09);
  color: #f8fbff;
  font-size: 22px;
  font-weight: 900;
}

#asteroidsCanvas {
  cursor: crosshair;
}

@media (max-width: 860px) {
  .game-selector {
    grid-template-columns: 1fr;
  }

  .touch-controls {
    display: grid;
  }
}

/* Asteroids canvas visibility fix v4 */
#asteroidsCanvas,
#gameCanvas {
  min-height: 280px;
}

.game-mode.active canvas {
  display: block;
}

@media (max-width: 700px) {
  #asteroidsCanvas,
  #gameCanvas {
    min-height: 220px;
  }
}
