:root {
  --ink: #f5f3dc;
  --dark: #0c1116;
  --panel: #151d24;
  --yellow: #f3bd21;
  --yellow2: #ffd84d;
  --green: #243b2f;
  --red: #de4b3e;
  --blue: #43a0d8;
  --line: #394650;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #080b0e; color: var(--ink); }
body {
  font-family: "Courier New", ui-monospace, monospace;
  display: flex;
  justify-content: center;
  padding: 12px;
  background:
    radial-gradient(circle at 50% 0%, #1b2630 0%, #0b1015 45%, #07090c 100%);
}

button, kbd { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.game-shell {
  width: min(1100px, 100%);
  border: 4px solid #303a43;
  background: var(--dark);
  box-shadow: 0 0 0 3px #06080a, 0 18px 50px rgba(0,0,0,.55);
}

.game-header, .game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  background: linear-gradient(#1a232b, #11171d);
  border-bottom: 3px solid #06080a;
}

.game-footer {
  border-top: 3px solid #06080a;
  border-bottom: 0;
  font-size: 11px;
  color: #9cabb5;
  letter-spacing: .08em;
}

.brand-block { display: flex; align-items: center; gap: 10px; }
.pixel-bus {
  color: var(--yellow);
  font-size: 28px;
  text-shadow: 3px 3px 0 #6c4a00;
}
.brand-block h1 { margin: 0; font-size: clamp(18px, 3vw, 28px); letter-spacing: .08em; color: var(--yellow2); }
.brand-block p { margin: 1px 0 0; font-size: 11px; color: #aebbc4; letter-spacing: .08em; }
.aapt-badge {
  border: 2px solid #6d7881;
  padding: 5px 8px;
  font-weight: 700;
  color: #cdd4d9;
  font-size: 12px;
}

.screen-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #1f472d;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #2b5b37;
}

.screen-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,.018) 0px,
    rgba(255,255,255,.018) 1px,
    rgba(0,0,0,.035) 2px,
    rgba(0,0,0,.035) 3px
  );
  mix-blend-mode: overlay;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 9, 12, .84);
}
.overlay.show { display: flex; }

.panel {
  width: min(680px, 94%);
  padding: clamp(16px, 3vw, 26px);
  background: #11181f;
  border: 3px solid #65717a;
  box-shadow: 7px 7px 0 #050708;
  text-align: center;
}
.panel h2 { margin: 8px 0 10px; color: var(--yellow2); letter-spacing: .12em; font-size: clamp(22px, 4vw, 36px); }
.mission { max-width: 600px; margin: 0 auto 16px; line-height: 1.45; color: #d7dee2; }
.route-sign {
  display: inline-block;
  background: var(--yellow);
  color: #17130a;
  padding: 6px 10px;
  border: 3px solid #0e0d09;
  box-shadow: inset 0 0 0 2px #ffe47d;
  font-size: 15px;
  letter-spacing: .08em;
}
.route-sign strong { font-size: 1.5em; }
.route-sign.small { font-size: 12px; }

.briefing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 16px 0;
}
.briefing-grid div {
  background: #0b1015;
  border: 1px solid #37444d;
  padding: 10px 6px;
}
.briefing-grid span { display: block; color: #87959f; font-size: 10px; margin-bottom: 4px; }
.briefing-grid strong { color: #f6f2d2; font-size: 12px; }

.controls-copy { font-size: 11px; line-height: 1.5; color: #b7c2c9; margin: 14px 0; }
kbd { color: #0a0d0f; background: #e6e2d0; padding: 1px 5px; border-bottom: 2px solid #8c8b82; }

.arcade-btn {
  border: 0;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: .08em;
  box-shadow: 4px 4px 0 #090b0c;
}
.arcade-btn.primary { background: var(--yellow); color: #111; border: 2px solid #ffe98a; }
.arcade-btn:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 #090b0c; }
.fine-print { color: #78858e; font-size: 10px; margin: 12px 0 0; }

.report-card {
  margin: 14px auto 18px;
  text-align: left;
  max-width: 470px;
  background: #0a0f13;
  border: 2px solid #3f4e59;
  padding: 12px 14px;
  line-height: 1.55;
  font-size: 13px;
}
.report-row { display:flex; justify-content:space-between; gap:12px; border-bottom:1px dashed #2d3942; padding:3px 0; }
.report-row:last-child { border:0; }
.report-score { color: var(--yellow2); font-size: 19px; font-weight: 900; }

.mobile-controls {
  display: none;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: #0d1318;
  border-top: 3px solid #06080a;
  user-select: none;
}
.pad { display:grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pad button, .load-btn {
  min-height: 62px;
  border: 2px solid #596670;
  background: #202a32;
  color: #f4f2e4;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 3px 3px 0 #050708;
}
.pad button.active, .pad button:active { background: #36434d; transform: translate(1px,1px); }
.load-btn {
  min-width: 86px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  line-height: 1.05;
}
.load-btn span { font-size: 17px; }

@media (hover: none), (pointer: coarse), (max-width: 760px) {
  body { padding: 0; }
  .game-shell { border-width: 0; width: 100%; min-height: 100vh; }
  .game-header { padding: 7px 9px; }
  .game-header .brand-block p { display:none; }
  .aapt-badge { font-size: 10px; }
  .mobile-controls { display: grid; }
  .game-footer { display: none; }
  .panel { width: 96%; padding: 14px; }
  .briefing-grid { grid-template-columns: repeat(2, 1fr); }
  .controls-copy p:first-child { display:none; }
}

@media (max-width: 460px) {
  .screen-wrap { aspect-ratio: 16 / 11; }
  .pad button, .load-btn { min-height: 56px; }
  .mobile-controls { gap: 7px; padding: 8px; }
  .load-btn { min-width: 76px; }
}
