@font-face{
  font-family:"ArkPixel";
  src:url("../../../assets/fonts/ark-pixel-12px-zh_hans.woff2") format("woff2");
  font-weight:400 700;
  font-style:normal;
  font-display:swap;
}

:root{
  --ink:#070b09;
  --bg:#0b0d0c;
  --panel:#121a15;
  --line:#2f4a3a;
  --gold:#e8b45a;
  --cream:#f3e6c8;
  --muted:#93a89a;
  --red:#c9484f;
}

*{box-sizing:border-box}
html,body{min-height:100%}
body{
  margin:0;
  padding:18px 14px 26px;
  background:
    radial-gradient(circle at 50% -10%, #2a2118 0%, transparent 55%),
    repeating-linear-gradient(45deg, #ffffff04 0 2px, transparent 2px 8px),
    #0b0d0c;
  color:var(--cream);
  font-family:"ArkPixel","Microsoft YaHei",monospace;
  font-weight:500;
  line-height:1.5;
  -webkit-font-smoothing:none;
  image-rendering:pixelated;
}

main{max-width:860px;margin:0 auto}

header{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:12px;
  margin-bottom:10px;
}
.tag{
  margin:0;
  font-size: 12px;
  letter-spacing:3px;
  color:var(--gold);
  text-shadow:2px 2px 0 #000;
}
h1{
  margin:4px 0 0;
  font-size: 22px;
  letter-spacing:3px;
  color:var(--cream);
  text-shadow:3px 3px 0 #000;
}
.tools{display:flex;align-items:center;gap:8px;font-size: 12px}
.tools a,.tools button{
  color:var(--cream);
  background:var(--panel);
  border:3px solid var(--ink);
  padding:5px 9px;
  font:inherit;
  text-decoration:none;
  cursor:pointer;
  box-shadow:3px 3px 0 #000;
}
.tools a:hover,.tools button:hover{background:#1b2a21;color:var(--gold)}
.tools button:active,.tools a:active{transform:translate(2px,2px);box-shadow:1px 1px 0 #000}

.stage{
  position:relative;
  border:4px solid var(--ink);
  background:#000;
  box-shadow:6px 6px 0 #000;
  overflow:hidden;
}

canvas{
  display:block;
  width:100%;
  aspect-ratio:16/9;
  background:#0b0d0c;
  image-rendering:pixelated;
  touch-action:none;
  cursor:pointer;
  outline:none;
}
canvas:focus-visible{outline:3px solid var(--gold);outline-offset:-3px}

#boot{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  background:#0b0d0c;
  transition:opacity .35s steps(4);
}
#boot.hide{opacity:0;pointer-events:none}
.boot-title{
  margin:0;
  font-size: 22px;
  letter-spacing:4px;
  color:var(--gold);
  text-shadow:3px 3px 0 #000;
}
.boot-sub{
  margin:0;
  font-size: 11px;
  letter-spacing:5px;
  color:var(--muted);
}
.boot-track{
  width:180px;
  height:8px;
  margin-top:8px;
  border:2px solid var(--line);
  background:#000;
}
.boot-track i{
  display:block;
  width:0;
  height:100%;
  background:var(--gold);
  transition:width .12s steps(3);
}
#bootText{
  margin:4px 0 0;
  font-size: 12px;
  color:var(--muted);
}

.hint{
  margin:10px 2px 0;
  font-size: 12px;
  letter-spacing:1px;
  color:var(--muted);
}

@media (max-width:560px){
  body{padding:10px 8px 18px}
  h1{font-size: 18px;letter-spacing:2px}
  .tag{font-size: 11px}
  .tools a,.tools button{font-size: 12px;padding:4px 6px}
  .hint{font-size: 11px;line-height:1.7}
}

/* Mobile pass 2026-10-30: controls outside the scaled canvas. */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
.mobile-controls { display:none; }
@media(max-width:900px), (any-pointer:coarse) {
 body { padding:max(10px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); overflow-x:hidden; }
 header { flex-wrap:wrap; align-items:center; }
 .tools { flex-wrap:wrap; }
 .tools a,.tools button { min-height:44px; display:inline-flex; align-items:center; justify-content:center; }
 .mobile-controls { display:grid; grid-template-columns:148px minmax(0,1fr); gap:10px; padding:12px 0; }
 .mobile-dpad { display:grid; grid-template-columns:repeat(3,46px); grid-template-rows:repeat(3,46px); gap:4px; }
 .mobile-dpad [data-key=ArrowUp] { grid-column:2; grid-row:1; }
 .mobile-dpad [data-key=ArrowLeft] { grid-column:1; grid-row:2; }
 .mobile-dpad [data-key=ArrowDown] { grid-column:2; grid-row:3; }
 .mobile-dpad [data-key=ArrowRight] { grid-column:3; grid-row:2; }
 .mobile-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
 .mobile-controls button { min-height:46px; min-width:0; padding:5px; background:var(--panel); color:var(--cream); border:2px solid var(--line); font:inherit; font-size:13px; touch-action:none; user-select:none; }
 .mobile-controls button:active,.mobile-controls button.held { background:#344c39; border-color:var(--gold); }
 .mobile-controls button:focus-visible { outline:3px solid var(--gold); }
 canvas { touch-action:pinch-zoom; }
 .hint { font-size:12px; line-height:1.6; }
 .boot-title { font-size:18px; } .boot-sub { letter-spacing:2px; }
 #bootText { max-width:95%; overflow-wrap:anywhere; text-align:center; }
}
@media(max-height:620px) and (orientation:landscape) and (any-pointer:coarse) {
 main { max-width:none; }
 .stage { width:min(100%,calc((100dvh - 80px) * 16 / 9)); margin:auto; }
 .mobile-controls { max-width:740px; margin:auto; }
}

/* Touch holds must not select game labels or open the system callout. */
@media (max-width:900px), (any-pointer:coarse) {
  body, body * { -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; }
  img, canvas { -webkit-user-drag:none; }
  input, textarea, select, [contenteditable]:not([contenteditable="false"]), [contenteditable]:not([contenteditable="false"]) * {
    -webkit-user-select:text; user-select:text; -webkit-touch-callout:default;
  }
}

.mobile-stick { position:relative; width:146px; height:146px; border:3px solid var(--line); border-radius:50%; background:#14291dcc; touch-action:none; user-select:none; -webkit-user-select:none; }
.stick-cross { position:absolute; inset:0; display:grid; place-items:center; color:#57745e; font-size:88px; pointer-events:none; }
#mobileKnob { position:absolute; width:56px; height:56px; left:50%; top:50%; margin:-28px 0 0 -28px; border:3px solid var(--gold); border-radius:50%; background:#486347; box-shadow:0 3px 0 #000; pointer-events:none; }
.mobile-stick.active { border-color:var(--gold); }
