Back to Poly Dogfight
SOURCE / PINNED RELEASE

Made of little things.

Poly Dogfight

Release
b8511ee374e3…
Author-recorded commit
5579434b9d8b…
License
LICENSE
Author’s source reference
nostr://npub1ye5ptcxfyyxl5vjvdjar2ua3f0hynkjzpx552mu5snj3qmx5pzjscpknpr/wss%3A%2F%2Fgit.napplet.soy%2F/n-44f63e5422b

Archive hash verified: bcadd2430d8ea2bc…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

src/styles.css
/*
  Poly Dogfight — "toy-box planet". App-owned palette (host theme is not applied):
  warm cream instrument chips on translucent ink over a bright flat-shaded world.
*/

:root {
  --ink: rgba(24, 32, 48, 0.62);
  --ink-solid: #182030;
  --cream: #fff6e2;
  --cream-dim: rgba(255, 246, 226, 0.72);
  --accent: #ffb43c;
  --sky: #6fc3ff;
  --boost: #ff8a3c;
  --danger: #ff5a4a;
  --radius: 14px;
  --gap: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: dark;
  font: 600 15px/1.3 ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  background: #9fd2f0;
  color: var(--cream);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- Pilot views (split screen) ---------- */

.views {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.view {
  position: absolute;
  container-type: size;
  overflow: hidden;
  --pilot: var(--cream);
}

.views.split .view {
  box-shadow: inset 0 0 0 1.5px rgba(24, 32, 48, 0.7);
}

.chip-pilot {
  min-width: 0;
  border-color: var(--pilot);
  box-shadow: inset 4px 0 0 var(--pilot);
}

.chip-pilot .chip-value {
  color: var(--pilot);
}

/* Other pilots: a tag under planes in view, an arrow on the edge for those out of view. */
.indicators {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  will-change: transform;
}

.indicator-label {
  position: absolute;
  /* Sits inward from the arrow; main.ts sets the offset from the arrow's angle. */
  transform: translate(-50%, -50%) translate(var(--lx, 0px), var(--ly, 0px));
  padding: 2px 8px 3px;
  border: 2px solid var(--pilot);
  border-radius: 999px;
  background: rgba(24, 32, 48, 0.78);
  color: var(--pilot);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.indicator-label small {
  color: var(--cream-dim);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.indicator-arrow {
  position: absolute;
  width: 14px;
  height: 16px;
  margin: -8px 0 0 -7px;
  background: var(--pilot);
  clip-path: polygon(100% 50%, 0 0, 22% 50%, 0 100%);
  filter: drop-shadow(0 0 1.5px rgba(24, 32, 48, 0.9));
  transform: rotate(var(--angle, 0rad));
}

/* In view: the tag hangs just under the plane, no arrow. */
.indicator.onscreen .indicator-arrow {
  display: none;
}

.indicator.onscreen .indicator-label {
  opacity: 0.9;
}

.spare {
  position: absolute;
  display: grid;
  place-items: end center;
  padding: 12px;
  pointer-events: none;
  text-align: center;
  box-shadow: inset 0 0 0 1.5px rgba(24, 32, 48, 0.7);
}

.spare p {
  margin: 0;
  max-width: 260px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--cream-dim);
  font-size: 13px;
}

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  top: calc(var(--gap) + var(--safe-top));
  left: calc(var(--gap) + var(--safe-left));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.gauges {
  display: flex;
  gap: 6px;
}

.chip,
.meter {
  background: var(--ink);
  border: 1.5px solid rgba(255, 246, 226, 0.22);
  border-radius: var(--radius);
  padding: 5px 10px 6px;
  backdrop-filter: blur(4px);
}

.chip {
  display: flex;
  flex-direction: column;
  min-width: 82px;
}

.chip-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cream-dim);
}

.chip-value {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.chip-value small {
  font-size: 11px;
  margin-left: 3px;
  color: var(--cream-dim);
}

.meters {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 170px;
}

.meter {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  padding: 5px 10px;
}

.meter-track {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 246, 226, 0.18);
  overflow: hidden;
}

.meter-fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  border-radius: inherit;
  transform: scaleX(0);
}

.meter-throttle {
  background: var(--sky);
}

.meter-boost {
  background: var(--boost);
}

.meter-boost.locked {
  background: repeating-linear-gradient(45deg, var(--boost) 0 4px, transparent 4px 8px);
}

.stall {
  align-self: flex-start;
  margin-top: 4px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--danger);
  color: #fff;
  font-size: 18px;
  letter-spacing: 0.08em;
  box-shadow: 0 0 0 3px rgba(255, 90, 74, 0.35);
  animation: blink 0.5s steps(2, start) infinite;
}

.stall small {
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-left: 4px;
  opacity: 0.9;
}

.stall-icon {
  font-size: 13px;
}

@keyframes blink {
  to {
    opacity: 0.55;
  }
}

/* ---------- Crash ---------- */

.crash {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  text-shadow: 0 2px 0 rgba(24, 32, 48, 0.5);
}

.crash-title {
  margin: 0;
  font-size: clamp(22px, 8cqw, 54px);
  font-weight: 800;
  color: var(--cream);
}

.crash-sub {
  margin: 4px 0 0;
  font-size: clamp(12px, 3.5cqw, 20px);
  background: var(--ink);
  padding: 4px 14px;
  border-radius: 99px;
}

/* ---------- Corner buttons ---------- */

.corner {
  position: absolute;
  top: calc(var(--gap) + var(--safe-top));
  right: calc(var(--gap) + var(--safe-right));
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 246, 226, 0.25);
  background: var(--ink);
  color: var(--cream);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.icon-btn:focus-visible,
.fly-btn:focus-visible,
.toggle input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* In split screen the frame centre always sits on a seam between views. */
.app.split .corner {
  top: 50%;
  right: auto;
  left: 50%;
  transform: translate(-50%, calc(-100% - 6px));
}

/* ---------- Menu ---------- */

.menu {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(24, 32, 48, 0.28);
  overflow: auto;
}

.card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: min(380px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(24, 32, 48, 0.82);
  border: 2px solid rgba(255, 246, 226, 0.2);
  box-shadow: 0 10px 0 rgba(24, 32, 48, 0.25);
  text-align: center;
}

.card-brief,
.card-setup {
  min-width: 0;
}

.card-setup {
  padding-top: 12px;
  border-top: 2px solid rgba(255, 246, 226, 0.12);
}

.card-options {
  margin: 0 0 14px;
  padding: 4px 10px 6px;
  border-radius: 16px;
  background: rgba(255, 246, 226, 0.06);
}

.card-options .hint {
  margin: 0;
}

.card-options .toggles {
  flex-wrap: wrap;
  gap: 0 16px;
  margin-top: 2px;
}

/* Wide frames: the controls reference on the left; the brief, options and Fly on the right. */
@media (min-width: 640px) and (min-height: 241px) {
  .card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: 'setup brief';
    gap: 0 24px;
    width: min(880px, 100%);
    padding: 22px 24px;
    text-align: left;
  }
  .card-brief {
    grid-area: brief;
    align-self: center;
    text-align: center;
  }
  .card-setup {
    grid-area: setup;
    padding: 0 24px 0 0;
    border-top: 0;
    border-right: 2px solid rgba(255, 246, 226, 0.12);
    /* Menu and card padding; only this column scrolls so Fly stays in view. */
    max-height: calc(100dvh - 80px);
    overflow: auto;
    overscroll-behavior: contain;
  }
  .card .card-title {
    font-size: 30px;
  }
}

@media (min-width: 640px) and (min-height: 241px) and (max-height: 420px) {
  .card {
    padding: 14px 18px;
  }
  .card-setup {
    max-height: calc(100dvh - 64px);
  }
  .card .card-title {
    font-size: 22px;
  }
  .card-goal,
  .card-options .hint {
    display: none;
  }
}

.card-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}

.card-sub {
  margin: 6px 0 14px;
  font-weight: 500;
  color: var(--cream-dim);
}

.fly-btn {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--ink-solid);
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 #c27a14;
}

.fly-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #c27a14;
}

.hint {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--cream-dim);
}

.toggles {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  cursor: pointer;
}

.toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.pilots {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--sky);
}

.save-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--cream-dim);
}

.controls {
  text-align: left;
  font-size: 13px;
}

.controls-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.controls-device {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(111, 195, 255, 0.16);
  color: var(--sky);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.controls dl[hidden] {
  display: none;
}

.controls dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 6px 0 0;
}

.controls dt {
  color: var(--cream-dim);
}

.controls dd {
  margin: 0;
  font-weight: 500;
}

/* ---------- Touch controls ---------- */

.touch {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 calc(14px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(14px + var(--safe-left));
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.touch.on {
  display: flex;
}

.stick {
  pointer-events: auto;
  touch-action: none;
  width: clamp(110px, 30vmin, 160px);
  height: clamp(110px, 30vmin, 160px);
  border-radius: 50%;
  background: rgba(24, 32, 48, 0.35);
  border: 2px solid rgba(255, 246, 226, 0.35);
  display: grid;
  place-items: center;
}

.stick-knob {
  width: 42%;
  height: 42%;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 3px 0 rgba(24, 32, 48, 0.35);
  pointer-events: none;
}

.touch-right {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.touch-buttons {
  display: grid;
  grid-template-columns: 52px 52px;
  gap: 10px;
}

.tbtn {
  pointer-events: auto;
  touch-action: none;
  min-width: 52px;
  min-height: 52px;
  border-radius: 16px;
  border: 2px solid rgba(255, 246, 226, 0.35);
  background: rgba(24, 32, 48, 0.45);
  color: var(--cream);
  font: inherit;
  font-size: 16px;
}

.tbtn-boost {
  grid-column: span 2;
  min-height: 60px;
  background: var(--boost);
  color: var(--ink-solid);
  font-weight: 800;
}

.tbtn-fire {
  background: var(--danger);
  color: #fff;
  font-weight: 800;
}

.tbtn-rocket {
  padding: 0;
  background: var(--accent);
  color: var(--ink-solid);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.throttle {
  pointer-events: auto;
  touch-action: none;
  position: relative;
  width: 52px;
  height: clamp(110px, 30vmin, 170px);
  border-radius: 16px;
  background: rgba(24, 32, 48, 0.45);
  border: 2px solid rgba(255, 246, 226, 0.35);
}

.throttle-knob {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 22px;
  border-radius: 10px;
  background: var(--sky);
  pointer-events: none;
}

/* ---------- Error ---------- */

.error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--ink-solid);
  text-align: center;
}

/* ---------- Small frames ---------- */

@media (max-width: 420px), (max-height: 420px) {
  :root {
    font-size: 13px;
  }
}

/* Each pilot view sizes its own HUD, so split screen compacts per view. */
@container (max-width: 420px) or (max-height: 420px) {
  .chip {
    min-width: 66px;
    padding: 4px 8px;
  }
  .chip-value {
    font-size: 17px;
  }
  .meters {
    width: 140px;
  }
}

@container (max-width: 300px) or (max-height: 240px) {
  .meters,
  .chip-value small {
    display: none;
  }
  .hud {
    top: 4px;
    left: 4px;
  }
  .chip {
    min-width: 0;
    padding: 2px 6px;
  }
  .chip-label {
    font-size: 8px;
  }
  .chip-value {
    font-size: 14px;
  }
  .stall {
    font-size: 12px;
    padding: 3px 8px;
  }
  .stall small {
    display: none;
  }
}

@media (max-width: 300px), (max-height: 240px) {
  .corner #cameraButton {
    display: none;
  }
  .corner {
    top: 4px;
    right: 4px;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
  }
  .card {
    padding: 10px 12px;
  }
  .card-title {
    font-size: 16px;
  }
  .card-sub,
  .controls,
  .pilots,
  .hint {
    display: none;
  }
  .fly-btn {
    min-height: 40px;
    font-size: 16px;
  }
  .toggles {
    display: none;
  }
  .card-setup {
    display: none;
  }
  .card-options {
    margin-bottom: 8px;
    padding: 0 6px;
  }
}

/* Touch controls in short landscape frames: keep them compact. */
@media (max-height: 420px) {
  .stick {
    width: 104px;
    height: 104px;
  }
  .throttle {
    height: 104px;
  }
  .tbtn-boost {
    min-height: 48px;
  }
  .touch-buttons {
    grid-template-columns: 46px 46px;
    gap: 6px;
  }
  .tbtn {
    min-width: 46px;
    min-height: 46px;
  }
}

/* Very small touch frames: hide rudder buttons, keep stick, slider and boost. */
@media (max-width: 300px), (max-height: 240px) {
  #yawLeft,
  #yawRight {
    display: none;
  }
  .stick,
  .throttle {
    width: 76px;
    height: 76px;
  }
  .throttle {
    width: 44px;
  }
  .touch-buttons {
    grid-template-columns: 1fr;
  }
  .tbtn-boost {
    grid-column: auto;
    min-height: 40px;
    font-size: 12px;
  }
  .tbtn {
    font-size: 12px;
  }
  .touch-buttons {
    gap: 4px;
  }
  .touch {
    padding: 0 6px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stall {
    animation: none;
  }
}

.scene:focus {
  outline: none;
}

/* Beginner helpers retain the toy-box game's own palette. */
.flight-modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 16px; }
.flight-modes .toggle { min-height: 44px; }
.beginner-label { color: var(--cream); font-size: 12px; font-weight: 700; }
.beginner-offer {
  position: absolute; inset: auto 8px 8px; z-index: 8;
  max-height: calc(100% - 16px); overflow: auto;
  pointer-events: auto; padding: 12px; border-radius: 12px;
  background: #fff4dc; color: #293547; box-shadow: 0 4px 18px #0004;
  font-size: 13px;
}
.beginner-offer p { margin: 0 0 8px; }
.beginner-offer button { min-height: 44px; padding: 8px; margin: 2px; border: 1px solid #293547; border-radius: 8px; background: #fff; color: #293547; cursor: pointer; }
.beginner-offer button:focus-visible { outline: 3px solid #267cb6; }
@media (max-height: 240px) { .beginner-offer { padding: 6px; font-size: 11px; } }

.touch.beginner #yawLeft, .touch.beginner #yawRight, .touch.beginner #throttleSlider { display: none; }

/* Rockets: reload pips, seeker lock box, incoming warning and arrows. */
.rocket-pips { display: flex; gap: 6px; }
.rocket-pip { position: relative; flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 246, 226, 0.18); overflow: hidden; }
.rocket-fill { position: absolute; inset: 0; background: var(--accent); transform-origin: left center; transform: scaleX(0); border-radius: inherit; }
.rocket-fill.loading { opacity: 0.5; }
.rocket-pips.cooling .rocket-fill:not(.loading) { opacity: 0.55; }
.incoming {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--ink-solid);
  border: 2px solid var(--danger);
  color: var(--danger);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  animation: blink 0.35s steps(2, start) infinite;
}
.incoming small { font-size: 11px; letter-spacing: 0.04em; margin-left: 4px; color: var(--cream); }
.lock-box {
  position: absolute;
  width: 40px;
  height: 40px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 2px #182030);
}
/* Corner brackets: a box border with the middle of each side knocked out. */
.lock-box::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 4px;
  clip-path: polygon(0 0, 35% 0, 35% 3px, 65% 3px, 65% 0, 100% 0, 100% 35%, calc(100% - 3px) 35%, calc(100% - 3px) 65%, 100% 65%, 100% 100%, 65% 100%, 65% calc(100% - 3px), 35% calc(100% - 3px), 35% 100%, 0 100%, 0 65%, 3px 65%, 3px 35%, 0 35%);
}
.lock-box span {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -2px);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.lock-box.waiting { opacity: 0.45; }
.lock-box.waiting span { display: none; }
.indicator.rocket .indicator-label { border-radius: 4px; }
@container (max-width: 300px) or (max-height: 240px) {
  .incoming { font-size: 12px; padding: 3px 8px; }
  .incoming small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .incoming { animation: none; }
}

/* Gun feedback: cream sight, mint assisted ring, X for damage / circle for armor. */
.reticle, .aim-point {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 2px #182030);
}
.reticle { left: 50%; top: 50%; width: 22px; height: 22px; border: 1px solid #fff1d2; border-radius: 50%; opacity: .85; }
.reticle-dot { position: absolute; left: 9px; top: 9px; width: 2px; height: 2px; background: #fff1d2; }
.reticle.assisted { border: 2px solid #a9f5ce; opacity: 1; }
.aim-point { width: 10px; height: 10px; border: 2px solid #a9f5ce; border-radius: 2px; }
/* Outside views: where the plane is heading. Wing stubs tell it apart from the
   round gun sight; it turns amber when the path meets ground or an obstacle. */
.flight-path {
  position: absolute;
  pointer-events: none;
  width: 10px;
  height: 10px;
  border: 2px solid #fff1d2;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 2px #182030);
  opacity: .8;
}
.flight-path::before, .flight-path::after { content: ''; position: absolute; top: 2px; width: 8px; height: 2px; background: currentColor; }
.flight-path { color: #fff1d2; }
.flight-path::before { right: 100%; margin-right: 2px; }
.flight-path::after { left: 100%; margin-left: 2px; }
.flight-path.impact { border-color: #ffb547; color: #ffb547; opacity: 1; }
.hit-marker { position: absolute; inset: -10px; }
.hit-marker::before, .hit-marker::after { content: ''; position: absolute; left: 50%; top: 0; height: 100%; width: 2px; background: #fff1d2; transform: rotate(45deg); }
.hit-marker::after { transform: rotate(-45deg); }
.hit-marker.armored { border: 1px dashed #fff1d2; border-radius: 50%; opacity: .65; }
.hit-marker.armored::before, .hit-marker.armored::after { display: none; }

/* Debug overlay (backquote). */
.perf {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 50;
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.6);
  color: #b6f5a8;
  font: 11px/1.35 ui-monospace, monospace;
  pointer-events: none;
}