/* Stars site. One idea: the page is made of the game's own colour fields, and the pixel font speaks only in headlines.
   Palette and type come from the game: panel navy, grass, coin gold, parchment, roof red, mushroom violet. */
@font-face { font-family: "Fusion Pixel"; src: url(/assets/fpx-site.woff2) format("woff2"); font-display: swap; }

:root {
  --ink: #070A1C; --navy: #0E1436; --panel: #161D4A; --line: #34428F;
  --grass: #5BAE3C; --grass-d: #4A9A30; --grass-l: #7BCB55;
  --gold: #FFC83D; --cream: #FFF3D0; --water: #2A6FD8; --red: #E2533B; --violet: #6A4FDB;
  --pixel: "Fusion Pixel", ui-monospace, "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo", monospace;
  --body: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo", "Noto Sans", sans-serif;
  --pad: clamp(16px, 4vw, 56px);
  --u: 6px;                      /* one "pixel" of the page: borders and shadows are whole pixels */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--navy); color: var(--cream); font: 18px/1.6 var(--body); }
img, video, canvas { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--pad); }
section { position: relative; padding: clamp(64px, 10vw, 136px) 0; }

h1, h2, h3, .btn, .brand, .time, .end-name, .end-tag { font-family: var(--pixel); font-weight: 400; letter-spacing: 0; }
h1 { font-size: clamp(40px, 9.4vw, 148px); line-height: 1.08; margin: 0; }
h2 { font-size: clamp(34px, 5.6vw, 84px); line-height: 1.12; margin: 0 0 24px; text-wrap: balance; }
h3 { font-size: clamp(26px, 3vw, 40px); line-height: 1.15; margin: 0 0 10px; }
p { margin: 0 0 16px; max-width: 34em; }
.gold { color: var(--gold); }

/* ───────── buttons: flat slabs with a hard pixel shadow */
.btn { display: inline-block; padding: 14px 22px; background: var(--gold); color: var(--ink); text-decoration: none; font-size: 22px; line-height: 1.2;
  border: 0; cursor: pointer; box-shadow: var(--u) var(--u) 0 rgba(0, 0, 0, .45); transition: transform .08s, box-shadow .08s; }
.btn:hover { transform: translate(2px, 2px); box-shadow: 4px 4px 0 rgba(0, 0, 0, .45); }
.btn:active { transform: translate(var(--u), var(--u)); box-shadow: 0 0 0 rgba(0, 0, 0, .45); }
.btn-ghost { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 3px var(--cream); }
.btn-ghost:hover, .btn-ghost:active { box-shadow: inset 0 0 0 3px var(--gold); color: var(--gold); transform: none; }
.btn-small { font-size: 18px; padding: 9px 14px; box-shadow: 4px 4px 0 rgba(0, 0, 0, .45); }
.btn-cream { background: var(--cream); }

/* ───────── nav */
.nav { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px var(--pad); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 28px; }
.brand img { border-radius: 9px; }
.brand-zh { color: var(--gold); }
.nav-right { display: flex; align-items: center; gap: 14px; }
.lang select { font: 16px var(--body); color: var(--cream); background: var(--panel); border: 3px solid var(--line); border-radius: 0; padding: 7px 10px; max-width: 42vw; }

/* ───────── hero */
.sky { position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--cream) 1.5px, transparent 2px), radial-gradient(rgba(255, 243, 208, .55) 1.5px, transparent 2px), radial-gradient(rgba(255, 200, 61, .8) 2px, transparent 2.5px);
  background-size: 310px 270px, 190px 230px, 530px 410px; background-position: 40px 60px, 120px 10px, 260px 180px; opacity: .5; }
.hero { padding: clamp(110px, 13vw, 170px) 0 0; overflow: hidden; }
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(28px, 4vw, 56px); }
.lede { font-size: clamp(18px, 1.6vw, 22px); }
.cta { display: flex; flex-wrap: wrap; gap: 18px; margin: 28px 0 14px; }
.note { font-size: 15px; opacity: .75; }
.hero-phone { position: relative; z-index: 2; width: min(100%, 1040px); margin: 0 auto -5%; }
@media (min-width: 1000px) {
  .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .hero-grid h1 { grid-column: 1 / -1; }
  .hero-copy { padding-bottom: 150px; }
  .hero-phone { margin: -3% -10% -8% 0; width: 112%; }
}

/* the phone: the bezel picture sits over the screen */
.device { position: relative; aspect-ratio: 1500 / 735; filter: drop-shadow(10px 14px 0 rgba(0, 0, 0, .3)); }
.device video, .device .screen { position: absolute; left: 2.1%; top: 4.9%; width: 95.8%; height: 90.2%; object-fit: cover; border-radius: 4.6% / 9.6%; background: #0B1030; }
.device .bezel { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* the ground under the hero, with the parade */
.ground { position: relative; z-index: 3; height: 84px; background: var(--grass); border-top: 12px solid var(--grass-l); margin-top: -1px; }
.parade { position: absolute; left: 0; right: 0; bottom: 66px; height: 96px; overflow: hidden; }
.agent { position: absolute; bottom: 0; width: 96px; height: 96px; background: url(/assets/cast.png) 0 0 / 1536px 384px; image-rendering: pixelated; }
.parade .agent { animation: hop .52s steps(4) infinite alternate; animation-delay: calc(var(--i) * -.13s); }
@keyframes hop { from { transform: translateY(0); } to { transform: translateY(-12px); } }

/* ───────── cast */
.cast { background: var(--grass); color: var(--ink); padding-top: clamp(40px, 6vw, 80px); }
.slab-ink span { background: var(--ink); color: var(--gold); padding: .08em .22em; box-decoration-break: clone; -webkit-box-decoration-break: clone; line-height: 1.4; }
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px 2px; margin: clamp(28px, 4vw, 52px) 0; }
.cast-grid .agent { position: static; justify-self: center; width: 64px; height: 64px; background-size: 1024px 256px; }
.cast-grid .agent:hover { animation: hop .2s steps(3) 4 alternate; }
.two { display: grid; gap: 8px 48px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); font-size: 20px; }

/* ───────── loop */
.loop { background: var(--cream); color: var(--ink); }
.steps { list-style: none; counter-reset: step; margin: clamp(28px, 4vw, 56px) 0 0; padding: 0; display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.steps li { counter-increment: step; border-top: var(--u) solid var(--ink); padding-top: 18px; }
.steps h3::before { content: counter(step); display: inline-block; min-width: 1.5em; margin-right: .45em; text-align: center; background: var(--gold); }
.order { margin: 14px 0 0; padding: 16px 18px; background: var(--panel); color: var(--gold); border: var(--u) solid var(--line); box-shadow: var(--u) var(--u) 0 rgba(0, 0, 0, .3); overflow-x: auto; font: 15px/1.5 ui-monospace, Menlo, monospace; }

/* ───────── verbs */
.verbs { background: var(--ink); padding-bottom: 0; }
.verbs-head { display: grid; gap: 8px 48px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: end; margin-bottom: clamp(28px, 4vw, 56px); }
.verbs-head h2, .verbs-head p { margin-bottom: 0; }
.verbs-head h2 { color: var(--gold); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { position: relative; overflow: hidden; aspect-ratio: 16 / 9; margin: 0; }
.tile img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform .5s cubic-bezier(.23, 1, .32, 1); }
.tile:hover img { transform: scale(1.08); }
.tile figcaption { position: absolute; left: 0; bottom: 0; padding: .1em .32em; font: clamp(22px, 3.2vw, 52px)/1.2 var(--pixel); }
.tile:nth-child(8n+1) figcaption { background: var(--red); color: var(--cream); }
.tile:nth-child(8n+2) figcaption { background: var(--gold); color: var(--ink); }
.tile:nth-child(8n+3) figcaption { background: var(--water); color: var(--cream); }
.tile:nth-child(8n+4) figcaption { background: var(--ink); color: var(--gold); }
.tile:nth-child(8n+5) figcaption { background: var(--violet); color: var(--cream); }
.tile:nth-child(8n+6) figcaption { background: var(--water); color: var(--cream); }
.tile:nth-child(8n+7) figcaption { background: var(--cream); color: var(--ink); }
.tile:nth-child(8n+8) figcaption { background: var(--grass); color: var(--ink); }

/* ───────── talk */
.talk { background: var(--navy); }
.talk-grid, .clock-grid { display: grid; gap: clamp(32px, 5vw, 72px); grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: center; }
.chat { display: grid; gap: 18px; font-size: clamp(18px, 2vw, 26px); font-family: var(--pixel); }
.bubble { margin: 0; padding: 16px 20px; max-width: none; background: var(--panel); border: var(--u) solid var(--line); box-shadow: var(--u) var(--u) 0 rgba(0, 0, 0, .35); }
.bubble.me { justify-self: end; background: #2B5CB8; border-color: #6FA2F5; color: #fff; }
.row { display: flex; gap: 12px; align-items: stretch; }
.face { flex: none; width: 76px; background: var(--panel) url(/assets/cast.png) -768px 2px / 1024px 256px no-repeat; image-rendering: pixelated; border: var(--u) solid var(--line); }
.pin { justify-self: start; margin: 0 0 0 88px; padding: 6px 14px; background: var(--gold); color: var(--ink); box-shadow: var(--u) var(--u) 0 rgba(0, 0, 0, .35); }

/* ───────── draw it / rewrite the laws */
.own { padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); }
.half { padding: clamp(56px, 8vw, 112px) var(--pad); }
.draw { background: var(--violet); }
.laws { background: var(--red); }
.painter { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 28px; align-items: flex-start; }
#paint { width: min(100%, 352px); background: #1B1440; border: var(--u) solid var(--cream); box-shadow: var(--u) var(--u) 0 rgba(0, 0, 0, .35); image-rendering: pixelated; touch-action: none; cursor: crosshair; }
.tools { display: grid; gap: 20px; }
.swatches { display: grid; grid-template-columns: repeat(4, 48px); gap: 10px; }
.swatches button { width: 48px; height: 48px; border: 4px solid var(--ink); padding: 0; cursor: pointer; }
.swatches button[aria-checked="true"] { outline: 4px solid var(--cream); outline-offset: 2px; }
.config { margin-top: 28px; max-width: 560px; }
.config pre { margin: 0; padding: 22px 24px; background: var(--panel); border: var(--u) solid var(--cream); box-shadow: var(--u) var(--u) 0 rgba(0, 0, 0, .35); font: clamp(18px, 2.2vw, 30px)/1.5 var(--pixel); overflow-x: auto; }
.config .dim { opacity: .65; }
.config output { color: var(--gold); }
.range { display: grid; gap: 10px; margin-top: 26px; font-size: 16px; }
.range input { width: 100%; accent-color: var(--gold); height: 32px; }
.street { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; min-height: 60px; }
.street i { width: 56px; height: 54px; background: url(/assets/house.png) center / cover; image-rendering: pixelated; }

/* ───────── clock */
.clock { background: #152A1C; transition: background .6s; }
.clock.is-day { background: var(--water); }
.time { font-size: clamp(64px, 12vw, 168px); line-height: 1; margin: 0 0 16px; color: var(--gold); }

/* ───────── trailer */
.trailer { background: var(--ink); }
.trailer video { width: 100%; aspect-ratio: 16 / 9; background: #000; border: var(--u) solid var(--line); margin-top: 12px; }

/* ───────── end */
.end { text-align: center; padding-bottom: 0; }
.end-in { position: relative; display: grid; justify-items: center; gap: 10px; }
.end-in img { border-radius: 36px; }
.end-name { font-size: clamp(56px, 10vw, 132px); line-height: 1.05; margin: 16px 0 0; max-width: none; }
.end-tag { font-size: clamp(22px, 3vw, 36px); color: var(--gold); margin-bottom: 24px; max-width: none; }
.foot { position: relative; display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: center; margin-top: clamp(56px, 9vw, 112px); padding-top: 22px; padding-bottom: 26px; border-top: 3px solid var(--line); font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .parade .agent, .cast-grid .agent:hover { animation: none; }
  .tile img, .btn { transition: none; }
}

/* ───────── narrow screens */
.brand, .btn { white-space: nowrap; }
@media (max-width: 999px) {
  .hero-phone { margin-bottom: 84px; }
}
@media (max-width: 560px) {
  .brand-zh { display: none; }
  .brand { font-size: 24px; gap: 8px; }
  .nav-right { gap: 8px; }
  .lang select { font-size: 14px; padding: 6px 4px; }
  .cast-grid { grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); }
  .cast-grid .agent { zoom: .75; }
  .parade .agent { zoom: .75; }
  .pin { margin-left: 0; }
}
