* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

:root {
  --bg-deep: #060813;
  --panel-bg: rgba(12, 16, 36, 0.92);
  --cyan: #4ceeff;
  --amber: #ffc630;
  --magenta: #ee349c;
  --crimson: #ff5468;
  --text-main: #e6f2ff;
  --text-dim: #8aa4cc;
}

html, body {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 25%, #121a3a 0%, #050711 75%);
  color: var(--text-main);
  font-family: 'Courier New', Consolas, monospace;
  overflow: hidden;
}

#app-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: rgba(8, 11, 24, 0.92);
  border-bottom: 1px solid rgba(76, 238, 255, 0.22);
  z-index: 10;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--cyan);
}

.brand-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.top-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-pill {
  background: #121936;
  color: var(--text-dim);
  border: 1px solid #2e4070;
  padding: 5px 11px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.hud-pill:hover {
  border-color: var(--cyan);
  color: #fff;
}

.hud-pill.active-pill {
  border-color: rgba(76, 238, 255, 0.65);
  color: var(--cyan);
  background: rgba(24, 62, 108, 0.38);
}

.hud-pill.accent-pill {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(98, 56, 12, 0.35);
}

.hud-pill.accent-pill:hover {
  background: rgba(184, 102, 18, 0.55);
  color: #fff;
}

.hud-pill.quake-pill {
  border-color: #d88a2c;
  color: #ffd084;
  background: rgba(68, 38, 10, 0.52);
}

.hud-pill.quake-pill:hover,
.hud-pill.quake-pill.active-pill {
  border-color: #ffbe4f;
  color: #fff8dc;
  background: rgba(132, 72, 14, 0.72);
  box-shadow: 0 0 10px rgba(255, 174, 48, 0.35);
}

#cabinet-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
}

#screen-bezel {
  position: relative;
  width: min(94vw, calc((100vh - 76px) * (16 / 9)));
  aspect-ratio: 16 / 9;
  background: #050712;
  border: 3px solid #26355e;
  border-radius: 8px;
  box-shadow:
    0 0 0 4px #0c1022,
    0 18px 55px rgba(0, 0, 0, 0.85),
    0 0 38px rgba(36, 148, 224, 0.18);
  overflow: hidden;
}

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

/* Authentic Subtle CRT Scanline + Vignette Overlay */
#crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      rgba(18, 16, 16, 0) 50%,
      rgba(0, 0, 0, 0.24) 50%
    ),
    radial-gradient(circle at center, transparent 66%, rgba(0, 0, 0, 0.48) 100%);
  background-size: 100% 3px, 100% 100%;
  z-index: 3;
}

.screen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 3.6%;
  background: linear-gradient(
    90deg,
    rgba(4, 5, 10, 0.0) 0%,
    rgba(4, 5, 10, 0.02) 48%,
    rgba(5, 6, 12, 0.56) 58%,
    rgba(5, 6, 12, 0.74) 100%
  );
  z-index: 5;
}

#pause-overlay,
#gameover-overlay {
  justify-content: center;
  padding-right: 0;
  background: rgba(5, 6, 13, 0.84);
}

.hidden {
  display: none !important;
}

.title-card,
.modal-card {
  background: linear-gradient(180deg, rgba(12, 13, 22, 0.88) 0%, rgba(7, 8, 15, 0.92) 100%);
  border: 1.5px solid rgba(206, 190, 164, 0.68);
  border-radius: 6px;
  padding: 8px 13px;
  max-width: 448px;
  max-height: 82%;
  overflow-y: auto;
  width: 44.5%;
  text-align: center;
  box-shadow:
    inset 0 0 0 2px rgba(72, 82, 104, 0.42),
    0 12px 34px rgba(0, 0, 0, 0.88),
    0 0 22px rgba(230, 50, 110, 0.14);
}

.modal-card {
  width: 92%;
  max-width: 440px;
  max-height: 92%;
  padding: 12px 16px;
}

.kicker {
  font-size: 9.5px;
  letter-spacing: 1.8px;
  color: #dcd0bc;
  margin-bottom: 1px;
  font-weight: 700;
}

.danger-text {
  color: var(--crimson);
}

.giger-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1px 0 2px;
}

.giger-title-logo {
  width: min(76%, 248px);
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.92)) drop-shadow(0 0 10px rgba(238, 52, 128, 0.28));
}

.gameover-giger-banner {
  width: 100%;
  height: 92px;
  overflow: hidden;
  border: 1px solid rgba(206, 190, 164, 0.58);
  border-radius: 4px;
  margin-bottom: 9px;
  background: #05060d;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.85);
}

.gameover-giger-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 42%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.arcade-logo {
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #7ad8ff 48%, #2868d8 52%, #ffc630 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #141c3c);
  margin-bottom: 2px;
}

.subtitle-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.8px;
  color: #ff6e9c;
  margin-bottom: 6px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 7px;
  text-align: left;
  font-size: 9.8px;
  color: #d6deee;
  background: rgba(8, 9, 18, 0.80);
  border: 1px solid rgba(142, 128, 108, 0.38);
  padding: 5px 8px;
  border-radius: 4px;
  margin-bottom: 7px;
}

.difficulty-panel {
  background: rgba(8, 9, 18, 0.84);
  border: 1px solid rgba(142, 128, 108, 0.42);
  border-radius: 5px;
  padding: 7px 9px;
  margin-bottom: 10px;
}

.diff-header {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: var(--cyan);
  margin-bottom: 5px;
}

.diff-hint {
  color: var(--text-dim);
  font-weight: 700;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 5px;
}

.diff-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px 3px;
  background: #0f1630;
  border: 1px solid #2c3f6e;
  border-radius: 4px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s ease;
}

.diff-btn .diff-name {
  font-size: 10px;
  font-weight: 900;
  color: #b8ceec;
  letter-spacing: 0.4px;
}

.diff-btn .diff-sub {
  font-size: 8.5px;
  font-weight: 700;
  color: #6f88b4;
  margin-top: 1px;
}

.diff-btn:hover {
  border-color: #6ea8ea;
  background: #162248;
}

.diff-btn[data-diff="0"].selected {
  border-color: #58ffd0;
  background: rgba(20, 86, 72, 0.42);
  box-shadow: 0 0 10px rgba(88, 255, 208, 0.25);
}
.diff-btn[data-diff="0"].selected .diff-name { color: #58ffd0; }

.diff-btn[data-diff="1"].selected {
  border-color: #4ceeff;
  background: rgba(20, 68, 108, 0.48);
  box-shadow: 0 0 10px rgba(76, 238, 255, 0.28);
}
.diff-btn[data-diff="1"].selected .diff-name { color: #4ceeff; }

.diff-btn[data-diff="2"].selected {
  border-color: #ffc630;
  background: rgba(96, 62, 12, 0.48);
  box-shadow: 0 0 10px rgba(255, 198, 48, 0.28);
}
.diff-btn[data-diff="2"].selected .diff-name { color: #ffc630; }

.diff-btn[data-diff="3"].selected {
  border-color: #ff5468;
  background: rgba(98, 16, 34, 0.52);
  box-shadow: 0 0 12px rgba(255, 84, 104, 0.34);
}
.diff-btn[data-diff="3"].selected .diff-name { color: #ff5468; }

.diff-btn.selected .diff-sub {
  color: #e8f4ff;
}

.diff-desc {
  font-size: 9.5px;
  color: #ffe89a;
  line-height: 1.25;
  min-height: 12px;
}

.sector-header {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--amber);
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid rgba(46, 68, 118, 0.65);
  margin-bottom: 4px;
}

.sector-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.sector-btn {
  padding: 4px 2px;
  background: #0d142c;
  border: 1px solid #2b3e6e;
  border-radius: 3px;
  color: #9eb8e2;
  font-family: inherit;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.sector-btn:hover {
  border-color: var(--cyan);
  color: #ffffff;
  background: #17244c;
}

.sector-btn.selected {
  border-color: var(--amber);
  color: #fff4a8;
  background: rgba(112, 66, 12, 0.52);
  box-shadow: 0 0 8px rgba(255, 198, 48, 0.28);
}

kbd {
  background: #1b284c;
  border: 1px solid #4868a8;
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  color: #fff294;
  font-weight: 700;
}

.cta-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.arcade-cta {
  flex: 1;
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: 1.8px;
  color: #080c1c;
  background: linear-gradient(180deg, #ffe46b 0%, #f59b18 100%);
  border: 2px solid #fff6c2;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 198, 48, 0.42);
  transition: transform 0.1s ease, filter 0.1s ease;
}

.splash-gallery-btn {
  padding: 8px 9px;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #f4e8d4;
  background: linear-gradient(180deg, #3c1830 0%, #1c0c1c 100%);
  border: 1.5px solid rgba(218, 198, 170, 0.7);
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.splash-gallery-btn:hover {
  border-color: #ff689c;
  color: #ffffff;
  background: linear-gradient(180deg, #642048 0%, #2c1028 100%);
  box-shadow: 0 0 12px rgba(255, 84, 148, 0.35);
}

.arcade-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.leaderboard-box {
  margin-top: 9px;
  text-align: left;
  border-top: 1px solid #23335c;
  padding-top: 7px;
}

.lb-title {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-align: center;
}

#highscore-list {
  list-style: none;
  font-size: 11px;
}

#highscore-list li {
  display: flex;
  justify-content: space-between;
  padding: 2px 4px;
  color: #d6e6ff;
}

#highscore-list .rk { color: var(--amber); width: 28px; }
#highscore-list .nm { flex: 1; font-weight: 700; }
#highscore-list .st { color: var(--cyan); margin-right: 12px; }
#highscore-list .sc { font-weight: 700; color: #fff294; }

.modal-card h2 {
  font-size: 24px;
  letter-spacing: 3px;
  margin-bottom: 10px;
  color: #fff;
}

.modal-card p {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.score-readout {
  font-size: 14px;
  font-weight: 800;
  color: var(--amber);
  margin-bottom: 14px;
}

.score-submit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

#pilot-name {
  flex: 1;
  background: #0a1024;
  border: 1px solid #3c5690;
  color: #fff;
  padding: 7px 10px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 4px;
}

/* Sprite Forge Inspector Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 16, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 20px;
}

.forge-window {
  width: min(1040px, 96vw);
  height: min(680px, 90vh);
  background: #0b1024;
  border: 2px solid var(--cyan);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.9);
}

.forge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: #101836;
  border-bottom: 1px solid #283c6e;
  gap: 16px;
}

.forge-header h3 {
  font-size: 15px;
  color: var(--amber);
  letter-spacing: 1.5px;
}

.forge-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.forge-sub code {
  color: var(--cyan);
}

.forge-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.forge-sidebar {
  width: 290px;
  border-right: 1px solid #243662;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.forge-item-btn {
  text-align: left;
  padding: 8px 10px;
  background: #0f1734;
  border: 1px solid #20305a;
  color: #bfd4f5;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}

.forge-item-btn:hover {
  border-color: var(--cyan);
}

.forge-item-btn.selected {
  background: #1b2f63;
  border-color: var(--amber);
  color: #fff294;
}

.forge-stage {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.panel-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  margin-bottom: 6px;
  font-weight: 700;
}

.checker-well {
  background-color: #101426;
  background-image:
    linear-gradient(45deg, #181e38 25%, transparent 25%),
    linear-gradient(-45deg, #181e38 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #181e38 75%),
    linear-gradient(-45deg, transparent 75%, #181e38 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border: 1px solid #2b3f70;
  border-radius: 6px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.checker-well canvas,
.checker-well img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.strip-scroll {
  justify-content: flex-start;
  overflow-x: auto;
  min-height: 140px;
}

.strip-scroll img {
  height: auto;
  transform: scale(2);
  transform-origin: left center;
  margin-right: 50%;
}

.forge-meta-text {
  margin-top: 6px;
  font-size: 11px;
  color: var(--amber);
}

/* Mobile Touch Controls (shown only on coarse touch screens) */
#touch-controls {
  display: none;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px;
}

@media (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
}

#touch-stick {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid rgba(76, 238, 255, 0.45);
  background: rgba(12, 20, 44, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

#touch-knob {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(76, 238, 255, 0.75);
}

.touch-actions {
  display: flex;
  gap: 10px;
}

.touch-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  border: 2px solid #fff;
}

.force-col { background: rgba(236, 142, 24, 0.75); border-color: #ffc630; }
.rapid-col { background: rgba(48, 118, 224, 0.75); border-color: #4ceeff; }
.wave-col  { background: rgba(238, 52, 156, 0.75); border-color: #ff94d8; }

/* ==========================================================================
   Quake-Style Drop-Down Developer Console
   ========================================================================== */
#quake-console {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58%;
  display: flex;
  flex-direction: column;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(20, 14, 8, 0.93) 0px,
      rgba(20, 14, 8, 0.93) 2px,
      rgba(12, 9, 6, 0.96) 2px,
      rgba(12, 9, 6, 0.96) 4px
    );
  border-bottom: 3px solid #d4882a;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.92),
    0 2px 14px rgba(232, 146, 36, 0.35),
    inset 0 -1px 0 #ffe09a;
  z-index: 22;
  transform: translateY(-106%);
  transition: transform 0.17s cubic-bezier(0.18, 0.88, 0.28, 1);
  pointer-events: none;
  font-family: 'Courier New', Consolas, monospace;
}

#quake-console.open {
  transform: translateY(0);
  pointer-events: auto;
}

.qcon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 12px;
  background: linear-gradient(90deg, #2d1b0c 0%, #1b120c 55%, #12182c 100%);
  border-bottom: 1px solid rgba(212, 136, 42, 0.45);
  font-size: 10px;
  letter-spacing: 0.8px;
}

.qcon-brand {
  color: #ffc864;
  font-weight: 900;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.qcon-hint {
  color: #b4a288;
  font-size: 9.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qcon-hint b {
  color: #58ffd0;
}

.qcon-output {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: 11.5px;
  line-height: 1.42;
  color: #dfd3be;
  user-select: text;
}

.qcon-output::-webkit-scrollbar {
  width: 7px;
}

.qcon-output::-webkit-scrollbar-track {
  background: rgba(12, 8, 4, 0.7);
}

.qcon-output::-webkit-scrollbar-thumb {
  background: #7c4f1c;
  border-radius: 3px;
}

.qline {
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 1px;
}

.qline-hdr {
  color: #ffb84a;
  font-weight: 800;
}

.qline-cmd {
  color: #ffffff;
  font-weight: 700;
}

.qline-ok {
  color: #58ffd0;
  font-weight: 700;
}

.qline-warn {
  color: #ff6472;
  font-weight: 700;
}

.qline-dim {
  color: #9e917c;
}

.qline-map {
  color: #7ee6ff;
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}

.qline-map:hover {
  background: rgba(212, 136, 42, 0.26);
  color: #fff2a6;
}

.qline-map.current-map {
  color: #ffd466;
  font-weight: 800;
}

.qcon-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(8, 6, 4, 0.92);
  border-top: 1px solid rgba(212, 136, 42, 0.42);
}

.qcon-prompt {
  color: #ffc858;
  font-weight: 900;
  font-size: 13px;
}

#qcon-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff6df;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  caret-color: #ffc858;
  user-select: text;
}

#qcon-input::placeholder {
  color: rgba(180, 160, 132, 0.45);
  font-weight: 400;
}
