  html, body {
    margin: 0; padding: 0;
    background: #1a1c2c;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none;
  }
  #site-footer {
    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 a {
    color: #c9cfe8;
    text-decoration: none;
    padding: 4px 2px;
  }
  #site-footer a:hover { color: #e9c35b; }
  #site-footer .sep { margin: 0 6px; color: #4a5070; }
  .modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(8, 9, 20, 0.72);
    align-items: center;
    justify-content: center;
    padding: 20px;
    -webkit-user-select: text; user-select: text;
  }
  .modal-panel {
    background: #232742;
    color: #dde1f2;
    max-width: 460px;
    width: 100%;
    max-height: 78vh;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid #3c4266;
    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: #e9c35b;
    letter-spacing: 0.06em;
  }
  .modal-panel h3 {
    margin: 16px 0 4px;
    font-size: 13px;
    color: #a9c1ff;
  }
  .modal-panel p { margin: 6px 0; }
  .modal-panel a { color: #a9c1ff; }
  .modal-panel pre.license-text {
    white-space: pre-wrap;
    font: 11px/1.7 "SF Mono", Menlo, Consolas, monospace;
    color: #b9bfd8;
    background: #1b1e35;
    border: 1px solid #3c4266;
    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: #1a1c2c;
    background: #e9c35b;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
  }
  .kw { color: #e9c35b; }
  #mobile-controls {
    position: fixed;
    inset: 0;
    z-index: 15;
    pointer-events: none;
    display: none;
  }
  #mobile-controls.active { display: block; }
  #mobile-controls img,
  #mobile-controls div {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
  }
  #stick-base {
    position: absolute;
    left: calc(18px + env(safe-area-inset-left, 0px));
    bottom: calc(26px + env(safe-area-inset-bottom, 0px));
    width: 122px; height: 122px;
    background: url("image/mc-stick.png") center / 100% 100% no-repeat;
    image-rendering: pixelated;
    pointer-events: auto;
    touch-action: none;
  }
  #stick-knob {
    position: absolute;
    left: 50%; top: 50%;
    width: 54px; height: 54px;
    margin: -27px 0 0 -27px;
    background: url("image/mc-knob.png") center / 100% 100% no-repeat;
    image-rendering: pixelated;
    pointer-events: none;
  }
  .mc-btn {
    position: absolute;
    pointer-events: auto;
    touch-action: none;
    background: center / 100% 100% no-repeat;
    image-rendering: pixelated;
    -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  #fire-btn {
    right: calc(22px + env(safe-area-inset-right, 0px));
    bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    width: 98px; height: 98px;
    background-image: url("image/mc-fire.png");
  }
  #fire-btn.on { filter: brightness(1.25); }
  #reload-btn {
    right: calc(132px + env(safe-area-inset-right, 0px));
    bottom: calc(36px + env(safe-area-inset-bottom, 0px));
    width: 60px; height: 60px;
    background-image: url("image/mc-reload.png");
  }
  /* On touch devices, nudge the game up a little so it clears the on-screen
     controls without hiding the top HUD behind the browser bar. PC unchanged. */
  html.touch canvas { transform: translateY(-30px); }
