/* ======================================================================
   WINGMAN — range spotter. Camera fills the app; every letter, line and
   shape is terminal green or inkegg pink with a dark-grey rim, so it reads
   on white paper and on black rings alike. See dist/views/wingman.ejs
   ====================================================================== */

:root {
  --wm-pink: var(--color-cyberpunk-pink, #e622c5);
  --wm-green: var(--color-terminal-green, #33ff33);
  --wm-border: #2b2b2b;
  --wm-font: "Arial Black", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* The screens set display:flex, which would beat the hidden attribute. */
.wm-shell [hidden] { display: none !important; }

body:has(.wm-shell) {
  overflow: hidden;
  overscroll-behavior: none;
}

.wm-shell {
  position: fixed;
  top: var(--nav-height, 53px);
  left: 0;
  right: 0;
  bottom: var(--footer-inset, 44px); /* above the site footer */
  z-index: 1;
  overflow: hidden;
  background: #000;
  font-family: var(--wm-font);
  font-weight: 900;
  color: var(--wm-pink);
}

/* Green or pink letters with a dark-grey rim. paint-order keeps the stroke
   behind the fill so the colour stays full-weight. */
.wm-shell .wm-btn,
.wm-keypad-head,
.wm-digit,
.wm-key,
.wm-result-msg {
  color: var(--wm-green);
  -webkit-text-stroke: 0.14em var(--wm-border);
  paint-order: stroke fill;
}

.wm-shell .wm-save,
.wm-digit {
  color: var(--wm-pink);
}

/* ── Title card ── */
.wm-title {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center; /* tall content scrolls instead of losing its top */
  gap: 18px;
  padding: 24px 16px;
  text-align: center;
}

.wm-title-art {
  margin: 0;
  line-height: 0;
}

.wm-title-art img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 720px);
  max-height: 48vh;
  object-fit: contain;
  border: 3px solid var(--wm-border);
  border-radius: 6px;
}

.wm-title-sub,
.wm-title-tips {
  max-width: 34em;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.4;
  color: #fff;
}

.wm-title-tips {
  font-size: 15px;
  color: #bbb;
}

.wm-check {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  max-width: 30em;
}

/* reset.css strips appearance from inputs; bring the checkbox back, big. */
.wm-check input {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 28px;
  height: 28px;
  accent-color: var(--wm-pink);
  margin: 0;
}

.wm-error {
  max-width: 30em;
  margin: 0;
  padding: 10px 14px;
  border: 3px solid var(--wm-pink);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: #200;
}

/* ── Buttons ── */
.wm-btn {
  font-family: var(--wm-font);
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 0.04em;
  padding: 12px 22px;
  background: rgba(0, 0, 0, 0.55);
  border: 5px solid currentColor;
  outline: 3px solid var(--wm-border);
  outline-offset: 0;
  box-shadow: inset 0 0 0 3px var(--wm-border);
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
}

.wm-btn:active { transform: scale(0.97); }
.wm-btn:focus-visible { outline-width: 5px; }

.wm-btn--big {
  font-size: clamp(26px, 6vw, 36px);
  padding: 18px 30px;
}

/* ── Live view ── */
.wm-live {
  position: absolute;
  inset: 0;
}

.wm-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none; /* drag-to-mark the target, not scroll */
}

.wm-save {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
}

/* ── Keypad + result: cover the whole app ── */
.wm-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vh;
  padding: 16px;
}

.wm-keypad-head {
  font-size: clamp(22px, 6vw, 40px);
  letter-spacing: 0.05em;
  text-align: center;
}

.wm-digits {
  display: flex;
  gap: 18px;
}

.wm-digit {
  display: inline-block;
  min-width: 1.1em;
  text-align: center;
  font-size: clamp(56px, 14vh, 120px);
  line-height: 1;
  border-bottom: 6px solid var(--wm-pink);
  box-shadow: 0 3px 0 var(--wm-border);
}

.wm-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: min(100%, 520px, 60vh);
  flex: 0 1 auto;
}

.wm-key {
  aspect-ratio: 1.35;
  min-height: 0;
  font-family: var(--wm-font);
  font-weight: 900;
  font-size: clamp(36px, 7vh, 64px);
  background: #111;
  border: 5px solid var(--wm-green);
  box-shadow: inset 0 0 0 3px var(--wm-border), 0 0 0 3px var(--wm-border);
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

.wm-key:active { background: #333; }

.wm-key--fn {
  font-size: clamp(18px, 3.4vh, 28px);
}

.wm-keypad-hint {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #bbb;
}

/* ── Result ── */
.wm-result-img {
  max-width: 100%;
  max-height: 62%;
  min-height: 0;
  object-fit: contain;
  border: 4px solid var(--wm-green);
  outline: 3px solid var(--wm-border);
}

.wm-result-msg {
  margin: 0;
  font-size: clamp(18px, 4vw, 26px);
  text-align: center;
}

.wm-result-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

/* Short landscape phones: keypad goes wide so all twelve keys fit. */
@media (max-height: 520px) and (orientation: landscape) {
  #wmKeypad {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "head keys" "digits keys" "hint keys";
    align-content: center;
    justify-items: center;
    gap: 10px 28px;
  }
  .wm-keypad-head { grid-area: head; font-size: 24px; align-self: end; }
  .wm-digits { grid-area: digits; }
  .wm-digit { font-size: 72px; }
  .wm-keypad-hint { grid-area: hint; align-self: start; }
  .wm-keys { grid-area: keys; width: min(52vw, 400px); gap: 8px; }
  .wm-key { aspect-ratio: 2.1; font-size: 30px; }
  .wm-key--fn { font-size: 16px; }
}
