/* Programming portfolio page */

.programming-main {
  display: grid;
  gap: 3rem;
}

.programming-hero {
  min-height: calc(100vh - 90px);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(460px, 1.2fr);
  gap: clamp(1.1rem, 3vw, 2rem);
  align-items: center;
}

.programming-intro {
  --local-x: 50%;
  --local-y: 50%;
  position: relative;
  display: grid;
  gap: 1rem;
  padding: clamp(1.1rem, 2.5vw, 1.45rem);
  border-radius: 18px;
  background:
    radial-gradient(circle at var(--local-x) var(--local-y), rgba(85, 215, 255, 0.1), transparent 34%),
    linear-gradient(135deg, rgba(13, 24, 45, 0.4), rgba(13, 24, 45, 0.1));
  box-shadow:
    inset 0 0 38px rgba(85, 215, 255, 0.035),
    0 0 62px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.programming-intro::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--border-angle),
    transparent 0 18%,
    rgba(85, 215, 255, 0.72) 24%,
    rgba(255, 216, 106, 0.64) 31%,
    transparent 42% 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.76;
  animation: borderOrbit 6.2s linear infinite;
}

.programming-intro > * {
  position: relative;
  z-index: 1;
}

.programming-intro h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2.1rem, 4.1vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: 0;
  text-wrap: balance;
}

.programming-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.programming-tags span,
.game-status,
.game-hud div {
  border: 1px solid rgba(129, 158, 196, 0.28);
  background: rgba(8, 13, 23, 0.58);
  box-shadow: inset 0 0 22px rgba(85, 215, 255, 0.035);
}

.programming-tags span {
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  color: #d9e8f8;
  font-size: 0.92rem;
  font-weight: 700;
}

.game-shell {
  position: relative;
  display: grid;
  gap: 0.8rem;
  padding: clamp(0.7rem, 1.8vw, 1rem);
  border: 1px solid rgba(85, 215, 255, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 216, 106, 0.11), transparent 28%),
    radial-gradient(circle at 16% 84%, rgba(85, 215, 255, 0.13), transparent 30%),
    rgba(5, 8, 16, 0.72);
  box-shadow:
    0 0 50px rgba(85, 215, 255, 0.08),
    0 26px 70px rgba(0, 0, 0, 0.22),
    inset 0 0 40px rgba(255, 255, 255, 0.018);
  overflow: hidden;
}

.game-shell::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(85, 215, 255, 0.22), transparent 38%, rgba(255, 216, 106, 0.2));
  opacity: 0.55;
}

.game-shell > * {
  position: relative;
  z-index: 1;
}

.game-topline,
.tech-stack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.game-topline h2,
.workflow-panel h2,
.tech-stack h2,
.code-card h3 {
  margin: 0;
}

.game-status {
  display: grid;
  gap: 0.1rem;
  min-width: 160px;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  text-align: right;
}

.game-status span,
.game-hud span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-status strong {
  color: var(--accent);
}

.game-frame {
  position: relative;
  height: clamp(440px, 52vw, 560px);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(129, 158, 196, 0.28);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 50%, rgba(85, 215, 255, 0.12), transparent 38%),
    #030711;
}

#cosmicGameCanvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.game-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(82%, 460px);
  transform: translate(-50%, -50%);
  padding: 1rem;
  border: 1px solid rgba(255, 216, 106, 0.28);
  border-radius: 14px;
  background: rgba(5, 8, 16, 0.78);
  color: #dfeaff;
  text-align: center;
  backdrop-filter: blur(12px);
  box-shadow:
    0 0 34px rgba(85, 215, 255, 0.1),
    inset 0 0 24px rgba(255, 255, 255, 0.026);
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.game-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.overlay-title {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 900;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.game-hud div {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  border-radius: 12px;
  padding: 0.58rem 0.65rem;
}

.game-hud strong {
  color: var(--text);
  font-size: 1.08rem;
}

.xp-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(129, 158, 196, 0.28);
  border-radius: 999px;
  background: rgba(7, 11, 20, 0.82);
}

.xp-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), #fff6bf);
  box-shadow: 0 0 18px rgba(255, 216, 106, 0.28);
  transition: width 0.18s ease;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.game-controls button {
  min-width: 120px;
  border: 1px solid rgba(129, 158, 196, 0.32);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  color: var(--text);
  background: rgba(9, 14, 24, 0.82);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.22s var(--ease-soft), border-color 0.22s ease, filter 0.22s ease;
}

.game-controls button:first-child {
  color: #09101a;
  border-color: rgba(255, 216, 106, 0.72);
  background: linear-gradient(135deg, #ffe38d, var(--accent));
}

.game-controls button:hover,
.game-controls button:focus-visible {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 16px rgba(85, 215, 255, 0.24));
}

.game-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.proof-grid,
.code-grid,
.workflow-grid {
  display: grid;
  gap: 0.9rem;
}

.proof-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.proof-card,
.workflow-panel,
.code-card,
.tech-stack {
  position: relative;
  border: 1px solid rgba(129, 158, 196, 0.24);
  border-radius: 14px;
  background:
    radial-gradient(circle at 84% 16%, rgba(85, 215, 255, 0.08), transparent 26%),
    rgba(10, 16, 28, 0.64);
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.018),
    0 18px 42px rgba(0, 0, 0, 0.14);
}

.proof-card {
  min-height: 150px;
  padding: 1rem;
}

.proof-card strong {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--accent-2);
  font-size: 1.02rem;
}

.proof-card p,
.workflow-panel p,
.code-card p {
  margin: 0;
  color: var(--muted);
}

.workflow-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workflow-panel,
.tech-stack {
  padding: 1.2rem;
}

.code-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.code-card {
  padding: 1rem;
  overflow: hidden;
}

.code-card h3 {
  color: var(--accent);
}

.code-card pre {
  margin: 0.8rem 0 0;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(85, 215, 255, 0.18);
  background: rgba(2, 5, 12, 0.8);
}

.code-card code {
  display: block;
  min-width: 520px;
  padding: 0.9rem;
  color: #d8f7ff;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.55;
}

.tech-stack {
  align-items: flex-start;
}

.stack-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  max-width: 680px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stack-list li {
  border: 1px solid rgba(255, 216, 106, 0.26);
  border-radius: 999px;
  padding: 0.42rem 0.64rem;
  color: #e7edf8;
  background: rgba(5, 8, 16, 0.62);
  font-weight: 700;
}

@media (max-width: 980px) {
  .programming-hero,
  .workflow-grid,
  .code-grid {
    grid-template-columns: 1fr;
  }

  .programming-hero {
    min-height: auto;
  }

  .programming-intro h1 {
    max-width: 18ch;
  }

  .proof-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .programming-main {
    gap: 2rem;
  }

  .programming-intro,
  .game-shell {
    border-radius: 14px;
  }

  .programming-intro h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .game-topline,
  .tech-stack {
    align-items: stretch;
    flex-direction: column;
  }

  .game-status {
    text-align: left;
  }

  .game-frame {
    height: min(72vh, 460px);
    min-height: 400px;
  }

  .game-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-controls button {
    flex: 1 1 100%;
  }

  .proof-grid {
    grid-template-columns: 1fr;
  }

  .stack-list {
    justify-content: flex-start;
  }
}
