:root {
  --bg: #050506;
  --panel: #111114;
  --panel-2: #191a1f;
  --line: #303038;
  --text: #f5f5f0;
  --muted: #a8abb3;
  --red: #ff3347;
  --yellow: #ffd12f;
  --blue: #2497ff;
  --green: #39ff7a;
  --sidebar: 300px;
  --stage-w: calc(100vw - var(--sidebar));
  --stage-h: calc(var(--stage-w) * 9 / 16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px),
    radial-gradient(circle at 72% 18%, rgba(36,151,255,.12), transparent 32rem),
    var(--bg);
  background-size: 28px 28px, 28px 28px, auto, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  cursor: none;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: none; }
a, button, .work-landmark { cursor: none; }

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #050506;
  transition: opacity .55s ease, visibility .55s ease;
}
.boot-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 24px 24px;
  transform: perspective(700px) rotateX(58deg) scale(1.4);
  transform-origin: center bottom;
}
.boot-panel {
  position: relative;
  width: min(760px, calc(100vw - 40px));
  padding: 42px;
  border: 1px solid var(--line);
  background: rgba(12,12,15,.88);
  box-shadow: 10px 10px 0 #000, 0 0 0 4px rgba(255,255,255,.03);
  overflow: hidden;
}
.kicker, .section-label, .nav, .sidebar-meta, .download, .chip, .floating-action, .route-node b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.boot-panel h1 {
  margin: 8px 0;
  max-width: 100%;
  font-size: 5.9rem;
  line-height: .92;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  text-shadow: 5px 5px 0 rgba(36,151,255,.38), 10px 10px 0 rgba(255,51,71,.28);
}
.boot-panel p { color: var(--muted); max-width: 560px; }
.enter-btn, .download, .floating-action a {
  border: 1px solid var(--yellow);
  color: #090909;
  background: var(--yellow);
  box-shadow: 5px 5px 0 #000;
  cursor: pointer;
}
.enter-btn { margin-top: 24px; padding: 14px 20px; font-weight: 900; }

.sidebar {
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: var(--sidebar);
  height: 100vh;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: rgba(6,6,8,.86);
  backdrop-filter: blur(16px);
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand strong { display: block; font-size: 1.15rem; }
.brand small { display: block; color: var(--muted); margin-top: 4px; }
.avatar-pixel {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: #050506;
  background: var(--green);
  font-weight: 950;
  box-shadow: 4px 4px 0 var(--blue), 8px 8px 0 var(--red);
}
.nav { display: grid; gap: 8px; margin-top: 8px; }
.nav a {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 40px;
  padding: 10px 8px;
  color: var(--muted);
  border-left: 3px solid transparent;
}
.nav a span { color: #666975; }
.nav a.active {
  color: var(--text);
  background: rgba(255,255,255,.06);
  border-left-color: var(--blue);
}
.sidebar-meta { margin-top: auto; color: var(--muted); font-size: .82rem; line-height: 1.5; overflow-wrap: anywhere; }
.sidebar-meta a { color: var(--blue); }
.view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  background: #0d0d10;
}
.view-toggle button {
  min-height: 34px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.view-toggle button.active { color: #050506; background: var(--green); font-weight: 900; }
.download { display: block; padding: 13px 14px; text-align: center; font-weight: 900; }

.world {
  margin-left: var(--sidebar);
  min-height: 100vh;
  overflow: clip;
}
.zone {
  position: relative;
  min-height: min(100vh, var(--stage-h));
  aspect-ratio: 16 / 9;
  padding: 56px clamp(28px, 5vw, 72px);
  display: grid;
  align-content: center;
  gap: 34px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
}
.zone::after {
  content: "16:9";
  position: absolute;
  right: 18px;
  top: 16px;
  color: rgba(255,255,255,.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .72rem;
}
.section-label {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: .9rem;
}
.section-label span {
  color: var(--yellow);
  font-size: 1.25rem;
}
.copy-block { max-width: 900px; position: relative; z-index: 2; }
.copy-block h2 {
  margin: 0 0 22px;
  max-width: 980px;
  font-size: 3.7rem;
  line-height: 1.06;
  text-transform: uppercase;
}
.copy-block p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.75;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.tag-row span, .chip {
  display: inline-flex;
  padding: 8px 10px;
  color: #050506;
  font-weight: 900;
  box-shadow: 4px 4px 0 #000;
}
.red { background: var(--red); }
.yellow { background: var(--yellow); }
.blue { background: var(--blue); }
.green { background: var(--green); }

.iso-stage {
  position: absolute;
  right: -7vw;
  bottom: 4vh;
  width: min(50vw, 720px);
  aspect-ratio: 1.25;
  transform: translateY(var(--scene-shift, 0px));
  will-change: transform;
}
.tile-map {
  position: absolute;
  inset: 8%;
  transform: rotateX(60deg) rotateZ(45deg);
  transform-style: preserve-3d;
  background:
    linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px),
    #15161a;
  background-size: 34px 34px;
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 0 0 5px #050506, 26px 26px 0 rgba(0,0,0,.8);
}
.tower, .road, .light { position: absolute; transform-style: preserve-3d; }
.tower {
  width: 74px;
  height: 74px;
  background: #292b33;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  animation: towerPulse 5.2s ease-in-out infinite;
}
.tower::after {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  transform: translateZ(70px);
  box-shadow: 0 0 0 1px rgba(255,255,255,.16);
}
.tower-a { left: 18%; top: 22%; background: var(--blue); }
.tower-b { left: 45%; top: 44%; background: var(--yellow); }
.tower-c { left: 68%; top: 26%; background: var(--green); }
.road { height: 18px; background: #f5f5f0; opacity: .78; }
.road-a { width: 46%; left: 18%; top: 58%; }
.road-b { width: 30%; left: 55%; top: 40%; transform: rotate(90deg); }
.light {
  width: 24px;
  height: 24px;
  animation: float 2.8s ease-in-out infinite;
}
.light-red { left: 34%; top: 34%; background: var(--red); }
.light-blue { left: 78%; top: 62%; background: var(--blue); animation-delay: .7s; }
.light-green { left: 54%; top: 18%; background: var(--green); animation-delay: 1.1s; }
@keyframes float { 50% { transform: translateZ(45px); } }
@keyframes towerPulse {
  50% { filter: brightness(1.2); transform: translateZ(10px); }
}

.map-route {
  position: relative;
  display: grid;
  gap: 24px;
  max-width: 980px;
}
.map-route::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 24px;
  bottom: 24px;
  width: 4px;
  background: repeating-linear-gradient(to bottom, var(--blue) 0 16px, transparent 16px 28px);
}
.route-node {
  position: relative;
  margin-left: 58px;
  padding: 18px 20px;
  background: rgba(18,19,23,.82);
  border: 1px solid var(--line);
  box-shadow: 8px 8px 0 #000;
}
.route-node::before {
  content: "";
  position: absolute;
  left: -50px;
  top: 28px;
  width: 22px;
  height: 22px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--red);
}
.route-node h3 { margin: 8px 0 10px; font-size: 1.55rem; }
.route-node p { margin: 0; color: var(--muted); line-height: 1.7; }
.route-node b { color: var(--green); }

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  perspective: 1200px;
}
.work-landmark {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 10px 10px 0 #000;
  transform: rotateX(5deg) rotateY(-7deg);
  transition: transform .34s cubic-bezier(.2,.8,.2,1), border-color .2s ease, box-shadow .34s ease;
  will-change: transform;
}
.work-landmark:hover, .work-landmark:focus-within {
  transform: translateY(-10px) scale(1.02);
  border-color: var(--yellow);
  box-shadow: 14px 14px 0 #000, 0 0 0 1px rgba(255,209,47,.2);
}
.work-landmark img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: 18% 0;
  image-rendering: auto;
  border-bottom: 1px solid var(--line);
}
.landmark-body { padding: 16px; }
.landmark-body h3 { margin: 14px 0 8px; font-size: 1.45rem; }
.landmark-body p { margin: 0; color: var(--muted); line-height: 1.6; }

.skills-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 1100px;
}
.skills-matrix div {
  min-height: 142px;
  padding: 18px;
  background: rgba(17,17,20,.88);
  border: 1px solid var(--line);
  box-shadow: 6px 6px 0 #000;
}
.skills-matrix b { display: block; margin: 16px 0 10px; font-size: 1.25rem; }
.skills-matrix p { margin: 0; color: var(--muted); line-height: 1.6; }
.pixel { display: block; width: 22px; height: 22px; box-shadow: 22px 0 0 rgba(255,255,255,.2), 44px 0 0 rgba(255,255,255,.1); }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
  max-width: 760px;
}
.contact-grid > * {
  padding: 16px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.floating-action {
  position: fixed;
  z-index: 11;
  right: 24px;
  bottom: 24px;
  width: min(300px, calc(100vw - 48px));
  padding: 16px;
  background: rgba(17,17,20,.92);
  border: 1px solid var(--line);
  box-shadow: 8px 8px 0 #000;
  backdrop-filter: blur(12px);
}
.floating-action small { color: var(--muted); }
.floating-action strong { display: block; margin: 8px 0 14px; font-size: 1.1rem; }
.floating-action a { display: inline-block; padding: 8px 14px; font-weight: 900; }

.edit-toolbar {
  position: fixed;
  z-index: 30;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(17,17,20,.9);
  border: 1px solid var(--line);
  box-shadow: 6px 6px 0 #000;
  backdrop-filter: blur(12px);
}
.edit-toolbar button {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #0d0d10;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .75rem;
}
.edit-toolbar button.active {
  color: #050506;
  background: var(--green);
  font-weight: 900;
}
body.editing [data-editable] {
  outline: 1px dashed var(--yellow);
  outline-offset: 4px;
  background: rgba(255,209,47,.08);
}
body.editing [data-editable]:focus {
  outline-color: var(--green);
  background: rgba(57,255,122,.12);
}
body.editing a [data-editable],
body.editing a {
  pointer-events: none;
}

.pixel-cursor,
.cursor-trail {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  width: 18px;
  height: 18px;
  pointer-events: none;
  transform: translate3d(-50px, -50px, 0);
  image-rendering: pixelated;
}
.pixel-cursor {
  background:
    linear-gradient(90deg, var(--red) 0 33.33%, var(--yellow) 33.33% 66.66%, var(--blue) 66.66% 100%);
  box-shadow: 4px 4px 0 #000, 0 0 0 2px rgba(255,255,255,.82);
  mix-blend-mode: difference;
}
.cursor-trail {
  width: 12px;
  height: 12px;
  background: var(--green);
  box-shadow: 0 0 0 2px #000;
  opacity: .6;
}
.cursor-trail:nth-of-type(3n) { background: var(--red); }
.cursor-trail:nth-of-type(3n + 1) { background: var(--yellow); }
.cursor-trail:nth-of-type(3n + 2) { background: var(--blue); }

body.plain .iso-stage,
body.plain .boot-grid { display: none; }
body.plain .world {
  background: #08080a;
}
body.plain .zone {
  min-height: min(100vh, var(--stage-h));
  aspect-ratio: 16 / 9;
  padding-top: 72px;
  padding-bottom: 72px;
}
body.plain .work-landmark {
  transform: none;
}

@media (max-width: 920px) {
  :root { --sidebar: 0px; }
  .sidebar {
    position: sticky;
    width: 100%;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand small, .sidebar-meta { display: none; }
  .nav { grid-template-columns: repeat(5, 1fr); gap: 3px; overflow-x: auto; }
  .nav a { justify-content: center; min-width: 68px; font-size: .72rem; padding: 8px 4px; }
  .nav a span { display: none; }
  .view-toggle, .download { max-width: 340px; }
  .world { margin-left: 0; }
  .zone {
    min-height: auto;
    aspect-ratio: auto;
    padding: 72px 18px 62px;
    scroll-margin-top: 210px;
    overflow: visible;
  }
  .zone::after { display: none; }
  .hero-zone { min-height: calc(100vh - 220px); align-content: start; }
  .iso-stage { opacity: .32; width: 92vw; right: -34vw; }
  .work-grid, .skills-matrix, .contact-grid { grid-template-columns: 1fr; }
  .work-landmark { transform: none; }
  .floating-action { display: none; }
  .boot-panel { padding: 28px; }
  .boot-panel h1 { font-size: 3.55rem; line-height: .96; }
  .copy-block h2 { font-size: 3rem; line-height: 1.08; }
  .copy-block p { font-size: 1rem; }
  .route-node h3 { font-size: 1.3rem; }
  .edit-toolbar {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (pointer: coarse) {
  body, a, button, .work-landmark { cursor: auto; }
  .pixel-cursor,
  .cursor-trail { display: none; }
}
