/* Dennis Pham's Costco Run — HUD, map overlay and screens.
   The 3D view is a full-bleed canvas; everything here layers on top of it. */

:root {
  --ink: #10131a;
  --paper: #f2f4f8;
  --gold: #ffd24a;
  --green: #4fd98a;
  --red: #ff5f5f;
  --blue: #2f6fd0;
  --panel-bg: rgba(14, 17, 22, 0.72);
  --panel-line: rgba(255, 255, 255, 0.14);
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0d11;
  font-family: var(--font);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* ============================== HUD ============================== */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.panel {
  position: absolute;
  background: var(--panel-bg);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 10px 14px;
}

#missionPanel {
  top: 16px;
  left: 16px;
  min-width: 250px;
  max-width: 300px;
}

#missionPanel h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 700;
}

#missionList {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  line-height: 1.55;
}

#missionList li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  transition: opacity 0.2s;
}

#missionList li .tick {
  width: 14px;
  flex: 0 0 14px;
  text-align: center;
  font-weight: 700;
}

#missionList li.done {
  opacity: 0.45;
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.35);
}

#missionList li.done .tick { color: var(--green); }
#missionList li.todo .tick { color: rgba(255, 255, 255, 0.3); }

#missionList li.final {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--panel-line);
  font-weight: 700;
}

#missionList li.final.ready { color: var(--green); }
#missionList li.final.locked { color: rgba(255, 255, 255, 0.4); }

#timerPanel {
  top: 16px;
  right: 16px;
  text-align: center;
  min-width: 110px;
}

#timerLabel {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
}

#timer {
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

#timer.warn { color: var(--gold); }

#timer.danger {
  color: var(--red);
  animation: pulse 0.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.09); }
}

#cartPanel {
  bottom: 16px;
  left: 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

#cartCount {
  font-weight: 700;
  color: var(--paper);
  font-size: 16px;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45);
}

#prompt {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  background: rgba(14, 17, 22, 0.85);
  border: 1px solid rgba(255, 210, 74, 0.6);
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 14.5px;
  white-space: nowrap;
}

#prompt b {
  color: var(--gold);
  letter-spacing: 0.04em;
}

#toasts {
  position: absolute;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.toast {
  background: rgba(14, 17, 22, 0.85);
  border: 1px solid var(--panel-line);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13.5px;
  animation: toastIn 0.22s ease-out;
  white-space: nowrap;
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.good { border-color: rgba(79, 217, 138, 0.7); color: #cdf5de; }
.toast.bad { border-color: rgba(255, 95, 95, 0.6); color: #ffd6d6; }
.toast.fade { opacity: 0; transition: opacity 0.4s, transform 0.4s; transform: translateY(-6px); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

#minimap {
  position: absolute;
  right: 16px;
  bottom: 16px;
  border-radius: 8px;
  border: 1px solid var(--panel-line);
}

/* =========================== MAP OVERLAY =========================== */

#mapOverlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(6, 8, 12, 0.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

#mapCanvas { border-radius: 12px; }

#mapHint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

#mapHint b {
  color: var(--gold);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 4px;
}

/* ============================= SCREENS ============================= */

.screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(47, 111, 208, 0.28), transparent 60%),
    rgba(7, 9, 13, 0.92);
}

.screenBox {
  width: min(680px, 100%);
  min-width: 0;            /* flex items default to min-width:auto and won't shrink */
  background: rgba(17, 21, 28, 0.92);
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  padding: 34px 38px 30px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 6px;
}

.screenBox h1 {
  margin: 0 0 8px;
  /* scales with the viewport so a long game name still fits the panel */
  font-size: clamp(30px, 6.4vw, 52px);
  letter-spacing: 0.01em;
  line-height: 1.04;
  font-weight: 800;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: break-word;
}

#endTitle.fail { color: var(--red); }
#endTitle.win { color: var(--green); }

.tagline {
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 14.5px;
  line-height: 1.5;
}

.briefing {
  text-align: left;
  margin: 0 auto 22px;
  padding-left: 22px;
  max-width: 430px;
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.85);
}

.briefing li::marker { color: var(--gold); font-weight: 700; }

.setting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 18px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.75);
}

.setting input[type="range"] {
  width: 230px;
  accent-color: var(--gold);
}

.setting output {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 46px;
  text-align: left;
  color: var(--paper);
}

.best {
  font-size: 13px;
  color: var(--green);
  margin-bottom: 16px;
}

.cta {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 34px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #14202c;
  background: linear-gradient(180deg, #ffd96a, #f0b429);
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}

.cta:hover { transform: translateY(-1px); filter: brightness(1.06); }
.cta:active { transform: translateY(0); }

.ghost {
  appearance: none;
  margin-top: 10px;
  border: 1px solid var(--panel-line);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 10px 24px;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}

.ghost:hover { color: var(--paper); border-color: rgba(255, 255, 255, 0.35); }

.controls {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--panel-line);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 8px 18px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
}

.controls .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.controls kbd {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--paper);
  white-space: nowrap;
}

.fineprint {
  margin: 18px 0 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.32);
}

.pauseStatus {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 18px;
}

/* ---- end-screen bodies ---- */

.missingList {
  list-style: none;
  margin: 0 auto 22px;
  padding: 0;
  max-width: 340px;
  text-align: left;
  font-size: 14px;
  line-height: 1.7;
}

.missingList li { color: rgba(255, 255, 255, 0.85); }
.missingList li .x { color: var(--red); font-weight: 700; margin-right: 8px; }
.missingList li.ok { color: rgba(255, 255, 255, 0.4); }
.missingList li.ok .x { color: var(--green); }

.receipt {
  background: #f7f5ef;
  color: #22252b;
  border-radius: 6px;
  padding: 20px 22px;
  margin: 0 auto 22px;
  max-width: 340px;
  text-align: left;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.receipt h3 {
  margin: 0 0 2px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.12em;
}

.receipt .sub {
  text-align: center;
  font-size: 10.5px;
  color: #6b7078;
  margin-bottom: 12px;
}

.receipt .line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.receipt .line span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt hr {
  border: 0;
  border-top: 1px dashed #b9bcc2;
  margin: 10px 0;
}

.receipt .total {
  font-weight: 700;
  font-size: 13.5px;
}

.receipt .stamp {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #2f7a4d;
  border: 2px solid #2f7a4d;
  border-radius: 4px;
  padding: 5px;
  transform: rotate(-1.5deg);
}

.statRow {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 20px;
}

.stat { text-align: center; }

.stat .v {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat .k {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

/* ============================== DEBUG ============================== */

#debugPanel {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(120, 255, 160, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: #9df5bf;
  white-space: pre;
  pointer-events: none;
}

@media (max-width: 720px) {
  .screen { padding: 14px; }
  .screenBox { padding: 26px 18px 22px; }
  .setting { flex-wrap: wrap; }
  .setting input[type="range"] { width: min(230px, 60vw); }
  .statRow { gap: 18px; }
  #missionPanel { min-width: 0; max-width: 54vw; font-size: 12px; }
  #timer { font-size: 26px; }
}
