:root {
  --bg: #06090f;
  --bg-soft: #0a1220;
  --panel: #0c1829;
  --panel-alt: #0f2035;
  --panel-deep: #07111d;
  --text: #d8f7ff;
  --muted: #8bc4d4;
  --accent: #34e4ff;
  --accent-dim: #1b8ab4;
  --accent-warm: #ffd166;
  --success: #8ef0b6;
  --warning: #ffbd4a;
  --danger: #ff6b9a;
  --line: #1d5f78;
  --focus: #6af0ff;
  --shadow: #03131b;
  --tile: minmax(44px, 1fr);
}

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

html,
body {
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'VT323', monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  letter-spacing: 0;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background-image:
    linear-gradient(rgba(52, 228, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 228, 255, 0.09) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.22;
}

body::after {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(52, 228, 255, 0.03) 4px
  );
  animation: scanlines 12s linear infinite;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
  image-rendering: pixelated;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 2px solid var(--line);
  background: rgba(6, 9, 15, 0.97);
  box-shadow: 0 4px 0 rgba(3, 19, 27, 0.65);
}

.nav {
  width: min(1100px, 92vw);
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  color: var(--accent);
  text-shadow: 2px 2px 0 #062633;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.nav-links a,
.mobile-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  font-family: 'Press Start 2P', monospace;
  text-transform: uppercase;
  font-size: 0.65rem;
  border: 2px solid var(--line);
  padding: 0.55rem 0.7rem;
  background: var(--panel);
  transition: transform 120ms steps(2), border-color 120ms steps(2), color 120ms steps(2), background 120ms steps(2);
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active,
.mobile-links a:hover,
.mobile-links a:focus-visible,
.mobile-links a.active {
  transform: translate(-2px, -2px);
  border-color: var(--accent);
  color: var(--accent);
  background: #0f2f4a;
}

.menu-toggle {
  display: none;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
}

.mobile-panel {
  display: none;
  border-top: 2px solid var(--line);
  padding: 0.9rem 4vw 1.2rem;
  background: var(--bg-soft);
}

.mobile-panel.open {
  display: block;
}

.mobile-links {
  list-style: none;
  display: grid;
  gap: 0.7rem;
}

.mobile-links a {
  width: 100%;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.hero {
  padding: 3rem 0 1.4rem;
}

.hero-panel {
  border: 2px solid var(--line);
  background:
    linear-gradient(180deg, rgba(52, 228, 255, 0.05), transparent 42%),
    linear-gradient(180deg, var(--panel-alt), var(--panel));
  padding: 2rem;
  box-shadow: 6px 6px 0 var(--shadow);
  position: relative;
}

.hero-panel::before {
  content: "SYSTEM ONLINE";
  position: absolute;
  right: 0.8rem;
  top: 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1.4fr minmax(180px, 260px);
  gap: 1rem;
  align-items: start;
}

.eyebrow {
  font-family: 'Press Start 2P', monospace;
  color: var(--muted);
  font-size: 0.66rem;
  margin-bottom: 0.8rem;
}

h1,
h2,
h3 {
  font-family: 'Press Start 2P', monospace;
  line-height: 1.3;
}

.hero h1 {
  color: var(--accent);
  font-size: 2.1rem;
  margin-bottom: 1rem;
  animation: flicker 3s steps(2, end) infinite;
}

.hero p {
  color: var(--text);
  font-size: 1.45rem;
  max-width: 760px;
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 0.25rem;
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

.avatar-panel {
  border: 2px solid var(--line);
  background: var(--panel-deep);
  padding: 0.7rem;
  box-shadow: 4px 4px 0 var(--shadow);
}

.avatar-handle {
  margin-top: 0.55rem;
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.58rem;
  color: var(--muted);
}

.avatar-frame {
  margin-top: 0.25rem;
  border: 3px solid var(--accent-dim);
  outline: 2px solid var(--line);
  background: #010b12;
  box-shadow: inset 0 0 0 2px #062130;
  padding: 0.45rem;
}

.avatar-frame img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 2px solid #0f3e53;
  filter: contrast(1.1) saturate(1.08);
}

.link-row,
.game-entry-actions {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.game-entry-actions {
  margin-top: 0.8rem;
}

.pixel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 2px solid var(--line);
  background: #0b2134;
  color: var(--text);
  padding: 0.65rem 0.9rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.62rem;
  line-height: 1.4;
  text-align: center;
  text-transform: uppercase;
  transition: transform 120ms steps(2), border-color 120ms steps(2), background 120ms steps(2), box-shadow 120ms steps(2), color 120ms steps(2);
}

.pixel-btn:hover,
.pixel-btn:focus-visible {
  border-color: var(--accent);
  background: #0f2f4a;
  color: var(--accent);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--shadow);
}

.pixel-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.pixel-btn.alt {
  background: transparent;
}

.start-pulse {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(52, 228, 255, 0.16);
  animation: pixel-bounce 1.6s steps(2, end) infinite;
}

.section {
  padding: 1.2rem 0 2.4rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head p {
  color: var(--muted);
  font-size: 1.2rem;
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card,
.skill-card {
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 1rem;
  box-shadow: 5px 5px 0 var(--shadow);
  transition: transform 120ms steps(2), border-color 120ms steps(2), box-shadow 120ms steps(2), background 120ms steps(2);
}

.card h3,
.skill-card h3 {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.card p,
.card li,
.copy {
  font-size: 1.2rem;
  color: var(--text);
}

.card:hover,
.card:focus-within,
.skill-card:hover,
.skill-card:focus-within {
  transform: translate(-2px, -2px);
  border-color: var(--accent-dim);
  box-shadow: 7px 7px 0 var(--shadow);
}

.meta {
  color: var(--muted);
  font-size: 1rem;
  margin: 0.6rem 0 0.8rem;
}

.list {
  list-style: square;
  padding-left: 1.2rem;
  color: var(--muted);
}

.card .actions,
.quest-card .actions {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.split {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.4fr 1fr;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.learned-panel {
  background: linear-gradient(180deg, #11263b, #0c1a2b);
}

.learning-panel {
  background: linear-gradient(180deg, #1f2a1f, #111d13);
  border-color: #2e7a47;
}

.learning-panel h3 {
  color: var(--success);
}

.skill-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tags li {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.58rem;
  line-height: 1.4;
  border: 2px solid var(--line);
  background: rgba(5, 12, 18, 0.9);
  padding: 0.4rem 0.45rem;
}

.learning-panel .skill-tags li {
  border-color: #2e7a47;
  color: #c8ffe0;
}

.terminal-adventure {
  padding-top: 0;
}

.game-shell {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  background:
    radial-gradient(circle at 16% 18%, rgba(52, 228, 255, 0.1), transparent 20%),
    linear-gradient(180deg, #0d1d31, #08111e);
  padding: 1rem;
  box-shadow: 7px 7px 0 var(--shadow);
  image-rendering: pixelated;
}

.game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 5px
  );
  mix-blend-mode: screen;
  opacity: 0.35;
}

.game-shell.is-booting {
  animation: boot-flicker 520ms steps(3, end) 2;
}

.game-topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.8rem;
}

.game-topbar h2 {
  font-size: 1rem;
  color: var(--accent);
}

.game-status {
  border: 2px solid var(--line);
  background: rgba(3, 19, 27, 0.75);
  padding: 0.45rem 0.55rem;
  color: var(--success);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.56rem;
  white-space: nowrap;
}

.boot-sequence {
  position: relative;
  z-index: 1;
  min-height: 58px;
  border: 2px solid #123c52;
  background: rgba(1, 11, 18, 0.9);
  color: var(--success);
  padding: 0.7rem;
  font-size: 1.15rem;
  white-space: pre-line;
  margin-bottom: 0.8rem;
}

.boot-sequence::after {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 1rem;
  margin-left: 0.25rem;
  background: var(--success);
  vertical-align: -0.1rem;
  animation: dialogue-blink 1s steps(1) infinite;
}

.game-screen {
  position: relative;
  z-index: 1;
  border: 3px solid #123c52;
  background:
    linear-gradient(rgba(52, 228, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 228, 255, 0.07) 1px, transparent 1px),
    #07101b;
  background-size: 24px 24px, 24px 24px, auto;
  padding: 0.75rem;
  min-height: 420px;
  overflow: hidden;
  outline-offset: 3px;
}

.game-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 6px,
    rgba(52, 228, 255, 0.06) 7px
  );
  animation: scanlines 7s linear infinite;
}

.game-map {
  display: grid;
  grid-template-columns: repeat(9, var(--tile));
  grid-template-rows: repeat(6, minmax(48px, 1fr));
  gap: 0.45rem;
  width: 100%;
  min-height: 350px;
  position: relative;
}

.game-map::before {
  content: "";
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  background:
    linear-gradient(90deg, transparent 48%, rgba(52, 228, 255, 0.08) 49%, rgba(52, 228, 255, 0.08) 51%, transparent 52%),
    linear-gradient(transparent 48%, rgba(52, 228, 255, 0.08) 49%, rgba(52, 228, 255, 0.08) 51%, transparent 52%);
  background-size: 11.11% 16.66%;
  border: 1px solid rgba(52, 228, 255, 0.1);
  pointer-events: none;
}

.station-tile {
  position: relative;
  z-index: 2;
  min-width: 0;
  border: 2px solid var(--accent-dim);
  background: rgba(9, 35, 54, 0.82);
  color: var(--text);
  padding: 0.45rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.52rem;
  line-height: 1.35;
  text-transform: uppercase;
  text-align: center;
  box-shadow: inset 0 0 0 2px rgba(52, 228, 255, 0.08), 0 0 12px rgba(52, 228, 255, 0.1);
  transition: transform 120ms steps(2), border-color 120ms steps(2), background 120ms steps(2), color 120ms steps(2);
}

.station-tile::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(52, 228, 255, 0.28);
  pointer-events: none;
}

.station-tile:hover,
.station-tile:focus-visible,
.station-tile.is-near {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(12, 62, 85, 0.95);
  color: var(--accent);
  animation: tile-glitch 320ms steps(2, end);
}

.station-profile {
  grid-column: 2;
  grid-row: 2;
}

.station-skills {
  grid-column: 5;
  grid-row: 2;
}

.station-projects {
  grid-column: 8;
  grid-row: 2;
}

.station-extensions {
  grid-column: 3;
  grid-row: 5;
}

.station-contact {
  grid-column: 7;
  grid-row: 5;
}

.game-player {
  z-index: 3;
  grid-column: 5;
  grid-row: 4;
  align-self: center;
  justify-self: center;
  width: 42px;
  height: 42px;
  border: 3px solid var(--accent);
  background:
    linear-gradient(90deg, transparent 45%, rgba(255, 255, 255, 0.2) 46%, rgba(255, 255, 255, 0.2) 54%, transparent 55%),
    var(--accent-warm);
  color: #06111d;
  display: grid;
  place-items: center;
  font-family: 'VT323', monospace;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform 120ms steps(2);
  animation: pixel-bounce 1.1s steps(2, end) infinite;
}

.game-player.is-moving {
  transform: translateY(-4px);
}

.player-face {
  transform: translateY(-1px);
}

.dialogue-box {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  border: 3px solid var(--accent);
  background: rgba(3, 19, 27, 0.96);
  box-shadow: 5px 5px 0 var(--shadow);
  padding: 0.9rem;
}

.dialogue-box::before {
  content: "";
  position: absolute;
  left: 0.6rem;
  top: -0.7rem;
  width: 1rem;
  height: 1rem;
  background: var(--accent);
  animation: dialogue-blink 1s steps(1) infinite;
}

.dialogue-speaker {
  font-family: 'Press Start 2P', monospace;
  color: var(--accent-warm);
  font-size: 0.62rem;
  margin-bottom: 0.45rem;
}

.dialogue-text {
  color: var(--text);
  font-size: 1.25rem;
  min-height: 3.1rem;
}

.dialogue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.game-instructions {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.mobile-controls {
  position: relative;
  z-index: 1;
  display: none;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  grid-template-areas:
    ". up ."
    "left action right"
    ". down .";
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.control-btn {
  border: 2px solid var(--line);
  background: #0b2134;
  color: var(--text);
  min-height: 48px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.58rem;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--shadow);
}

.control-btn:active,
.control-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.control-btn[data-move="up"] {
  grid-area: up;
}

.control-btn[data-move="left"] {
  grid-area: left;
}

.control-btn[data-move="right"] {
  grid-area: right;
}

.control-btn[data-move="down"] {
  grid-area: down;
}

.control-btn.interact {
  grid-area: action;
  border-color: var(--accent-warm);
  color: var(--accent-warm);
}

.pixel-particle {
  position: absolute;
  z-index: 4;
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 8px 0 0 var(--accent-warm), -8px 4px 0 var(--success);
  pointer-events: none;
  animation: sparkle-pop 650ms steps(4, end) forwards;
}

.achievement-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: min(360px, calc(100vw - 2rem));
  border: 3px solid var(--accent-warm);
  background: #0a1524;
  color: var(--text);
  padding: 0.8rem 1rem;
  box-shadow: 6px 6px 0 var(--shadow);
  animation: achievement-slide-in 320ms steps(4, end);
}

.achievement-label {
  display: block;
  color: var(--accent-warm);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.58rem;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.achievement-toast strong {
  display: block;
  font-size: 1.2rem;
}

.quest-board {
  border: 2px solid var(--line);
  background:
    linear-gradient(90deg, rgba(52, 228, 255, 0.04), transparent 18%, rgba(255, 209, 102, 0.03)),
    var(--panel);
  padding: 1rem;
  box-shadow: 6px 6px 0 var(--shadow);
}

.quest-board-head {
  align-items: start;
  border-bottom: 2px solid #123c52;
  padding-bottom: 1rem;
}

.quest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.quest-card {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  background: #0a1726;
  padding: 1rem;
  box-shadow: 5px 5px 0 var(--shadow);
  transition: transform 120ms steps(2), border-color 120ms steps(2), box-shadow 120ms steps(2);
}

.quest-card::after,
.module-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), transparent, var(--accent-warm));
  opacity: 0.55;
}

.quest-card:hover,
.quest-card:focus-within {
  transform: translate(-2px, -2px);
  border-color: var(--accent);
  box-shadow: 7px 7px 0 var(--shadow);
}

.quest-card.locked {
  border-color: #385065;
}

.quest-card-top,
.module-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.85rem;
}

.quest-icon,
.module-slot {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--accent-dim);
  background: #06111d;
  color: var(--accent);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
}

.quest-card h3 {
  color: var(--accent);
  font-size: 0.8rem;
  margin-bottom: 0.55rem;
}

.quest-card p {
  font-size: 1.15rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  background: rgba(3, 19, 27, 0.82);
  color: var(--muted);
  padding: 0.35rem 0.45rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  line-height: 1.35;
  text-transform: uppercase;
}

.status-chip.online {
  border-color: #2e7a47;
  color: var(--success);
}

.status-chip.progress {
  border-color: #8a6f20;
  color: var(--warning);
}

.status-chip.soon {
  border-color: #86556d;
  color: var(--danger);
}

.quest-progress {
  height: 16px;
  border: 2px solid #123c52;
  background: #05101a;
  margin-top: 0.8rem;
  padding: 2px;
}

.quest-progress span {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, var(--accent-dim) 8px 12px);
}

.quest-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  border-top: 2px solid #123c52;
  margin-top: 1rem;
  padding-top: 1rem;
}

.module-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.module-toolbar h2 {
  font-size: 1rem;
  color: var(--accent);
}

.module-search {
  width: min(360px, 100%);
}

.module-search input {
  width: 100%;
  border: 2px solid var(--line);
  background: #06111d;
  color: var(--text);
  padding: 0.7rem 0.8rem;
  box-shadow: 4px 4px 0 var(--shadow);
  font-size: 1.15rem;
}

.module-search input::placeholder {
  color: var(--muted);
}

.module-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(52, 228, 255, 0.06), transparent 45%),
    #0a1726;
}

.module-card:hover,
.module-card:focus-within {
  animation: tile-glitch 320ms steps(2, end);
}

.module-slot {
  width: 46px;
  color: var(--accent-warm);
  border-color: var(--accent-warm);
}

.module-empty {
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 1rem;
  font-size: 1.2rem;
  box-shadow: 5px 5px 0 var(--shadow);
}

.card,
.skill-card,
.avatar-panel,
.hero-panel,
.game-shell,
.quest-board,
.module-toolbar {
  animation: terminal-reveal 420ms steps(6, end);
}

.panel-flicker {
  animation: panel-flicker 5s steps(2, end) infinite;
}

footer {
  border-top: 2px solid var(--line);
  padding: 1rem 0 2rem;
  margin-top: 1.5rem;
}

footer .container {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@keyframes flicker {
  0%, 18%, 22%, 70%, 100% { opacity: 1; }
  20%, 21%, 72% { opacity: 0.8; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes terminal-reveal {
  0% {
    opacity: 0;
    transform: translateY(4px);
    filter: brightness(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: brightness(1);
  }
}

@keyframes panel-flicker {
  0%, 96%, 100% { filter: brightness(1); }
  97% { filter: brightness(0.96); }
  98% { filter: brightness(1.02); }
}

@keyframes boot-flicker {
  0% { filter: brightness(0.65) contrast(1.2); transform: translateY(0); }
  35% { filter: brightness(1.35) contrast(1.05); transform: translateY(-1px); }
  70% { filter: brightness(0.88) contrast(1.25); transform: translateY(1px); }
  100% { filter: brightness(1) contrast(1); transform: translateY(0); }
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(8px); }
}

@keyframes pixel-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes achievement-slide-in {
  0% { transform: translateX(120%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes dialogue-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes sparkle-pop {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.6); }
  70% { opacity: 1; transform: translate(-50%, -120%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(0.2); }
}

@keyframes tile-glitch {
  0%, 100% { filter: none; }
  35% { filter: hue-rotate(22deg) brightness(1.2); }
  70% { filter: contrast(1.25); }
}

@media (max-width: 840px) {
  .nav-links {
    display: none;
  }

  .menu-toggle {
    display: inline-block;
  }

  .split,
  .hero-layout {
    grid-template-columns: 1fr;
  }

  .avatar-panel {
    max-width: 260px;
  }

  .hero-panel {
    padding: 1.5rem;
  }

  .game-topbar,
  .section-head,
  .module-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .mobile-controls {
    display: grid;
  }
}

@media (max-width: 640px) {
  .brand {
    font-size: 0.86rem;
  }

  .hero {
    padding-top: 2rem;
  }

  .hero h1 {
    font-size: 1.35rem;
  }

  .hero p {
    font-size: 1.25rem;
  }

  .hero-panel::before {
    position: static;
    display: block;
    margin-bottom: 0.8rem;
  }

  .pixel-btn {
    width: 100%;
  }

  .game-shell,
  .quest-board {
    padding: 0.75rem;
  }

  .game-screen {
    min-height: 380px;
    padding: 0.5rem;
  }

  .game-map {
    grid-template-columns: repeat(9, minmax(27px, 1fr));
    grid-template-rows: repeat(6, minmax(42px, 1fr));
    gap: 0.25rem;
    min-height: 310px;
  }

  .station-tile {
    padding: 0.25rem;
    font-size: 0.42rem;
  }

  .station-tile span {
    display: block;
    overflow-wrap: anywhere;
  }

  .game-player {
    width: 34px;
    height: 34px;
    font-size: 0.72rem;
  }

  .dialogue-box {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
  }

  .dialogue-text {
    font-size: 1.1rem;
  }

  .quest-grid,
  .grid,
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .game-player,
  .start-pulse {
    animation: none !important;
  }
}
