:root {
  --bg: #070b16;
  --bg-elev: #0c1424;
  --bg-card: #101a2e;
  --line: rgba(94, 234, 212, 0.16);
  --text: #e8f1ff;
  --muted: #8ea3bc;
  --accent: #5eead4;
  --accent-2: #3b82f6;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --max: 1120px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
}

body {
  position: relative;
  isolation: isolate;
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.025) 0 1px,
      transparent 1px 4px
    ),
    radial-gradient(1100px 520px at 12% -12%, rgba(94, 234, 212, 0.16), transparent 58%),
    radial-gradient(900px 480px at 100% 0%, rgba(59, 130, 246, 0.22), transparent 52%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 42vw;
  height: 42vw;
  max-width: 520px;
  max-height: 520px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(70px);
}

body::before {
  top: -8%;
  left: -6%;
  background: rgba(94, 234, 212, 0.16);
  animation: drift-a 22s ease-in-out infinite;
}

body::after {
  right: -8%;
  top: 12%;
  background: rgba(59, 130, 246, 0.2);
  animation: drift-b 26s ease-in-out infinite;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #99f6e4;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 20;
  background: var(--bg-elev);
  padding: 8px 12px;
  border-radius: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: rgba(7, 11, 22, 0.82);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  animation: icon-glow 5s ease-in-out infinite;
}

.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  background: rgba(94, 234, 212, 0.1);
}

.menu-btn {
  display: none;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.hero {
  padding: 72px 0 48px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1.05fr);
  gap: 36px 48px;
  align-items: start;
  text-align: left;
}

.hero-visual {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

.hero-logo {
  width: 100%;
  height: auto;
  border-radius: 22px;
  box-shadow: var(--shadow);
  animation: rise 0.8s ease-out both, glow 6.5s ease-in-out 0.8s infinite;
}

.hero-seal {
  margin: 0;
  padding: 16px 18px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: rise 0.8s ease-out 0.12s both;
}

.hero-seal-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-seal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.55);
  animation: pulse-dot 2.2s ease-out infinite;
}

.hero-seal-title {
  margin: 0;
  color: var(--text);
  font-weight: 650;
  font-size: 1.02rem;
  line-height: 1.35;
}

.hero-seal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.hero-seal-tags li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-screens {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.hero-copy {
  max-width: 40rem;
}

.hero h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.85rem);
  animation: rise 0.8s ease-out 0.06s both;
}

.hero .lead {
  margin: 0 0 22px;
  animation: rise 0.8s ease-out 0.1s both;
}

.hero-proof {
  color: var(--muted);
  margin: 0 0 12px;
  max-width: 52ch;
  animation: rise 0.8s ease-out 0.14s both;
}

.hero-stat {
  color: var(--text);
  font-weight: 600;
  margin: 18px 0 0;
  animation: rise 0.8s ease-out 0.18s both;
}

.hero-stat strong {
  color: var(--accent);
}

.php-screen {
  margin: 0;
  text-align: left;
  background: #050814;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}

.php-screen-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: #0a1222;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.php-screen-bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
}

.php-screen-bar i:first-child {
  background: #f87171;
}

.php-screen-bar i:nth-child(2) {
  background: #fbbf24;
}

.php-screen-bar i:nth-child(3) {
  background: #34d399;
}

.php-screen-bar span {
  margin-left: 6px;
}

.php-screen-code {
  margin: 0;
  padding: 10px 12px 12px;
  min-width: 18ch;
  min-height: 3.1em;
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--accent);
  white-space: pre;
}

.php-screen-hero {
  animation: rise 0.8s ease-out 0.12s both;
}

.php-screen-hero .php-screen-code {
  min-width: 0;
  min-height: 3.4em;
  font-size: 0.72rem;
  overflow: hidden;
}

.py-screen .php-screen-code {
  color: #93c5fd;
}

.py-screen .caret {
  background: #93c5fd;
}

.java-screen .php-screen-code {
  color: #fcd34d;
}

.java-screen .caret {
  background: #fcd34d;
}

.js-screen .php-screen-code {
  color: #fde047;
}

.js-screen .caret {
  background: #fde047;
}

.mysql-screen .php-screen-code {
  color: #67e8f9;
}

.mysql-screen .caret {
  background: #67e8f9;
}

.sqlite-screen .php-screen-code {
  color: #c4b5fd;
}

.sqlite-screen .caret {
  background: #c4b5fd;
}

.caret {
  display: inline-block;
  width: 7px;
  height: 0.95em;
  margin-left: 1px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

.hero .actions {
  justify-content: flex-start;
  margin-top: 28px;
  animation: rise 0.8s ease-out 0.2s both;
}

.kicker {
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

h1,
h2,
h3 {
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 16px;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  letter-spacing: -0.03em;
}

.lead {
  color: var(--muted);
  font-size: 1.15rem;
  max-width: 58ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 600;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, border-color 0.2s ease;
}

button.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 200% 200%;
  color: #061018;
  animation: sheen 9s ease infinite;
}

.btn-primary:hover {
  color: #061018;
  filter: brightness(1.08);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--text);
  background: transparent;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.about {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  align-items: start;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 36px;
}

.about h3 {
  margin-top: 22px;
}

.portrait {
  width: 220px;
  aspect-ratio: 1;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--bg-card);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.section {
  padding: 72px 0;
}

.section header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 28px;
}

.section p.hint {
  color: var(--muted);
  margin: 0;
}

.section p.hint.trail-note {
  margin-top: 28px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.55s ease;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(94, 234, 212, 0.45);
  box-shadow: 0 16px 40px rgba(59, 130, 246, 0.12);
}

.js .card {
  opacity: 0;
  transform: translateY(16px);
}

.js .card.is-in {
  opacity: 1;
  transform: none;
}

.js .card:nth-child(3n+2) {
  transition-delay: 70ms;
}

.js .card:nth-child(3n+3) {
  transition-delay: 140ms;
}

.js .card.is-in:hover {
  transform: translateY(-6px);
}

.card .meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tag {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(94, 234, 212, 0.1);
  border-radius: 999px;
  padding: 4px 9px;
}

.tag.muted {
  color: var(--muted);
  background: rgba(142, 163, 188, 0.12);
}

.card h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.card p {
  color: var(--muted);
  margin: 0 0 18px;
  flex: 1;
}

.card-links {
  display: flex;
  gap: 14px;
  font-size: 0.95rem;
}

.about p {
  color: var(--muted);
}

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 0.92rem;
}

.contact {
  text-align: center;
}

.contact .lead {
  margin-inline: auto;
}

.contact .actions {
  justify-content: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.92rem;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.prose {
  max-width: 72ch;
}

.prose p,
.prose ul {
  color: var(--muted);
}

.prose h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.back {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--muted);
  text-decoration: none;
}

.note {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 14px;
  color: var(--muted);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.game-page {
  padding: 36px 0 72px;
}

.game-page .lead {
  margin-inline: 0;
  margin-bottom: 28px;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.panel h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.terminal {
  min-height: 8.5rem;
  margin: 0 0 18px;
  padding: 14px 16px;
  background: #050814;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--accent);
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.92rem;
  white-space: pre-wrap;
  line-height: 1.5;
}

.terminal.lose {
  color: #f87171;
}

.terminal.win {
  color: var(--accent);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choices .btn {
  min-width: 72px;
}

.field {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
}

.field input {
  width: 5.5rem;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #050814;
  color: var(--text);
  font: inherit;
}

.score {
  color: var(--muted);
  margin: 0 0 12px;
}

.game-actions {
  justify-content: flex-start;
  margin-top: 16px;
}

.code-block {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  background: #050814;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #93c5fd;
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}

.board-wrap {
  position: relative;
  width: min(100%, 400px);
  margin-inline: auto;
}

#board {
  display: block;
  width: 100%;
  height: auto;
  background: #050814;
  border: 1px solid var(--line);
  border-radius: 14px;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(5, 8, 20, 0.78);
  border-radius: 14px;
  text-align: center;
  padding: 16px;
}

.overlay[hidden] {
  display: none;
}

.game-hint {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
  margin: 12px 0 0;
}

@media (max-width: 900px) {
  .about,
  .grid,
  .grid-2,
  .game-layout,
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    order: -1;
  }

  .hero-screens {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portrait {
    width: 160px;
  }

  .menu-btn {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    right: 20px;
    top: 72px;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    flex-direction: column;
    min-width: 180px;
  }

  .nav-links.open {
    display: flex;
  }
}

@keyframes drift-a {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(12%, 18%) scale(1.12);
  }
}

@keyframes drift-b {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-14%, 10%) scale(1.08);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes glow {
  0%,
  100% {
    box-shadow: var(--shadow), 0 0 0 0 rgba(94, 234, 212, 0);
  }
  50% {
    box-shadow: var(--shadow), 0 0 42px 2px rgba(94, 234, 212, 0.22);
  }
}

@keyframes icon-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(94, 234, 212, 0));
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(94, 234, 212, 0.55));
  }
}

@keyframes sheen {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(94, 234, 212, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(94, 234, 212, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body::before,
  body::after,
  .brand img,
  .hero h1,
  .hero .lead,
  .hero-proof,
  .hero-stat,
  .hero .actions,
  .hero-logo,
  .hero-seal,
  .hero-seal-dot,
  .hero-screens,
  .php-screen-hero,
  .btn-primary,
  .caret {
    animation: none;
  }

  .js .card,
  .js .card.is-in,
  .js .card.is-in:hover,
  .card,
  .card:hover,
  .btn:hover {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
