@font-face {
  font-family: Sora;
  src: url("/assets/fonts/Sora-Variable.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Orbitron;
  src: url("/assets/fonts/Orbitron-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #f4f5ff;
  font-family: Sora, system-ui, sans-serif;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: #10151bd9;
  border: 1px solid #ffffff30;
  border-radius: 24px;
  padding: 12px 20px;
  font-size: 14px;
  min-height: 44px;
}
button:hover {
  background: #173540;
  border-color: #4be4ff;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 2px solid #52edff;
  outline-offset: 5px;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
#game {
  display: block;
  width: 100%;
  height: 100dvh;
  touch-action: none;
}
header {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  left: max(24px, env(safe-area-inset-left));
  right: max(24px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 18px;
  pointer-events: none;
}
header > * {
  pointer-events: auto;
}
.brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px #ae22e62b);
}
h1 {
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 7px;
}
.heading {
  min-width: 0;
}
.heading p {
  font-size: 13px;
  color: #c2c9d4;
  margin: 0;
  text-shadow: 0 2px 8px #000;
}
header > button {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
  background: #090d13c9;
}
.game-hud {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: max(24px, env(safe-area-inset-left));
  right: max(24px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}
.game-hud > * {
  pointer-events: auto;
}
#instructions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #060a10c9;
  border: 1px solid #ffffff20;
  border-radius: 16px;
  padding: 13px 18px;
  font-size: 12px;
  color: #cad4de;
}
.keys {
  font-size: 22px;
  letter-spacing: 9px;
  color: #fff;
}
.tools {
  display: flex;
  gap: 8px;
}
.tools button {
  font-size: 12px;
  padding: 10px 16px;
}
#loading {
  position: fixed;
  inset: 0;
  background: #000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  z-index: 20;
}
#loading img {
  width: 90px;
}
#loading p {
  font-size: 14px;
  color: #c7d1df;
}
.load-line {
  width: 160px;
  height: 2px;
  background: linear-gradient(90deg, #10dfff, #7d42ff, #fa2dbc, #ffe628);
  animation: pulse 1.3s ease-in-out infinite;
}
.ready #loading {
  display: none;
}
#approach {
  position: fixed;
  left: 50%;
  bottom: 125px;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
}
#approach > span {
  display: block;
  margin: 0 0 10px;
  text-shadow: 0 2px 12px #000;
  font-size: 19px;
}
#interact {
  background: #06121de8;
  border-color: #38e5ff99;
  box-shadow: 0 0 24px #00cfff1a;
}
kbd {
  font: inherit;
  border: 1px solid #73cde94d;
  border-radius: 6px;
  padding: 3px 7px;
  margin-right: 7px;
  font-size: 12px;
}
#touch-controls {
  display: none;
  position: fixed;
  bottom: max(32px, env(safe-area-inset-bottom));
  left: max(28px, env(safe-area-inset-left));
  right: max(28px, env(safe-area-inset-right));
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}
#joystick {
  width: 112px;
  height: 112px;
  background: #05101b90;
  border: 1px solid #72deff55;
  border-radius: 50%;
  position: relative;
  touch-action: none;
  pointer-events: auto;
}
#stick {
  position: absolute;
  left: 35px;
  top: 35px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #85e6ff33;
  border: 1px solid #9eebff88;
  box-shadow: 0 0 18px #1eceff22;
  pointer-events: none;
}
.joystick-label {
  position: absolute;
  bottom: 9px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: #bce4f5;
  pointer-events: none;
}
#run {
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  pointer-events: auto;
  touch-action: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-size: 12px;
}
#run[aria-pressed="true"] {
  border-color: #ea60fc;
  box-shadow: 0 0 20px #e32cef44;
}
dialog {
  background: #080b10;
  color: #f4f5ff;
  border: 1px solid #28303f;
  border-radius: 22px;
  padding: 36px;
  max-width: 660px;
  width: calc(100% - 32px);
  max-height: 85dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #000c;
}
dialog h2 {
  font-size: 24px;
  font-weight: 500;
  margin: 0 45px 12px 0;
}
dialog p {
  font-size: 14px;
  line-height: 1.7;
  color: #b5c1ce;
}
.close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 28px;
  z-index: 2;
}
#project-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
#projects[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#projects > h2,
#projects > p { flex: 0 0 auto; }
#projects #project-list {
  min-height: 0;
  grid-auto-rows: max-content;
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #457484 #060a10;
  padding: 2px 4px 6px;
}
#project-list button {
  text-align: left;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 18px;
}
#project-list img {
  width: 90px;
  height: 58px;
  object-fit: contain;
  background: #010307;
  flex: 0 0 auto;
  border-radius: 6px;
}
#project-list small {
  display: block;
  color: #9daabd;
  margin-top: 6px;
}
#project-list button > span {
  min-width: 0;
}
#viewer {
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #0c0c0c;
  padding: 80px 24px 20px;
  overflow: hidden;
}
#viewer video,
#viewer > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#viewer [hidden] {
  display: none;
}
.viewer-heading {
  position: absolute;
  left: 24px;
  top: 20px;
  right: 80px;
}
.viewer-heading h2 {
  font-size: 18px;
  margin: 0 0 6px;
}
.viewer-heading span {
  font-size: 12px;
  color: #aab3bf;
}
#error {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(90%, 420px);
  padding: 28px;
  background: #111924;
  border-radius: 20px;
  z-index: 5;
}
#error p {
  line-height: 1.6;
}
#video-error {
  position: absolute;
  top: 40%;
  left: 10%;
  right: 10%;
  text-align: center;
}
[hidden] {
  display: none !important;
}
@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}
@media (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
  #instructions {
    display: none;
  }
  .game-hud {
    bottom: auto;
    top: 105px;
    justify-content: flex-end;
  }
  .tools button {
    font-size: 11px;
    padding: 6px 12px;
    min-height: 36px;
  }
  #approach {
    bottom: 160px;
  }
  kbd {
    display: none;
  }
}
@media (max-width: 600px) {
  header {
    left: 14px;
    right: 14px;
    gap: 10px;
    top: max(12px, env(safe-area-inset-top));
  }
  .brand img {
    width: 52px;
    height: 52px;
  }
  h1 {
    font-size: 14px;
  }
  .heading p {
    display: none;
  }
  header > button {
    font-size: 12px;
    padding: 9px 14px;
  }
  .game-hud {
    left: 14px;
    right: 14px;
  }
  #instructions {
    max-width: 180px;
    font-size: 11px;
  }
  .keys {
    font-size: 18px;
  }
  #approach {
    width: 240px;
  }
  #approach > span {
    font-size: 16px;
  }
  #viewer {
    padding: 90px 10px 10px;
  }
  dialog {
    padding: 28px 20px;
  }
}
@media (max-height: 500px) and (pointer: coarse) {
  header {
    top: 8px;
  }
  .brand img {
    width: 46px;
    height: 46px;
  }
  .heading p {
    display: none;
  }
  .game-hud {
    top: 65px;
  }
  #joystick {
    width: 96px;
    height: 96px;
  }
  #stick {
    left: 27px;
    top: 27px;
  }
  #touch-controls {
    bottom: 18px;
  }
  #approach {
    bottom: 28px;
  }
  #approach > span {
    font-size: 14px;
    margin-bottom: 6px;
  }
  #run {
    width: 60px;
    height: 60px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.touch-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
#jump {
  pointer-events: auto;
  touch-action: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-size: 12px;
  padding: 10px;
  border-color: #b25aff75;
}
@media (max-height: 500px) and (pointer: coarse) {
  #jump {
    width: 60px;
    height: 60px;
  }
}

/* Page title and controls stay separate from the persistent corner navigation. */
.portfolio-intro {
  position: fixed;
  z-index: 3;
  top: max(24px, env(safe-area-inset-top));
  left: max(118px, env(safe-area-inset-left));
  right: max(118px, env(safe-area-inset-right));
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  pointer-events: none;
}
.portfolio-intro .heading { max-width: 920px; }
.portfolio-intro::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -24px -60px -20px;
  background: radial-gradient(ellipse at 50% 10%, #000b, #0003 58%, transparent 76%);
  pointer-events: none;
}
.portfolio-intro h1 {
  margin: 0;
  font: 700 clamp(26px, 2.85vw, 40px)/1.2 Orbitron, Sora, sans-serif;
  letter-spacing: -.025em;
  text-wrap: balance;
  color: #f4f5ff;
}
.portfolio-intro .heading p {
  display: block;
  max-width: 580px;
  margin: 11px auto 0;
  font-size: 13px;
  line-height: 1.55;
  text-wrap: balance;
  color: #d5dfe8;
}
.portfolio-intro #all-projects {
  pointer-events: auto;
  min-height: 42px;
  padding: 10px 22px;
  border-color: #65d9f86b;
  background: #050d16df;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
body:has(.portfolio-intro) .portfolio-minimap[data-position^="top"] { top: 180px; }
body.navi-footer-active .portfolio-intro { visibility: hidden; pointer-events: none; }

@media (pointer: coarse) {
  .game-hud {
    top: auto;
    bottom: max(164px, calc(env(safe-area-inset-bottom) + 144px));
    justify-content: center;
  }
  .tools button { min-height: 44px; }
  #approach { bottom: 225px; }
  body:has(.portfolio-intro) .portfolio-minimap[data-position^="bottom"] {
    bottom: max(225px, calc(env(safe-area-inset-bottom) + 205px));
  }
}
@media (max-width: 700px) and (orientation: portrait) {
  .portfolio-intro {
    top: max(91px, calc(env(safe-area-inset-top) + 80px));
    left: 18px;
    right: 18px;
    gap: 10px;
  }
  .portfolio-intro h1 { font-size: clamp(25px, 7vw, 31px); line-height: 1.17; }
  .portfolio-intro .heading p { font-size: 12px; line-height: 1.5; margin-top: 9px; }
  .portfolio-intro #all-projects { min-height: 42px; padding: 9px 18px; font-size: 12px; }
  body:has(.portfolio-intro) .portfolio-minimap[data-position^="top"] { top: 265px; }
  #approach {
    left: 18px;
    width: min(180px, calc(100vw - 182px));
    bottom: 222px;
    transform: none;
  }
  #approach > span { font-size: 13px; line-height: 1.3; margin-bottom: 7px; }
  #interact { width: 100%; min-height: 44px; padding: 10px 9px; font-size: 12px; }
  body:has(.portfolio-minimap[data-position$="left"]) #approach { left: auto; right: 18px; }
  #projects { max-height: calc(100dvh - 28px); padding: 62px 16px 22px; }
  #projects h2 { margin-right: 0; font-size: 22px; }
  #project-list button { gap: 12px; padding: 12px; }
  #project-list img { width: 74px; height: 46px; }
  #project-list button > span { font-size: 13px; }
  #project-list small { font-size: 11px; line-height: 1.5; }
  #viewer { padding: 112px 10px 12px; }
  .viewer-heading { left: 16px; right: 68px; top: 18px; }
  .viewer-heading h2 { font-size: 16px; line-height: 1.4; }
  .viewer-heading span { font-size: 11px; line-height: 1.5; }
  #viewer .close { right: 12px; top: 12px; }
}
@media (max-width: 700px) and (orientation: portrait) and (max-height: 700px) {
  .portfolio-intro { top: 82px; gap: 8px; }
  .portfolio-intro h1 { font-size: 24px; line-height: 1.14; }
  .portfolio-intro .heading p { margin-top: 7px; font-size: 11px; line-height: 1.5; }
  .portfolio-intro #all-projects { min-height: 38px; padding: 8px 16px; }
  body:has(.portfolio-intro) .portfolio-minimap[data-position^="top"] { top: 238px; }
  body:has(.portfolio-intro) .portfolio-minimap[data-position^="bottom"] { bottom: 204px; }
  .portfolio-minimap { --minimap-width: 134px; --minimap-canvas: 120px; }
  .portfolio-minimap__legend { gap: 1px 9px; }
  .game-hud { bottom: 130px; }
  #touch-controls { bottom: 16px; left: 22px; right: 22px; }
  #joystick { width: 96px; height: 96px; }
  #stick { left: 27px; top: 27px; }
  .touch-actions { gap: 10px; }
  #jump, #run { width: 64px; height: 64px; }
  #approach { bottom: 188px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .portfolio-intro { top: 10px; left: 76px; right: 76px; gap: 8px; }
  .portfolio-intro h1 { font-size: clamp(19px, 2.8vw, 26px); line-height: 1.2; }
  .portfolio-intro .heading p { display: none; }
  .portfolio-intro #all-projects { min-height: 36px; padding: 7px 16px; font-size: 12px; }
  body:has(.portfolio-intro) .portfolio-minimap[data-position^="top"] { top: 105px; }
  body:has(.portfolio-intro) .portfolio-minimap[data-position="top-left"] { top: 76px; }
  #projects { max-height: calc(100dvh - 24px); padding: 22px; }
  #projects h2 { font-size: 20px; }
  #project-list { gap: 9px; margin-top: 16px; }
  #project-list button { padding: 10px 14px; }
  #viewer { padding: 76px 16px 10px; }
  .viewer-heading h2 { font-size: 16px; }
  .viewer-heading span { font-size: 11px; }
}
@media (orientation: landscape) and (max-height: 540px) and (pointer: coarse) {
  .game-hud { top: 62px; bottom: auto; justify-content: flex-end; }
  .tools { gap: 5px; }
  .tools button { min-height: 36px; padding: 6px 10px; font-size: 11px; }
  body:has(.portfolio-intro) .portfolio-minimap[data-position="bottom-left"] { bottom: 124px; }
  body:has(.portfolio-intro) .portfolio-minimap[data-position="bottom-right"] { bottom: 88px; }
  #approach { bottom: 24px; }
}
