:root {
  --bg-deep: #061526;
  --bg-mid: #0a2342;
  --bg-panel: rgba(255, 255, 255, 0.06);
  --cyan: #2ca7e0;
  --cyan-bright: #5ec8f5;
  --frost: #e0f2ff;
  --text: #ffffff;
  --muted: rgba(224, 242, 255, 0.72);
  --line: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --font: 'Sora', sans-serif;
  --display: 'Orbitron', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(44, 167, 224, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 90%, rgba(10, 35, 66, 0.9), transparent 50%),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 50%, #12375a 100%);
}

.bg-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
}

#app { position: relative; z-index: 2; }

/* Nav */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(6, 21, 38, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--cyan), #0a2342);
  box-shadow: 0 8px 20px rgba(44, 167, 224, 0.35);
  color: #fff;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.brand-text small {
  color: var(--muted);
  font-size: 0.72rem;
}

.nav-menu {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  color: var(--frost);
  text-decoration: none;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(44, 167, 224, 0.18);
  border-color: rgba(94, 200, 245, 0.35);
  color: #fff;
}

/* Sections */
.section {
  min-height: 100vh;
  display: none;
  padding: 110px 1.5rem 2.5rem;
}

/* Embedded in portfolio modal iframe */
body.embedded {
  overflow-y: auto;
  overflow-x: hidden;
}

body.embedded .section {
  min-height: auto;
  padding: 88px 1rem 2rem;
}

body.embedded .hero {
  min-height: auto;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding-bottom: 1rem;
}

body.embedded .hero-visual {
  min-height: 200px;
}

body.embedded .nav {
  padding: 0.65rem 1rem;
}

body.embedded .nav-menu {
  gap: 0.25rem;
}

body.embedded .nav-link {
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
}

body.embedded .modal-content {
  width: 100%;
  max-height: 88vh;
}

body.embedded .modal-body {
  max-height: calc(88vh - 64px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.embedded .modal {
  z-index: 3000;
}

body.embedded .game-card,
body.embedded .project-card {
  transform: none !important;
}

body.embedded .nav-portfolio-link,
body.embedded .lab-footer {
  display: none !important;
}

.nav-link.nav-portfolio-link {
  background: rgba(44, 167, 224, 0.12);
  border-color: rgba(94, 200, 245, 0.35);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link.nav-portfolio-link:hover {
  background: rgba(44, 167, 224, 0.3);
  border-color: rgba(94, 200, 245, 0.6);
  transform: translateX(-2px);
}

.lab-footer {
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
  border-top: 1px solid rgba(94, 200, 245, 0.12);
  background: rgba(5, 12, 22, 0.5);
  backdrop-filter: blur(8px);
}

.lab-footer p {
  margin: 0;
}

.lab-footer a {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 500;
  transition: 0.2s ease;
}

.lab-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.demo-back {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 5000;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: rgba(6, 21, 38, 0.88);
  border: 1px solid rgba(94, 200, 245, 0.35);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: 0.2s ease;
}

.demo-back:hover {
  background: rgba(44, 167, 224, 0.25);
  transform: translateY(-1px);
}

.section.active { display: block; animation: sectionIn 0.45s ease; }

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.container { max-width: 1120px; margin: 0 auto; }

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 2.5rem;
}

.section-kicker,
.hero-kicker {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan-bright);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.section-title {
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  background: linear-gradient(110deg, #fff 20%, var(--cyan-bright) 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-desc {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* Hero */
.hero {
  max-width: 1120px;
  margin: 0 auto;
  min-height: calc(100vh - 140px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 2.5rem;
}

.hero-title {
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.brand-line {
  display: block;
  letter-spacing: 0.16em;
  font-size: 0.72em;
  color: var(--frost);
  margin-bottom: 0.2rem;
}

.text-gradient {
  display: block;
  background: linear-gradient(110deg, #fff 10%, var(--cyan-bright) 55%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
  max-width: 34rem;
  margin-bottom: 1.6rem;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.4rem;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1.4rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: 0.25s ease;
}

.btn-primary {
  background: linear-gradient(120deg, var(--cyan), #0a2342);
  color: #fff;
  box-shadow: 0 10px 28px rgba(44, 167, 224, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(44, 167, 224, 0.45);
}

.btn-secondary {
  background: transparent;
  color: var(--frost);
  border: 1px solid rgba(94, 200, 245, 0.45);
}

.btn-secondary:hover {
  background: rgba(44, 167, 224, 0.12);
  transform: translateY(-2px);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.hero-meta i { color: var(--cyan-bright); margin-right: 0.35rem; }

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
}

.visual-orbit {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  border: 1px dashed rgba(94, 200, 245, 0.35);
  animation: spinSlow 18s linear infinite;
}

.visual-orbit::before {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 1px solid rgba(44, 167, 224, 0.25);
  box-shadow: 0 0 60px rgba(44, 167, 224, 0.2);
}

.floating-cube {
  width: 140px;
  height: 140px;
  position: relative;
  transform-style: preserve-3d;
  animation: cubeSpin 14s infinite linear;
}

@keyframes cubeSpin {
  from { transform: rotateX(-18deg) rotateY(0deg); }
  to { transform: rotateX(-18deg) rotateY(360deg); }
}

@keyframes spinSlow {
  to { transform: rotate(360deg); }
}

.cube-face {
  position: absolute;
  width: 140px;
  height: 140px;
  border: 1px solid rgba(94, 200, 245, 0.55);
  background: linear-gradient(145deg, rgba(44, 167, 224, 0.28), rgba(10, 35, 66, 0.75));
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: #fff;
  box-shadow: inset 0 0 30px rgba(44, 167, 224, 0.2);
}

.cube-face.front { transform: rotateY(0deg) translateZ(70px); }
.cube-face.back { transform: rotateY(180deg) translateZ(70px); }
.cube-face.right { transform: rotateY(90deg) translateZ(70px); }
.cube-face.left { transform: rotateY(-90deg) translateZ(70px); }
.cube-face.top { transform: rotateX(90deg) translateZ(70px); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(70px); }

/* Cards */
.skills-grid,
.games-grid,
.projects-grid {
  display: grid;
  gap: 1.25rem;
}

.skills-grid,
.games-grid {
  grid-template-columns: repeat(3, 1fr);
}

.projects-grid {
  grid-template-columns: repeat(3, 1fr);
}

.skill-card,
.game-card,
.project-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.skill-card {
  padding: 1.7rem;
  text-align: center;
}

.skill-card:hover,
.game-card:hover,
.project-card:hover {
  transform: translateY(-8px);
  border-color: rgba(94, 200, 245, 0.55);
  box-shadow: 0 22px 50px rgba(44, 167, 224, 0.22);
}

.skill-icon,
.game-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  color: #fff;
  background: linear-gradient(145deg, rgba(44, 167, 224, 0.9), rgba(10, 35, 66, 0.95));
  box-shadow: 0 10px 24px rgba(44, 167, 224, 0.3);
}

.skill-card h3,
.game-card h3,
.project-content h3 {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.55rem;
}

.skill-copy,
.game-card p,
.project-content p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1.1rem;
}

.skill-level { margin-bottom: 1.2rem; }

.level-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.level-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--cyan-bright));
  transition: width 1.6s ease;
  position: relative;
}

.level-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.level-text {
  color: var(--cyan-bright);
  font-weight: 600;
  font-size: 0.9rem;
}

.skill-btn {
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(120deg, var(--cyan), #0a2342);
  transition: 0.25s ease;
}

.skill-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(44, 167, 224, 0.35);
}

.game-card {
  display: block;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  padding: 1.6rem;
  cursor: pointer;
}

.game-cta,
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--cyan-bright);
  font-weight: 600;
  font-size: 0.9rem;
}

.project-card {
  overflow: hidden;
  cursor: pointer;
}

.project-image {
  height: 170px;
  display: grid;
  place-items: center;
  position: relative;
}

.tone-shop {
  background:
    radial-gradient(circle at 30% 30%, rgba(94, 200, 245, 0.35), transparent 45%),
    linear-gradient(145deg, #0d3a5c, #12375a);
}

.tone-game {
  background:
    radial-gradient(circle at 70% 40%, rgba(44, 167, 224, 0.4), transparent 50%),
    linear-gradient(145deg, #08243f, #0f4c75);
}

.tone-health {
  background:
    radial-gradient(circle at 40% 60%, rgba(56, 189, 168, 0.35), transparent 50%),
    linear-gradient(145deg, #0a3a42, #0f5a63);
}

.project-placeholder {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.project-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(6, 21, 38, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.project-content { padding: 1.4rem 1.5rem 1.55rem; }

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.tech-tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--frost);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 200, 245, 0.28);
  background: rgba(44, 167, 224, 0.12);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(4, 14, 26, 0.82);
  backdrop-filter: blur(8px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  width: min(860px, 100%);
  max-height: 90vh;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(12, 40, 68, 0.96), rgba(6, 21, 38, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  font-family: var(--display);
  letter-spacing: 0.04em;
}

.close-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  transition: 0.25s ease;
}

.close-btn:hover {
  background: rgba(44, 167, 224, 0.25);
  transform: rotate(90deg);
}

.modal-body {
  padding: 1.4rem;
  max-height: 70vh;
  overflow-y: auto;
}

/* Particles */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--cyan-bright);
  opacity: 0.55;
  animation: floatUp 7s infinite linear;
}

@keyframes floatUp {
  0% { transform: translateY(100vh); opacity: 0; }
  15% { opacity: 0.7; }
  85% { opacity: 0.7; }
  100% { transform: translateY(-10vh); opacity: 0; }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-subtitle { margin-inline: auto; }
  .hero-buttons, .hero-meta { justify-content: center; }
  .skills-grid,
  .games-grid,
  .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav { flex-direction: column; align-items: flex-start; }
  .nav-menu { width: 100%; }
  .section { padding-top: 140px; }
  .floating-cube, .cube-face { width: 110px; height: 110px; }
  .cube-face.front { transform: rotateY(0deg) translateZ(55px); }
  .cube-face.back { transform: rotateY(180deg) translateZ(55px); }
  .cube-face.right { transform: rotateY(90deg) translateZ(55px); }
  .cube-face.left { transform: rotateY(-90deg) translateZ(55px); }
  .cube-face.top { transform: rotateX(90deg) translateZ(55px); }
  .cube-face.bottom { transform: rotateX(-90deg) translateZ(55px); }
  .visual-orbit { width: 220px; height: 220px; }
}
