:root {
  --ink: #21243d;        /* circus navy */
  --paper: #fdf3e0;      /* cream canvas */
  --accent: #d6303a;     /* big-top red */
  --accent2: #1f9e8f;    /* teal */
  --gold: #f4b62c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #ffd49b;
}

#app { position: fixed; inset: 0; }
canvas { display: block; }

/* ---------- Blocker / start screen ---------- */
#blocker {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 25%, rgba(244,182,44,.45), rgba(33,36,61,.85));
  backdrop-filter: blur(2px);
  z-index: 20;
  transition: opacity .4s ease;
}
#blocker.hidden { opacity: 0; pointer-events: none; }

#instructions {
  position: relative;
  background: var(--paper);
  border-radius: 18px;
  padding: 2.4rem 2.6rem;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  border: 3px solid var(--ink);
  /* marquee bulbs running around the card */
  outline: 4px dotted var(--gold);
  outline-offset: 6px;
}
/* red/cream big-top stripe across the top of the card */
#instructions::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 14px;
  border-radius: 15px 15px 0 0;
  background: repeating-linear-gradient(
    90deg, var(--accent) 0 18px, var(--paper) 18px 36px
  );
}
#instructions h1 { margin: .4rem 0 .2rem; font-size: 2rem; }
.lead { margin: 0 0 1.2rem; opacity: .8; }
.controls {
  list-style: none;
  padding: 0;
  margin: 0 0 1.4rem;
  display: grid;
  gap: .5rem;
  text-align: left;
  font-size: .95rem;
}
.controls li { display: flex; align-items: center; gap: .3rem; }

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: .12em .4em;
  border: 2px solid var(--ink);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: .82em;
  font-weight: 700;
  text-align: center;
}

#enterBtn {
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: var(--accent);
  border: 3px solid var(--ink);
  border-bottom-width: 5px;
  border-radius: 12px;
  padding: .7rem 1.6rem;
  cursor: pointer;
  transition: transform .08s ease;
}
#enterBtn:active { transform: translateY(2px); border-bottom-width: 3px; }

.back-link { margin: 1rem 0 0; font-size: .85rem; }
.back-link a { color: var(--ink); opacity: .55; text-decoration: none; }
.back-link a:hover { opacity: 1; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,.8);
  font-size: 1.4rem;
  text-shadow: 0 0 4px rgba(0,0,0,.5);
}
#prompt {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28,20,16,.85);
  color: var(--paper);
  padding: .6rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
#prompt kbd { color: var(--ink); }
#vendorCount {
  position: absolute;
  bottom: 16px; left: 16px;
  background: rgba(253,246,233,.9);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: .35rem .7rem;
  font-size: .85rem;
  font-weight: 700;
}

.hidden { display: none !important; }

/* ---------- Vendor modal ---------- */
#modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28,20,16,.55);
  backdrop-filter: blur(3px);
}
.modal-card {
  position: relative;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 2.4rem 2.2rem 2rem;
  max-width: 440px;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  animation: pop .18s ease;
  overflow: hidden;
}
/* big-top stripe across the top, like a ticket stub */
.modal-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 14px;
  background: repeating-linear-gradient(
    90deg, var(--accent) 0 18px, var(--paper) 18px 36px
  );
}
@keyframes pop {
  from { transform: scale(.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-card h2 { margin: .2rem 0 .1rem; font-size: 1.7rem; }
.category {
  display: inline-block;
  margin: 0 0 1rem;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .7;
}
#modalDesc { line-height: 1.5; }
#modalSwatch {
  width: 100%; height: 130px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  margin-bottom: .9rem;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.25);
}
.hint { font-size: .8rem; opacity: .65; margin-top: 1.2rem; }
#modalClose {
  position: absolute;
  top: .6rem; right: .8rem;
  border: none;
  background: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}
