:root {
  --bg-top: #0b2840;
  --bg-bottom: #031120;
  --frame: #74c5f2;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

@font-face {
  font-family: "PressStart2P";
  src: url("assets/fonts/PressStart2P.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  position: fixed;
  inset: 0;
  background: #000000;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.game-shell {
  width: 100vw;
  height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: auto;
  aspect-ratio: 9 / 16;
  max-width: 100vw;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  touch-action: none;
  pointer-events: auto;
  background: #041426;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.petition-modal {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: hidden;
  background: rgba(2, 10, 18, 0.78);
  z-index: 80;
}

.petition-modal.active {
  display: flex;
}

.petition-card {
  width: min(92%, 560px);
  max-width: calc(100% - 6px);
  max-height: calc(100% - 8px);
  overflow-y: auto;
  padding: 22px;
  border: 2px solid #7fd9ff;
  border-radius: 12px;
  background: rgba(4, 22, 36, 0.96);
  box-shadow:
    0 20px 45px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(195, 240, 255, 0.2);
  color: #dcf7ff;
  font-family: "PressStart2P", monospace;
}

.petition-title {
  margin: 0 0 14px;
  text-align: center;
  font-size: 22px;
  line-height: 1.25;
}

.petition-copy {
  margin: 0 0 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

.petition-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 11px;
  color: #bdefff;
}

.petition-input {
  width: 100%;
  border: 2px solid #5bb8e0;
  border-radius: 8px;
  background: #031521;
  color: #e7fcff;
  padding: 11px 10px;
  font-size: 16px;
  line-height: 1.3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.petition-input:focus {
  outline: 2px solid #98e4ff;
  outline-offset: 1px;
}

.petition-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.petition-btn {
  border: 2px solid #5bb8e0;
  border-radius: 8px;
  padding: 10px 8px;
  background: #08314e;
  color: #ebfdff;
  font-family: "PressStart2P", monospace;
  font-size: 12px;
  cursor: pointer;
}

.petition-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.petition-btn-primary {
  background: #0d466a;
  border-color: #87dbff;
}

.petition-status {
  min-height: 1.6em;
  margin: 14px 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.45;
  color: #b7f0c4;
}

.petition-status.error {
  color: #ffc1c1;
}

@media (pointer: fine) {
  .game-shell {
    align-items: center;
  }

  #game-canvas {
    width: min(100vw, calc(100dvh * 0.5625));
    height: min(100dvh, calc(100vw * 1.7777777778));
  }
}
