:root {
  --ink: #07080f;
  --panel: rgba(16, 19, 36, .68);
  --line: rgba(170, 185, 255, .14);
  --text: #eef0ff;
  --soft: #aab1d4;
  --faint: #6d759c;
  --lime: #d7ff63;
  --cyan: #5cdcfa;
  --coral: #ff8a66;
  --amber: #ffd166;
  --violet: #a78bfa;
  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --hand: "Caveat", "Bradley Hand", cursive;
  --pad: clamp(18px, 5vw, 56px);
  --max: 1180px;
  --sx: 0;
  --sy: 0;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: var(--ink); }
html.still { scroll-behavior: auto; }
body {
  margin: 0; color: var(--text); font: 400 16px/1.65 var(--display);
  overflow-x: hidden; overflow-x: clip; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
::selection { background: var(--lime); color: var(--ink); }
.dragging { cursor: grabbing; user-select: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 100; background: var(--lime); color: var(--ink); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* wide decorative layers must never create sideways scroll (clip keeps sticky working) */
#main { overflow-x: clip; }

/* ---------- backdrop ---------- */
#gl { position: fixed; inset: 0; width: 100%; height: 100vh; height: 100lvh; z-index: -2; pointer-events: none; }
.vignette {
  position: fixed; inset: 0; z-index: -3; pointer-events: none;
  background:
    radial-gradient(60% 50% at 78% 24%, rgba(72, 92, 220, .22), transparent 70%),
    radial-gradient(50% 45% at 8% 80%, rgba(140, 70, 200, .16), transparent 70%),
    radial-gradient(40% 35% at 55% 105%, rgba(60, 200, 190, .12), transparent 70%),
    var(--ink);
}
.no-gl .vignette { background: radial-gradient(40% 40% at 75% 35%, rgba(215, 255, 99, .18), transparent 70%), radial-gradient(55% 55% at 65% 45%, rgba(92, 220, 250, .2), transparent 70%), var(--ink); }
.progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 60; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--coral), var(--amber), var(--lime), var(--cyan), var(--violet)); transform-origin: left; transform: scaleX(0); }

/* a shape summoned from the terminal floats above the page for a moment */
.hologram #gl { z-index: 45; }

/* ---------- header + dock ---------- */
.top {
  position: fixed; inset: 0 0 auto; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) var(--pad) 14px; font: 500 12px var(--mono);
  background: linear-gradient(var(--ink) 55%, rgba(7, 8, 15, .82) 75%, transparent);
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; }
.logo b { color: var(--lime); font-weight: 700; }
.logo-cube { position: relative; width: 16px; height: 16px; transform-style: preserve-3d; animation: cube 9s linear infinite; }
.logo-cube i { position: absolute; inset: 0; border: 1px solid var(--lime); background: rgba(215, 255, 99, .08); }
.logo-cube i:nth-child(1) { transform: translateZ(8px); }
.logo-cube i:nth-child(2) { transform: rotateY(180deg) translateZ(8px); }
.logo-cube i:nth-child(3) { transform: rotateY(90deg) translateZ(8px); }
.logo-cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(8px); }
.logo-cube i:nth-child(5) { transform: rotateX(90deg) translateZ(8px); }
.logo-cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(8px); }
@keyframes cube { from { transform: rotateX(-24deg) rotateY(0); } to { transform: rotateX(-24deg) rotateY(360deg); } }
.links { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 99px; background: rgba(10, 12, 24, .7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.links a { text-decoration: none; color: var(--soft); padding: 5px 12px; border-radius: 99px; transition: color .2s, background .2s; }
.links a:hover { color: var(--text); }
.links a[aria-current] { background: var(--text); color: var(--ink); }
.top-actions { display: flex; gap: 8px; }
.chip { border: 1px solid var(--line); background: rgba(10, 12, 24, .7); border-radius: 99px; padding: 8px 13px; text-decoration: none; font: 500 11px var(--mono); white-space: nowrap; }
.chip:hover { border-color: var(--lime); }
.chip-solid { background: var(--lime); border-color: var(--lime); color: var(--ink); font-weight: 700; }
.dock { display: none; }
br.narrow { display: none; }

/* ---------- type + buttons ---------- */
h1, h2, h3, h4, p { margin: 0; }
h2 { font-size: clamp(2.3rem, 6.4vw, 4.9rem); line-height: .98; letter-spacing: -.035em; font-weight: 800; text-wrap: balance; }
h2 em { font-style: normal; color: transparent; background: linear-gradient(100deg, var(--lime), var(--cyan) 55%, var(--violet)); -webkit-background-clip: text; background-clip: text; padding-right: .06em; }
.kicker { font: 700 11px var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--lime); margin-bottom: 16px; }
.sub { margin-top: 18px; max-width: 54ch; color: var(--soft); }
.head { max-width: 760px; margin-bottom: clamp(36px, 6vw, 68px); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px; text-decoration: none;
  border: 1px solid var(--line); border-radius: 14px; background: rgba(18, 22, 44, .75); font: 700 12.5px var(--mono);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .45); transition: transform .15s, box-shadow .15s, border-color .2s, translate .2s;
}
.btn:hover { border-color: var(--cyan); transform: translateY(-2px); box-shadow: 0 7px 0 rgba(0, 0, 0, .45); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .45); }
.btn-solid { background: var(--lime); border-color: var(--lime); color: var(--ink); box-shadow: 0 5px 0 #6d8a1c; }
.btn-solid:hover { box-shadow: 0 7px 0 #6d8a1c; border-color: var(--lime); }
.btn-solid:active { box-shadow: 0 1px 0 #6d8a1c; }
.btn-ghost { background: transparent; border-style: dashed; box-shadow: none; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.glass { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.note { font: 600 1.45rem/1.1 var(--hand); color: var(--amber); }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: perspective(1000px) translate3d(0, 56px, -60px) rotateX(-14deg); transition: opacity .7s ease, transform .9s cubic-bezier(.16, 1, .3, 1); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- hero ---------- */
/* dragging here spins the particles: don't select text, and let sideways swipes through */
.hero { touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: 110px var(--pad) 90px; max-width: calc(var(--max) + 2 * var(--pad)); margin: 0 auto; }
.hero-copy { position: relative; z-index: 2; will-change: transform; }
.eyebrow { display: flex; align-items: center; gap: 10px; font: 500 12px var(--mono); color: var(--soft); margin-bottom: 20px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(215, 255, 99, .55); } 100% { box-shadow: 0 0 0 12px rgba(215, 255, 99, 0); } }
.name { font-weight: 800; text-transform: uppercase; }
.name span { display: block; }
.name .hi { font: 600 clamp(1.9rem, 4vw, 2.8rem)/1 var(--hand); text-transform: none; color: var(--coral); rotate: -4deg; width: max-content; margin-bottom: 4px; }
.name .big { font-size: clamp(4.2rem, 13.5vw, 11rem); line-height: .84; letter-spacing: -.05em; will-change: transform; }
.name .big:not(.outline) {
  text-shadow:
    calc(var(--sx) * 2px) calc(var(--sy) * 2px + 1px) 0 #5663b8,
    calc(var(--sx) * 4px) calc(var(--sy) * 4px + 2px) 0 #454f98,
    calc(var(--sx) * 6px) calc(var(--sy) * 6px + 3px) 0 #353d78,
    calc(var(--sx) * 8px) calc(var(--sy) * 8px + 4px) 0 #262c5a,
    calc(var(--sx) * 12px) calc(var(--sy) * 12px + 14px) 30px rgba(0, 0, 0, .6);
}
/* stroke first, solid fill on top: hides the overlapping contours inside variable-font glyphs */
.name .outline { color: var(--ink); -webkit-text-stroke: 3px var(--lime); paint-order: stroke fill; }
.role { margin-top: 28px; font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--soft); min-height: 3.4em; }
.role b { color: var(--text); font-weight: 600; }
.rotator { font-family: var(--mono); font-size: .86em; color: var(--cyan); }
.caret { display: inline-block; width: .5em; height: 1.05em; margin-left: 3px; vertical-align: text-bottom; background: var(--cyan); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.note-hero { position: absolute; right: calc(var(--pad) + 2%); bottom: 12%; rotate: -5deg; display: flex; flex-direction: column-reverse; align-items: flex-end; pointer-events: none; }
.note-hero svg { width: 70px; fill: none; stroke: var(--amber); stroke-width: 2.5; stroke-linecap: round; margin: 0 80px 4px 0; }
.glyphs { position: absolute; inset: 0; pointer-events: none; }
.glyphs span { position: absolute; left: var(--x); top: var(--y); font: 500 var(--s) var(--mono); color: rgba(170, 185, 255, .28); white-space: nowrap; will-change: transform; }
.scroll-cue { position: absolute; left: 50%; bottom: 22px; translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; font: 500 10px var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
.scroll-cue span { width: 22px; height: 34px; border: 1.5px solid var(--faint); border-radius: 12px; position: relative; }
.scroll-cue span::after { content: ""; position: absolute; left: 50%; top: 6px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: var(--lime); animation: wheel 1.6s infinite; }
@keyframes wheel { to { transform: translateY(13px); opacity: 0; } }

.ticker { overflow: hidden; border-block: 1px solid var(--line); background: rgba(10, 12, 26, .7); padding: 14px 0; rotate: -1.4deg; scale: 1.03; }
.ticker-track { width: max-content; white-space: pre; font: 700 clamp(.9rem, 2vw, 1.15rem) var(--mono); text-transform: uppercase; letter-spacing: .05em; will-change: transform; }

/* ---------- sections ---------- */
.section { position: relative; max-width: calc(var(--max) + 2 * var(--pad)); margin: 0 auto; padding: clamp(90px, 14vw, 180px) var(--pad) clamp(40px, 8vw, 90px); }
.mega { position: absolute; top: clamp(34px, 6vw, 70px); left: 50%; transform: translateX(-50%); z-index: -1; white-space: nowrap; font-size: clamp(4.5rem, 15vw, 13rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(170, 185, 255, .13); pointer-events: none; user-select: none; }

/* story */
.story { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(28px, 5vw, 70px); align-items: start; }
.story-text { display: grid; gap: 22px; color: var(--soft); font-size: 1.08rem; text-shadow: 0 1px 14px var(--ink); }
.story-text .lead { font-size: clamp(1.35rem, 2.4vw, 1.75rem); line-height: 1.4; color: var(--text); }
.story-text mark { background: linear-gradient(transparent 62%, rgba(215, 255, 99, .26) 62%); color: var(--text); }
.note-inline { rotate: -2deg; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; perspective: 900px; }
.stats > div:nth-child(even) { margin-top: 36px; }
.tilt { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d; transition: transform .18s ease-out, border-color .25s, box-shadow .25s; position: relative; }
.tilt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .13), transparent 55%); transition: opacity .3s; }
.tilt:hover::after { opacity: 1; }
.stat { height: 100%; padding: 24px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.stat b { display: block; font-size: clamp(2.8rem, 5.5vw, 4.4rem); line-height: 1; letter-spacing: -.04em; color: var(--lime); transform: translateZ(38px); }
.stat span { display: block; margin-top: 8px; font: 400 12px/1.5 var(--mono); color: var(--soft); transform: translateZ(18px); }

/* pinned 3D stack */
.pinned { height: 430vh; position: relative; }
.pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: center; max-width: calc(var(--max) + 2 * var(--pad)); margin: 0 auto; padding: 76px var(--pad) 24px; overflow: hidden; }
.pin .head { margin-bottom: 8px; }
.pin-body { display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 30px; min-height: 0; flex: 0 1 600px; }
.stage { --size: min(30vw, 42vh, 340px); --gap: calc(var(--size) * .25); height: 100%; min-height: 0; display: grid; place-items: center; perspective: 1400px; }
.stack { --spread: 1; --turn: -40deg; --lean: 60deg; --at: 4; position: relative; width: var(--size); height: var(--size); transform-style: preserve-3d; transform: rotateX(var(--lean)) rotateZ(var(--turn)); }
.plate {
  position: absolute; inset: 0; border-radius: 26px; border: 1.5px solid var(--c);
  background:
    linear-gradient(90deg, transparent calc(100% - 1px), rgba(255, 255, 255, .07) 0) 0 0 / 12.5% 100%,
    linear-gradient(transparent calc(100% - 1px), rgba(255, 255, 255, .07) 0) 0 0 / 100% 12.5%,
    rgba(16, 20, 44, .5);
  transform: translateZ(calc((var(--i) - 2) * var(--gap) * (.12 + var(--spread) * .88)));
  opacity: .5; transition: opacity .35s, box-shadow .35s, background-color .35s;
}
.plate span { position: absolute; left: 16px; bottom: 12px; font: 700 clamp(10px, 1.2vw, 13px) var(--mono); letter-spacing: .1em; color: var(--c); }
.plate.on { opacity: 1; box-shadow: 0 0 50px -4px var(--c), inset 0 0 60px -22px var(--c); background-color: rgba(30, 36, 78, .82); }
.beam { position: absolute; left: 50%; top: 50%; transform-style: preserve-3d; }
.beam i { position: absolute; width: 18px; height: 18px; margin: -9px; border-radius: 50%; background: #fff; box-shadow: 0 0 24px 8px rgba(255, 255, 255, .6); transform: translateZ(calc((var(--at) - 2) * var(--gap) * (.12 + var(--spread) * .88) + 2px)); transition: transform .5s cubic-bezier(.3, 1.5, .5, 1); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.step { cursor: pointer; padding: 12px 18px; border-left: 2px solid var(--line); border-radius: 0 16px 16px 0; transition: background .3s, border-color .3s; }
.step h3 { font-size: 1.35rem; letter-spacing: -.02em; color: var(--faint); transition: color .3s; }
.step small { font: 700 11px var(--mono); margin-right: 10px; color: var(--c); vertical-align: 3px; }
.step p { display: grid; max-height: 0; overflow: hidden; opacity: 0; color: var(--soft); transition: max-height .4s, opacity .3s, margin .3s; }
.step.on { border-color: var(--c); background: var(--panel); }
.step.on h3 { color: var(--text); }
.step.on p { display: block; max-height: 12em; opacity: 1; margin-top: 6px; }

/* playground */
.console { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.console-in { display: flex; flex-direction: column; gap: 14px; padding: clamp(18px, 3vw, 32px); }
.console-in label { font: 500 12px/1.6 var(--mono); color: var(--soft); }
textarea { width: 100%; resize: vertical; min-height: 104px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(4, 6, 14, .75); font: 400 16px/1.6 var(--mono); }
textarea:focus { border-color: var(--lime); outline: none; }
.examples, .filters, .term-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.examples button, .filters button, .term-chips button { border: 1px solid var(--line); background: rgba(255, 255, 255, .03); border-radius: 99px; padding: 8px 13px; font: 500 11.5px var(--mono); color: var(--soft); }
.examples button:hover, .filters button:hover, .term-chips button:hover { color: var(--text); border-color: var(--cyan); }
.console-in .btn { align-self: flex-start; margin-top: auto; }
.console-out { padding: clamp(18px, 3vw, 32px); background: rgba(3, 5, 12, .55); border-left: 1px solid var(--line); display: grid; gap: 22px; align-content: start; min-width: 0; }
.out-block h4 { font: 700 10.5px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.masked { font: 400 13px/1.7 var(--mono); overflow-wrap: anywhere; }
.masked mark { background: var(--amber); color: var(--ink); border-radius: 5px; padding: 1px 5px; font-weight: 700; }
.scores, .trace { list-style: none; margin: 0; padding: 0; font: 400 12px var(--mono); }
.scores:empty::after { content: "—"; }
.scores li { display: grid; grid-template-columns: 112px 1fr 34px; align-items: center; gap: 10px; padding: 3px 0; color: var(--faint); }
.scores i { --v: 0; height: 8px; border-radius: 9px; background: linear-gradient(90deg, var(--faint), var(--faint)) 0 0 / calc(var(--v) * 100%) 100% no-repeat, rgba(255, 255, 255, .06); transition: background-size .6s cubic-bezier(.2, .8, .2, 1); }
.scores li.win { color: var(--text); }
.scores li.win i { background-image: linear-gradient(90deg, var(--cyan), var(--lime)); }
.scores b { font-weight: 500; text-align: right; }
.trace { min-height: 11.5em; }
.trace li { padding: 3px 0; color: var(--soft); animation: slide .35s ease both; overflow-wrap: anywhere; }
.trace b { display: inline-block; width: 62px; color: var(--lime); }
.trace .warn, .trace .warn b { color: var(--amber); }
@keyframes slide { from { opacity: 0; transform: translateX(-12px); } }

/* git log */
.log { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 26px; }
.log::before { content: ""; position: absolute; left: 9px; top: 10px; bottom: 10px; width: 2px; background: linear-gradient(var(--lime), var(--cyan), var(--violet), var(--amber), var(--coral)); }
.log > li { position: relative; padding-left: 48px; max-width: 880px; }
.log > li:nth-child(even) { margin-left: clamp(0px, 8vw, 110px); }
.commit { padding: clamp(20px, 3vw, 30px); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.commit:hover { border-color: var(--c); box-shadow: 0 24px 60px -30px var(--c); }
.commit::before { content: ""; position: absolute; left: -45px; top: 30px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--c); box-shadow: 0 0 16px var(--c); }
.log > li:nth-child(even) .commit::before { left: calc(-45px - clamp(0px, 8vw, 110px)); }
.hash { font: 700 11px var(--mono); color: var(--c); margin-bottom: 10px; }
.commit h3 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); letter-spacing: -.02em; line-height: 1.2; transform: translateZ(24px); }
.org { font: 500 12px var(--mono); color: var(--faint); margin-top: 4px; }
.commit ul { margin: 14px 0 0; padding-left: 18px; color: var(--soft); font-size: .98rem; }
.commit li::marker { content: "+  "; color: var(--c); font-family: var(--mono); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tags span { font: 500 10.5px var(--mono); padding: 4px 9px; border-radius: 7px; background: rgba(170, 185, 255, .09); color: var(--soft); }
.school { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 50px; }
.school p { height: 100%; padding: 18px 20px; border: 1px dashed var(--line); border-radius: 18px; background: rgba(7, 8, 15, .55); font: 400 12px/1.7 var(--mono); color: var(--faint); }
.school b { display: block; font: 600 1rem/1.35 var(--display); color: var(--text); margin-bottom: 6px; }
.school i { color: var(--amber); font-style: normal; }

/* side quests */
.quests { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 22px; perspective: 1200px; }
.quest { display: flex; flex-direction: column; height: 100%; text-decoration: none; background: rgba(14, 17, 34, .86); border: 1px solid var(--line); border-radius: 22px; }
.quest:hover { border-color: var(--lime); box-shadow: 0 30px 60px -28px rgba(92, 220, 250, .45); }
.quest canvas { display: block; width: 100%; aspect-ratio: 16 / 9; background: #0a0c1c; border-radius: 21px 21px 0 0; touch-action: pan-x pan-y; }
.quest-body { padding: 18px 20px 20px; transform: translateZ(30px); display: flex; flex-direction: column; flex: 1; }
.quest h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 1.28rem; letter-spacing: -.02em; }
.stars { font: 700 12px var(--mono); color: var(--amber); white-space: nowrap; }
.quest-body > p:not(.tags) { margin: 8px 0 0; color: var(--soft); font-size: .95rem; line-height: 1.55; }
.quest .tags { margin-top: auto; padding-top: 14px; }
.swipe-hint { display: none; }

/* trophies */
.trophies { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.flip { position: relative; display: block; width: 100%; height: 230px; padding: 0; border: 0; background: none; perspective: 1000px; text-align: center; }
.face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 20px; border-radius: 22px; border: 1px solid var(--line); border-bottom: 4px solid var(--c); backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .65s cubic-bezier(.3, 1.35, .5, 1), visibility 0s .2s; }
.front { background: rgba(16, 19, 38, .86); }
.back { visibility: hidden; background: linear-gradient(150deg, #1e2450, #10132a); transform: rotateY(-180deg); font-size: .95rem; line-height: 1.55; border-color: var(--c); }
.flip[aria-pressed="true"] .front { visibility: hidden; transform: rotateY(180deg); }
.flip[aria-pressed="true"] .back { visibility: visible; transform: rotateY(0); }
@media (hover: hover) {
  .flip:hover .front { transform: rotateY(12deg) translateY(-4px); }
  .flip[aria-pressed="true"]:hover .front { transform: rotateY(180deg); }
}
.face i { font-style: normal; font-size: 2.8rem; line-height: 1.2; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .5)); }
.face b { font-size: 1.15rem; line-height: 1.25; }
.face small { font: 500 11px var(--mono); color: var(--c); }

/* toolbox globe */
.toolbox { display: grid; justify-items: center; gap: 18px; }
.filters { justify-content: center; }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--ink); border-color: var(--text); }
.globe { position: relative; isolation: isolate; z-index: 0; width: min(100%, 860px); height: clamp(380px, 64vh, 580px); touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.globe::before { content: ""; position: absolute; inset: 12% 22%; border-radius: 50%; background: radial-gradient(circle, rgba(120, 130, 255, .17), transparent 68%); }
.tool { position: absolute; left: 50%; top: 50%; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--c); background: rgba(9, 11, 24, .9); font: 700 13px var(--mono); white-space: nowrap; will-change: transform; transition: background .2s, color .2s; }
.tool:hover, .tool.picked { background: var(--c); color: var(--ink); }
.tool.dim { visibility: hidden; }
.globe-info { width: min(100%, 520px); min-height: 94px; padding: 18px 22px; text-align: center; color: var(--soft); }
.globe-info b { display: block; color: var(--c, var(--lime)); font: 700 13px var(--mono); margin-bottom: 4px; }

/* terminal */
.term { max-width: 880px; border: 1px solid var(--line); border-radius: 18px; background: rgba(4, 6, 12, .86); box-shadow: 0 40px 90px -40px rgba(215, 255, 99, .28); overflow: hidden; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.term-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--coral); }
.term-bar i:nth-child(2) { background: var(--amber); }
.term-bar i:nth-child(3) { background: var(--lime); }
.term-bar span { margin: 0 auto; font: 500 11px var(--mono); color: var(--faint); }
.term-out { height: 340px; overflow-y: auto; padding: 18px 20px 6px; font: 400 13px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out .cmd { color: var(--cyan); margin-top: 10px; }
.term-out .ok { color: var(--lime); }
.term-out .err { color: var(--coral); }
.term-out .dim { color: var(--faint); }
.term-out a { color: var(--lime); }
.term-form { display: flex; gap: 10px; align-items: center; padding: 10px 20px 14px; }
.term-form label { font: 700 13px var(--mono); color: var(--lime); white-space: nowrap; }
.term-form input { flex: 1; min-width: 0; border: 0; background: transparent; font: 400 16px var(--mono); caret-color: var(--lime); padding: 6px 0; }
.term-form input:focus { outline: none; }
.term-form:focus-within { background: rgba(215, 255, 99, .05); }
.term-chips { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
code { font: 700 .9em var(--mono); color: var(--lime); }

/* hello */
.hello { position: relative; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 120px var(--pad) 28px; text-align: center; }
.hello-card { max-width: 720px; margin-block: auto 40px; padding-top: 22vh; }
.hello h2 { font-size: clamp(3.4rem, 11vw, 8rem); }
.hello-card > p:not(.kicker) { max-width: 46ch; margin: 22px auto 0; color: var(--soft); font-size: 1.1rem; text-shadow: 0 1px 14px var(--ink); }
.hello .cta { justify-content: center; }
.foot { width: min(100%, var(--max)); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 22px; border-top: 1px solid var(--line); font: 400 11px var(--mono); color: var(--faint); }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 80; translate: -50% 20px; opacity: 0; pointer-events: none; max-width: calc(100% - 32px); width: max-content; padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--ink); font: 700 12px var(--mono); transition: opacity .3s, translate .3s; }
.toast.show { opacity: 1; translate: -50% 0; }

/* invisibility cloak easter egg */
main, .top, .dock { transition: opacity .8s, filter .8s; }
.cloaked main, .cloaked .top, .cloaked .dock { opacity: .03; filter: blur(8px); pointer-events: none; }

@media (min-width: 1060px) {
  #terminal { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); gap: 50px; align-items: center; }
  #terminal .head { margin: 0; }
}

/* ---------- tablets ---------- */
@media (max-width: 1060px) {
  .links { display: none; }
  .trophies { grid-template-columns: repeat(2, 1fr); }

  .dock {
    position: fixed; z-index: 55; left: 10px; right: 10px; bottom: 10px; max-width: 560px; margin-inline: auto;
    display: grid; grid-template-columns: repeat(6, 1fr); padding: 5px; border-radius: 20px;
    border: 1px solid var(--line); background: rgba(12, 14, 30, .88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  }
  .dock a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 46px; border-radius: 15px; text-decoration: none; font: 500 10px var(--mono); color: var(--soft); }
  .dock i { font-style: normal; font-size: 15px; line-height: 1.2; }
  .dock a[aria-current] { background: var(--lime); color: var(--ink); }
  .hero { padding-bottom: 104px; }
  .scroll-cue { display: none; }
  .pin { padding-bottom: 86px; }
  .hello { padding-bottom: 96px; }
}
@media (max-width: 899px), (max-width: 1100px) and (orientation: portrait) {
  .hero { align-items: flex-end; padding-top: 64px; padding-bottom: 104px; }
  .hero-copy { width: 100%; padding-top: 27svh; text-shadow: 0 2px 18px var(--ink); }
  .note-hero { top: 80px; bottom: auto; right: var(--pad); flex-direction: column; font-size: 1.2rem; max-width: 12ch; text-align: right; }
  .note-hero svg { display: none; }
  .scroll-cue { display: none; }
}
@media (max-width: 899px) {
  .story, .console { grid-template-columns: minmax(0, 1fr); }
  .console-out { border-left: 0; border-top: 1px solid var(--line); }
  .school { grid-template-columns: 1fr; }
  .glyphs span:nth-child(n+5) { display: none; }

  .pin { justify-content: flex-start; padding-top: 70px; }
  .pin h2 { font-size: clamp(1.8rem, 8vw, 3rem); }
  .pin .kicker { margin-bottom: 8px; }
  .pin-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 4px; flex: 1; }
  .stage { --size: min(48vw, 23svh, 300px); --gap: calc(var(--size) * .24); }
  .steps { min-height: 150px; gap: 0; display: block; }
  .step { display: none; padding: 14px 16px; }
  .step.on { display: block; animation: slide .35s ease; }
}

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .logo span:last-child { display: none; }
  .name .big { font-size: 22vw; }
  .role { margin-top: 20px; }
  .hero .cta { margin-top: 22px; }
  /* the typing line gets a row of its own, sized so its longest phrase never wraps */
  br.narrow { display: inline; }
  .rotator { font-size: min(.86em, 3.6vw); white-space: nowrap; }

  .stats > div:nth-child(even) { margin-top: 20px; }
  .log::before { left: 5px; }
  .log > li { padding-left: 26px; }
  .log > li:nth-child(even) { margin-left: 0; }
  .commit::before, .log > li:nth-child(even) .commit::before { left: -26px; width: 12px; height: 12px; }

  /* side quests become a swipeable 3D deck */
  .quests { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: calc(-1 * var(--pad)); padding: 8px var(--pad) 18px; scroll-padding-inline: var(--pad); scrollbar-width: none; }
  .quests::-webkit-scrollbar { display: none; }
  .quests > div { flex: 0 0 min(84%, 360px); scroll-snap-align: center; }
  .js .quests > .reveal { opacity: 1; transform: none; }
  .swipe-hint { display: block; text-align: center; font: 500 11px var(--mono); color: var(--faint); }

  .trophies { gap: 12px; }
  .flip { height: 200px; }
  .face { padding: 14px 10px; }
  .face b { font-size: 1rem; }
  .back { font-size: .8rem; line-height: 1.5; }
  .face i { font-size: 2.2rem; }
  .tool { font-size: 11.5px; padding: 6px 10px; }
  .scores li { grid-template-columns: 104px 1fr 34px; }
  .term-out { height: 300px; font-size: 12px; }
  .foot { justify-content: center; }
}

/* short portrait phones: keep the buttons above the dock */
@media (max-width: 720px) and (max-height: 720px) {
  .hero-copy { padding-top: 11svh; }
  .name .big { font-size: 18vw; }
  .eyebrow { margin-bottom: 10px; font-size: 11px; }
  .role { margin-top: 14px; }
  .hero .cta { margin-top: 16px; gap: 8px; }
  .hero .btn { min-height: 44px; padding: 10px 16px; }
  .hero #tilt-btn { min-height: 34px; padding: 6px 12px; font-size: 11px; }
  .note-hero { top: 62px; max-width: none; font-size: 1.05rem; }
}

/* very small phones */
@media (max-width: 360px) and (max-height: 600px) {
  .hero-copy { padding-top: 6svh; }
  .role { margin-top: 14px; font-size: .98rem; }
  .hero .cta { margin-top: 16px; gap: 8px; }
  .hero .btn { min-height: 44px; padding: 10px 16px; }
  .note-hero { display: none; }
}

/* short desktop windows: the pinned scene has to fit */
@media (min-width: 900px) and (max-height: 700px) {
  .pin h2 { font-size: 2.6rem; }
  .pin .kicker { margin-bottom: 6px; }
  .step { padding-block: 6px; }
  .step h3 { font-size: 1.1rem; }
}

/* short landscape phones: text left, particles right */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { align-items: center; padding-top: 70px; padding-bottom: 20px; }
  .hero-copy { padding-top: 0; width: 62%; }
  .name .hi { font-size: 1.5rem; }
  .name .big { font-size: 17vh; }
  .eyebrow { margin-bottom: 6px; }
  .role { margin-top: 10px; min-height: 0; font-size: .95rem; }
  .hero .cta { margin-top: 12px; }
  .hero .btn { min-height: 40px; padding-block: 8px; }
  .note-hero, .scroll-cue, #tilt-btn { display: none !important; }
  br.narrow { display: none; }
  /* height is scarce: the menu moves up into the header */
  .logo span:last-child { display: none; }
  .dock { top: 9px; bottom: auto; left: calc(var(--pad) + 30px); right: auto; width: min(340px, 50vw); margin: 0; padding: 3px; }
  .dock a { min-height: 32px; }
  .dock i { display: none; }
  .toast { bottom: 16px; }
  .hello { align-items: flex-start; text-align: left; padding: 70px var(--pad) 16px; }
  .hello-card { max-width: 58%; padding-top: 0; margin-block: auto 16px; }
  .hello h2 { font-size: 3rem; }
  .hello-card > p:not(.kicker) { margin: 10px 0 0; font-size: .95rem; }
  .hello .cta { justify-content: flex-start; margin-top: 16px; }
  .pinned { height: auto; }
  .pin { position: static; height: auto; }
  .stage { display: none; }
  .pin-body { display: block; }
  .steps { display: grid; }
  .step, .step.on { display: block; }
  .step p { display: block; max-height: none; opacity: 1; margin-top: 6px; }
}

/* ---------- calm mode: the motion toggle, or the OS preference ---------- */
html.still *, html.still *::before, html.still *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
html.still .reveal { opacity: 1; transform: none; }

/* ---------- no JavaScript: a plain, readable page without the toys ---------- */
html:not(.js) .pinned { height: auto; }
html:not(.js) .pin { position: static; height: auto; overflow: visible; }
html:not(.js) .stage { display: none; }
html:not(.js) .pin-body { display: block; }
html:not(.js) .steps { display: grid; }
html:not(.js) .step { display: block; }
html:not(.js) .step p { display: block; max-height: none; opacity: 1; margin-top: 6px; }
html:not(.js) .flip { height: auto; perspective: none; cursor: default; }
html:not(.js) .face { position: static; visibility: visible; transform: none; }
html:not(.js) .front { border-bottom: 0; border-radius: 22px 22px 0 0; }
html:not(.js) .back { border-radius: 0 0 22px 22px; }
html:not(.js) :is(#play, #toolbox, #terminal, .quest canvas, #motion, .note, .links a[href="#toolbox"], .links a[href="#terminal"], .dock a[href="#terminal"]) { display: none; }

@media print {
  #gl, .vignette, .dock, .top, .progress, .ticker, .mega, .glyphs { display: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
