  html, body {
    margin: 0; padding: 0;
    background: #060c18;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none;
  }
  canvas { image-rendering: pixelated; }
  div#pyxel-screen { background-color: #060c18 !important; }
  #site-footer {
    display: flex;
    flex-wrap: wrap;
    row-gap: 6px;
    max-width: calc(100% - 44px);
    position: fixed;
    left: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    font: 11px/1 -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    color: #8f96b3;
    background: rgba(12, 14, 30, 0.78);
    padding: 6px 12px;
    border-radius: 999px;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  #site-footer .footer-group { white-space: nowrap; }
  #site-footer a {
    color: #c9cfe8;
    text-decoration: none;
    padding: 4px 2px;
  }
  #site-footer a:hover { color: #ffcd8c; }
  #site-footer .sep { margin: 0 6px; color: #4a5070; }
  .modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(4, 8, 16, 0.78);
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-user-select: text; user-select: text;
  }
  .modal-panel {
    background: #101b2c;
    color: #d8e2e0;
    max-width: 460px;
    width: 100%;
    max-height: 78vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 12px;
    border: 1px solid #2f4556;
    padding: 22px 24px 18px;
    font: 13px/1.85 -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  }
  .modal-panel h2 {
    margin: 0 0 12px;
    font-size: 15px;
    color: #ffcd8c;
    letter-spacing: 0.06em;
  }
  .modal-panel h3 {
    margin: 16px 0 4px;
    font-size: 13px;
    color: #83c6d6;
  }
  .modal-panel p { margin: 6px 0; }
  .modal-panel a { color: #83c6d6; }
  /* Pyxel's own logo (same release as pyxel.js), on a light chip so its dark lettering reads. */
  .modal-panel a.powered-by { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; margin: 2px 0 12px; padding: 10px 18px 12px; background: #eeeeee; border-radius: 6px; text-decoration: none; }
  .modal-panel a.powered-by span { font: 10px/1 "SF Mono", Menlo, Consolas, monospace; letter-spacing: .24em; color: #2b335f; }
  .modal-panel a.powered-by img { display: block; width: 152px; height: 64px; image-rendering: pixelated; }
  .modal-panel pre.license-text {
    white-space: pre-wrap;
    font: 11px/1.7 "SF Mono", Menlo, Consolas, monospace;
    color: #b3cfcd;
    background: #0c1421;
    border: 1px solid #2f4556;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 8px 0;
  }
  .modal-close {
    display: block;
    margin: 16px auto 0;
    padding: 9px 28px;
    min-height: 44px;
    font: 13px -apple-system, BlinkMacSystemFont, sans-serif;
    color: #060c18;
    background: #ffcd8c;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
  }
  .kw { color: #ffcd8c; }

  /* ---- Touch controls: a hull console under the visor feed ---- */
  /* The portrait screen sits at the top at full width; the console takes the rest. */
  /* A little breathing room above the screen (2026-10-02); notched phones add their inset. */
  :root { --top-gap: calc(10px + env(safe-area-inset-top, 0px)); --mc-h: 206px; --screen-h: min(calc(100dvh - var(--mc-h) - var(--top-gap) - env(safe-area-inset-bottom, 0px)), calc(100vw * 1.25)); }
  html.touch div#pyxel-screen { top: var(--top-gap) !important; height: var(--screen-h) !important; }
  #mobile-controls {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0; top: calc(var(--top-gap) + var(--screen-h));
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    z-index: 15;
    background:
      repeating-linear-gradient(90deg, transparent 0 31px, rgba(47, 69, 86, .25) 31px 32px),
      #0c1421;
    border-top: 1px solid #2f4556;
    font-family: 'DotGothic16', monospace;
    color: #b3cfcd;
    touch-action: none;
  }
  /* No text selection, loupe, callout or double-tap zoom anywhere on the console. */
  #mobile-controls, #mobile-controls * {
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none; touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }
  html.touch #mobile-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  #mobile-controls.idle .mc-left, #mobile-controls.idle .mc-right, #mobile-controls.idle .mc-top { visibility: hidden; }
  .mc-left { flex-shrink: 0; }
  #stick {
    position: relative;
    width: 112px; height: 112px;
    border-radius: 50%;
    border: 2px solid #2f4556;
    background: radial-gradient(circle, #152637 0 55%, #101b2c 56%);
    touch-action: none;
  }
  #stick::before, #stick::after { content: ""; position: absolute; background: #223a4c; }
  #stick::before { left: 50%; top: 14px; bottom: 14px; width: 2px; margin-left: -1px; }
  #stick::after { top: 50%; left: 14px; right: 14px; height: 2px; margin-top: -1px; }
  #stick-knob {
    position: absolute; left: 50%; top: 50%;
    width: 46px; height: 46px; margin: -23px 0 0 -23px;
    border-radius: 50%;
    background: #345568;
    border: 2px solid #83c6d6;
    box-shadow: 0 3px 0 #0c1421;
    pointer-events: none; z-index: 1;
  }
  #stick span {
    position: absolute; left: -10px; right: -10px; bottom: -22px;
    text-align: center; font-size: 11px; color: #679498; white-space: nowrap;
  }
  .mc-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: min(190px, calc(100vw - 210px));
  }
  .mc-btn {
    position: relative;
    height: 52px;
    min-width: 0;
    padding: 2px 4px;
    border: 2px solid #2f4556;
    border-radius: 4px;
    background: #152637;
    box-shadow: 0 3px 0 #060c18;
    color: #d8e2e0;
    font: 14px/1.2 'DotGothic16', monospace;
    overflow: hidden;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mc-btn b { display: block; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: clip; letter-spacing: -.02em; }
  .mc-btn small { display: block; font-size: 10px; color: #679498; white-space: nowrap; }
  .mc-btn.wide { grid-column: 1 / -1; height: 46px; }
  .mc-btn.wide b, .mc-btn.wide small { display: inline; margin: 0 4px; }
  .mc-btn.held, .mc-btn.firing { background: #345568; border-color: #83c6d6; transform: translateY(2px); box-shadow: 0 1px 0 #060c18; }
  .mc-btn.ready { border-color: #5594ac; }
  .mc-btn.kick b { color: #ffcd8c; }
  .mc-btn.decoy b { color: #f1938b; }
  .mc-btn.loud { border-color: #a74c50; }
  .mc-btn.loud small { color: #f1938b; }
  .mc-btn.inactive { color: #426776; }
  .mc-btn.inactive b { color: #426776; }
  .mc-btn .meter {
    position: absolute; left: 0; bottom: 0; height: 3px;
    width: var(--power, 0%); background: #ffcd8c; pointer-events: none;
  }
  .mc-btn#thrust .meter { background: #8dead4; }
  .mc-left { order: 1; }
  .mc-top { order: 2; display: flex; flex-direction: column; gap: 10px; }
  .mc-right { order: 3; }
  .mc-mini {
    min-width: 46px; height: 32px;
    border: 2px solid #2f4556; border-radius: 4px;
    background: #0c1421dd; color: #b3cfcd;
    font: 13px/1 'DotGothic16', monospace;
    -webkit-tap-highlight-color: transparent;
  }
  /* PC key guide in the empty margin beside the portrait screen,
     styled like the in-game HUD panels. */
  #key-guide {
    /* The screen is height-limited (4:5), so its right edge sits at 50% + 40vh. */
    position: fixed; left: calc(50% + 40vh + 28px); top: 50%; transform: translateY(-50%);
    z-index: 12; pointer-events: none; box-sizing: border-box;
    width: 214px; padding: 14px 16px 12px;
    background: #0c1421; border: 1px solid #2f4556;
    box-shadow: inset 0 0 0 3px #060c18, inset 0 0 0 4px #152637;
    font: 13px/1.4 'DotGothic16', monospace; color: #b3cfcd;
  }
  #key-guide .kg-head {
    margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid #223a4c;
    font-size: 11px; letter-spacing: .22em; color: #5594ac;
  }
  #key-guide ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
  #key-guide li { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; }
  #key-guide .keys { display: flex; gap: 3px; justify-content: flex-end; }
  #key-guide kbd {
    display: inline-block; min-width: 18px; padding: 2px 5px 1px; box-sizing: border-box;
    font: 11px/1.3 'DotGothic16', monospace; text-align: center; color: #ffcd8c;
    background: #152637; border: 1px solid #426776; box-shadow: 0 2px 0 #060c18;
  }
  #key-guide li small { display: block; font-size: 10px; color: #679498; }
  #key-guide .kg-note {
    margin: 10px 0 0; padding-top: 8px; border-top: 1px solid #223a4c;
    font-size: 10px; color: #679498;
  }
  html.touch #key-guide { display: none !important; }
  .intro-skip {
    position: fixed; right: 14px; z-index: 16;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    min-height: 40px; padding: 6px 14px;
    border: 2px solid #2f4556; border-radius: 4px;
    background: #0c1421ee; color: #d8e2e0;
    font: 13px/1 'DotGothic16', monospace;
    cursor: pointer;
  }
  html.touch .intro-skip { top: calc(var(--top-gap) + var(--screen-h) - 52px); bottom: auto; }
  html.touch #site-footer { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }

  /* Landscape phones: stick and buttons flank the portrait screen. */
  @media (orientation: landscape) and (max-height: 520px) {
    html.touch div#pyxel-screen { top: 0 !important; height: 100% !important; }
    html.touch #mobile-controls { background: none; border: 0; top: 0; height: 100%; padding: 12px calc(14px + env(safe-area-inset-right, 0px)) 12px calc(14px + env(safe-area-inset-left, 0px)); pointer-events: none; align-items: flex-end; }
    html.touch #mobile-controls > * { pointer-events: auto; }
    .mc-right { width: 180px; }
    .mc-top { position: absolute; flex-direction: row; top: 12px; right: calc(14px + env(safe-area-inset-right, 0px)); }
    html.touch .intro-skip { top: auto; bottom: 14px; right: 50%; transform: translateX(50%); }
  }

  /* Side panels on wide screens (deco.js): decorative art laid over Pyxel's
     letterbox margins; clicks pass through to the game. The key guide above
     sits on the right panel during play. */
  canvas.side-deco {
    position: fixed; z-index: 5; pointer-events: none;
    image-rendering: pixelated; opacity: 0; transition: opacity .6s;
  }
  html.side-deco-on canvas.side-deco { opacity: 1; }
  html.touch canvas.side-deco { display: none !important; }
