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

:root {
  --bg:     #0b0f1a;
  --bg2:    #0f1525;
  --card:   #111827;
  --border: #1e2d4a;
  --blue:   #3b82f6;
  --blue2:  #60a5fa;
  --blue3:  #1d4ed8;
  --text:   #e2e8f0;
  --muted:  #64748b;
  --green:  #22c55e;
  --font:   "Inter", sans-serif;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); overflow-x: hidden; font-size: 15px; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 1.5rem; }
section { padding: 5rem 0; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--blue3); border-radius: 3px; }

/* NAV */
#nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(11,15,26,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
#nav.scrolled { border-color: var(--border); }
.nav-inner { max-width: 1000px; margin: 0 auto; padding: 0 1.5rem; height: 58px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 1.15rem; font-weight: 800; color: var(--blue2); letter-spacing: .05rem; }
.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-size: .875rem; font-weight: 500; color: var(--muted); transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.menu-btn { display: none; background: none; border: none; color: var(--text); font-size: 1.1rem; cursor: pointer; padding: .4rem; }
.mobile-nav { display: none; flex-direction: column; padding: .75rem 1.5rem 1rem; gap: .25rem; border-top: 1px solid var(--border); }
.mobile-nav a { padding: .6rem 0; font-size: .95rem; color: var(--muted); border-bottom: 1px solid var(--border); }
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav.open { display: flex; }

/* BUTTONS */
.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--blue); color: #fff;
  padding: .65rem 1.5rem; border-radius: 8px;
  font-weight: 600; font-size: .875rem; border: none; cursor: pointer;
  transition: background .2s, transform .15s; font-family: var(--font);
}
.btn-primary:hover { background: var(--blue3); transform: translateY(-1px); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: .5rem;
  background: transparent; color: var(--blue2);
  padding: .65rem 1.5rem; border-radius: 8px;
  font-weight: 600; font-size: .875rem;
  border: 1px solid var(--border); transition: border-color .2s;
}
.btn-ghost:hover { border-color: var(--blue); }

/* SECTION LABELS */
.sec-label { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .12rem; text-transform: uppercase; color: var(--blue2); margin-bottom: .5rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; margin-bottom: 2rem; }

/* HERO */
#hero { padding-top: 7rem; min-height: 100vh; display: flex; align-items: center; }
.hero-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.avatar-wrap { margin-bottom: .5rem; }
.avatar {
  width: 120px; height: 120px; border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 30px rgba(59,130,246,.25);
  margin: 0 auto;
}
.hero-center h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; line-height: 1.15; }
.hero-center h1 span { color: var(--blue2); }
.role { font-size: .95rem; color: var(--blue2); font-weight: 500; min-height: 1.4em; }
.cursor { display: inline-block; animation: blink .7s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.desc { color: var(--muted); max-width: 420px; font-size: .9rem; }
.hero-btns { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; margin-top: .5rem; }

/* STATS BAR */
.stats-bar {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
}
.stats-inner {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.stat-item { text-align: center; }
.stat-num {
  display: block;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--blue2);
  line-height: 1;
}
.stat-label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08rem;
  margin-top: .3rem;
}

/* ABOUT */
#about { background: var(--bg); }
.about-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 2.5rem; align-items: start; }
.about-info { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; }
.info-row { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: 1rem; }
.info-row:last-of-type { margin-bottom: 0; }
.info-row i { color: var(--blue); margin-top: .2rem; width: 16px; flex-shrink: 0; }
.info-row small { display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08rem; }
.info-row span { font-size: .875rem; font-weight: 600; }
.green { color: var(--green) !important; }
.about-text p { color: var(--muted); margin-bottom: .85rem; font-size: .9rem; }
.about-text strong { color: var(--blue2); }

/* SKILLS */
#skills { background: var(--bg2); }
.skills-list { display: flex; flex-direction: column; gap: .75rem; }
.skill-bar-item {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.3rem;
  transition: border-color .2s;
}
.skill-bar-item:hover { border-color: var(--blue); }
.skill-bar-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 10px;
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: var(--blue2);
}
.skill-bar-body { flex: 1; min-width: 0; }
.skill-bar-name { font-size: .9rem; font-weight: 700; color: var(--text); display: block; margin-bottom: .15rem; }
.skill-bar-desc { font-size: .78rem; color: var(--muted); margin: 0; }

/* SERVICES */
#services { background: var(--bg); }
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
}
.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.6rem 1.4rem;
  transition: border-color .2s, transform .2s;
}
.service-card:hover { border-color: var(--blue); transform: translateY(-3px); }
.service-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: var(--blue2);
  margin-bottom: 1rem;
}
.service-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .5rem; }
.service-card p { font-size: .825rem; color: var(--muted); line-height: 1.55; }

/* PROJECTS */
#projects { background: var(--bg2); }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; margin-bottom: 1.2rem; }
.project-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .2s, transform .2s;
  color: var(--text);
}
.project-card:hover { border-color: var(--blue); transform: translateY(-3px); }
.proj-thumb {
  height: 100px; background: linear-gradient(135deg, #0f172a, #1e3a5f);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: rgba(96,165,250,.4);
}
.proj-body { padding: 1.2rem; flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.proj-body h3 { font-size: .95rem; font-weight: 700; }
.proj-url { font-size: .75rem; color: var(--blue2); }
.proj-body p { font-size: .825rem; color: var(--muted); flex: 1; }
.proj-visit { font-size: .8rem; color: var(--blue2); font-weight: 600; display: flex; align-items: center; gap: .4rem; margin-top: .5rem; }

/* CONTACT */
#contact { background: var(--bg); }
.contact-wrap { max-width: 520px; }
.contact-sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.email-link {
  display: inline-flex; align-items: center; gap: .75rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: .9rem 1.4rem;
  font-size: .95rem; font-weight: 600; color: var(--text);
  transition: border-color .2s; margin-bottom: 2rem;
}
.email-link i { color: var(--blue); }
.email-link:hover { border-color: var(--blue); color: var(--blue2); }
.socials { display: flex; gap: .75rem; flex-wrap: wrap; }
.social-item {
  display: flex; align-items: center; gap: .6rem;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: .7rem 1.2rem;
  font-size: .875rem; font-weight: 600; color: var(--muted);
  transition: all .2s;
}
.social-item i { font-size: 1.1rem; }
.social-item:hover { border-color: var(--blue); color: var(--blue2); }

/* FOOTER */
footer { background: var(--bg2); border-top: 1px solid var(--border); padding: 2rem 0; text-align: center; }
footer .logo { display: block; margin-bottom: .4rem; }
footer p { color: var(--muted); font-size: .825rem; }
footer strong { color: var(--blue2); }
.copy { margin-top: .2rem; font-size: .75rem; opacity: .5; }

/* BACK TO TOP */
#toTop {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--blue3); border: none; color: #fff;
  font-size: .9rem; cursor: pointer; z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .2s;
  display: flex; align-items: center; justify-content: center;
}
#toTop.show { opacity: 1; pointer-events: auto; }
#toTop:hover { transform: translateY(-2px); }

/* REVEAL */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .45s ease, transform .45s ease; }
.reveal.in { opacity: 1; transform: none; }

/* RESPONSIVE */
@media (max-width: 700px) {
  .nav-links { display: none; }
  .menu-btn { display: block; }
  .about-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: 1fr; }
  .stats-inner { gap: 1rem; }
}

/* PACMAN GAME */
#game-section { padding-top: 7rem; min-height: 100vh; display: flex; flex-direction: column; align-items: center; }
.game-container { max-width: 600px; width: 100%; display: flex; flex-direction: column; align-items: center; }
.game-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 1rem; }
.game-header h2 { margin-bottom: 0; font-size: 1.5rem; }
.game-header h2 span { color: var(--blue2); }
.game-stats { display: flex; align-items: center; gap: 1rem; }
.hearts { display: flex; gap: .3rem; color: #ef4444; font-size: 1.2rem; }
.hearts .empty { color: var(--border); }
.scores { display: flex; gap: .5rem; }
.score-board { font-size: 1rem; font-weight: 700; color: var(--blue2); background: var(--card); padding: .4rem .8rem; border-radius: 8px; border: 1px solid var(--border); }
.canvas-wrapper { position: relative; width: 100%; display: flex; justify-content: center; background: var(--bg2); border: 2px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
#gameCanvas { display: block; max-width: 100%; height: auto; }

/* D-PAD CONTROLS (Mobile) */
.d-pad { display: none; flex-direction: column; align-items: center; gap: .5rem; margin-top: 2rem; }
.d-row { display: flex; gap: .5rem; justify-content: center; }
.d-btn { width: 55px; height: 55px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); color: var(--blue2); font-size: 1.5rem; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .1s, transform .1s; user-select: none; -webkit-tap-highlight-color: transparent; }
.d-btn:active { background: var(--blue3); color: #fff; transform: scale(0.95); }
@media (max-width: 700px) {
  .d-pad { display: flex; }
}

/* WIN MODAL */
.modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(11,15,26,0.85); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .3s; }
.modal.show { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--card); border: 1px solid var(--border); padding: 2rem; border-radius: 16px; text-align: center; max-width: 90%; transform: scale(0.9); transition: transform .3s; box-shadow: 0 10px 40px rgba(0,0,0,0.8); }
.modal.show .modal-content { transform: scale(1); }
.trophy-wrap { width: 80px; height: 80px; margin: 0 auto 1rem; border-radius: 50%; background: rgba(251,191,36,0.15); border: 2px solid rgba(251,191,36,0.3); display: flex; align-items: center; justify-content: center; }
.trophy-icon { font-size: 2.5rem; color: #fbbf24; filter: drop-shadow(0 0 10px rgba(251,191,36,0.6)); }
.modal-content h3 { font-size: 1.8rem; color: #fff; margin-bottom: .5rem; }
.modal-content p { color: var(--muted); margin-bottom: 1.5rem; font-size: .95rem; }

