html,
body {
  overflow: hidden;
  background: #2a1d16;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* --- speech bubbles over the customers ---------------------------------------- */

#bubbles,
#popups {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.bubble {
  position: absolute;
  left: 0;
  top: 0;
  min-width: 128px;
  padding: 8px 12px 10px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-top: 7px solid var(--who, var(--tomato));
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(58, 38, 24, 0.28), 0 10px 22px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 0.2s;
  will-change: transform;
}
.bubble.in {
  opacity: 1;
  animation: bubble-in 0.42s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.bubble.out {
  opacity: 0;
  transition: opacity 0.3s;
}
@keyframes bubble-in {
  from {
    scale: 0.4;
  }
  to {
    scale: 1;
  }
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  background: var(--paper);
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(45deg) skew(8deg, 8deg);
  border-bottom-right-radius: 4px;
}
.bubble .who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.bubble .dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--who);
  border: 2px solid var(--ink);
}
.bubble .tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  color: #fff;
}
.bubble .tag.vip {
  background: var(--mustard-deep);
}
.bubble .tag.hurry {
  background: #5c6bc0;
}
.bubble .items {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 8px;
}
.bubble .patience {
  height: 9px;
  border-radius: 9px;
  background: #efe4d2;
  border: 2px solid var(--ink);
  overflow: hidden;
}
.bubble .patience i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--lettuce);
  border-radius: 9px;
  transition: background 0.4s;
}
.bubble.mid .patience i {
  background: var(--mustard);
}
.bubble.low .patience i {
  background: var(--tomato);
}
.bubble.low {
  animation: shake 0.6s infinite;
}
@keyframes shake {
  0%,
  100% {
    rotate: 0deg;
  }
  25% {
    rotate: -2deg;
  }
  75% {
    rotate: 2deg;
  }
}
.bubble .say {
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 10px;
  background: #ffe1dc;
  color: var(--tomato-deep);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  white-space: nowrap;
}
.bubble.complain {
  border-color: var(--tomato-deep);
}
.bubble.done {
  border-color: var(--lettuce-deep);
}
.bubble.done::before {
  content: '✓';
  position: absolute;
  right: -14px;
  top: -18px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--lettuce);
  color: #fff;
  border: 3px solid var(--ink);
  font-weight: 700;
  font-size: 20px;
  line-height: 28px;
  text-align: center;
  animation: bubble-in 0.3s cubic-bezier(0.3, 1.8, 0.5, 1);
}

.popup {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: float-up 2.1s ease-out forwards;
  pointer-events: none;
}
.popup b {
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 7px var(--money);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}
.popup .tip,
.popup .bonus {
  font-size: 15px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--paper);
  border: 2px solid var(--ink);
}
.popup .bonus {
  background: var(--mustard);
}
@keyframes float-up {
  0% {
    opacity: 0;
    translate: 0 20px;
    scale: 0.6;
  }
  12% {
    opacity: 1;
    translate: 0 0;
    scale: 1.1;
  }
  20% {
    scale: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    translate: 0 -60px;
  }
}

/* --- the top bar -------------------------------------------------------------------- */

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 18px;
  z-index: 6;
  pointer-events: none;
}
.hud-left,
.hud-right {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.hud-right {
  flex-direction: column;
  align-items: flex-end;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 20px;
  font-weight: 600;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(58, 38, 24, 0.3);
}
.chip.day b {
  font-weight: 700;
  color: var(--tomato);
}
.chip.day span {
  color: var(--ink-soft);
  font-size: 16px;
  padding-left: 8px;
  border-left: 2px solid var(--line);
}
.chip.clock svg {
  width: 22px;
  height: 22px;
  color: var(--ink);
}
.chip.clock.last {
  background: #ffe1dc;
  color: var(--tomato-deep);
  animation: pulse 0.9s infinite;
}
@keyframes pulse {
  50% {
    scale: 1.06;
  }
}
.chip.coins {
  font-size: 26px;
  font-weight: 700;
  color: var(--money);
  padding: 6px 18px 6px 8px;
}
.chip.coins.bump {
  animation: bump 0.45s;
}
@keyframes bump {
  30% {
    scale: 1.15;
  }
}
.coin-ico {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--mustard);
  border: 3px solid var(--mustard-deep);
  color: var(--mustard-deep);
  font-size: 17px;
}
.goal {
  position: relative;
  width: 260px;
  margin-top: 6px;
  margin-bottom: 26px;
}
.goal-bar {
  height: 14px;
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.85);
  border: 3px solid var(--ink);
  overflow: hidden;
}
.goal-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--mustard), #ffdf6b);
  transition: width 0.3s;
}
#goal-marks .mark {
  position: absolute;
  top: -5px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}
#goal-marks .mark em {
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
}
#goal-marks .mark.pop svg {
  animation: bump 0.6s;
}

#streak {
  position: fixed;
  bottom: 18px;
  left: 50%;
  translate: -50% 0;
  z-index: 6;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  background: linear-gradient(180deg, #ff8a3c, var(--tomato));
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(58, 38, 24, 0.3);
}
#streak b {
  font-size: 20px;
}
#streak.bump {
  animation: bump 0.5s;
}

#toast {
  position: fixed;
  left: 50%;
  top: 42%;
  z-index: 8;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  pointer-events: none;
  font-size: 46px;
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 10px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
#toast.big {
  font-size: 76px;
}
#toast .count {
  font-size: 150px;
  color: var(--mustard);
}

/* --- cards -------------------------------------------------------------------------- */

.card-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s;
}
.card-layer.show {
  opacity: 1;
  pointer-events: auto;
}
.card-layer > * {
  transform: translateY(24px) scale(0.96);
  transition: transform 0.45s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.card-layer.show > * {
  transform: none;
}
#card-title {
  background: radial-gradient(ellipse at 50% 55%, rgba(42, 29, 22, 0.15), rgba(42, 29, 22, 0.55));
}
#card-intro,
#card-results,
#card-pause {
  background: rgba(42, 29, 22, 0.35);
}

.title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 900px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  filter: drop-shadow(0 8px 0 rgba(58, 38, 24, 0.35));
}
.logo-hat svg {
  display: block;
  transform: rotate(-10deg);
  animation: hat 3s ease-in-out infinite;
}
@keyframes hat {
  50% {
    transform: rotate(-4deg) translateY(-6px);
  }
}
.logo-text {
  font-size: clamp(56px, 9vw, 116px);
  font-weight: 700;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 14px var(--ink);
  paint-order: stroke fill;
  letter-spacing: -0.01em;
}
.logo-text b {
  color: var(--tomato);
}
.tagline {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
}
.join-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 24px 18px 18px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 26px;
  box-shadow: var(--pop);
}
.join-qr {
  width: 200px;
  height: 200px;
  border-radius: 14px;
  border: 3px solid var(--line);
  background: #fff;
  image-rendering: pixelated;
}
.join-card.small .join-qr {
  width: 150px;
  height: 150px;
}
.join-text ol {
  margin: 0 0 12px;
  padding-left: 1.4em;
  font-size: 20px;
  line-height: 1.6;
}
.join-text ol li::marker {
  font-weight: 700;
  color: var(--tomato);
}
.join-alt {
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.join-alt b {
  color: var(--ink);
}
.join-alt .code {
  display: inline-block;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--mustard);
  border: 2px solid var(--ink);
  color: var(--ink);
}
.status {
  margin: 4px 0 0;
  padding: 10px 20px;
  font-size: 20px;
  font-weight: 600;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
}
.status.ready {
  background: #e3f6d6;
  animation: pulse 1.4s infinite;
}
.continue {
  margin: 0;
  font-weight: 600;
  color: #fff;
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
}
.continue:empty {
  display: none;
}

.ticket {
  position: relative;
  width: min(560px, 92vw);
  padding: 30px 34px 26px;
  text-align: center;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 26px;
  box-shadow: var(--pop);
}
.ticket::before {
  /* a little pin at the top, like an order ticket */
  content: '';
  position: absolute;
  top: -16px;
  left: 50%;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  border-radius: 50%;
  background: var(--tomato);
  border: 4px solid var(--ink);
}
.ticket-top {
  margin-bottom: 4px;
}
.day-badge {
  display: inline-block;
  padding: 4px 16px;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  background: var(--tomato);
  border: 3px solid var(--ink);
  border-radius: 999px;
}
.ticket h1 {
  margin: 10px 0 6px;
  font-size: 46px;
  line-height: 1.05;
}
.ticket .blurb {
  margin: 0 auto 14px;
  max-width: 440px;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.new {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.new:empty {
  display: none;
}
.new-label {
  width: 100%;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tomato);
}
.new-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  font-weight: 600;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
}
.goals-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.goals {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 8px 0 6px;
}
.goals .goal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.goals .goal > span,
.goals .goal {
  font-size: 18px;
}
.goals .goal svg {
  display: inline-block;
}
.best {
  min-height: 1.2em;
  margin: 6px 0 0;
  font-weight: 600;
  color: var(--ink-soft);
}
.hint {
  margin: 16px 0 0;
  padding: 10px 16px;
  font-size: 17px;
  font-weight: 600;
  background: var(--cream);
  border: 2px dashed var(--line);
  border-radius: 16px;
}
.res-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 12px;
}
.res-stars .rs {
  animation: star-in 0.5s cubic-bezier(0.3, 1.8, 0.5, 1) both;
  animation-delay: var(--d);
}
.res-stars .rs:nth-child(2) {
  translate: 0 -12px;
}
@keyframes star-in {
  from {
    scale: 0;
    rotate: -40deg;
  }
}
.rows {
  margin: 0 auto;
  max-width: 380px;
  text-align: left;
}
.rows .row {
  display: flex;
  justify-content: space-between;
  padding: 5px 2px;
  font-size: 19px;
  border-bottom: 2px dotted var(--line);
}
.rows .row.total {
  margin-top: 6px;
  font-size: 26px;
  border-bottom: 0;
}
.rows .row.total b {
  color: var(--money);
}
.next {
  margin: 8px 0 0;
  font-weight: 700;
}
.ticket.pause .join-card {
  margin: 10px auto 0;
  width: fit-content;
  box-shadow: none;
}

/* --- corner bits ------------------------------------------------------------------- */

.conn {
  position: fixed;
  left: 16px;
  bottom: 14px;
  z-index: 12;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  border: 2px solid var(--ink);
}
.conn.none,
.conn.offline {
  color: var(--tomato-deep);
}
.corner {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 12;
  display: flex;
  gap: 8px;
  align-items: center;
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: rgba(255, 253, 248, 0.9);
  font-size: 19px;
  cursor: pointer;
}
.icon-btn.off {
  opacity: 0.5;
  text-decoration: line-through;
}
.sound-hint {
  padding: 8px 16px;
  font-weight: 600;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--mustard);
  cursor: pointer;
  animation: pulse 1.2s infinite;
}

body[data-phase='open'] .conn,
body[data-phase='countdown'] .conn {
  opacity: 0.75;
}

/* big screens (a TV across the room): everything a size up */
@media (min-height: 950px) {
  .title-wrap,
  .ticket {
    zoom: 1.3;
  }
  #hud {
    zoom: 1.25;
  }
}
@media (min-height: 1300px) {
  .title-wrap,
  .ticket {
    zoom: 1.7;
  }
  #hud {
    zoom: 1.6;
  }
}

@media (max-height: 760px) {
  .join-qr {
    width: 160px;
    height: 160px;
  }
  .ticket {
    padding: 20px 28px 18px;
  }
  .ticket h1 {
    font-size: 36px;
    margin: 6px 0 4px;
  }
  .ticket .blurb {
    font-size: 17px;
    margin-bottom: 10px;
  }
  .rows .row {
    font-size: 17px;
    padding: 3px 2px;
  }
  .rows .row.total {
    font-size: 22px;
  }
  .res-stars svg {
    width: 56px;
    height: 56px;
  }
  .hint {
    margin-top: 10px;
    padding: 7px 12px;
    font-size: 15px;
  }
  .logo-text {
    font-size: 72px;
  }
}
@media (max-height: 600px) {
  .ticket .hint,
  .tagline {
    display: none;
  }
  .join-qr {
    width: 130px;
    height: 130px;
  }
}
