:root {
  --bg:        #0A0612;
  --bg2:       #12091F;
  --bg3:       #1A0F2A;

  --purple:        #A020F0;
  --purple-dim:    #3D1A5F;
  --purple-soft:   #6B3FA0;
  --purple-glow:   rgba(160, 32, 240, 0.25);

  --white:     #F5F0FF;
  --grey:      #B8A8D9;

  --discord:   #5865F2;
  --steam:     #171A21;
  --steam-lt:  #66C0F4;
  --email:     #6B21A8;

  --pixel:     2px;
  --border:    1px solid rgba(160, 32, 240, 0.25);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: radial-gradient(circle at top, #1C1030 0, #0A0612 45%, #05020A 100%);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
}

/* ─── LOADING SCREEN ─── */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at top, #1C1030 0, #0A0612 45%, #05020A 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

#loader .logo-text {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(18px, 4vw, 36px);
  color: var(--purple);
  text-shadow: 0 0 20px var(--purple-glow);
  animation: flicker 3s infinite;
}

#loader .tagline {
  font-family: 'VT323', monospace;
  font-size: clamp(16px, 3vw, 24px);
  color: var(--grey);
  letter-spacing: 2px;
}

.bar-wrap {
  width: min(480px, 80vw);
  height: 28px;
  border: 3px solid var(--purple);
  image-rendering: pixelated;
  padding: 3px;
  position: relative;
  background: #05020A;
}

.bar-inner {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--purple) 0px,
    var(--purple) 14px,
    transparent 14px,
    transparent 18px
  );
  width: 0%;
  transition: width 0.08s steps(1);
  box-shadow: 0 0 12px var(--purple-glow);
}

.bar-pct {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--purple);
  text-align: right;
  margin-top: 6px;
}

.bar-msg {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: var(--purple-soft);
  text-align: center;
  min-height: 24px;
  letter-spacing: 1px;
}

/* ─── NAV ─── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: rgba(10, 6, 18, 0.92);
  border-bottom: 2px solid rgba(61, 26, 95, 0.8);
  backdrop-filter: blur(10px);
}

.nav-logo {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: var(--purple);
  text-shadow: 0 0 8px var(--purple-glow);
  cursor: pointer;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-links a {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--grey);
  text-decoration: none;
  padding: 8px 14px;
  border: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s, text-shadow 0.2s;
  position: relative;
}

.nav-links a::before {
  content: '▶';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 7px;
  opacity: 0;
  transition: opacity 0.2s;
  color: var(--purple);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--purple);
  border-color: var(--purple-dim);
  text-shadow: 0 0 6px var(--purple-glow);
}

.nav-links a:hover::before,
.nav-links a.active::before {
  opacity: 1;
}

/* ─── SECTIONS ─── */
section {
  min-height: 100vh;
  padding: 100px 32px 60px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ─── HOME ─── */
#home {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  max-width: 1100px;
  margin: 0 auto;
  padding: 120px 32px 60px;
  position: relative;
}

.home-eyebrow {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--purple-soft);
  letter-spacing: 4px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.home-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(28px, 6vw, 64px);
  line-height: 1.4;
  color: var(--white);
  text-shadow: 4px 4px 0 var(--purple-dim);
  margin-bottom: 24px;
}

.home-title span {
  color: var(--purple);
  text-shadow:
    0 0 20px var(--purple-glow),
    4px 4px 0 #000;
}

.home-sub {
  font-family: 'VT323', monospace;
  font-size: 26px;
  color: var(--grey);
  margin-bottom: 48px;
  max-width: 600px;
  line-height: 1.5;
}

.cta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-pixel {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 14px 24px;
  border: 3px solid var(--purple);
  background: transparent;
  color: var(--purple);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: inline-block;
}

.btn-pixel:hover {
  background: var(--purple);
  color: var(--bg);
  box-shadow:
    0 0 20px var(--purple-glow),
    4px 4px 0 var(--purple-dim);
  transform: translate(-1px, -1px);
}

.btn-pixel.ghost {
  border-color: var(--grey);
  color: var(--grey);
}

.btn-pixel.ghost:hover {
  background: var(--grey);
  color: var(--bg);
  box-shadow: none;
}

/* Ghost sprite deco */
.ghost-deco {
  position: absolute;
  right: 60px;
  bottom: 80px;
  font-size: 120px;
  opacity: 0.08;
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
  text-shadow: 0 0 18px var(--purple-glow);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-20px); }
}

/* Scanlines overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
  pointer-events: none;
}

/* ─── SECTION HEADER ─── */
.sec-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 56px;
}

.sec-num {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--purple-soft);
  opacity: 0.8;
}

.sec-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(16px, 3vw, 26px);
  color: var(--white);
  text-shadow: 0 0 10px rgba(160, 32, 240, 0.2);
}

.sec-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--purple-dim), transparent);
}

/* ─── ABOUT / ROYALGHOST ─── */
#about {
  max-width: 1100px;
  margin: 0 auto;
  padding: 100px 32px 60px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}

@media (max-width: 700px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

.about-card {
  background: var(--bg2);
  border: 2px solid rgba(61, 26, 95, 0.9);
  padding: 28px;
  position: relative;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
}

.about-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--purple-soft));
}

.card-label {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--purple-soft);
  letter-spacing: 3px;
  margin-bottom: 14px;
  opacity: 0.9;
}

.card-body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.8;
  color: var(--grey);
}

.card-body strong {
  color: var(--white);
  font-weight: 600;
}

.about-full {
  grid-column: 1 / -1;
}

/* stat pills */
.stat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.stat-pill {
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 4px 14px;
  border: 2px solid var(--purple-dim);
  color: var(--purple);
  background: rgba(160, 32, 240, 0.08);
  letter-spacing: 1px;
}

/* ─── SOCIAL CARDS ─── */
.social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.social-card {
  border: 3px solid;
  padding: 24px 20px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.02), transparent 55%);
}

.social-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity 0.15s;
}

.social-card:hover {
  transform: translate(-3px, -3px);
}

.social-card:hover::after {
  opacity: 0.05;
}

.social-card.discord {
  border-color: var(--discord);
  box-shadow: inset 0 0 40px rgba(88, 101, 242, 0.08);
}

.social-card.discord:hover {
  box-shadow:
    0 0 20px rgba(88, 101, 242, 0.5),
    inset 0 0 40px rgba(88, 101, 242, 0.15);
}

.social-card.steam {
  border-color: var(--steam-lt);
  box-shadow: inset 0 0 40px rgba(102, 192, 244, 0.08);
}

.social-card.steam:hover {
  box-shadow:
    0 0 20px rgba(102, 192, 244, 0.5),
    inset 0 0 40px rgba(102, 192, 244, 0.15);
}

.social-card.email {
  border-color: var(--email);
  box-shadow: inset 0 0 40px rgba(107, 33, 168, 0.12);
}

.social-card.email:hover {
  box-shadow:
    0 0 20px rgba(107, 33, 168, 0.6),
    inset 0 0 40px rgba(107, 33, 168, 0.2);
}

.social-icon {
  font-size: 32px;
}

.social-platform {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  letter-spacing: 1px;
}

.social-card.discord .social-platform {
  color: var(--discord);
}

.social-card.steam .social-platform {
  color: var(--steam-lt);
}

.social-card.email .social-platform {
  color: var(--email);
}

.social-handle {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: var(--white);
  letter-spacing: 1px;
}

.social-desc {
  font-size: 12px;
  color: var(--grey);
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
}

.social-badge {
  display: inline-block;
  font-family: 'VT323', monospace;
  font-size: 13px;
  padding: 2px 8px;
  margin-top: 4px;
  width: fit-content;
}

.discord .social-badge {
  background: var(--discord);
  color: #fff;
}

.steam .social-badge {
  background: var(--steam-lt);
  color: var(--bg);
}

.email .social-badge {
  background: var(--email);
  color: #fff;
}

/* ─── PROJECTS ─── */
#projects {
  max-width: 1100px;
  margin: 0 auto;
  padding: 100px 32px 60px;
}

.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.proj-card {
  background: var(--bg2);
  border: 2px solid var(--bg3);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.proj-card:hover {
  border-color: var(--purple);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px var(--purple-glow);
}

.proj-logo-area {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: radial-gradient(circle at top, #241238 0, #1A0F2A 60%, #0A0612 100%);
  position: relative;
  overflow: hidden;
}

.proj-logo-area::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, var(--bg2));
}

.proj-content {
  padding: 18px 20px 22px;
}

.proj-tag {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--purple-soft);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.proj-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--white);
  margin-bottom: 10px;
  line-height: 1.6;
}

.proj-desc {
  font-size: 13px;
  color: var(--grey);
  line-height: 1.7;
  margin-bottom: 16px;
}

.proj-enter {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--purple-dim);
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

.proj-card:hover .proj-enter {
  color: var(--purple);
}

/* ─── PROJECT MODAL ─── */
.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  padding: 16px;
}

.modal-bg.open {
  display: flex;
}

.modal {
  background: var(--bg2);
  border: 3px solid var(--purple);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: 0 0 60px var(--purple-glow);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--grey);
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--purple);
}

.modal-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--purple);
  margin-bottom: 20px;
  padding-right: 40px;
}

.modal-body {
  font-size: 14px;
  color: var(--grey);
  line-height: 1.8;
}

.modal-body strong {
  color: var(--white);
}

.modal-body ul {
  list-style: none;
  margin: 14px 0;
}

.modal-body ul li::before {
  content: '▸  ';
  color: var(--purple);
}

.modal-body ul li {
  margin-bottom: 8px;
  padding-left: 4px;
}

/* ─── UTIL ─── */
@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    opacity: 1;
    text-shadow: 0 0 20px var(--purple-glow);
  }
  20%, 24%, 55% {
    opacity: 0.6;
    text-shadow: none;
  }
}

.hidden {
  display: none !important;
}

.pixel-divider {
  width: 100%;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--purple-dim) 0,
    var(--purple-dim) 8px,
    transparent 8px,
    transparent 12px
  );
  margin: 12px 0 32px;
}

/* ─── FOOTER ─── */
footer {
  text-align: center;
  padding: 40px 32px;
  border-top: 1px solid var(--bg3);
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--grey);
  letter-spacing: 2px;
}

footer span {
  color: var(--purple);
  text-shadow: 0 0 10px var(--purple-glow);
}

/* ─── RESPONSIVE TWEAKS ─── */
@media (max-width: 600px) {
  nav {
    padding: 0 16px;
  }

  #home {
    padding: 110px 20px 50px;
  }

  section {
    padding: 100px 20px 50px;
  }

  .ghost-deco {
    font-size: 80px;
    right: 20px;
    bottom: 40px;
  }
}
