/* PUZZLE BOOTH — photobooth sticker look
   cream paper, ink outlines, hard offset shadows, coral/teal/yellow accents */

:root {
  --cream: #f7efe3;
  --ink: #2a2118;
  --coral: #ff5a4e;
  --teal: #1aa7a0;
  --yellow: #ffc83d;
  --white: #fffdf8;
  --disp: "Lilita One", system-ui, sans-serif;
  --ui: "Karla", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--ui);
  color: var(--ink);
  background: var(--cream);
}

/* the single drawing surface — CSS size pinned to viewport (hi-DPI safe) */
#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
#cam {
  display: none;
}

.hud {
  position: fixed;
  z-index: 5;
}

/* wordmark */
.brand {
  left: 26px;
  top: 20px;
  user-select: none;
}
.brand h1 {
  font-family: var(--disp);
  font-size: 30px;
  margin: 0;
  letter-spacing: 1px;
}
.brand h1 span {
  color: var(--coral);
}
.brand .tag {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: rgba(42, 33, 24, 0.55);
}

/* telemetry chips */
.chips {
  right: 22px;
  top: 22px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 360px;
}
.chip {
  display: flex;
  gap: 8px;
  align-items: baseline;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.chip .k {
  opacity: 0.55;
  letter-spacing: 1px;
}
.chip .v.on {
  color: var(--teal);
}
.chip .v.off {
  color: var(--coral);
}

/* grid switch + restart */
.controls {
  left: 26px;
  bottom: 22px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.seg {
  display: flex;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
}
.seg button {
  font-family: var(--ui);
  font-weight: 700;
  font-size: 13px;
  border: 0;
  background: transparent;
  padding: 8px 14px;
  cursor: pointer;
  color: rgba(42, 33, 24, 0.55);
}
.seg button.active {
  background: var(--yellow);
  color: var(--ink);
}
.btn {
  font-family: var(--ui);
  font-weight: 700;
  font-size: 13px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition:
    transform 0.08s,
    box-shadow 0.08s;
}
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

/* state hint pill */
.hint {
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 8px 18px;
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

/* loading / error overlay */
.ov {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(42, 33, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ov.hide {
  display: none;
}
.card {
  background: var(--white);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 26px 34px;
  text-align: center;
  max-width: 440px;
}
.card h2 {
  font-family: var(--disp);
  font-size: 26px;
  margin: 0 0 6px;
}
.card p {
  margin: 0;
  font-weight: 700;
  color: rgba(42, 33, 24, 0.6);
  font-size: 14px;
  line-height: 1.6;
}

/* Back Button */
.back-btn {
  position: fixed;
  top: 90px;
  left: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 3px solid var(--ink);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--ui);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
  box-shadow: 4px 4px 0 var(--ink);
}

.back-btn:hover {
  background: var(--yellow);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.back-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.back-arrow {
  font-size: 18px;
  transition: transform 0.2s ease;
}

.back-btn:hover .back-arrow {
  transform: translateX(-4px);
}

.back-text {
  font-weight: 700;
  text-transform: uppercase;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .back-btn {
    top: 82px;
    left: 27px;
    padding: 10px 16px;
    font-size: 13px;
    gap: 6px;
  }

  .back-arrow {
    font-size: 16px;
  }

  .back-text {
    display: none;
  }
}

@media (max-width: 480px) {
  .back-btn {
    top: 82px;
    left: 20px;
    padding: 8px 12px;
    min-width: 44px;
    justify-content: center;
  }
}
