:root {
  --bg-main: #0b0b0f;
  --bg-secondary: #14141a;
  --surface: #1d1f26;
  --pink: #e4007c;
  --turquoise: #00c5b4;
  --blue: #0072ff;
  --text-main: #f2f2f2;
  --text-secondary: #a1a1aa;
  --accent: #7c3aed;
  --border: rgba(242, 242, 242, 0.15);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --game-board-width: clamp(280px, 30vw, 430px);
  --header-height: 78px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 20% 10%, rgba(228, 0, 124, 0.18), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(0, 197, 180, 0.16), transparent 28%),
    radial-gradient(circle at 50% 95%, rgba(0, 114, 255, 0.14), transparent 35%),
    var(--bg-main);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(45deg, transparent 47%, var(--turquoise) 48%, transparent 50%),
    linear-gradient(-45deg, transparent 47%, var(--pink) 48%, transparent 50%);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 0;
  background: linear-gradient(180deg, rgba(11, 11, 15, 0.96), rgba(11, 11, 15, 0.72));
  border-bottom: 1px solid rgba(242, 242, 242, 0.08);
  backdrop-filter: blur(18px);
}

.navbar {
  width: min(1280px, calc(100% - 32px));
  min-height: 48px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.82rem;
}

.brand-mark {
  width: 18px;
  height: 18px;
  display: inline-block;
  background: linear-gradient(135deg, var(--pink), var(--turquoise));
  transform: rotate(45deg);
  box-shadow: 0 0 22px rgba(0, 197, 180, 0.35);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(242, 242, 242, 0.1);
  border-radius: 999px;
  background: rgba(29, 31, 38, 0.62);
}

.nav-link {
  position: relative;
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-weight: 800;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.nav-link:hover {
  color: var(--text-main);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--text-main);
  background: linear-gradient(135deg, rgba(228, 0, 124, 0.36), rgba(0, 197, 180, 0.18));
  box-shadow: inset 0 0 0 1px rgba(242, 242, 242, 0.08);
}

.menu-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-main);
  background: rgba(242, 242, 242, 0.06);
  cursor: pointer;
}

.menu-button span {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: var(--text-main);
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 52px) 0 70px;
}

.page-section {
  display: none;
  min-height: calc(100vh - var(--header-height) - 80px);
}

.page-section.active {
  display: block;
  animation: pageFade 260ms ease both;
}

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

.home-grid {
  min-height: calc(100vh - var(--header-height) - 110px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 32px;
  align-items: center;
}

.eyebrow {
  color: var(--pink);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-weight: 900;
  font-size: clamp(0.68rem, 1.5vw, 0.8rem);
  margin-bottom: 14px;
}

h1 {
  max-width: 850px;
  font-size: clamp(3.2rem, 9vw, 7.7rem);
  line-height: 0.9;
  letter-spacing: -0.085em;
}

h1 span {
  display: block;
  color: var(--turquoise);
  text-shadow: 0 0 28px rgba(0, 197, 180, 0.35);
}

.hero-description,
.section-heading p {
  max-width: 720px;
  margin-top: 22px;
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.7;
}

.hero-description strong,
.section-heading strong {
  color: var(--text-main);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 50px;
  padding: 13px 20px;
  border-radius: 999px;
  font-weight: 900;
}

.primary-link {
  background: linear-gradient(135deg, var(--pink), var(--accent), var(--blue));
  box-shadow: 0 16px 32px rgba(228, 0, 124, 0.18);
}

.secondary-link {
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: rgba(242, 242, 242, 0.06);
}

.ornament {
  width: 260px;
  height: 260px;
  margin-left: auto;
  position: relative;
  border: 1px solid rgba(242, 242, 242, 0.1);
  transform: rotate(45deg);
  opacity: 0.85;
}

.ornament::before,
.ornament::after,
.ornament div {
  content: "";
  position: absolute;
  inset: 34px;
  border: 1px solid rgba(0, 197, 180, 0.2);
}

.ornament::after {
  inset: 76px;
  border-color: rgba(228, 0, 124, 0.35);
  box-shadow: 0 0 30px rgba(228, 0, 124, 0.12);
}

.ornament div:nth-child(1) {
  inset: 116px;
  background: var(--pink);
  border: 0;
}

.ornament div:nth-child(2) {
  inset: -20px 110px;
  border-color: rgba(124, 58, 237, 0.26);
}

.ornament div:nth-child(3) {
  inset: 110px -20px;
  border-color: rgba(0, 114, 255, 0.25);
}

.section-heading {
  margin-bottom: clamp(22px, 4vw, 34px);
}

.section-heading h2 {
  font-size: clamp(2.4rem, 7vw, 5.2rem);
  line-height: 0.94;
  letter-spacing: -0.07em;
}

.about-heading h2 {
  color: var(--turquoise);
  text-shadow: 0 0 28px rgba(0, 197, 180, 0.28);
}

.role-text {
  margin-top: 10px !important;
  color: var(--text-main) !important;
  font-weight: 800;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(280px, var(--game-board-width)) minmax(220px, 280px);
  gap: 24px;
  justify-content: center;
  align-items: start;
}

.panel,
.canvas-card,
.cv-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(29, 31, 38, 0.86), rgba(11, 11, 15, 0.86));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel,
.cv-card {
  border-radius: 24px;
  padding: 24px;
}

.panel-label {
  color: var(--turquoise);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 900;
  margin-bottom: 12px;
}

.score-panel h3 {
  font-size: clamp(3.2rem, 8vw, 4rem);
  line-height: 1;
  margin-bottom: 16px;
}

.progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(242, 242, 242, 0.1);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink), var(--turquoise), var(--blue));
  transition: width 180ms ease;
}

.goal {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.goal strong {
  color: var(--text-main);
}

.status-card {
  min-height: 74px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 16px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--text-secondary);
  box-shadow: 0 0 18px currentColor;
}

.status-dot.playing {
  background: var(--turquoise);
}

.status-dot.paused {
  background: var(--blue);
}

.status-dot.danger {
  background: var(--pink);
}

#gameStatus {
  color: var(--text-secondary);
  line-height: 1.5;
}

button {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text-main);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  touch-action: manipulation;
}

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

button:active {
  transform: translateY(0) scale(0.98);
}

.primary-button,
#overlayButton {
  background: linear-gradient(135deg, var(--pink), var(--accent), var(--blue));
  box-shadow: 0 16px 32px rgba(228, 0, 124, 0.18);
}

.ghost-button {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: rgba(242, 242, 242, 0.06);
}

.canvas-card {
  width: 100%;
  padding: clamp(12px, 2.5vw, 18px);
  border-radius: 28px;
}

.game-frame {
  width: min(100%, var(--game-board-width));
  margin: 0 auto;
  position: relative;
}

#game {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 2;
  height: auto;
  margin: 0 auto;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(242, 242, 242, 0.1);
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  text-align: center;
  padding: 28px;
  border-radius: 18px;
  background: rgba(11, 11, 15, 0.78);
  backdrop-filter: blur(6px);
}

.overlay.is-visible {
  display: grid;
}

.overlay h3 {
  font-size: clamp(1.8rem, 5vw, 2.2rem);
  color: var(--turquoise);
  margin-bottom: 10px;
}

.overlay p {
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
}

#overlayButton {
  width: min(220px, 100%);
}

.touch-header {
  width: min(100%, var(--game-board-width));
  margin: 16px auto 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.touch-header p {
  color: var(--text-secondary);
  font-weight: 800;
}

.toggle-button {
  width: auto;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: rgba(242, 242, 242, 0.06);
  border-radius: 999px;
  font-size: 0.84rem;
}

/* Teclado táctil alineado:
      Rotar
   Izq Bajar Der
      Pausa
*/
.touch-controls {
  width: min(100%, var(--game-board-width));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    ". rotate ."
    "left down right"
    "pause pause pause";
  gap: 10px;
  max-height: 260px;
  overflow: hidden;
  opacity: 1;
  transition: max-height 220ms ease, opacity 160ms ease, margin 220ms ease;
}

.touch-controls.is-hidden {
  max-height: 0;
  opacity: 0;
  margin-top: -8px;
  pointer-events: none;
}

.touch-button {
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 1px solid rgba(242, 242, 242, 0.16);
  background: rgba(242, 242, 242, 0.07);
}

.touch-button span {
  font-size: 1.4rem;
  line-height: 1;
}

.touch-button small {
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.touch-button[data-action="rotate"] {
  grid-area: rotate;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.42), rgba(0, 114, 255, 0.18));
}

.touch-button[data-action="left"] {
  grid-area: left;
}

.touch-button[data-action="down"] {
  grid-area: down;
}

.touch-button[data-action="right"] {
  grid-area: right;
}

.touch-button[data-action="pause"],
.pause-touch {
  grid-area: pause;
  background: linear-gradient(135deg, rgba(228, 0, 124, 0.42), rgba(0, 197, 180, 0.18));
}

.controls-panel ul {
  display: grid;
  gap: 12px;
  list-style: none;
  margin-bottom: 22px;
}

.controls-panel li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

kbd {
  min-width: 38px;
  display: inline-flex;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text-main);
  background: rgba(242, 242, 242, 0.08);
  border: 1px solid rgba(242, 242, 242, 0.18);
  font-weight: 900;
}

.next-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.next-card p {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

#next {
  width: 120px;
  height: 120px;
  display: block;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.24);
  border-radius: 14px;
}

.about-layout {
  display: grid;
  gap: 22px;
}

.cv-card p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.cv-card h3 {
  margin-bottom: 6px;
  color: var(--text-main);
  font-size: 1.08rem;
}

.cv-card h4 {
  margin-bottom: 10px;
  color: var(--turquoise);
  font-size: 0.95rem;
}

.summary-card p:last-child {
  max-width: 920px;
  font-size: clamp(1rem, 1.7vw, 1.12rem);
}

.timeline {
  position: relative;
  display: grid;
  gap: 24px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 8px;
  width: 2px;
  background: linear-gradient(var(--pink), var(--turquoise), var(--blue));
  opacity: 0.58;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--pink);
  box-shadow: 0 0 20px rgba(228, 0, 124, 0.55);
}

.timeline-item:nth-child(2) .timeline-dot {
  background: var(--turquoise);
  box-shadow: 0 0 20px rgba(0, 197, 180, 0.55);
}

.timeline-item:nth-child(3) .timeline-dot {
  background: var(--blue);
  box-shadow: 0 0 20px rgba(0, 114, 255, 0.55);
}

.timeline-date {
  margin-bottom: 4px;
  color: var(--pink) !important;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.muted {
  color: var(--text-secondary);
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tags span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(242, 242, 242, 0.12);
  border-radius: 999px;
  color: var(--text-main);
  background: rgba(242, 242, 242, 0.06);
  font-size: 0.86rem;
  font-weight: 800;
}

.tags span:nth-child(3n + 1) {
  border-color: rgba(228, 0, 124, 0.28);
}

.tags span:nth-child(3n + 2) {
  border-color: rgba(0, 197, 180, 0.28);
}

.tags span:nth-child(3n + 3) {
  border-color: rgba(0, 114, 255, 0.28);
}

@media (max-width: 1120px) {
  :root {
    --game-board-width: clamp(280px, 42vw, 420px);
  }

  .game-layout {
    grid-template-columns: minmax(220px, 280px) minmax(280px, var(--game-board-width));
  }

  .controls-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: start;
  }

  .controls-panel ul {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .next-card {
    min-width: 170px;
  }
}

@media (max-width: 820px) {
  :root {
    --game-board-width: min(92vw, 380px);
  }

  .site-header {
    padding: 10px 0;
  }

  .navbar {
    width: min(100% - 24px, 1280px);
  }

  .menu-button {
    display: grid;
  }

  .nav-menu {
    position: absolute;
    top: 68px;
    left: 12px;
    right: 12px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border-radius: 22px;
    background: rgba(20, 20, 26, 0.96);
    box-shadow: var(--shadow);
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-link {
    width: 100%;
    text-align: center;
  }

  .home-grid {
    min-height: calc(100vh - var(--header-height) - 110px);
    grid-template-columns: 1fr;
  }

  .ornament {
    display: none;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .canvas-card {
    order: -1;
  }

  .score-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: center;
  }

  .score-panel .panel-label,
  .score-panel .goal,
  .score-panel .progress,
  .score-panel h3 {
    margin: 0;
  }

  .score-panel .panel-label,
  .score-panel h3,
  .score-panel .progress,
  .score-panel .goal {
    grid-column: 1;
  }

  .score-panel .status-card,
  .score-panel .primary-button,
  .score-panel .ghost-button {
    grid-column: 2;
    margin: 0;
  }

  .controls-panel {
    display: block;
  }

  .controls-panel ul {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .next-card {
    min-width: 0;
  }

  .two-columns,
  .tech-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  :root {
    --game-board-width: min(94vw, 340px);
  }

  .page-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 26px;
  }

  .brand {
    letter-spacing: 0.1em;
    font-size: 0.72rem;
  }

  h1 {
    font-size: clamp(3rem, 18vw, 5.4rem);
  }

  .section-heading h2 {
    font-size: clamp(2.4rem, 15vw, 4rem);
  }

  .hero-actions {
    display: grid;
  }

  .score-panel {
    grid-template-columns: 1fr;
  }

  .score-panel .status-card,
  .score-panel .primary-button,
  .score-panel .ghost-button,
  .score-panel .panel-label,
  .score-panel h3,
  .score-panel .progress,
  .score-panel .goal {
    grid-column: 1;
  }

  .touch-controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .touch-button {
    min-height: 58px;
  }

  .panel,
  .cv-card {
    padding: 20px;
  }
}

@media (max-height: 760px) and (min-width: 821px) {
  :root {
    --game-board-width: clamp(260px, 26vw, 350px);
  }

  .section-heading {
    margin-bottom: 20px;
  }

  .page-shell {
    padding-top: 28px;
  }
}
