    * { box-sizing: border-box; }

    html, body { min-height: 100%; }

    body {
      margin: 0;
      padding: 10px;
      color: #000000;
      background-color: #000044;
      background-image:
        radial-gradient(circle at 2px 2px, #ffffff 0 1px, transparent 1.5px),
        linear-gradient(45deg, transparent 46%, #004080 47% 53%, transparent 54%);
      background-size: 23px 23px, 46px 46px;
      font-family: Verdana, Arial, sans-serif;
      font-size: 13px;
    }

    .page {
      width: 1040px;
      max-width: 100%;
      margin: 0 auto;
      padding: 5px;
      background: #c0c0c0;
      border: 7px outset #eeeeee;
    }

    table { border-collapse: separate; }

    .masthead {
      width: 100%;
      border: 5px ridge #9a9a9a;
      background: #000000;
      color: #00ff66;
    }

    .masthead td { padding: 8px; text-align: center; }

    .logo {
      margin: 0;
      color: #00ff66;
      font-family: "Courier New", monospace;
      font-size: clamp(24px, 5vw, 52px);
      line-height: 0.95;
      letter-spacing: -4px;
      text-shadow: 3px 0 #003cff, -2px 0 #00a844;
    }

    .subtitle {
      margin-top: 5px;
      color: #00ccff;
      font-family: "Courier New", monospace;
      font-weight: bold;
      letter-spacing: 2px;
    }

    .blink {
      color: #ffff00;
      animation: blink 1.1s steps(1) infinite;
    }

    @keyframes blink { 50% { opacity: 0; } }

    .ticker {
      margin: 5px 0;
      padding: 3px;
      color: #ffff00;
      background: #000080;
      border: 3px inset #ffffff;
      font: bold 12px "Courier New", monospace;
    }

    .main-layout { width: 100%; border-spacing: 5px; }
    .main-layout > tbody > tr > td { vertical-align: top; }
    .screen-cell { width: 660px; }

    .box-title {
      padding: 3px 6px;
      color: #ffffff;
      background: #000080;
      border: 2px outset #d8d8d8;
      font-weight: bold;
      font-size: 12px;
    }

    .screen-shell {
      padding: 7px;
      background: #686868;
      border: 6px ridge #e8e8e8;
    }

    .canvas-wrap {
      position: relative;
      width: 640px;
      max-width: 100%;
      margin: 0 auto;
      overflow: hidden;
      border: 3px inset #8b8b8b;
      background: #000000;
      aspect-ratio: 4 / 3;
    }

    canvas {
      display: block;
      width: 100%;
      height: 100%;
      background: #000000;
      image-rendering: pixelated;
    }

    .scanlines,
    .analog-glow,
    .analog-noise,
    .navigation-noise,
    .hud {
      position: absolute;
      inset: 0;
      pointer-events: none;
    }

    .analog-glow {
      z-index: 1;
      opacity: 0;
      background: transparent;
      mix-blend-mode: screen;
      filter: blur(3px) brightness(1.25);
      transform: scale(1.012);
      transition: opacity 160ms linear;
    }

    .analog-noise {
      z-index: 2;
      opacity: 0;
      background: transparent;
      mix-blend-mode: screen;
      image-rendering: auto;
      transition: opacity 120ms linear;
    }

    .navigation-noise {
      z-index: 4;
      opacity: 0;
      background: transparent;
      mix-blend-mode: screen;
      image-rendering: auto;
      transition: opacity 100ms linear;
    }

    .canvas-wrap.navigation-degraded .navigation-noise {
      opacity: var(--navigation-noise-opacity, 0.06);
    }

    .analog-beam {
      position: absolute;
      z-index: 3;
      left: 0;
      right: 0;
      top: -8%;
      height: 2px;
      opacity: 0;
      pointer-events: none;
      background: linear-gradient(to right, transparent 0%, #36ff83 18%, #b5ffd0 50%, #36ff83 82%, transparent 100%);
      box-shadow: 0 0 5px #00ff66, 0 0 13px rgba(0, 255, 102, 0.7);
    }

    .scanlines {
      z-index: 5;
      opacity: 0;
      background:
        linear-gradient(rgba(0, 255, 90, 0.025), rgba(0, 255, 90, 0.025)),
        repeating-linear-gradient(
          to bottom,
          transparent 0,
          transparent 2px,
          rgba(0, 0, 0, 0.75) 3px,
          rgba(0, 0, 0, 0.75) 4px
        );
      transition: opacity 160ms linear;
    }

    .hud {
      z-index: 6;
      color: #00eaff;
      font: bold 14px "Courier New", monospace;
      text-shadow: 0 0 4px #0066ff;
    }

    .canvas-wrap.analog-vision .analog-glow { opacity: 0.32; }
    .canvas-wrap.analog-vision .analog-noise { opacity: var(--analog-noise-opacity, 0.11); }
    .canvas-wrap.analog-vision .scanlines { opacity: 0.2; }

    .canvas-wrap.analog-vision .analog-beam {
      opacity: 0.72;
      animation: analog-sweep 2.8s linear infinite;
    }

    .canvas-wrap.analog-vision .hud {
      color: #4ff2ff;
      text-shadow: 0 0 4px #00b7ff, 0 0 10px rgba(0, 190, 255, 0.65);
    }

    .canvas-wrap.analog-vision .hud-name {
      color: #ffc042;
      text-shadow: 0 0 5px #ff7a1a, 0 0 12px rgba(255, 170, 60, 0.7);
    }

    .canvas-wrap.analog-vision .hud-alt,
    .canvas-wrap.analog-vision .hud-hdg {
      color: #66f7ff;
      text-shadow: 0 0 4px #0088ff, 0 0 10px rgba(0, 170, 255, 0.7);
    }

    .canvas-wrap.hud-hidden .hud { display: none; }

    .navigation-alert {
      position: absolute;
      z-index: 7;
      top: 13%;
      left: 50%;
      min-width: 52%;
      max-width: 86%;
      transform: translateX(-50%);
      padding: 5px 9px;
      border: 1px solid #ffff00;
      color: #ffff00;
      background: rgba(0, 0, 0, 0.78);
      text-align: center;
      font: bold clamp(11px, 2.3vw, 17px) "Courier New", monospace;
      letter-spacing: 1px;
      text-shadow: 0 0 5px rgba(255, 255, 0, 0.8);
      pointer-events: none;
    }

    .navigation-alert[hidden] { display: none; }
    .navigation-alert span { display: block; margin-top: 3px; color: #ff6633; font-size: 0.82em; }
    .navigation-alert span[hidden] { display: none; }
    #navigation-status.is-warning { color: #ffff00; }
    #navigation-status.is-critical { color: #ff6633; }

    .hull-critical-alert {
      position: absolute;
      z-index: 7;
      top: 25%;
      left: 50%;
      max-width: 86%;
      transform: translateX(-50%);
      padding: 5px 9px;
      border: 1px solid #ff4422;
      color: #ff4422;
      background: rgba(0, 0, 0, 0.78);
      text-align: center;
      font: bold clamp(11px, 2.3vw, 17px) "Courier New", monospace;
      letter-spacing: 1px;
      text-shadow: 0 0 5px rgba(255, 68, 34, 0.85);
      pointer-events: none;
    }

    .hull-critical-alert[hidden] { display: none; }

    .fuel-alert {
      position: absolute;
      z-index: 7;
      top: 34%;
      left: 50%;
      max-width: 86%;
      transform: translateX(-50%);
      padding: 5px 9px;
      border: 1px solid #ff1d14;
      color: #ff1d14;
      background: rgba(0, 0, 0, 0.82);
      text-align: center;
      font: bold clamp(11px, 2.3vw, 17px) "Courier New", monospace;
      letter-spacing: 1px;
      text-shadow: 0 0 5px rgba(255, 29, 20, 0.85);
      pointer-events: none;
    }

    .fuel-alert.is-low {
      border-color: #ffff00;
      color: #ffff00;
      text-shadow: 0 0 5px rgba(255, 255, 0, 0.8);
    }

    .fuel-alert[hidden] { display: none; }

    #fuel-status-row {
      color: #39aaff;
      font-weight: bold;
    }

    .mission-complete {
      position: absolute;
      z-index: 8;
      top: 62%;
      left: 50%;
      width: min(88%, 420px);
      transform: translate(-50%, -50%);
      padding: 10px 12px;
      border: 2px solid #00ff66;
      color: #00ff66;
      background: rgba(0, 0, 0, 0.88);
      box-shadow: 0 0 0 2px #003311, 0 0 14px rgba(0, 255, 102, 0.55);
      text-align: center;
      font: bold clamp(12px, 2.6vw, 19px) "Courier New", monospace;
      letter-spacing: 1px;
      text-shadow: 0 0 6px rgba(0, 255, 102, 0.85);
      pointer-events: auto;
    }

    .mission-complete[hidden] { display: none; }
    .mission-complete span { display: block; margin-top: 7px; color: #00eaff; font-size: 0.72em; }
    .mission-complete-actions {
      display: flex;
      gap: 8px;
      justify-content: center;
      margin-top: 10px;
    }
    .mission-complete-actions button {
      min-width: 0;
      padding: 6px 8px;
      border: 3px outset #eeeeee;
      color: #000000;
      background: #c8c8c8;
      font: bold 11px "Courier New", monospace;
    }
    .mission-complete-actions button:active { border-style: inset; }
    .mission-complete-actions button:focus-visible {
      outline: 2px solid #ffff00;
      outline-offset: 2px;
    }

    .game-over {
      position: absolute;
      z-index: 9;
      top: 54%;
      left: 50%;
      width: min(86%, 360px);
      transform: translate(-50%, -50%);
      padding: 12px;
      border: 2px solid #ff6633;
      color: #ff6633;
      background: rgba(0, 0, 0, 0.92);
      box-shadow: 0 0 0 2px #551100, 0 0 14px rgba(255, 102, 51, 0.55);
      text-align: center;
      font: bold clamp(13px, 2.8vw, 21px) "Courier New", monospace;
      letter-spacing: 1px;
      text-shadow: 0 0 6px rgba(255, 102, 51, 0.8);
      pointer-events: auto;
    }

    .game-over[hidden] { display: none; }
    .game-over span { display: block; margin-top: 7px; color: #ffff00; font-size: 0.68em; }
    .game-over-actions { margin-top: 11px; }
    .game-over-actions button {
      min-width: 150px;
      padding: 7px 10px;
      border: 3px outset #eeeeee;
      color: #000000;
      background: #c8c8c8;
      font: bold 11px "Courier New", monospace;
    }
    .game-over-actions button:active { border-style: inset; }
    .game-over-actions button:focus-visible {
      outline: 2px solid #ffff00;
      outline-offset: 2px;
    }

    .mission-feedback {
      position: absolute;
      z-index: 7;
      top: 31%;
      left: 50%;
      transform: translateX(-50%);
      padding: 5px 9px;
      border: 1px solid #ffff00;
      color: #ffff00;
      background: rgba(0, 0, 0, 0.84);
      text-align: center;
      font: bold clamp(11px, 2.2vw, 16px) "Courier New", monospace;
      letter-spacing: 1px;
      text-shadow: 0 0 5px rgba(255, 255, 0, 0.85);
      pointer-events: none;
    }

    .mission-feedback[hidden] { display: none; }

    .mission-range {
      position: absolute;
      z-index: 7;
      top: 62%;
      left: 50%;
      width: max-content;
      max-width: calc(100% - 24px);
      box-sizing: border-box;
      transform: translateX(-50%);
      padding: 4px 8px;
      border: 1px dashed #00ffff;
      color: #00ffff;
      background: rgba(0, 0, 0, 0.84);
      text-align: center;
      font: bold clamp(10px, 1.9vw, 14px) "Courier New", monospace;
      letter-spacing: 1px;
      text-shadow: 0 0 4px rgba(0, 255, 255, 0.7);
      pointer-events: none;
    }

    .mission-range[hidden] { display: none; }

    @keyframes analog-sweep {
      from { top: -8%; }
      to { top: 108%; }
    }

    .hud-name {
      position: absolute;
      top: 3%;
      left: 50%;
      transform: translateX(-50%);
      font-size: clamp(17px, 4vw, 29px);
      letter-spacing: 2px;
    }

    .hud-alt { position: absolute; left: 4%; bottom: 5%; }
    .hud-hdg { position: absolute; right: 4%; bottom: 5%; }

    .crosshair {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 36px;
      height: 22px;
      transform: translate(-50%, -50%);
      border-left: 2px solid #ff4d1f;
      border-right: 2px solid #ff4d1f;
      filter: drop-shadow(0 0 4px rgba(255, 77, 31, 0.85));
    }

    .crosshair::before {
      content: "";
      position: absolute;
      left: -10px;
      right: -10px;
      top: 10px;
      border-top: 2px solid #ff4d1f;
    }

    .mission-lock-frame {
      position: absolute;
      top: 50%;
      left: 50%;
      width: var(--lock-width, 96px);
      height: var(--lock-height, 72px);
      transform: translate(-50%, -50%);
      color: #ffff00;
      filter: drop-shadow(0 0 4px rgba(255, 255, 0, 0.9));
      pointer-events: none;
    }

    .mission-lock-frame[hidden] { display: none; }
    .lock-corner { position: absolute; width: 18px; height: 18px; border-color: currentColor; border-style: solid; }
    .lock-tl { top: 0; left: 0; border-width: 2px 0 0 2px; }
    .lock-tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
    .lock-bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
    .lock-br { right: 0; bottom: 0; border-width: 0 2px 2px 0; }

    .corner { position: absolute; width: 23px; height: 23px; }
    .c1 { left: 3%; top: 4%; border-left: 2px solid #00ff66; border-top: 2px solid #00ff66; }
    .c2 { right: 3%; top: 4%; border-right: 2px solid #00ff66; border-top: 2px solid #00ff66; }
    .c3 { left: 3%; bottom: 4%; border-left: 2px solid #00ff66; border-bottom: 2px solid #00ff66; }
    .c4 { right: 3%; bottom: 4%; border-right: 2px solid #00ff66; border-bottom: 2px solid #00ff66; }

    #webgl-error {
      display: none;
      position: absolute;
      inset: 0;
      z-index: 10;
      padding: 80px 30px;
      color: #ffff00;
      background: #000000;
      text-align: center;
      font: bold 20px "Courier New", monospace;
    }

    .status-table {
      width: 100%;
      margin-top: 5px;
      border: 3px ridge #ffffff;
      background: #000000;
      color: #00ff66;
      font: 12px "Courier New", monospace;
    }

    .status-table td {
      padding: 4px 7px;
      border: 1px solid #005522;
      white-space: nowrap;
    }

    .hull-meter {
      display: inline-block;
      width: min(190px, 45vw);
      height: 10px;
      margin-left: 9px;
      vertical-align: -1px;
      border: 1px solid #ff6644;
      background: #260600;
      box-shadow: inset 0 0 0 1px #000000;
    }

    .hull-meter-fill {
      display: block;
      width: var(--hull-level, 100%);
      height: 100%;
      background: #ff2b16;
      box-shadow: 0 0 5px rgba(255, 50, 22, 0.85);
      transition: width 120ms linear;
    }

    .fuel-meter {
      display: inline-block;
      width: min(190px, 45vw);
      height: 10px;
      margin-left: 9px;
      vertical-align: -1px;
      border: 1px solid #3aaeff;
      background: #00152d;
      box-shadow: inset 0 0 0 1px #000000;
    }

    .fuel-meter-fill {
      display: block;
      width: var(--fuel-level, 100%);
      height: 100%;
      background: #168cff;
      box-shadow: 0 0 5px rgba(22, 140, 255, 0.9);
      transition: width 120ms linear;
    }

    .controls-cell {
      width: 335px;
      padding: 5px;
      border: 5px ridge #ffffff;
      background: #a8a8a8;
    }

    .control-panel {
      margin-bottom: 8px;
      padding: 5px;
      border: 3px inset #eeeeee;
      background: #c0c0c0;
    }

    .panel-label {
      margin: -2px -2px 5px;
      padding: 2px 4px;
      color: #ffffff;
      background: #000080;
      text-align: center;
      font: bold 12px "Courier New", monospace;
    }

    .dpad {
      display: grid;
      grid-template-columns: repeat(3, 78px);
      grid-template-rows: repeat(3, 58px);
      justify-content: center;
      gap: 3px;
      user-select: none;
      -webkit-user-select: none;
    }

    button {
      color: #000000;
      background: #c0c0c0;
      border: 5px outset #eeeeee;
      border-radius: 0;
      font-family: Arial, sans-serif;
      font-weight: bold;
      cursor: pointer;
      touch-action: none;
    }

    button:hover { background: #d8d8d8; }
    button:active,
    button.is-active {
      padding: 5px 1px 1px 5px;
      background: #a0a0a0;
      border-style: inset;
    }

    .pad-button { min-width: 0; padding: 2px; font-size: 20px; line-height: 1; }
    .pad-button small { display: block; margin-top: 3px; font-size: 8px; line-height: 1; }
    .up { grid-column: 2; grid-row: 1; }
    .left { grid-column: 1; grid-row: 2; }
    .center {
      grid-column: 2;
      grid-row: 2;
      display: grid;
      place-items: center;
      background: #5e5e5e;
      border: 4px inset #999999;
      color: #00ff66;
      font: bold 9px "Courier New", monospace;
      text-align: center;
    }
    .right { grid-column: 3; grid-row: 2; }
    .down { grid-column: 2; grid-row: 3; }

    .utility-buttons {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 5px;
    }

    .utility-buttons button { min-height: 45px; font-size: 11px; }
    .utility-buttons .wide { grid-column: 1 / -1; }

#analog-button.is-active,
#sound-button.is-active,
#hud-button.is-active,
#digital-rain-button.is-active,
#starfield-button.is-active,
#hull-integrity-button.is-active,
#fuel-endurance-button.is-active {
      color: #00ff66;
      background: #001b0a;
      text-shadow: 0 0 5px #00aa44;
    }

    .settings-modal,
    .missions-modal {
      position: fixed;
      inset: 0;
      z-index: 200;
      display: grid;
      place-items: center;
      padding: 15px;
      background: rgba(0, 0, 25, 0.78);
    }

    .settings-modal[hidden],
    .missions-modal[hidden] { display: none; }

    .settings-window,
    .missions-window {
      width: 390px;
      max-width: 100%;
      color: #000000;
      background: #c0c0c0;
      border: 6px outset #eeeeee;
      box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.65);
    }

    .settings-titlebar,
    .missions-titlebar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 32px;
      padding: 3px 4px 3px 8px;
      color: #ffffff;
      background: #000080;
      font: bold 13px "Courier New", monospace;
      letter-spacing: 1px;
    }

    .settings-titlebar button,
    .missions-titlebar button {
      width: 28px;
      min-height: 24px;
      padding: 0;
      border-width: 3px;
      font-size: 12px;
    }

    .settings-content,
    .missions-content { padding: 10px; }

    .settings-group {
      padding: 8px;
      border: 3px inset #eeeeee;
      background: #b8b8b8;
    }

    .settings-group + .settings-group { margin-top: 8px; }

    .settings-group-title {
      margin-bottom: 8px;
      padding: 3px 5px;
      color: #00ff66;
      background: #000000;
      font: bold 11px "Courier New", monospace;
    }

    .settings-group button {
      width: 100%;
      min-height: 42px;
      font-size: 11px;
    }

    .settings-group button + button { margin-top: 5px; }

    .settings-group p {
      margin: 8px 2px 0;
      font-size: 10px;
      line-height: 1.4;
    }

    .missions-content > p {
      margin: 0 0 10px;
      font-size: 10px;
      line-height: 1.4;
    }

    .mission-catalog-entry {
      padding: 8px;
      border: 3px inset #eeeeee;
      background: #b8b8b8;
    }

    .mission-catalog-entry + .mission-catalog-entry { margin-top: 8px; }

    .mission-catalog-entry h2 {
      margin: 0;
      padding: 3px 5px;
      color: #00ff66;
      background: #000000;
      font: bold 12px "Courier New", monospace;
    }

    .mission-catalog-entry p,
    .mission-catalog-state {
      margin: 8px 2px 0;
      font-size: 11px;
      line-height: 1.4;
    }

    .mission-catalog-state { color: #000080; font-weight: bold; }

    .mission-catalog-actions { margin-top: 8px; }

    .mission-catalog-actions button {
      width: 100%;
      min-height: 42px;
      font-size: 11px;
    }

    .help {
      margin-top: 8px;
      padding: 5px;
      border: 3px inset #eeeeee;
      background: #ffffcc;
      font-size: 10px;
      line-height: 1.45;
    }

    .visitor-counter {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      margin: 6px auto;
    }

    .visitor-counter-label {
      font: bold 9px "Courier New", monospace;
      letter-spacing: 1px;
    }

    footer a.visitor-counter-badge {
      display: block;
      background: #000000;
      border: 2px inset #ffffff;
      line-height: 0;
    }

    .visitor-counter-badge img {
      display: block;
      width: 88px;
      height: 31px;
      border: 0;
      image-rendering: pixelated;
    }

    .visitor-counter-badge:focus-visible {
      outline: 2px solid #00ff66;
      outline-offset: 2px;
    }

    footer {
      padding: 7px 4px 2px;
      text-align: center;
      font-size: 10px;
    }

    footer a { color: #0000ee; text-decoration: underline; }

    .github-button {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      margin-top: 7px;
      padding: 4px 8px;
      color: #000000;
      background: #ffffff;
      border: 3px outset #eeeeee;
      box-shadow: 1px 1px 0 #000000;
      font: bold 10px Arial, sans-serif;
      text-decoration: none;
    }

    .github-button:hover {
      color: #000000;
      background: #e8e8e8;
      text-decoration: none;
    }

    .github-button:active {
      border-style: inset;
      box-shadow: none;
      transform: translate(1px, 1px);
    }

    .github-button:focus-visible {
      outline: 2px solid #00ff66;
      outline-offset: 2px;
    }

    .github-button svg {
      width: 14px;
      height: 14px;
      fill: currentColor;
      flex: none;
    }

    @media (max-width: 980px) {
      body { padding: 3px; }
      .page { border-width: 4px; }
      .main-layout,
      .main-layout > tbody,
      .main-layout > tbody > tr,
      .main-layout > tbody > tr > td { display: block; width: 100%; }
      .main-layout { table-layout: fixed; }
      .controls-cell { margin-top: 6px; }
      .controls-cell-inner {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        max-width: 660px;
        margin: 0 auto;
      }
      .control-panel { min-width: 0; margin-bottom: 0; }
      .dpad {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 78px));
      }
      .utility-buttons,
      .help { grid-column: 1 / -1; }
      .help { margin-top: 0; }
      .logo { letter-spacing: -2px; }
    }

    @media (max-width: 430px) {
      .controls-cell { padding: 3px; }
      .controls-cell-inner { gap: 4px; }
      .control-panel {
        padding: 3px;
        border-width: 2px;
      }
      .panel-label {
        margin: -1px -1px 3px;
        padding: 2px 1px;
        font-size: 9px;
        white-space: nowrap;
      }
      .dpad {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: repeat(3, 46px);
        gap: 2px;
      }
      .pad-button {
        padding: 1px;
        border-width: 3px;
        font-size: 16px;
      }
      .pad-button small { margin-top: 2px; font-size: 7px; }
      .pad-button:active,
      .pad-button.is-active { padding: 3px 0 0 3px; }
      .center { border-width: 3px; font-size: 7px; }
      .status-table { table-layout: fixed; font-size: 9px; }
      .status-table td { padding: 3px; white-space: normal; }
      .hud { font-size: 10px; }
      .lock-corner { width: 12px; height: 12px; }
      .mission-complete-actions { flex-direction: column; }
    }

    @media (prefers-reduced-motion: reduce) {
      .blink { animation: none; }
      .navigation-noise { transition: none; }
      .hull-meter-fill { transition: none; }
      .canvas-wrap.analog-vision .analog-beam {
        top: 50%;
        opacity: 0.35;
        animation: none;
      }
    }
  
