:root {
  color-scheme: dark;
  font-family: "SFMono-Regular", "Roboto Mono", Menlo, Consolas, monospace;
  font-synthesis: none;
  --ink: #f8f8f2;
  --muted: #9aa3a8;
  --line: #353b40;
  --cyan: #55e7f0;
  --red: #ff4d55;
  --yellow: #ffd34e;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 280px;
  min-height: 100%;
  background: #000;
  overscroll-behavior: none;
}

body {
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: #000;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

button,
kbd {
  font: inherit;
}

a {
  color: var(--cyan);
  text-underline-offset: 0.22em;
}

a:hover {
  color: #fff;
}

a:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}

button {
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.arcade-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.45rem, 1.4vmin, 0.85rem);
  padding:
    max(0.5rem, env(safe-area-inset-top))
    max(0.5rem, env(safe-area-inset-right))
    max(0.5rem, env(safe-area-inset-bottom))
    max(0.5rem, env(safe-area-inset-left));
}

.game-frame {
  width: min(960px, 100%, calc((100dvh - 7.5rem) * 1.5));
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 1px solid #24292d;
  background: #000;
  box-shadow: 0 0 0 1px #060708, 0 0 28px rgb(85 231 240 / 8%);
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  outline: none;
}

#game:focus-visible {
  box-shadow: inset 0 0 0 3px var(--cyan);
}

.touch-controls {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "steering drive"
    "system system";
  gap: 0.55rem;
}

.control-cluster,
.system-controls {
  min-width: 0;
  display: grid;
  gap: 0.45rem;
}

.steering-controls {
  grid-area: steering;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drive-controls {
  grid-area: drive;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.system-controls {
  grid-area: system;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.control-button,
.system-button {
  min-width: 0;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #080a0b;
  box-shadow: inset 0 -3px 0 #191d20;
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.control-button {
  font-size: clamp(0.8rem, 3.1vw, 1rem);
}

.control-button.steer {
  border-color: #3d5c61;
  color: var(--cyan);
  font-size: 1.15rem;
}

.control-button.gas {
  border-color: #746832;
  color: var(--yellow);
}

.control-button.turbo {
  border-color: #78363b;
  color: #ff737a;
}

.system-button {
  min-height: 2.25rem;
  color: #b8c0c4;
  font-size: clamp(0.58rem, 2.25vw, 0.72rem);
}

.system-button.start {
  color: var(--cyan);
}

.control-button:hover,
.system-button:hover {
  border-color: #7a858b;
  color: #fff;
}

.control-button:active,
.system-button:active,
.control-button[data-active="true"],
.system-button[data-active="true"] {
  transform: translateY(2px);
  border-color: currentColor;
  box-shadow: inset 0 1px 0 #20262a;
}

.control-button:focus-visible,
.system-button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.keyboard-hint {
  max-width: 960px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.58rem, 1.35vw, 0.72rem);
  line-height: 1.6;
  letter-spacing: 0.025em;
  text-align: center;
  text-transform: uppercase;
}

.community-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem 0.7rem;
}

.playtest-label {
  margin: 0;
  color: var(--yellow);
  font-size: 0.62rem;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.community-button {
  min-height: 2.45rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #405258;
  border-radius: 0;
  background: #080d0f;
  color: var(--cyan);
  font-size: 0.68rem;
  line-height: 1.4;
  font-weight: 800;
  letter-spacing: 0.035em;
  cursor: pointer;
  touch-action: manipulation;
}

.community-button:hover,
.community-button:focus-visible {
  border-color: var(--cyan);
  color: #fff;
}

.community-button:focus-visible,
.dialog-close:focus-visible,
.prompt-dismiss:focus-visible,
.feedback-submit:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.community-button:disabled {
  color: var(--muted);
  cursor: default;
}

.community-status {
  max-width: 35rem;
  margin: 0;
  color: var(--yellow);
  font-size: 0.7rem;
  line-height: 1.6;
  text-align: center;
}

.community-status:empty {
  display: none;
}

.share-fallback {
  width: min(30rem, 100%);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.6;
}

.share-fallback input {
  width: 100%;
  min-height: 2.5rem;
  margin-top: 0.35rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #080d0f;
  color: var(--ink);
  font: inherit;
}

.post-run-prompt {
  position: relative;
  width: min(42rem, 100%);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 2.3rem 0.75rem 0.9rem;
  border-left: 2px solid var(--yellow);
  background: #10120b;
}

.post-run-prompt[hidden],
.feedback-receipt[hidden],
#feedbackForm[hidden],
.share-fallback[hidden] {
  display: none;
}

.post-run-prompt p {
  flex: 1;
  margin: 0;
  color: #c9cfbd;
  font-size: 0.7rem;
  line-height: 1.6;
}

.post-run-prompt .community-button {
  flex-shrink: 0;
}

.prompt-dismiss,
.dialog-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.65rem;
  cursor: pointer;
  touch-action: manipulation;
}

.prompt-dismiss {
  position: absolute;
  top: 0.25rem;
  right: 0.35rem;
  min-width: 1.8rem;
  min-height: 1.8rem;
}

.feedback-dialog {
  width: min(36rem, calc(100% - 1.5rem));
  max-height: 85vh;
  max-height: 85dvh;
  margin: auto;
  padding: clamp(1.05rem, 4vw, 1.8rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #507178;
  background: #080b0d;
  color: var(--ink);
  box-shadow: 0 1rem 6rem rgb(0 0 0 / 80%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.feedback-dialog::backdrop {
  background: rgb(0 0 0 / 78%);
}

.feedback-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.feedback-heading .playtest-label {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

.feedback-heading h2 {
  margin: 0.4rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  line-height: 1.1;
}

.dialog-close {
  min-width: 2.5rem;
  min-height: 2.5rem;
  margin: -0.35rem -0.4rem 0 0;
}

.feedback-intro {
  margin: 0.8rem 0 1.5rem;
  color: #aeb9bf;
  font-size: 0.88rem;
  line-height: 1.65;
}

.feedback-question {
  min-width: 0;
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

.feedback-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.feedback-question legend,
.comment-label {
  padding: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.5;
}

.comment-label {
  display: block;
  margin-bottom: 0.55rem;
}

.comment-label span {
  color: var(--muted);
  font-weight: 400;
}

.rating-caption {
  margin: 0.3rem 0 0.6rem;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.6;
}

.rating-options,
.choice-options {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.rating-options {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.choice-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rating-options label,
.choice-options label {
  position: relative;
  display: flex;
  cursor: pointer;
}

.rating-options input,
.choice-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.rating-options span,
.choice-options span {
  width: 100%;
  min-height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.3rem;
  border: 1px solid #39484f;
  background: #0c1418;
  color: #c8d3d8;
  font-size: 0.8rem;
  line-height: 1.35;
  text-align: center;
}

.rating-options span {
  font-size: 1rem;
  font-weight: 700;
}

.rating-options input:checked + span,
.choice-options input:checked + span {
  border-color: var(--cyan);
  background: #163c41;
  color: #fff;
}

.rating-options input:focus-visible + span,
.choice-options input:focus-visible + span {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}

.feedback-question textarea {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
  padding: 0.7rem;
  border: 1px solid #39484f;
  border-radius: 0;
  background: #0c1418;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
}

.feedback-question textarea:focus-visible,
.share-fallback input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

#feedbackCharacterCount {
  display: block;
  text-align: right;
}

.feedback-consent {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding-top: 1rem;
  border-top: 1px solid #2b373d;
  color: #aeb9bf;
  font-size: 0.75rem;
  line-height: 1.65;
  cursor: pointer;
}

.feedback-consent input {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.2rem 0 0;
  accent-color: var(--cyan);
}

.feedback-submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.feedback-submit {
  min-height: 2.9rem;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--cyan);
  border-radius: 0;
  background: var(--cyan);
  color: #061116;
  font-size: 0.88rem;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
}

.feedback-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.feedback-submit-row > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.feedback-status {
  margin: 0.8rem 0 0;
  color: var(--yellow);
  font-size: 0.78rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.feedback-status:empty {
  display: none;
}

.feedback-receipt {
  padding: 1rem;
  border: 1px solid #396369;
  background: #0b2024;
  margin-bottom: 1.3rem;
}

.feedback-receipt h3 {
  margin: 0;
  color: var(--cyan);
  font-size: 1.05rem;
}

.feedback-receipt p {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  line-height: 1.65;
}

.feedback-receipt .receipt-code {
  color: var(--yellow);
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.feedback-receipt .receipt-note {
  color: #94acb2;
  font-size: 0.73rem;
}

.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

kbd {
  display: inline-block;
  min-width: 1.45em;
  margin-inline: 0.08em;
  padding: 0.08em 0.28em;
  border: 1px solid #3b4246;
  background: #090b0c;
  color: #e7ecee;
  line-height: 1.25;
  text-align: center;
}

noscript {
  padding: 0.4rem;
  color: var(--red);
  font-size: 0.75rem;
  text-align: center;
  text-transform: uppercase;
}

.content-shell,
.site-footer {
  width: min(960px, calc(100% - 1rem));
  margin-inline: auto;
}

.content-shell {
  padding: clamp(2.8rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 4rem);
}

.content-intro {
  max-width: 48rem;
}

.content-intro h2,
.legal-header h1,
.legal-document h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.content-intro h2 {
  max-width: 14ch;
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  line-height: 0.98;
}

.content-intro > p {
  max-width: 52rem;
  margin: 1.35rem 0 0;
  color: #c7ced1;
  font-size: clamp(0.94rem, 2vw, 1.12rem);
  line-height: 1.75;
}

.game-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.6rem, 4vw, 3.4rem);
  margin-top: clamp(2.8rem, 6vw, 4.5rem);
  padding-top: clamp(1.4rem, 3vw, 2.2rem);
  border-top: 1px solid var(--line);
}

.game-guide article {
  min-width: 0;
}

.game-guide h3,
.legal-document h3,
.privacy-control h4 {
  margin: 0 0 0.75rem;
  color: var(--cyan);
  font-size: 0.82rem;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-guide p,
.pickup-list {
  margin: 0;
  color: #aeb7bb;
  font-size: 0.86rem;
  line-height: 1.75;
}

.pickup-list > div {
  padding-block: 0.65rem;
  border-top: 1px solid #23292c;
}

.pickup-list > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.pickup-list dt {
  color: var(--ink);
  font-weight: 800;
}

.pickup-list dd {
  margin: 0.18rem 0 0;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 1.3rem 0 max(1.3rem, env(safe-area-inset-bottom));
  border-top: 1px solid #22282b;
  color: #7f898e;
  font-size: 0.68rem;
  line-height: 1.6;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
}

.site-footer a {
  color: #b7c0c4;
}

.site-footer .copyright {
  grid-column: 1 / -1;
}

.legal-page {
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgb(85 231 240 / 4%), transparent 24rem),
    #000;
}

.legal-shell {
  width: min(780px, calc(100% - 2rem));
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(4rem, 9vw, 7rem);
}

.back-link {
  display: inline-block;
  margin-bottom: clamp(2.5rem, 7vw, 5.5rem);
  color: #aeb7bb;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-decoration: none;
  text-transform: uppercase;
}

.legal-header h1 {
  color: var(--red);
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  line-height: 0.95;
}

.legal-meta {
  margin: 1.15rem 0 0;
  color: var(--yellow);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.legal-header > p:last-child {
  max-width: 43rem;
  margin: 1.3rem 0 0;
  color: #c5cdd0;
  font-size: clamp(0.94rem, 2vw, 1.06rem);
  line-height: 1.75;
}

.current-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 2.2rem;
  padding: 1rem 0;
  border-block: 1px solid var(--line);
  color: #aeb7bb;
  font-size: 0.72rem;
  line-height: 1.5;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.current-status strong {
  width: 100%;
  color: var(--ink);
}

.current-status span::before {
  content: "✓";
  margin-right: 0.38rem;
  color: var(--cyan);
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 1.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.045em;
}

.legal-document {
  scroll-margin-top: 1rem;
  margin-top: clamp(4.5rem, 10vw, 7rem);
}

.legal-document h2 {
  padding-bottom: 1.1rem;
  border-bottom: 2px solid var(--ink);
  font-size: clamp(2rem, 6vw, 3.5rem);
  line-height: 1.05;
}

.legal-document section {
  padding: clamp(1.6rem, 4vw, 2.5rem) 0;
  border-bottom: 1px solid #252b2e;
}

.legal-document section p,
.legal-document section li {
  color: #b9c2c6;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(0.94rem, 1.9vw, 1.02rem);
  line-height: 1.75;
}

.legal-document section p {
  margin: 0.75rem 0 0;
}

.legal-document section p:first-of-type {
  margin-top: 0;
}

.legal-document ul {
  margin: 1rem 0 0;
  padding-left: 1.4rem;
}

.legal-document li + li {
  margin-top: 0.55rem;
}

.legal-document code {
  color: var(--yellow);
  font-family: inherit;
  overflow-wrap: anywhere;
}

.privacy-control {
  margin-top: 1.6rem;
  padding: 1.25rem;
  border: 1px solid #3d484d;
  background: #080a0b;
}

.privacy-control h4 {
  color: var(--ink);
}

.legal-button {
  min-height: 2.8rem;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--cyan);
  border-radius: 0;
  background: #071013;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.legal-button:hover {
  background: var(--cyan);
  color: #000;
}

.legal-button[data-confirming="true"] {
  border-color: var(--red);
  background: #170708;
  color: #ff7e84;
}

.legal-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.control-status {
  min-height: 1.5em;
  color: var(--yellow) !important;
  font-family: inherit !important;
  font-size: 0.75rem !important;
}

.legal-end-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
  margin-top: clamp(3rem, 7vw, 5rem);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.legal-footer {
  grid-template-columns: 1fr;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.qa-harness {
  width: min(960px, 100%);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.65rem;
  border: 1px solid #334047;
  background: #050708;
  color: #b9c4c9;
  font-size: 0.7rem;
}

.qa-harness label {
  display: grid;
  gap: 0.2rem;
}

.qa-harness input,
.qa-harness button {
  min-height: 2rem;
  border: 1px solid #3e4b52;
  border-radius: 0;
  background: #0a0d0f;
  color: #f8f8f2;
  font: inherit;
}

.qa-harness input {
  width: 6.5rem;
  padding-inline: 0.35rem;
}

.qa-harness button {
  align-self: end;
  padding-inline: 0.55rem;
  cursor: pointer;
}

.qa-harness output {
  width: 100%;
  max-height: 7rem;
  overflow: auto;
  padding: 0.4rem;
  border-top: 1px solid #263036;
  color: #55e7f0;
  overflow-wrap: anywhere;
}

@media (pointer: fine) and (min-width: 48rem) {
  .touch-controls {
    width: auto;
    grid-template-columns: auto;
    grid-template-areas: "system";
  }

  .steering-controls,
  .drive-controls {
    display: none;
  }

  .system-controls {
    grid-template-columns: repeat(4, minmax(6.25rem, auto));
  }

  .system-button {
    min-height: 2rem;
  }
}

@media (pointer: coarse), (max-width: 47.99rem) {
  .game-frame {
    width: min(960px, 100%);
  }

  .system-button {
    min-height: 2.75rem;
  }

  .keyboard-hint {
    display: none;
  }

  .community-controls {
    gap: 0.4rem;
  }

  .community-controls .playtest-label {
    width: 100%;
    text-align: center;
  }

  .post-run-prompt {
    flex-wrap: wrap;
  }

  .game-guide {
    grid-template-columns: 1fr;
  }

  .site-footer {
    grid-template-columns: 1fr;
  }

  .site-footer nav {
    justify-content: flex-start;
  }

  .site-footer .copyright {
    grid-column: auto;
  }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 36rem) {
  .arcade-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(12rem, 28vw);
    grid-template-rows: 1fr;
    align-items: center;
    gap: 0.65rem;
  }

  .game-frame {
    width: min(960px, 100%, calc((100dvh - 1rem) * 1.5));
    justify-self: end;
  }

  .touch-controls {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "steering drive"
      "system system";
  }

  .system-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-button,
  .system-button {
    min-height: clamp(2.2rem, 13vh, 3rem);
  }
}

@media (max-width: 21rem) {
  .system-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
