/* Lost at Sea. neal.fun register: white panel, black 1px borders, Julius display,
   Roboto-Medium body, one accent (the duck's yellow), tiny hover physics. */

@font-face { font-family: Roboto; src: url("vendor/fonts/roboto-medium.woff2") format("woff2"); }
@font-face { font-family: Roboto; font-weight: 700; src: url("vendor/fonts/roboto-bold.woff2") format("woff2"); }
@font-face { font-family: RobotoLight; src: url("vendor/fonts/roboto-light.woff2") format("woff2"); }
@font-face { font-family: Julius; src: url("vendor/fonts/JuliusSansOne-Regular.woff2") format("woff2"); }

:root {
  --black: #000;
  --divider: rgb(189, 189, 189);
  --pill-gray: rgb(238, 238, 238);
  --track: rgb(219, 219, 219);
  --accent: #ffd337;
  --patch: #127672;  /* darkest step of the map's heatmap */
  --sand: #e3c78f;
  --sea: #93cde2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  color: var(--black);
  font-family: Roboto, sans-serif, system-ui, -apple-system, "Segoe UI", Ubuntu, Cantarell, "Noto Sans";
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ---------- stage (full-bleed map) ---------- */
#stage { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; }
#map canvas { cursor: crosshair; }

/* bottom-center CTA pill (asteroid-launcher's "CLICK IMPACT LOCATION") */
#drop-pill {
  position: absolute; left: 50%; bottom: 24px;
  transform: translateX(-50%);
  background: rgb(255, 255, 255); border-radius: 20px;
  padding: 10px 20px;
  font-family: Julius, sans-serif; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.04em;
  box-shadow: rgba(0, 0, 0, 0.15) 0 2px 8px;
  z-index: 5; pointer-events: none;
  transition: opacity 0.3s ease;
}
#drop-pill.gone { opacity: 0; }

/* shown while ducks drift: what the shading means */
#legend {
  position: absolute; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 66px);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px;
  background: rgb(255, 255, 255); border-radius: 20px;
  padding: 7px 14px 7px 9px;
  font-family: Julius, sans-serif; font-size: 12px; white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.06em;
  box-shadow: rgba(0, 0, 0, 0.12) 0 2px 8px;
  z-index: 5; pointer-events: none;
  opacity: 0; transition: opacity 0.3s ease;
}
#legend.show { opacity: 1; }
#legend .swatch {
  width: 34px; height: 9px; border-radius: 5px;
  background: linear-gradient(to right, rgba(135,218,208,0.6), rgb(55,172,162), rgb(18,118,114));
}

/* ---------- dock (playback bar over the map) ---------- */
#dock {
  position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(80px);
  width: min(480px, calc(100% - 32px));
  display: flex; align-items: center; gap: 14px;
  background: rgb(255, 255, 255); border-radius: 20px;
  box-shadow: rgba(0, 0, 0, 0.15) 0 2px 8px;
  padding: 9px 18px 9px 10px;
  z-index: 5; opacity: 0;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.35s ease;
}
#dock.show { transform: translateX(-50%) translateY(0); opacity: 1; }

#playpause {
  border: none; background: var(--black); color: #fff;
  width: 34px; height: 34px; border-radius: 100%;
  cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center;
}
@media (hover: hover) { #playpause:hover { transform: scale(1.033); } }

#clock {
  font-family: Julius, sans-serif; font-size: 13px;
  text-transform: uppercase; white-space: nowrap;
  min-width: 78px; text-align: right;
}

#scrub {
  flex: 1; cursor: pointer; height: 19px;
  -webkit-appearance: none; appearance: none; background: none;
}
#scrub::-webkit-slider-runnable-track {
  height: 7px; border-radius: 2px;
  background: linear-gradient(to right, var(--black) var(--fill, 0%), var(--track) var(--fill, 0%));
}
#scrub::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 19px; height: 19px; margin-top: -6px;
  border-radius: 100%; background: var(--black);
}
#scrub::-moz-range-track { height: 7px; border-radius: 2px; background: var(--track); }
#scrub::-moz-range-progress { height: 7px; border-radius: 2px; background: var(--black); }
#scrub::-moz-range-thumb { width: 19px; height: 19px; border-radius: 100%; background: var(--black); border: none; }

/* ---------- floating panel over the map ---------- */
#panel {
  position: absolute; top: 16px; left: 16px;
  width: 316px; max-height: calc(100% - 32px);
  overflow-y: auto;
  background: rgb(255, 255, 255); border-radius: 10px;
  box-shadow: rgba(0, 0, 0, 0.18) 0 4px 18px;
  display: flex; flex-direction: column;
  padding: 22px 20px 10px;
  z-index: 6;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
}
#panel[data-state="playing"] {
  transform: translateX(-28px); opacity: 0; pointer-events: none;
}

.title {
  font-family: Julius, sans-serif; font-size: 28px; font-weight: 400;
  text-transform: uppercase; text-align: center; line-height: 1.25;
}

.tagline {
  font-family: RobotoLight, sans-serif;
  font-size: 15px; line-height: 1.55; text-align: center;
  color: rgb(51, 51, 51); margin: 12px 4px 0;
}

.hero { display: grid; place-items: center; margin: 12px 0 0; }
.hero img { width: 60px; height: 60px; animation: bob 3.2s ease-in-out infinite; }

.instruction {
  display: flex; align-items: center; gap: 12px;
  font-family: Julius, sans-serif; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.09em;
  text-align: center; opacity: 0.6;
  margin: 18px 0 0;
}
.instruction::before, .instruction::after {
  content: ""; height: 1px; flex: 1;
  background: var(--divider);
}
body:not(.ready) .instruction span { visibility: hidden; }
#panel[data-state="done"] .idle-only,
#panel:not([data-state="done"]) .done-only { display: none; }

#presets {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 7px;
  margin-top: 14px;
}
body:not(.ready) #presets { visibility: hidden; }
.spot {
  background: var(--pill-gray); border: none; border-radius: 999px;
  padding: 7px 12px;
  font-family: Roboto, sans-serif; font-size: 13px; color: var(--black);
  cursor: pointer;
  transition: transform 0.07s linear, background-color 0.07s linear;
}
@media (hover: hover) {
  .spot:hover { transform: scale(1.04); background: rgb(226, 226, 226); }
}
.spot:active { transform: scale(1.02); }

/* results state */
#panel[data-state="done"] #panel-idle { display: none; }
#panel:not([data-state="done"]) #panel-results { display: none; }

.results-label {
  font-family: Julius, sans-serif; font-size: 12px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.09em; text-align: center; opacity: 0.6;
}
#result-headline {
  font-family: Julius, sans-serif; font-size: 19px; font-weight: 400;
  text-transform: uppercase; text-align: center; line-height: 1.4;
  margin: 10px 0 18px; text-wrap: balance;
}

/* the three outcomes as one stacked bar, coloured like the map */
#result-bar {
  display: flex; gap: 2px; height: 8px;
  border-radius: 4px; overflow: hidden;
}
#result-bar .seg { flex-basis: 0; min-width: 0; }
.patch { background: var(--patch); }
.coast { background: var(--sand); }
.open { background: var(--sea); }

#result-rows { margin-top: 8px; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline;
  padding: 9px 0;
  font-size: 14px; line-height: 1.35;
}
.row + .row { border-top: 1px solid rgb(232, 232, 232); }
.dot { width: 9px; height: 9px; border-radius: 50%; transform: translateY(-1px); }
.row-text { display: flex; flex-direction: column; gap: 1px; }
.row-where { font-family: RobotoLight, sans-serif; font-size: 13px; color: rgb(102, 102, 102); }
.row-pct { font-weight: 700; font-variant-numeric: tabular-nums; }

#result-far {
  font-family: RobotoLight, sans-serif; font-size: 13px; line-height: 1.45;
  color: rgb(102, 102, 102); text-align: center;
  margin-top: 8px; text-wrap: pretty;
}

.panel-foot { margin-top: auto; padding-top: 16px; text-align: center; }
.footlink {
  background: none; border: none; cursor: pointer;
  font-family: RobotoLight, sans-serif; font-size: 13px;
  color: var(--black); opacity: 0.55; text-decoration: underline;
}
.footlink:hover { opacity: 1; }

/* ---------- toast ---------- */
#toast {
  position: absolute; left: 50%; top: 20px;
  transform: translateX(-50%);
  background: var(--black); color: rgb(255, 255, 255);
  border-radius: 3px; padding: 9px 14px;
  font-family: Julius, sans-serif; font-size: 13px; text-transform: uppercase;
  z-index: 7; opacity: 0; pointer-events: none;
  transition: opacity 0.2s linear;
}
#toast.show { opacity: 1; }

/* ---------- duck marker ---------- */
.duck { pointer-events: none; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3)); }
.duck img { position: relative; display: block; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob {
  0%   { transform: translateY(0) rotate(-2.5deg); }
  25%  { transform: translateY(-3px) rotate(0deg); }
  50%  { transform: translateY(-4.5px) rotate(2.5deg); }
  75%  { transform: translateY(-1.5px) rotate(0.5deg); }
  100% { transform: translateY(0) rotate(-2.5deg); }
}
.duck.dropping img { animation: duckdrop 0.7s cubic-bezier(0.3, 0.8, 0.4, 1) 1, bob 3.2s ease-in-out 0.7s infinite; }
@keyframes duckdrop {
  0%   { transform: translateY(-46px) scale(1); opacity: 0; }
  38%  { transform: translateY(0) scale(1); opacity: 1; }
  55%  { transform: translateY(1px) scale(1.14, 0.84); }
  75%  { transform: translateY(-3px) scale(0.96, 1.05); }
  100% { transform: translateY(0) scale(1); }
}

/* ---------- about dialog ---------- */
#about {
  margin: auto; border: none; border-radius: 12px;
  max-width: min(480px, calc(100vw - 32px));
  padding: 26px 28px;
  box-shadow: rgba(0, 0, 0, 0.5) 0 0 15px;
  font-family: Roboto, sans-serif;
}
#about::backdrop { background: rgba(0, 0, 0, 0.55); }
#about h2 {
  font-family: Julius, sans-serif; font-size: 24px; font-weight: 400;
  text-transform: uppercase; text-align: center; margin-bottom: 14px;
}
#about p { font-size: 14px; line-height: 1.55; margin-bottom: 10px; }
#about a { color: var(--black); }
#about .fine { font-size: 12px; opacity: 0.6; }
#about-close {
  display: block; margin: 16px auto 0;
  background: var(--pill-gray); border: none; border-radius: 999px;
  padding: 8px 18px; font-family: Roboto, sans-serif; font-size: 14px; color: var(--black);
  cursor: pointer;
}
@media (hover: hover) { #about-close:hover { background: rgb(226, 226, 226); } }

/* ---------- responsive ---------- */
@media (max-width: 700px) {
  #panel {
    top: auto; left: 12px; right: 12px; bottom: 84px;
    width: auto; max-height: 48vh;
    padding: 16px 16px 8px;
  }
  #panel[data-state="playing"] { transform: translateY(28px); }
  .title { font-size: 21px; }
  .tagline { font-size: 14px; }
  .hero { display: none; }
  #dock { bottom: 14px; }
  #drop-pill { display: none; }
  #legend { top: 12px; bottom: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .duck img, .duck.dropping img, .hero img { animation: none; }
  #dock, #toast, #drop-pill, #legend { transition: none; }
}

.panel-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; column-gap: 18px; row-gap: 4px; }
.author-credit { color: #66615a; font-size: 13px; white-space: nowrap; }
.author-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.author-link:hover { text-decoration-style: solid; }
.author-link:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
