:root {
  color-scheme: dark;
  --field: #101b26;
  --ink: #e8eedb;
  --muted: #aab9b7;
  --mint: #80d6bc;
  --rust: #e89361;
}
* { box-sizing: border-box; }
body {
  background: var(--field);
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-weight: 400;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: auto;
  touch-action: pan-y;
}
.masthead {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 22px 28px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
h1 { margin: 0; font-size: 23px; line-height: 1.4; font-weight: 650; }
h1 span { margin-left: 12px; font-size: 18px; font-weight: 400; color: var(--mint); }
.identity p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
nav { display: flex; align-items: center; gap: 20px; flex-shrink: 0; font-size: 13px; }
a { color: var(--mint); text-underline-offset: 4px; }
a:hover { color: var(--ink); }
button { font: inherit; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .65; }
#start-game { padding: 11px 16px; border: 1px solid var(--mint); border-radius: 4px; color: var(--field); background: var(--mint); }
#start-game:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
:focus-visible { outline: 3px solid var(--rust); outline-offset: 4px; }
#game {
  position: relative;
  width: 100%;
  height: auto;
  flex: 1;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
}
#game canvas {
  display: block;
  margin: 0;
  width: min(640px, calc((100svh - 220px) * 10 / 9));
  max-width: 100%;
  height: auto;
  aspect-ratio: 10 / 9;
  image-rendering: pixelated;
}
.field-notes { text-align: center; padding: 10px 20px max(18px, env(safe-area-inset-bottom)); }
.field-notes p { margin: 6px auto; max-width: 80ch; line-height: 1.7; font-size: 13px; }
.field-notes .release-note { font-size: 12px; color: var(--muted); }
.release-note a { margin-left: 10px; }
#player-status { color: var(--muted); font-size: 12px; }
kbd { color: var(--mint); font: inherit; font-weight: 600; }
.touch-guide { display: none; }
#controller { position: relative; bottom: auto; transform: none; width: min(100%, 420px); height: 210px; flex-shrink: 0; margin: 0 auto; opacity: 1; }
#controller button { border: 0; }
#controller_dpad { left: 0; bottom: 12px; }
#controller_dpad:before { background: #324949; }
#controller_dpad button { background: #324949; color: var(--ink); font-size: 17px; padding: 0; box-shadow: none; }
#controller .roundBtn { background: #cb794f; color: #101b26; box-shadow: 0 3px 0 #754832; }
#controller .capsuleBtn { background: #526963; color: #f2f4df; box-shadow: 0 3px 0 #2b3b3a; text-transform: none; }
#controller .btnPressed { background: var(--mint); color: var(--field); opacity: 1; }
@media (max-width: 640px), (pointer: coarse) {
  .masthead { padding: 16px 18px 10px; gap: 12px; align-items: flex-start; }
  h1 { font-size: 20px; }
  h1 span { display: block; margin: 0; font-size: 14px; }
  .identity p { font-size: 11px; max-width: 30ch; }
  nav { flex-direction: column; gap: 9px; align-items: flex-end; font-size: 11px; }
  #start-game { font-size: 12px; padding: 10px 12px; }
  #game canvas { width: min(100%, 480px, calc((100svh - 410px) * 10 / 9)) !important; height: auto !important; min-width: 160px; }
  #controller { display: block !important; }
  .keyboard-guide { display: none; }
  .touch-guide { display: block; }
  .field-notes { padding: 0 12px max(12px, env(safe-area-inset-bottom)); }
  .field-notes p { font-size: 11px; }
  .field-notes .release-note { font-size: 10px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .masthead { padding-top: 8px; padding-bottom: 4px; }
  .identity p, .field-notes .release-note, #player-status { display: none; }
  #game canvas { width: min(42vw, calc((100svh - 112px) * 10 / 9)) !important; }
  #controller { position: absolute; bottom: 25%; left: 0; width: 100%; height: 184px; margin: 0; pointer-events: none; }
  #controller button, #controller_dpad { pointer-events: auto; }
  #controller_dpad { left: 0; }
}
