/* Base styles */
:root {
  --bg: #ffffff;
  --text: #111111;
  --primary: #1f6feb;
  --muted: #666;
  --surface: #f5f7fb;
  --border: #e5e7eb;
  --header-h: 64px;
}

:root.dark {
  --bg: #0b0f17;
  --text: #e5e7eb;
  --primary: #8ab4f8;
  --muted: #a1a1aa;
  --surface: #121826;
  --border: #1f2937;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Keyframes */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
@keyframes spin360 {
  to { transform: rotate(360deg); }
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
@keyframes floaty {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  /* Safe area for notched phones */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  background: rgba(245, 247, 251, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
:root.dark header {
  background: rgba(18, 24, 38, 0.88);
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

h1 {
  font-size: 20px;
  margin: 0;
}

.logo-wave { display: inline-block; transform-origin: 50% 50%; }
.logo-wave span { display: inline-block; animation: floaty 3s ease-in-out infinite; }
.logo-wave span:nth-child(odd) { animation-delay: .1s; }
.logo-wave span:nth-child(even) { animation-delay: .35s; }

/* Hero / typing */
.hero { display:flex; gap:12px; align-items:center; padding: 18px; background: linear-gradient(180deg, rgba(0,0,0,0.02), transparent); border-radius: 10px; margin-bottom: 12px; }
.hero .typing { font-weight:600; font-size:18px; color:var(--primary); }
.typing .cursor { display:inline-block; width:8px; height:18px; background:currentColor; margin-left:6px; vertical-align:middle; animation: blink .9s steps(1) infinite; }

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 12px;
}

nav a {
  text-decoration: none;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  position: relative;
}
nav a::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}
nav a:hover::after, nav a.active::after { transform: scaleX(1); }

nav a:hover {
  background: var(--border);
}

nav a.active {
  background: var(--primary);
  color: #fff;
}
/* Sötét módban a --primary világoskék, fehér szöveggel rossz a kontraszt,
   ezért sötétebb kék hátteret használunk az aktív menüpontnál. */
:root.dark nav a.active {
  background: #1f6feb;
  color: #fff;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

section {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .5s ease, transform .5s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
  animation: fadeUp .5s ease forwards;
  animation-delay: var(--d, 0ms);
}

section#snake-game {
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  background: var(--bg);
  border: 2px solid var(--primary);
  box-shadow: 0 10px 40px rgba(31,111,235,.12);
}

section.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Snake game styles (inline) */
#inlineSnakeStart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 2px solid var(--primary);
  background: linear-gradient(135deg, var(--primary), rgba(138,180,248,.9));
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  margin-top: 12px;
  box-shadow: 0 4px 12px rgba(31,111,235,.25);
  font-size: 16px;
}
#inlineSnakeStart:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 28px rgba(31,111,235,.35), 0 0 20px rgba(31,111,235,.2);
}
#inlineSnakeStart:active {
  transform: translateY(-2px) scale(0.98);
}
#inlineSnakeStart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.snake-canvas {
  width: 100%;
  height: auto;
  max-width: 400px;
  margin: 0 auto;
  display: block;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  border-radius: 12px;
  border: 3px solid var(--primary);
  aspect-ratio: 1 / 1;
  box-shadow: 0 12px 32px rgba(77, 124, 255, 0.25);
  transition: box-shadow .3s ease;
}
.snake-canvas:active {
  box-shadow: 0 8px 20px rgba(77, 124, 255, 0.3);
}

@media (max-width: 600px) {
  .snake-canvas { max-width: 100%; }
  .button.small { font-size: 12px; padding: 6px 10px; }
}

@media (max-width: 480px) {
  .snake-canvas { max-width: 100%; }
}

@media (max-width: 360px) {
  .snake-canvas { aspect-ratio: 1 / 1; }
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.card {
  display: block;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .2s ease, color .2s ease;
  overflow: hidden;
  position: relative;
}
/* 3D tilt container */
.card { transform-style: preserve-3d; will-change: transform; perspective: 800px; }
.card .card-inner { transform: translateZ(0); transition: transform .12s ease, box-shadow .12s ease; }
.card.tilt { box-shadow: 0 18px 40px rgba(0,0,0,.12); }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.12); background: var(--surface); }
.card:active { animation: pop .15s ease; }
.card-badges { display: flex; gap: 6px; margin-bottom: 8px; }
.badge {
  font-size: 12px;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(31,111,235,.1);
  color: var(--primary);
  border: 1px solid var(--border);
}

/* pulsing badge */
.badge.pulse { animation: badgePulse 1600ms ease-in-out infinite; }
@keyframes badgePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(31,111,235,0.12); }
  50% { transform: scale(1.06); box-shadow: 0 6px 18px -6px rgba(31,111,235,0.18); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(31,111,235,0); }
}
.card-title { font-weight: 600; margin-bottom: 6px; text-transform: capitalize; }
.card-meta { color: var(--muted); font-size: 12px; }
.card.hint { background: var(--surface); color: var(--muted); }

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.gallery img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  cursor: zoom-in;
  border: 1px solid var(--border);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.gallery img:hover {
  transform: scale(1.04);
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
  border-color: var(--primary);
}

/* Drag-to-scroll gallery */
.gallery { cursor: grab; user-select: none; }
.gallery.dragging { cursor: grabbing; }

/* header parallax background */
.header-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .06; background: radial-gradient(800px 400px at 10% 20%, var(--primary), transparent 20%), radial-gradient(600px 300px at 85% 80%, #ff8fb1, transparent 12%); transform: translate3d(0,0,0); transition: transform .12s linear; }
.header-inner { position: relative; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.lightbox.show { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.lightbox .close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  min-height: 44px;
  min-width: 44px;
  height: 44px;
  width: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}

.icon-btn:hover { background: var(--border); }
.icon-btn:active { transform: scale(0.98); }
.icon-btn.spin { animation: spin360 .4s ease; }
.icon-btn, .button { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: currentColor;
  opacity: .25;
  animation: ripple .5s ease-out;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(1); opacity: 0; }
}

.hamburger {
  display: none;
}

/* Asztali nézet: a menü egy sorban, logó balra, menü + vezérlők jobbra */
@media (min-width: 721px) {
  .header-inner { justify-content: flex-start; gap: 16px; }
  .header-inner > h1 { margin-right: auto; }
  nav { order: 1; }
  .controls { order: 2; }
  nav ul { flex-wrap: nowrap; }
  nav a { white-space: nowrap; }
}

/* Mobile nav */
@media (max-width: 720px) {
  nav ul {
    position: fixed;
    top: calc(var(--header-h) + env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    left: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    display: none;
    z-index: 1001;
  }
  nav ul.open { display: flex; }
  .hamburger { display: inline-flex; }
  nav a { padding: 12px 14px; min-height: 44px; display: flex; align-items: center; }
}

/* Phone-first layout */
@media (max-width: 600px) {
  .header-inner { padding: 0 12px; gap: 8px; }
  h1 { font-size: 16px; }
  .logo-wave span { font-size: 0.9em; }
  .container { padding: 16px 12px 48px; }
  section { padding: 16px 12px; margin-bottom: 14px; }
  section h2 { font-size: 1.25rem; margin-top: 0; }
  .hero {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px;
  }
  .hero .typing { font-size: 16px; }
  .hero h2 { font-size: 1.2rem; }
  .card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .card { padding: 12px; }
  .gallery {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding-bottom: 8px;
    margin: 0 -12px;
  }
  .gallery img {
    flex: 0 0 min(85vw, 200px);
    width: min(85vw, 200px);
    height: 140px;
    scroll-snap-align: start;
  }
  .button, .icon-btn { min-height: 44px; min-width: 44px; touch-action: manipulation; }
  #toTop {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
  }
  footer { padding: 16px 12px; font-size: 14px; }
}

/* Inline Snake section on phone */
@media (max-width: 600px) {
  section#snake-game { padding: 12px; margin-bottom: 14px; }
  section#snake-game h2 { font-size: 1.2rem; }
  section#snake-game [style*="display:flex"][style*="justify-content:center"] { max-width: 100%; }
  #inlineSnakeCanvas {
    max-width: 100%;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
  }
  section#snake-game .button { min-width: 0; flex: 1 1 33%; }
}

/* Tic-Tac-Toe on phone */
@media (max-width: 600px) {
  .ttt-wrap { max-width: 100%; padding: 0 8px; }
  .ttt-board { max-width: min(100%, 260px); padding: 8px; gap: 4px; }
  .ttt-cell { font-size: clamp(24px, 10vw, 36px); }
  .ttt-wrap .button { min-width: 100%; min-height: 44px; }
}

/* Prevent iOS zoom on focus (inputs ≥16px) */
input, select, textarea { font-size: 16px; }
@media (max-width: 600px) {
  input, select, textarea { font-size: max(16px, 1rem); }
}

footer {
  text-align: center;
  color: var(--muted);
  padding: 24px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

/* Scroll to top */
#toTop {
  position: fixed;
  right: 16px;
  bottom: 16px;
  height: 40px;
  width: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
}

#toTop.show { display: flex; }

/* Utilities */
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.button:hover { background: var(--border); }
.button:active { transform: translateY(1px); }
.button:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.muted { color: var(--muted); }

/* Tic-Tac-Toe (Amőba) */
.ttt-wrap {
  max-width: 320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.ttt-status {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0;
}
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  aspect-ratio: 1;
  max-width: 280px;
  background: var(--surface);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.ttt-cell {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: clamp(28px, 8vw, 42px);
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.ttt-cell:hover:not(.x):not(.o) {
  background: var(--surface);
  border-color: var(--primary);
}
.ttt-cell:active:not(.x):not(.o) { transform: scale(0.96); }
.ttt-cell.x { color: var(--primary); }
.ttt-cell.o { color: #e11d48; }
.ttt-cell.win {
  background: rgba(31, 111, 235, 0.15);
  border-color: var(--primary);
  animation: pop .3s ease;
}
:root.dark .ttt-cell.o { color: #f87171; }
.ttt-wrap .button { min-width: 120px; }



/* Visually hidden (accessibility) */
.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;
}

/* Scroll progress bar */
#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #a78bfa, #06d6a0);
  z-index: 9999;
  transition: width .1s linear;
  pointer-events: none;
}

/* Toast notifications */
#toastContainer {
  position: fixed;
  bottom: 70px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 8000;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  animation: toastIn .3s ease;
  pointer-events: auto;
  max-width: 260px;
}
.toast.success { border-left-color: #06d6a0; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0);    }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0);    }
  to   { opacity: 0; transform: translateX(20px); }
}

/* Skills section */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(31,111,235,.08);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: default;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
  animation: fadeUp .4s ease both;
}
.skill-tag:hover {
  transform: translateY(-3px) scale(1.05);
  background: rgba(31,111,235,.15);
  box-shadow: 0 6px 16px rgba(31,111,235,.15);
  border-color: var(--primary);
}
.skill-tag .skill-icon { font-size: 16px; }

/* Footer improvements */
.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease;
}
.footer-links a:hover {
  color: var(--primary);
  background: rgba(31,111,235,.08);
}


/* ── EXTRA EFFECTS ─────────────────────────────────────────────────────────── */

/* Cursor spotlight (via CSS vars --cx / --cy set by JS) */
body {
  background:
    radial-gradient(700px circle at var(--cx, -1000px) var(--cy, -1000px),
      rgba(31,111,235,.055),
      transparent 40%),
    var(--bg);
}
:root.dark body {
  background:
    radial-gradient(700px circle at var(--cx, -1000px) var(--cy, -1000px),
      rgba(138,180,248,.05),
      transparent 40%),
    var(--bg);
}

/* Custom cursor ring */
#cursorRing {
  position: fixed;
  width: 30px;
  height: 30px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width .2s, height .2s, border-color .2s, opacity .3s;
  opacity: 0;
  mix-blend-mode: difference;
}
#cursorRing.active { opacity: 1; }
#cursorRing.over-link {
  width: 14px;
  height: 14px;
  border-color: #a78bfa;
}

/* Logo glitch */
@keyframes glitchA {
  0%,100% { clip-path: inset(0 0 85% 0); transform: translate(-4px, 0) skewX(-3deg); color: #00ffff; }
  33%      { clip-path: inset(35% 0 45% 0); transform: translate(4px, 0) skewX(2deg); color: #00ffff; }
  66%      { clip-path: inset(75% 0 8% 0);  transform: translate(-2px, 0); color: #00ffff; }
}
@keyframes glitchB {
  0%,100% { clip-path: inset(55% 0 25% 0); transform: translate(4px, 0); color: #ff00aa; }
  33%      { clip-path: inset(10% 0 65% 0); transform: translate(-4px, 0); color: #ff00aa; }
  66%      { clip-path: inset(70% 0 12% 0); transform: translate(2px, 0) skewX(-2deg); color: #ff00aa; }
}
.logo-wave { position: relative; }
.logo-wave::before,
.logo-wave::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  pointer-events: none;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  white-space: nowrap;
}
.logo-wave.glitching::before {
  opacity: 1;
  animation: glitchA .38s steps(2) forwards;
}
.logo-wave.glitching::after {
  opacity: 1;
  animation: glitchB .38s steps(2) forwards;
}

/* Neon pulse on inline snake canvas */
@keyframes neonPulse {
  0%,100% {
    box-shadow:
      0 0 8px rgba(77,124,255,.5),
      0 0 20px rgba(77,124,255,.25),
      0 12px 32px rgba(77,124,255,.25);
  }
  50% {
    box-shadow:
      0 0 22px rgba(77,124,255,.8),
      0 0 50px rgba(77,124,255,.4),
      0 0 80px rgba(167,139,250,.2),
      0 12px 40px rgba(77,124,255,.4);
  }
}
#inlineSnakeCanvas {
  animation: neonPulse 2.5s ease-in-out infinite;
}

/* Animated border glow on snake & ttt sections */
@keyframes sectionHue {
  0%,100% { border-color: var(--primary); box-shadow: 0 10px 40px rgba(31,111,235,.12); }
  33%      { border-color: #a78bfa;       box-shadow: 0 10px 40px rgba(167,139,250,.18); }
  66%      { border-color: #06d6a0;       box-shadow: 0 10px 40px rgba(6,214,160,.15);  }
}
section#snake-game,
section#tic-tac-toe {
  animation: sectionHue 6s ease-in-out infinite;
}

/* Card mouse-shine overlay (updated via JS custom props) */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    100px circle at var(--mx, -200px) var(--my, -200px),
    rgba(255,255,255,.13),
    transparent 65%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.card:hover::after { opacity: 1; }

/* Floating decorative orbs in hero */
.hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: orbFloat var(--dur, 8s) ease-in-out infinite;
  opacity: .18;
  filter: blur(1px);
}
@keyframes orbFloat {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-20px) scale(1.06); }
}
section#home { position: relative; overflow: hidden; }

/* Skill tag stagger (entrance handled by JS) */
.skill-tag { opacity: 0; }
.skill-tag.visible { opacity: 1; transition: opacity .4s ease, transform .4s ease; }

/* Section h2 scramble flicker */
.scrambling { color: var(--primary); }

/* Ripple on click anywhere */
.global-ripple {
  position: fixed;
  border-radius: 50%;
  background: rgba(31,111,235,.18);
  pointer-events: none;
  animation: globalRipple .7s ease-out forwards;
  z-index: 9997;
  transform: translate(-50%, -50%) scale(0);
}
@keyframes globalRipple {
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* Shooting stars */
@keyframes shootingStar {
  0%   { transform: translateX(0) translateY(0) rotate(-35deg); opacity: 1; }
  100% { transform: translateX(400px) translateY(200px) rotate(-35deg); opacity: 0; }
}
.shooting-star {
  position: fixed;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0), var(--primary), rgba(255,255,255,0));
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
  animation: shootingStar var(--dur, .7s) ease-out forwards;
  opacity: 0;
}

/* ── ADDED IMPROVEMENTS ─────────────────────────────────────────────────────── */

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Section h2 typography */
section > h2 {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Gradient underline on section headings */
section > h2::after {
  content: '';
  display: block;
  margin-top: 8px;
  height: 2px;
  width: 48px;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  border-radius: 1px;
}

/* Link styling in body text */
section p a {
  color: var(--primary);
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: text-decoration-color .15s ease;
}
section p a:hover { text-decoration-color: var(--primary); }

/* About section two-column layout */
.about-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
}
.about-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.about-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.about-link-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(31,111,235,.25);
}
@media (max-width: 600px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-links { flex-direction: row; flex-wrap: wrap; }
}

/* Contact card layout */
.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-wrap: wrap;
}
.contact-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.contact-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.contact-info a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
  transition: color .15s ease;
}
.contact-info a:hover { color: var(--primary); }

/* Smooth theme-switch transition on key elements */
body, header, footer, .button, .icon-btn, nav ul,
.badge, .skill-tag, .ttt-cell, .ttt-board, input,
.toast, .contact-card, .about-link-btn {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: .2s;
  transition-timing-function: ease;
}
/* Don't override animation-driven transitions */
.hero-orb, .shooting-star, .global-ripple, .ripple, canvas,
.logo-wave span, #scrollProgress { transition: none !important; }

/* prefers-reduced-motion: disable decorative animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .logo-wave span { animation: none; }
  .hero-orb, .shooting-star { display: none !important; }
  #inlineSnakeCanvas { animation: none; }
  section#snake-game, section#tic-tac-toe { animation: none; }
}

/* ── ADDED FEATURES (talkingsasquach-inspired) ───────────────────────── */

/* Marquee ticker */
.marquee {
  overflow: hidden;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  color: #fff;
  border-bottom: 1px solid var(--border);
}
.marquee-track {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  padding: 8px 0;
  animation: marqueeScroll 28s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span { font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
@keyframes marqueeScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Stats counters */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { text-align: center; padding: 18px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.stat:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 10px 26px rgba(31,111,235,.15); }
.stat-num { font-size: clamp(28px, 5vw, 40px); font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--primary), #a78bfa); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* Video grid */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.video-card { display: block; text-decoration: none; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.video-card:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 14px 32px rgba(31,111,235,.18); }
.video-thumb { position: relative; aspect-ratio: 16 / 9; background-color: #0f172a; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; }
.video-card.placeholder .video-thumb { background-image: linear-gradient(135deg, var(--primary) 0%, #a78bfa 60%, #06d6a0 100%); opacity: .85; }
.video-play { width: 54px; height: 54px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; transition: transform .25s ease, background .25s ease; }
.video-card:hover .video-play { transform: scale(1.12); background: var(--primary); }
.video-info { padding: 12px 14px; }
.video-title { font-weight: 600; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Newsletter */
.newsletter-card { max-width: 520px; }
.newsletter-form { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.newsletter-form input { flex: 1; min-width: 200px; padding: 12px 14px; border: 2px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 14px; transition: border-color .2s ease, box-shadow .2s ease; }
.newsletter-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(31,111,235,.18); }

/* Discord / community CTA */
#community { background: linear-gradient(135deg, var(--surface), rgba(88,101,242,.12)); }
.discord-cta { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.discord-cta-text h2 { margin: 0 0 6px; }
.discord-cta-text p { margin: 0; }
.discord-btn { background: linear-gradient(135deg, #5865F2, #7983f5) !important; border-color: #5865F2 !important; color: #fff !important; white-space: nowrap; }

/* Toast error variant */
.toast.error { border-left-color: #ff6b6b; }

/* Responsive for added features */
@media (max-width: 720px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .video-grid { grid-template-columns: 1fr 1fr; }
  .discord-cta { flex-direction: column; align-items: flex-start; }
  .discord-btn { width: 100%; text-align: center; }
}
@media (max-width: 420px) {
  .video-grid { grid-template-columns: 1fr; }
  .marquee-track span { font-size: 12px; }
}


/* ══ TALKINGSASQUACH-INSPIRED RETRO / SYNTHWAVE THEME ══════════════════ */

/* Animated synthwave landscape background (neon grid + glowing horizon) */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60vw 42vh at 50% 80%, rgba(20,33,206,.55), transparent 60%),
    radial-gradient(34vw 24vh at 50% 82%, rgba(255,60,160,.28), transparent 60%),
    linear-gradient(180deg, #04010d 0%, #0a0a2e 38%, #1a0b3a 60%, #3a0c52 74%, #04010d 100%);
}
body::after {
  content: "";
  position: fixed; left: 50%; bottom: -2px;
  width: 320vw; height: 55vh;
  transform: translateX(-50%) perspective(38vh) rotateX(74deg);
  transform-origin: bottom center;
  z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,170,255,.55) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0,170,255,.55) 2px, transparent 2px);
  background-size: 90px 90px;
  animation: gridScroll 2.4s linear infinite;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 35%);
  mask-image: linear-gradient(180deg, transparent, #000 35%);
}
@keyframes gridScroll { from { background-position: 0 0; } to { background-position: 0 90px; } }

body { background: #04010d; }

/* Neon glowing hacker headings */
.logo-wave {
  font-family: 'VT323', monospace;
  font-size: clamp(16px, 2.4vw, 28px);
  letter-spacing: 1px; color: #cfe3ff;
  white-space: nowrap; line-height: 1;
  text-shadow: 1px 1px 2px #000, 0 0 10px rgba(22,22,231,.95), 0 0 4px rgba(7,7,170,.95);
}
nav a { font-family: 'VT323', monospace; font-size: 19px; letter-spacing: .5px; }
section > h2 {
  font-family: 'VT323', monospace; letter-spacing: 1px;
  text-shadow: 1px 1px 2px #000, 0 0 8px rgba(22,22,231,.85), 0 0 3px rgba(7,7,170,.9);
}

/* Hero: link-in-bio over the animated scene */
section#home { background: transparent; border: none; box-shadow: none; padding-top: 24px; }
.ts-hero { text-align: center; padding: 44px 12px 36px; animation: fadeIn 1.4s ease both; }
.ts-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(26px, 7vw, 56px);
  color: #dbe6ff; margin: 0; transform: none;
  text-shadow: 2px 2px 2px #000, 0 0 14px rgba(22,22,231,1), 0 0 6px rgba(7,7,170,1), 0 0 28px rgba(0,153,255,.7);
  animation: neonPulse 3s ease-in-out infinite;
}
@keyframes neonPulse {
  0%,100% { text-shadow: 2px 2px 2px #000, 0 0 14px rgba(22,22,231,1), 0 0 6px rgba(7,7,170,1), 0 0 28px rgba(0,153,255,.7); }
  50%     { text-shadow: 2px 2px 2px #000, 0 0 22px rgba(40,80,255,1), 0 0 10px rgba(7,7,170,1), 0 0 42px rgba(0,153,255,.95); }
}
.ts-subtitle {
  font-family: 'VT323', monospace; font-size: clamp(18px, 3.4vw, 26px);
  color: #59c2ff; margin: 16px 0 28px; text-shadow: 0 0 8px rgba(0,153,255,.8);
}
.ts-links { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.ts-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'VT323', monospace; font-size: 20px;
  text-decoration: none; color: #dbe6ff;
  padding: 10px 16px; border-radius: 6px;
  border: 2px solid rgba(0,153,255,.55);
  background: rgba(8,12,40,.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  text-shadow: 0 0 6px rgba(0,153,255,.7);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.ts-link:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: #00aaff; background: rgba(20,33,120,.7);
  box-shadow: 0 0 16px rgba(20,33,206,.9), 0 0 6px rgba(0,153,255,.8);
}
.ts-ico { font-size: 22px; image-rendering: pixelated; filter: drop-shadow(0 0 4px rgba(0,153,255,.6)); }

/* Footer neon */
footer { background: rgba(4,1,13,.6); }
footer p, footer a { font-family: 'VT323', monospace; font-size: 18px; color: #59c2ff; text-shadow: 0 0 6px rgba(0,153,255,.6); }

/* Buttons + marquee tuned to the neon vibe */
.button:hover { box-shadow: 0 0 14px rgba(20,33,206,.55); }
.marquee { background: linear-gradient(90deg, #1421ce, #6a0dad); }
.marquee-track span { font-family: 'VT323', monospace; font-size: 16px; text-shadow: 0 0 6px rgba(0,153,255,.7); }

/* Stat numbers glow */
.stat-num { text-shadow: 0 0 14px rgba(0,153,255,.45); }

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
  .ts-title { animation: none; }
}
@media (max-width: 600px) { .logo-wave { font-size: clamp(14px, 4.4vw, 22px); } }
