/* Spaceparasite . locked tokens (GDD section 11)
   sky #6D0DFF #A30DFF #D801EF #FC25E9 #26AEFF #00CCFF . pink #FF4CB8 deep #E0288F . star #FFFD16
   ink #1A0B3D panel #2A1266 cream #FFF4FB mint #6FF2C8 . checker #FFD6F2 #E5C8FF
   type: Press Start 2P (labels, numbers) + Pixelify Sans (body). 4px grid. radius 0. 4px ink borders, hard 4px offset shadows.
   motion: steps() only on DOM. */
@font-face { font-family: 'Press Start 2P'; src: url(assets/fonts/press-start-2p-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url(assets/fonts/pixelify-sans-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url(assets/fonts/pixelify-sans-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url(assets/fonts/pixelify-sans-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --sky1: #6D0DFF; --sky2: #A30DFF; --sky3: #D801EF; --sky4: #FC25E9; --sky5: #26AEFF; --sky6: #00CCFF;
  --pink: #FF4CB8; --deep: #E0288F; --star: #FFFD16; --ink: #1A0B3D; --panel: #2A1266; --panel2: #3B1A7A;
  --cream: #FFF4FB; --mint: #6FF2C8; --chk1: #FFD6F2; --chk2: #E5C8FF;
  --px: 'Press Start 2P', monospace; --body: 'Pixelify Sans', 'Trebuchet MS', sans-serif;
  --b: 4px; --shadow: 4px 4px 0 var(--ink);
}
* { box-sizing: border-box; }
html { background: var(--sky1); }
body {
  margin: 0; color: var(--cream); font-family: var(--body); font-size: 18px; line-height: 1.4;
  /* stepped pixel bands of the avatar sky, no smooth blend */
  background:
    linear-gradient(180deg, var(--sky1) 0 12%, #8710FF 12% 20%, var(--sky2) 20% 30%, #BD07F7 30% 38%, var(--sky3) 38% 48%,
      #EA13EC 48% 56%, var(--sky4) 56% 64%, #9A6CF4 64% 70%, #5E8DFA 70% 76%, var(--sky5) 76% 86%, #13BDFF 86% 93%, var(--sky6) 93% 100%);
  min-height: 100vh; overflow-x: hidden;
  -webkit-font-smoothing: none;
}
body::before, body::after { /* pastel checker peeking through the corners, like the avatar */
  content: ''; position: fixed; width: 96px; height: 96px; pointer-events: none; z-index: 0;
  background: conic-gradient(var(--chk1) 25%, rgba(255,255,255,.6) 0 50%, var(--chk1) 0 75%, rgba(255,255,255,.6) 0) 0 0 / 32px 32px;
}
body::before { top: 0; left: 0; clip-path: polygon(0 0, 100% 0, 100% 33%, 67% 33%, 67% 67%, 33% 67%, 33% 100%, 0 100%); }
body::after { bottom: 0; right: 0; clip-path: polygon(100% 100%, 0 100%, 0 67%, 33% 67%, 33% 33%, 67% 33%, 67% 0, 100% 0); }

.page { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 24px 16px 32px; }
img { image-rendering: pixelated; }
h1, h2 { margin: 0; font-weight: 400; }
h2 { font-family: var(--px); font-size: 12px; letter-spacing: 1px; color: var(--star); text-shadow: 2px 2px 0 var(--ink); margin-bottom: 12px; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 4px solid var(--star); outline-offset: 2px; }

/* marquee */
.marquee { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand-mark { width: 96px; height: 126px; filter: drop-shadow(4px 4px 0 var(--ink)); animation: bob 1.2s steps(2) infinite; }
.wordmark { font-family: var(--px); font-size: 40px; line-height: 1.1; color: var(--pink); display: flex; flex-direction: column;
  text-shadow: 4px 4px 0 var(--ink), -2px -2px 0 var(--cream); letter-spacing: 2px; }
.wordmark span:last-child { color: var(--cream); text-shadow: 4px 4px 0 var(--ink), -2px -2px 0 var(--pink); }
.tagline { margin: 8px 0 0; font-size: 20px; font-weight: 600; text-shadow: 2px 2px 0 var(--ink); }
.status { font-family: var(--px); font-size: 10px; background: var(--ink); color: var(--mint); padding: 12px 16px; border: var(--b) solid var(--cream); box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; }
.blink { width: 8px; height: 8px; background: var(--mint); display: inline-block; animation: blink 1s steps(2) infinite; }

/* cabinet */
.cabinet { background: var(--panel); border: var(--b) solid var(--ink); box-shadow: 8px 8px 0 var(--ink), inset 0 0 0 4px var(--panel2); padding: 16px; }
.hud { display: grid; grid-template-columns: 1.3fr 1.5fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.hud-cell { background: var(--ink); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hud-cell .lbl { font-family: var(--px); font-size: 8px; color: var(--chk2); }
.hud-cell b { font-family: var(--px); font-size: 18px; font-weight: 400; color: var(--star); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-cell b.small { font-size: 12px; color: var(--pink); line-height: 18px; }
.hud-colony b { font-size: 22px; color: var(--cream); }
.hud-colony b.bump { animation: bump .3s steps(3); }
.hud-tools { flex-direction: row; align-items: center; justify-content: flex-end; gap: 8px; }
.clock { font-family: var(--px); font-size: 8px; color: var(--mint); white-space: nowrap; }
.chip { font-family: var(--px); font-size: 8px; background: var(--panel2); border: 2px solid var(--cream); padding: 8px 10px; box-shadow: 2px 2px 0 #000; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--pink); color: var(--ink); }
.chip:active { transform: translate(2px, 2px); box-shadow: none; }

.screen { position: relative; border: var(--b) solid var(--ink); background: var(--sky2); line-height: 0; overflow: hidden; display: flex; justify-content: center; }
.screen canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: pan-y; cursor: crosshair; }
.screen canvas.hovering { cursor: pointer; }
.nojs { position: absolute; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; font-family: var(--px); font-size: 12px; line-height: 1.6; padding: 24px; text-align: center; text-shadow: 2px 2px 0 var(--ink); }
.js .nojs { display: none; }
.toast { margin: 8px 0 0; min-height: 38px; display: flex; align-items: center; justify-content: center; font-family: var(--px); font-size: 9px; line-height: 1.6; background: var(--ink); color: var(--cream); padding: 8px 12px; border: 2px solid var(--cream); text-align: center; pointer-events: none; }
.toast.hot { color: var(--star); border-color: var(--star); }

/* host rail */
.rail { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.host { display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto auto; column-gap: 12px; row-gap: 6px; align-items: center; text-align: left; background: var(--ink); border: 2px solid var(--panel2); padding: 10px; box-shadow: 2px 2px 0 #000; min-width: 0; }
.host:hover { border-color: var(--star); }
.host img { grid-row: 1 / 4; width: 48px; height: 48px; object-fit: contain; }
.host .h-name { font-family: var(--px); font-size: 9px; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host .h-state { font-family: var(--body); font-weight: 600; font-size: 15px; color: var(--mint); line-height: 1.15; }
.host .h-name .short { display: none; }
.host .meter { height: 8px; }
.host.locked img { filter: brightness(.35) saturate(.4); }
.host.locked .h-state { color: var(--chk2); }
.host.feeding { border-color: var(--pink); background: #2B0C4F; }
.host.feeding .h-state { color: var(--pink); animation: blink .6s steps(2) infinite; }
.host.napping .h-state { color: var(--chk2); }
.host.flash { animation: flash .5s steps(2) 3; }
.meter { position: relative; height: 12px; background: var(--panel2); border: 2px solid var(--cream); }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--mint); box-shadow: inset 0 2px 0 rgba(255,255,255,.7); }
.host.napping .meter i { background: var(--chk2); }
.host.feeding .meter i { background: var(--pink); }

/* growth */
.growth { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.panel { background: var(--ink); border: var(--b) solid var(--ink); box-shadow: inset 0 0 0 2px var(--panel2); padding: 16px; margin: 0; }
.evo-next { font-family: var(--px); font-size: 8px; display: grid; gap: 8px; margin-bottom: 12px; color: var(--cream); }
.evo-next .meter i { background: var(--star); }
.evo-track { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.evo-track li { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: baseline; font-size: 16px; color: #9C8CC4; }
.evo-track li b { font-family: var(--px); font-size: 8px; font-weight: 400; }
.evo-track li .n { font-family: var(--px); font-size: 8px; text-align: right; }
.evo-track li.got { color: var(--cream); }
.evo-track li.got b { color: var(--mint); }
.evo-track li.next b { color: var(--star); }
.evo-track li span.d { display: block; font-size: 15px; }
.count { color: var(--cream); margin-left: 8px; }
.tray { display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; min-height: 120px; }
.tray img { width: 24px; height: 28px; }
.tray img.pop { animation: pop .4s steps(4); }
.tray .more { font-family: var(--px); font-size: 8px; align-self: center; margin-left: 8px; color: var(--star); }
.tray-empty { margin: 0; color: #9C8CC4; }

/* control deck */
.deck { display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; margin-top: 12px; align-items: stretch; }
.buy { display: flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--px); font-size: 12px; color: var(--ink); background: var(--pink); border: var(--b) solid var(--ink); padding: 14px 18px; box-shadow: 0 6px 0 var(--deep), 0 6px 0 4px var(--ink); margin-bottom: 8px; }
.buy:hover { background: #FF6CC6; }
.buy:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--deep), 0 2px 0 4px var(--ink); }
.buy img { width: 32px; height: 32px; }
.dock { display: flex; flex-direction: column; justify-content: center; gap: 6px; text-align: left; background: var(--ink); border: 2px solid var(--panel2); padding: 10px 14px; min-width: 0; margin-bottom: 8px; }
.dock .lbl { font-family: var(--px); font-size: 8px; color: var(--chk2); }
.dock code { font-family: var(--px); font-size: 10px; color: var(--mint); overflow-wrap: anywhere; line-height: 1.5; }
.deck-icon { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-decoration: none; background: var(--ink); border: 2px solid var(--panel2); padding: 8px 14px; font-family: var(--px); font-size: 8px; margin-bottom: 8px; }
.deck-icon:hover, .dock:hover { border-color: var(--star); }
.deck-icon img { width: 32px; height: 32px; }

/* lower */
.lower { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-top: 24px; }
.lower .panel { border-color: var(--ink); box-shadow: 8px 8px 0 var(--ink), inset 0 0 0 2px var(--panel2); }
.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 16px; max-height: 330px; overflow: auto; }
.log li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.log li time { font-family: var(--px); font-size: 8px; color: var(--mint); padding-top: 5px; }
.log li.fresh { animation: flash .5s steps(2) 2; }
.log-empty { display: block !important; color: #9C8CC4; }
.specimen { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: start; background: var(--cream); color: var(--ink); }
.specimen img { width: 160px; height: 160px; border: var(--b) solid var(--ink); }
.specimen h2 { color: var(--deep); text-shadow: none; }
.specimen dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 17px; }
.specimen dt { font-family: var(--px); font-size: 8px; padding-top: 6px; color: var(--deep); }
.specimen dd { margin: 0; }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; font-weight: 600; text-shadow: 2px 2px 0 var(--ink); }
.foot p { margin: 0; }
.chip.ghost { background: transparent; border-color: var(--ink); color: var(--ink); box-shadow: none; text-shadow: none; }
.chip.warn { background: var(--pink); color: var(--ink); }

.modal { position: fixed; inset: 0; background: rgba(26,11,61,.8); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border: var(--b) solid var(--cream); box-shadow: 8px 8px 0 var(--ink); padding: 24px; max-width: 420px; }
.modal-box p { margin: 0 0 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes bump { 50% { transform: scale(1.25); color: var(--star); } }
@keyframes pop { 0% { transform: translateY(-12px) scale(1.5); } 60% { transform: translateY(2px); } }
@keyframes flash { 50% { border-color: var(--star); background: #4A1C8F; } }

@media (max-width: 919px) {
  .wordmark { font-size: 28px; }
  .hud { grid-template-columns: 1fr 1fr 1fr; }
  .hud-cell:nth-child(2) { grid-column: span 2; order: 5; }
  .hud-tools { order: 6; }
  .rail { grid-template-columns: 1fr 1fr; }
  .growth, .lower { grid-template-columns: 1fr; }
  .deck { grid-template-columns: 1fr 1fr; }
  .buy { grid-column: 1 / -1; justify-content: center; }
  .dock { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  .page { padding: 16px 12px 24px; }
  .cabinet { padding: 8px; box-shadow: 4px 4px 0 var(--ink); }
  .brand-mark { width: 48px; height: 63px; }
  .wordmark { font-size: 20px; }
  .tagline { font-size: 16px; }
  .status { font-size: 8px; padding: 8px 12px; width: 100%; }
  .marquee { margin-bottom: 12px; gap: 12px; }
  .tagline { margin-top: 4px; }
  .hud { grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; }
  .hud-cell { padding: 6px 8px; gap: 4px; }
  .hud-cell b { font-size: 13px; }
  .hud-colony b { font-size: 15px; }
  .hud-cell:nth-child(2) { grid-column: span 2; order: 4; flex-direction: row; align-items: center; gap: 8px; }
  .hud-cell:nth-child(2) b.small { font-size: 10px; line-height: 14px; }
  .hud-tools { grid-column: span 1; order: 5; flex-direction: column; align-items: stretch; gap: 4px; padding: 4px; }
  .hud-tools .clock { text-align: center; font-size: 8px; }
  .hud-tools .chip { padding: 6px 4px; font-size: 8px; }
  .host { grid-template-columns: 32px 1fr; padding: 8px; column-gap: 8px; }
  .host img { width: 32px; height: 32px; }
  .host .h-name { font-size: 8px; }
  .host .h-name .long { display: none; }
  .host .h-name .short { display: inline; }
  .host .h-state { font-size: 14px; }
  .toast { font-size: 9px; min-height: 0; padding: 6px 8px; position: absolute; left: 8px; right: 8px; bottom: 8px; margin: 0; pointer-events: none; }
  .screen-wrap { position: relative; }
  .dock code { font-size: 8px; word-break: normal; overflow-wrap: normal; }
  .specimen { grid-template-columns: 1fr; }
  .specimen img { width: 128px; height: 128px; }
  .panel { padding: 12px; }
  .buy { font-size: 10px; }
  body::before, body::after { width: 48px; height: 48px; background-size: 16px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
