:root {
  --bg: #070a11;
  --bg-2: #0d1422;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --text: #eef3ff;
  --muted: #a9b9d9;
  --line: rgba(255, 255, 255, 0.16);
  --primary: #5d7dff;
  --secondary: #2ad0b3;
  --danger: #ff6262;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(93, 125, 255, 0.25), transparent 45%),
    radial-gradient(900px 500px at -10% 60%, rgba(42, 208, 179, 0.15), transparent 50%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  min-height: 100vh;
  line-height: 1.5;
}

.container { width: min(1120px, 92vw); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(7, 10, 17, 0.78);
  border-bottom: 1px solid var(--line);
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 0;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.3px;
}

nav { display: flex; flex-wrap: wrap; gap: 0.75rem; }

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
}

nav a:hover, nav a.active {
  color: var(--text);
  background: var(--panel);
}

main { padding: 3.4rem 0 4rem; flex: 1 0 auto; }

.hero {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
}

h1 { font-size: clamp(1.8rem, 4.4vw, 3rem); line-height: 1.15; margin: 0.35rem 0 0.65rem; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0.2rem 0 0.8rem; }

.about-title {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  max-width: 20ch;
}

.eyebrow {
  color: var(--secondary);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

.lead { color: var(--muted); max-width: 68ch; line-height: 1.7; }

main p {
  line-height: 1.7;
}

.card,
.panel {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

button.btn {
  appearance: none;
  -webkit-appearance: none;
}

.btn-primary { background: linear-gradient(130deg, var(--primary), #8f63ff); color: #fff; border-color: rgba(255,255,255,0.1); }
.btn-ghost { border-color: var(--line); color: var(--text); background: rgba(255,255,255,0.07); }

.actions { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.2rem; }

.project-link { color: var(--secondary); text-decoration: none; font-weight: 600; }
.project-link:hover { text-decoration: underline; }

.project-stack {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.project-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: rgba(93, 125, 255, 0.55);
  background: linear-gradient(120deg, rgba(93, 125, 255, 0.2), rgba(255, 255, 255, 0.04));
}

.project-card h2 {
  margin: 0 0 0.4rem;
}

.project-card p {
  margin: 0;
  color: var(--muted);
}

.project-kind {
  color: var(--secondary) !important;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem !important;
  font-weight: 700;
}


.project-card .actions {
  margin-top: 0;
}


.project-links {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}

.project-links .btn {
  white-space: nowrap;
}

.project-card {
  align-items: flex-start;
}




.kpi-list { display: grid; gap: 0.8rem; }
.kpi { padding: 0.85rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.03); }

.site-footer {
  margin-top: auto;
  background: rgba(7, 10, 17, 0.82);
  backdrop-filter: blur(8px);
  padding: 1.6rem 0;
}

.footer-grid { display: grid; gap: 1rem; grid-template-columns: 1.5fr 1fr 1fr; }
.footer-grid p, .footer-grid a { color: var(--muted); }
.footer-grid a { text-decoration: none; }
.footer-grid a:hover { color: var(--text); }

.game-wrap { display: grid; gap: 1rem; }

.game-stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.35);
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 0.6rem;
  background: linear-gradient(180deg, rgba(8, 12, 20, 0.82), rgba(8, 12, 20, 0.68));
  padding: 1rem;
}

.game-overlay.hidden {
  display: none;
}

.game-overlay h2 {
  margin: 0;
}

.game-overlay p {
  margin: 0;
  color: var(--muted);
  max-width: 58ch;
}

canvas {
  width: 100%;
  max-width: 900px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #05080f;
}

.hud { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.mobile-controls {
  display: none;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(2, 54px);
  gap: 0.4rem;
  justify-content: start;
}

.mobile-controls button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  font-weight: 700;
}

.mobile-controls .up { grid-column: 2; }
.mobile-controls .left { grid-column: 1; grid-row: 2; }
.mobile-controls .down { grid-column: 2; grid-row: 2; }
.mobile-controls .right { grid-column: 3; grid-row: 2; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  main { padding-top: 2.4rem; }
  .mobile-controls { display: grid; }
  .project-card { flex-direction: column; align-items: flex-start; }
  .tetris-layout { grid-template-columns: 1fr; }
  .next-list { max-width: 100%; }
  .mobile-tetris-controls { display: grid; }
}


.tetris-layout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
}

.leaderboard {
  min-height: 600px;
}

.leaderboard h2 {
  margin-top: 0;
}

#highScoreList {
  margin: 0.4rem 0 1rem;
  padding-left: 1.2rem;
}

.score-form {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.score-form input {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
}

.hidden {
  display: none;
}


#gameCanvas {
  width: min(300px, 80vw);
  max-width: 300px;
  image-rendering: pixelated;
}

.next-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-bottom: 1rem;
  max-width: 250px;
}

.next-list canvas {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  image-rendering: pixelated;
  background: #0b0f1a;
}


body.no-scroll {
  overflow: hidden;
}

.game-modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 17, 0.65);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 100;
}

.game-modal-card {
  width: min(980px, 96vw);
  max-height: 94vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(22, 30, 50, 0.95), rgba(10, 14, 24, 0.95));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
}

.next-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.35rem;
}

.next-item span {
  width: 1.2rem;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}


.inline-host {
  margin-top: 1rem;
}

.game-shell {
  display: grid;
  gap: 0.8rem;
}

.mobile-tetris-controls {
  display: none;
  grid-template-columns: repeat(5, minmax(48px, 1fr));
  gap: 0.5rem;
}

.mobile-tetris-controls button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.5rem;
}


.game-modal.hidden {
  display: none;
}

.game-shell.hidden {
  display: none;
}


#pacCanvas {
  width: min(420px, 92vw);
  max-width: 420px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1020;
}
