:root {
  --red: #ff2020;
  --yellow: #ffd700;
  --dark: #0a0a0a;
  --white: #ffffff;
  --orange: #ff6b00;
  --sky: #87ceeb;
  --ground: #8b4513;
  --platform: #4169e1;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  background: var(--sky);
  font-family: "Nunito", sans-serif;
  overflow-x: hidden;
  cursor: none;
}

#cursor {
  width: 14px;
  height: 14px;
  background: var(--red);
  border: 2px solid var(--dark);
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.08s ease;
  box-shadow: 2px 2px 0 var(--dark);
}
#cursor.squish {
  transform: translate(-50%, -50%) scale(1.6, 0.6);
}

/* =========================
   INTRO — SPLIT CURTAIN
========================= */
#intro-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Top curtain */
.intro-curtain-a {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: var(--yellow);
  z-index: 1;
}

/* Bottom curtain */
.intro-curtain-b {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: var(--yellow);
  z-index: 1;
}

/* Centered logo — sits above curtains */
.intro-logo {
  position: relative;
  z-index: 2;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(18px, 4vw, 32px);
  color: var(--yellow);
  letter-spacing: 6px;
  opacity: 0; /* GSAP controls */
}

/* NAV — starts hidden, GSAP animates it in */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--yellow);
  border-bottom: 4px solid var(--dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
}
.nav-logo {
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-ball {
  width: 18px;
  height: 18px;
  background: var(--red);
  border: 3px solid var(--dark);
  border-radius: 50%;
  animation: nb 0.6s ease-in-out infinite alternate;
  display: inline-block;
}
@keyframes nb {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-7px);
  }
}
.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}
.nav-links a {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--dark);
  text-decoration: none;
  padding: 6px 12px;
  border: 3px solid transparent;
  transition: all 0.12s;
}
.nav-links a:hover {
  background: var(--red);
  color: var(--white);
  border-color: var(--dark);
  box-shadow: 3px 3px 0 var(--dark);
}

/* HERO */
#hero {
  min-height: 100vh;
  background: var(--sky);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  padding-top: 56px;
  flex-direction: column;
  margin-top: 1.5rem;
}

/* score bar starts hidden */
.score-bar {
  position: fixed;
  left: 0;
  right: 0;
  top: 56px;
  background: var(--dark);
  border-top: 3px solid var(--yellow);
  height: 28px;
  display: flex;
  align-items: center;
  overflow: hidden;
  z-index: 100;
}
.score-ticker {
  display: flex;
  gap: 60px;
  white-space: nowrap;
  animation: tick 22s linear infinite;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: var(--yellow);
}
@keyframes tick {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}
.ticker-sep {
  color: var(--red);
}

/* TOUCH CONTROLS */
#touch-controls {
  display: none;
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  z-index: 15;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px;
}
#touch-controls.visible {
  display: flex;
}
.touch-dpad {
  display: flex;
  gap: 8px;
}
.touch-btn {
  width: 58px;
  height: 58px;
  background: rgba(255, 215, 0, 0.85);
  border: 4px solid #0a0a0a;
  box-shadow: 4px 4px 0 #0a0a0a;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Press Start 2P", monospace;
  font-size: 18px;
  color: #0a0a0a;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  transition:
    transform 0.08s,
    box-shadow 0.08s;
}
.touch-btn.pressed {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #0a0a0a;
  background: #ff2020;
  color: white;
}
.touch-jump {
  width: 72px;
  height: 72px;
  background: rgba(255, 32, 32, 0.88);
  color: white;
  font-size: 22px;
}
.touch-jump.pressed {
  background: #aa0000;
}

#game-wrap {
  width: 100%;
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}
#game-canvas {
  display: block;
  width: 100%;
  border-bottom: 4px solid var(--dark);
  image-rendering: pixelated;
}
#game-hud {
  position: absolute;
  top: 8px;
  left: 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: var(--dark);
  display: flex;
  gap: 16px;
  z-index: 10;
  background: rgba(255, 215, 0, 0.88);
  border: 3px solid var(--dark);
  padding: 6px 12px;
  box-shadow: 3px 3px 0 var(--dark);
}
.hud-lives {
  color: var(--red);
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  gap: 14px;
  background: rgba(10, 10, 10, 0.78);
}
.game-overlay h2 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(14px, 3vw, 30px);
  color: var(--yellow);
  text-shadow: 4px 4px 0 var(--dark);
  text-align: center;
  line-height: 1.6;
}
.game-overlay p {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(6px, 1.8vw, 8px);
  color: var(--white);
  text-align: center;
  line-height: 2.2;
  padding: 0 10px;
}
.btn-play {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  background: var(--red);
  color: var(--white);
  border: 4px solid var(--dark);
  padding: 12px 26px;
  box-shadow: 5px 5px 0 var(--dark);
  cursor: none;
  transition: all 0.1s;
  margin-top: 6px;
  display: inline-block;
  text-decoration: none;
}
.btn-play:hover {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--dark);
}
.score-big {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  color: var(--yellow);
  background: var(--dark);
  border: 3px solid var(--yellow);
  padding: 8px 18px;
}

/* HERO INFO — starts hidden, GSAP handles reveal */
.lr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--red);
  width: 100%;
  align-items: stretch;
}
.hero-info-left {
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}
.hero-info-left h1 {
  color: white;
  font-weight: bold;
  /* letter-level animation — GSAP sets opacity/transform on .char spans */
}
.hero-info-left p {
  font-size: 13px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.5);
  padding: 10px 12px;
  border: 3px solid var(--dark);
  box-shadow: 3px 3px 0 var(--dark);
  max-width: 100%;
}
.hero-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.smallie {
  zoom: 1.4;
}

.puzzle-panel {
  background: var(--white);
  border-left: 4px solid var(--dark);
  border-right: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 2rem 1.5rem;
  height: auto;
}
.puzzle-label {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--white);
  background: var(--red);
  padding: 5px 12px;
  margin-top: 1rem;
  border: 2px solid var(--dark);
  text-align: center;
}
#puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 260px;
}
.tile {
  aspect-ratio: 1;
  background: var(--yellow);
  border: 3px solid var(--dark);
  box-shadow: 3px 3px 0 var(--dark);
  font-family: "Press Start 2P", monospace;
  font-size: clamp(14px, 2.5vw, 22px);
  color: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
  user-select: none;
}
.tile:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--dark);
}
.tile.empty {
  background: var(--sky);
  border-style: dashed;
  box-shadow: none;
  cursor: default;
}
.tile.correct {
  background: #00e676;
}
.puzzle-moves {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--dark);
}
.puzzle-moves span {
  color: var(--red);
}
.puzzle-solved {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: var(--dark);
  background: #00e676;
  border: 3px solid var(--dark);
  padding: 8px 14px;
  box-shadow: 3px 3px 0 var(--dark);
  display: none;
  text-align: center;
  line-height: 1.8;
}
.btn-shuffle {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  background: var(--dark);
  color: var(--yellow);
  border: 3px solid var(--yellow);
  padding: 8px 16px;
  box-shadow: 3px 3px 0 var(--yellow);
  cursor: pointer;
  transition: all 0.1s;
}
.btn-shuffle:hover {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--yellow);
}

.btn-primary {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  background: var(--dark);
  color: var(--white);
  border: 4px solid var(--dark);
  padding: 12px 20px;
  box-shadow: 4px 4px 0 var(--dark);
  cursor: none;
  text-decoration: none;
  transition: all 0.1s;
  display: inline-block;
}
.btn-primary:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--dark);
}
.btn-secondary {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  background: var(--white);
  color: var(--dark);
  border: 4px solid var(--dark);
  padding: 12px 20px;
  box-shadow: 4px 4px 0 var(--dark);
  cursor: none;
  text-decoration: none;
  transition: all 0.1s;
  display: inline-block;
}
.btn-secondary:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--dark);
}

.pixel-divider {
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    var(--red) 0 20px,
    var(--yellow) 20px 40px
  );
}

/* =========================
   SECTION TITLE ANIMATION
   .title-line / .title-line-inner injected by JS
========================= */
.section-title .title-line {
  overflow: hidden;
}
.section-title .title-line-inner {
  display: block;
}

/* ABOUT */
#about {
  background: var(--yellow);
  padding: 80px 5%;
  border-top: 4px solid var(--dark);
  border-bottom: 4px solid var(--dark);
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  align-items: start;
}
.about-text p {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.8;
  color: var(--dark);
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.55);
  padding: 12px 14px;
  border: 3px solid var(--dark);
  box-shadow: 3px 3px 0 var(--dark);
}
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.skill-chip {
  background: var(--white);
  border: 3px solid var(--dark);
  box-shadow: 3px 3px 0 var(--dark);
  padding: 9px 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.1s;
  cursor: default;
}
.skill-chip:hover {
  background: var(--red);
  color: var(--white);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--dark);
}
.skill-dot {
  width: 9px;
  height: 9px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--dark);
  flex-shrink: 0;
}
.skill-chip:hover .skill-dot {
  background: var(--yellow);
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}
.section-label {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  background: var(--red);
  color: var(--white);
  display: inline-block;
  padding: 6px 14px;
  border: 3px solid var(--dark);
  box-shadow: 3px 3px 0 var(--dark);
  margin-bottom: 14px;
  letter-spacing: 1px;
}
.section-title {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(13px, 2vw, 22px);
  color: var(--dark);
  line-height: 1.6;
}

/* PROJECTS */
#projects {
  background: var(--sky);
  color: #151515;
  padding: 8rem 4rem;
  overflow: hidden;
  font-weight: 500;
}
#projects .section-header {
  max-width: 1400px;
  margin: 0 auto 5rem;
  text-align: left;
}
#projects .section-label {
  background: transparent;
  border: none;
  box-shadow: none;
  color: #000000;
  font-size: 0.7rem;
  letter-spacing: 2px;
  display: block;
}
#projects .section-title {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.1;
  color: #ffffff;
  margin-top: 1rem;
}
.projects-grid {
  display: flex;
  gap: 2rem;
  width: max-content;
  padding-bottom: 2rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.project-card {
  flex: 0 0 auto;
  width: 420px;
  min-height: 600px;
  background: var(--yellow);
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 2rem;
  overflow: hidden;
  scroll-snap-align: start;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.project-card:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  background-color: red;
  color: white;
}
.card-level {
  font-size: 1.5rem;
  font-family: "Press Start 2P", monospace;
  color: #000000;
  margin-bottom: 1rem;
}
.card-visual {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  margin-bottom: 1rem;
  position: relative;
}
.card-visual img {
  height: 70px !important;
  margin: 0 !important;
  position: static !important;
}
.card-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.card-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1rem;
}
.tag {
  font-size: 0.6rem;
  padding: 4px 8px;
  border: 1px solid #151515;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-link {
  font-size: 0.7rem;
  font-weight: bold;
  text-decoration: none;
  color: #000000;
}
.card-link:hover {
  border-bottom: solid 1px var(--white);
  width: auto;
  color: rgb(255, 255, 255);
}

/* EXPERIENCE */
#experience {
  background: var(--red);
  padding: 80px 5%;
  border-top: 4px solid var(--dark);
  border-bottom: 4px solid var(--dark);
}
#experience .section-title {
  color: var(--white);
  text-shadow: 3px 3px 0 var(--dark);
}
#experience .section-label {
  background: var(--dark);
}
.timeline {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--dark);
}
.timeline-item {
  display: flex;
  gap: 22px;
  margin-bottom: 28px;
  align-items: flex-start;
}
.timeline-ball {
  width: 58px;
  height: 58px;
  background: var(--yellow);
  border: 4px solid var(--dark);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  z-index: 1;
}
.timeline-content {
  background: var(--white);
  border: 4px solid var(--dark);
  box-shadow: 5px 5px 0 var(--dark);
  padding: 16px 20px;
  flex: 1;
}
.timeline-year {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: var(--red);
  margin-bottom: 5px;
}
.timeline-role {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--dark);
  margin-bottom: 7px;
  line-height: 1.6;
}
.timeline-company {
  font-size: 12px;
  font-weight: 900;
  color: var(--dark);
  margin-bottom: 7px;
}
.timeline-desc {
  font-size: 12px;
  font-weight: 700;
  color: #333;
  line-height: 1.7;
}

/* CONTACT */
#contact {
  background: var(--sky);
  padding: 80px 5%;
  border-top: 4px solid var(--dark);
}
.contact-wrap {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}
.contact-card {
  background: var(--yellow);
  border: 5px solid var(--dark);
  box-shadow: 8px 8px 0 var(--dark);
  padding: 36px;
  margin-top: 2rem;
}
.contact-card p {
  font-size: 13px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.7;
  margin-bottom: 22px;
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}
.contact-link {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: var(--dark);
  text-decoration: none;
  background: var(--white);
  border: 3px solid var(--dark);
  padding: 9px 14px;
  box-shadow: 3px 3px 0 var(--dark);
  transition: all 0.1s;
  display: flex;
  align-items: center;
  gap: 7px;
}
.contact-link:hover {
  background: var(--red);
  color: var(--white);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--dark);
}

.game-over-footer {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  text-align: center;
  padding: 18px;
  background: var(--dark);
  color: var(--yellow);
  border-top: 4px solid var(--yellow);
  letter-spacing: 1px;
}

/* ============================================================
   MOBILE — max-width: 768px
============================================================ */
@media (max-width: 768px) {
  #cursor {
    display: none;
  }
  body {
    cursor: auto;
  }
  .nav-links {
    display: none;
  }
  nav {
    padding: 0 1rem;
  }
  .nav-logo {
    font-size: 11px;
  }
  .score-bar {
    top: 56px;
    height: 24px;
  }
  .score-ticker {
    font-size: 6px;
  }
  #hero {
    padding-top: 56px;
    margin-top: 0;
  }
  #game-hud {
    font-size: 7px;
    gap: 8px;
    padding: 4px 8px;
    top: 6px;
    left: 8px;
  }
  .hero-info-left {
    padding: 1.5rem 1rem;
    width: 100%;
  }
  .lr {
    grid-template-columns: 1fr;
  }
  .puzzle-panel {
    border-left: none;
    border-top: 4px solid var(--dark);
    width: calc(100% - 2rem);
    margin: 0 1rem 1.5rem;
  }
  .hero-info-left h1 {
    font-size: clamp(9px, 3.5vw, 14px);
    margin-bottom: 12px;
  }
  .hero-info-left p {
    font-size: 12px;
    max-width: 100%;
    margin-bottom: 14px;
  }
  .hero-ctas {
    gap: 8px;
  }
  .btn-primary,
  .btn-secondary {
    font-size: 8px;
    padding: 10px 14px;
  }
  .puzzle-label {
    font-size: 7px;
    text-align: center;
    padding: 4px 8px;
  }
  #puzzle-grid {
    max-width: 240px;
    gap: 6px;
  }
  #about {
    padding: 50px 5%;
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .skills-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .skill-chip {
    font-size: 6px;
    padding: 8px 10px;
  }
  #projects {
    padding: 50px 4%;
  }
  .projects-grid {
    flex-direction: column;
    width: 100%;
    overflow: visible;
  }
  .project-card {
    width: 100%;
    min-height: auto;
  }
  .card-visual img {
    margin-left: 50% !important;
    transform: translateX(-50%);
    margin-top: 1.5rem !important;
  }
  #experience {
    padding: 50px 4%;
  }
  .timeline::before {
    left: 22px;
  }
  .timeline-item {
    gap: 14px;
  }
  .timeline-ball {
    width: 46px;
    height: 46px;
    font-size: 16px;
  }
  .timeline-content {
    padding: 12px 14px;
  }
  .timeline-role {
    font-size: 8px;
  }
  #contact {
    padding: 50px 4%;
  }
  .contact-card {
    padding: 20px 16px;
  }
  .contact-links {
    gap: 8px;
  }
  .contact-link {
    font-size: 6px;
    padding: 8px 10px;
  }
  .game-over-footer {
    font-size: 6px;
    padding: 14px 8px;
    letter-spacing: 0px;
    line-height: 1.8;
  }
  .section-header {
    margin-bottom: 2rem;
  }
  .section-title {
    font-size: clamp(11px, 3.5vw, 16px);
  }
  .section-label {
    font-size: 6px;
    padding: 5px 10px;
  }
}

/* ============================================================
   SMALL MOBILE — max-width: 400px
============================================================ */
@media (max-width: 400px) {
  .hero-info-left h1 {
    font-size: 9px;
  }
  .hero-info-left p {
    font-size: 11px;
  }
  .btn-primary,
  .btn-secondary {
    font-size: 7px;
    padding: 9px 11px;
  }
  #puzzle-grid {
    max-width: 200px;
    gap: 5px;
  }
  .touch-btn {
    width: 50px;
    height: 50px;
    font-size: 15px;
  }
  .touch-jump {
    width: 62px;
    height: 62px;
    font-size: 18px;
  }
  .timeline-ball {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
  .timeline-role {
    font-size: 7px;
  }
  .contact-card {
    padding: 16px 12px;
  }
  .skills-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
