/* ============================================================
   STUB — Meta Display HUD
   600 × 600 viewport. Photo-notes for ticket stubs, coat checks,
   valet tags, lockers — ephemeral references that never go to
   your camera roll.
   ============================================================ */

:root {
  --bg-0:        #000000;
  --bg-1:        #0e0a18;
  --bg-2:        #181030;
  --bg-3:        #251745;
  --line:        #2f1f55;
  --line-2:      #4a2f7a;

  --text:        #f4eafe;
  --text-2:      #c8b8e0;
  --text-3:      #7d6da0;
  --text-4:      #4d4068;

  --purple:      #c084fc;
  --purple-hi:   #d8b4fe;
  --purple-dim:  #7c3aed;
  --purple-glow: rgba(192, 132, 252, 0.55);
  --purple-wash: rgba(192, 132, 252, 0.10);

  --cyan:        #5ee7df;
  --cyan-hi:     #a4f4ef;
  --cyan-glow:   rgba(94, 231, 223, 0.55);

  --red:         #ff5e7e;
  --red-glow:    rgba(255, 94, 126, 0.45);

  --pad-l:       30px;
  --pad-r:       30px;
  --pad-t:       22px;
  --pad-b:       22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: inherit;
  padding: 0;
}

.mono {
  font-family: "JetBrains Mono", "SF Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.hidden { display: none !important; }

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--pad-t) var(--pad-r) var(--pad-b) var(--pad-l);
  gap: 14px;
}

.focusable {
  outline: none;
  border: 3px solid transparent;
  transition:
    transform .12s ease,
    border-color .12s ease,
    box-shadow .12s ease,
    background .12s ease;
}
.focusable:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 26px var(--cyan-glow);
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-mark {
  font-size: 22px;
  color: var(--purple);
  text-shadow: 0 0 14px var(--purple-glow);
  line-height: 1;
}
.brand-text {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--text-2);
}
.topbar-clock,
.topbar-counter {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 2px;
}

/* ============================================================
   HERO (empty home)
   ============================================================ */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.hero-title {
  font-size: 60px;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -2.5px;
  color: var(--text);
}
.hero-sub {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 3.5px;
  color: var(--purple);
}
.hero-blurb {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-2);
  max-width: 440px;
}

/* ============================================================
   CTA
   ============================================================ */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 4px;
  padding: 20px;
  min-height: 66px;
  background: linear-gradient(180deg, var(--purple), var(--purple-dim));
  color: #100422;
  box-shadow: 0 4px 12px rgba(192, 132, 252, 0.18);
  border: 3px solid transparent;
  flex-shrink: 0;
  opacity: 0.92;
  transition: opacity .12s ease, background .12s ease,
              box-shadow .12s ease, border-color .12s ease,
              transform .12s ease;
}
.cta:focus {
  background: linear-gradient(180deg, var(--purple-hi), var(--purple));
  box-shadow: 0 0 30px var(--purple-glow);
  border-color: var(--purple-hi);
  opacity: 1;
  transform: translateY(-1px);
}
.cta-icon { font-size: 24px; line-height: 1; font-weight: 700; }

/* ============================================================
   HINT BAR
   ============================================================ */
.hint-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.hint-keys {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.key {
  display: inline-block;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 6px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: "JetBrains Mono", monospace;
}

/* ============================================================
   STEP HEADER
   ============================================================ */
.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.step-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 5px;
  color: var(--text-2);
}
.step-pips {
  display: flex;
  gap: 6px;
}
.pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  display: inline-block;
}
.pip.on {
  background: var(--purple);
  border-color: var(--purple);
  box-shadow: 0 0 8px var(--purple-glow);
}

/* ============================================================
   STUB CARD — used on home, confirm, detail
   ============================================================ */
.stub-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(192,132,252,0.10), rgba(192,132,252,0.02));
  border: 2px solid var(--purple);
  border-radius: 18px;
  padding: 20px 26px 18px;
  gap: 12px;
  position: relative;
  box-shadow: 0 0 28px rgba(192,132,252,0.18);
}
.stub-card::before,
.stub-card::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #000;
  border: 2px solid var(--purple);
  top: 78px;
}
.stub-card::before { left: -10px;  }
.stub-card::after  { right: -10px; }

.stub-card-fresh {
  animation: stub-pop .35s ease;
}
@keyframes stub-pop {
  0%   { transform: scale(.94); opacity: 0; }
  60%  { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); }
}

.stub-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.stub-category {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--purple);
  text-shadow: 0 0 10px var(--purple-glow);
}
.stub-time {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-3);
}

.perforation {
  height: 2px;
  background-image: linear-gradient(to right,
    var(--line-2) 50%, transparent 0%);
  background-size: 10px 2px;
  background-repeat: repeat-x;
  margin: 4px 0;
  opacity: 0.85;
}

.stub-code {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 120px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -3px;
  color: var(--text);
  text-shadow: 0 0 24px var(--purple-glow);
  word-break: break-all;
  text-align: center;
  padding: 6px 0;
  min-height: 0;
}
.stub-code.code-long  { font-size: 78px; letter-spacing: -2px; }
.stub-code.code-xlong { font-size: 54px; letter-spacing: -1px; }

.stub-location {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-2);
  text-align: center;
  line-height: 1.2;
}
.stub-foot {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--text-4);
  text-align: center;
  margin-top: 2px;
}

/* ============================================================
   CAROUSEL (home)
   ============================================================ */
.carousel {
  flex: 1;
  display: flex;
  min-height: 0;
}
.carousel > .stub-card,
.carousel > .new-card {
  width: 100%;
}
.new-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-1);
  border: 2px dashed var(--line-2);
  border-radius: 18px;
  padding: 24px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.new-card .nc-plus {
  font-size: 80px;
  font-weight: 700;
  line-height: 1;
  color: var(--purple);
  text-shadow: 0 0 18px var(--purple-glow);
}
.new-card .nc-label {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 5px;
  color: var(--purple);
}
.new-card .nc-sub {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-3);
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: 9px;
}
.carousel-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  transition: background .15s, border-color .15s, transform .15s;
}
.carousel-dots .dot.on {
  background: var(--purple);
  border-color: var(--purple);
  transform: scale(1.15);
  box-shadow: 0 0 6px var(--purple-glow);
}
.carousel-dots .dot.new {
  background: transparent;
  border-style: dashed;
  border-color: var(--line-2);
}
.carousel-dots .dot.new.on {
  background: transparent;
  border-color: var(--purple);
  box-shadow: 0 0 6px var(--purple-glow);
}

/* ============================================================
   CAPTURE — the "New Stub" screen IS the capture surface.
   Top-left quadrant is highlighted as the camera's centered-frame
   sweet spot; the rest of the canvas calls out PINCH TO CAPTURE.
   ============================================================ */
#capture {
  /* let the cam-zone sit in absolute coordinates */
  position: absolute;
  padding: var(--pad-t) var(--pad-r) var(--pad-b) var(--pad-l);
}

.cam-zone {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 282px;
  height: 282px;
  border-radius: 24px;
  /* No hard frame: a soft radial spotlight indicates the *area*
     where you should aim, with the brightest point at the center. */
  background:
    radial-gradient(circle at center,
      rgba(192, 132, 252, 0.22) 0%,
      rgba(192, 132, 252, 0.10) 38%,
      rgba(192, 132, 252, 0.03) 68%,
      transparent 92%);
  animation: cam-breath 2.6s infinite ease-in-out;
  overflow: hidden;
}
@keyframes cam-breath {
  0%, 100% { filter: brightness(0.9); }
  50%      { filter: brightness(1.15); }
}

.cz-reticle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* sonar-ping rings expanding from the center */
.cz-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--purple-hi);
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: cz-pulse 2.2s infinite ease-out;
}
.cz-pulse-1 { animation-delay: 0s; }
.cz-pulse-2 { animation-delay: 0.73s; }
.cz-pulse-3 { animation-delay: 1.46s; }
@keyframes cz-pulse {
  0%   { width: 24px;  height: 24px;  opacity: 0.85; border-width: 1.5px; }
  85%  { opacity: 0;   border-width: 0.5px; }
  100% { width: 220px; height: 220px; opacity: 0;   border-width: 0.5px; }
}

.cz-ring {
  position: absolute;
  width: 64px;
  height: 64px;
  border: 2px solid var(--purple-hi);
  border-radius: 50%;
  box-shadow: 0 0 16px var(--purple-glow);
}
.cz-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--purple-hi);
  box-shadow: 0 0 14px var(--purple-glow), 0 0 28px var(--purple-glow);
}
.cz-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 5px;
  color: var(--purple-hi);
  text-shadow: 0 0 12px var(--purple-glow);
  opacity: 0.9;
}

/* Big "NEW CAPTURE" instruction, placed in the diagonal-opposite
   corner from the camera zone so the eye lands on it next. */
.cap-instruction {
  position: absolute;
  right: 28px;
  bottom: 36px;
  text-align: right;
  max-width: 340px;
}
.cap-pinch {
  font-size: 60px;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -2.5px;
  color: var(--text);
  text-shadow: 0 0 22px var(--purple-glow);
}
.cap-pinch em {
  font-style: normal;
  color: var(--purple);
  text-shadow: 0 0 18px var(--purple-glow);
}
.cap-sub {
  margin-top: 18px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.35;
  color: var(--text-2);
}

/* ============================================================
   SCANNING
   ============================================================ */
.scan-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 0;
}
.scan-card {
  width: 380px;
  height: 220px;
  border: 2px solid var(--cyan);
  border-radius: 16px;
  background: rgba(94,231,223,0.05);
  box-shadow: 0 0 30px var(--cyan-glow);
  overflow: hidden;
  position: relative;
}
.scan-card-inner {
  position: absolute;
  inset: 0;
}
.scan-shimmer {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 6px,
      rgba(94,231,223,0.08) 7px,
      rgba(94,231,223,0.08) 8px);
}
.scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan-glow), 0 0 32px var(--cyan-glow);
  animation: scan-sweep 1.05s linear infinite;
}
@keyframes scan-sweep {
  0%   { top: 0;    opacity: 0.2; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0.2; }
}
.scan-glyphs {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  align-items: center;
  justify-items: center;
  font-size: 34px;
  font-weight: 800;
  color: var(--cyan);
  opacity: 0.45;
  text-shadow: 0 0 10px var(--cyan-glow);
}
.scan-glyphs span {
  animation: glyph-flicker 0.7s infinite ease-in-out;
}
.scan-glyphs span:nth-child(2) { animation-delay: .08s; }
.scan-glyphs span:nth-child(3) { animation-delay: .16s; }
.scan-glyphs span:nth-child(4) { animation-delay: .24s; }
.scan-glyphs span:nth-child(5) { animation-delay: .32s; }
.scan-glyphs span:nth-child(6) { animation-delay: .40s; }
.scan-glyphs span:nth-child(7) { animation-delay: .48s; }
.scan-glyphs span:nth-child(8) { animation-delay: .56s; }
@keyframes glyph-flicker {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}
.scan-status {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan-glow);
}

/* ============================================================
   DELETE
   ============================================================ */
.delete-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: 0;
}
.del-mini-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 36px;
  border: 2px solid var(--red);
  border-radius: 16px;
  background: rgba(255,94,126,0.08);
  box-shadow: 0 0 22px var(--red-glow);
  filter: grayscale(0.3);
}
.del-mini-cat {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--red);
}
.del-mini-code {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -2px;
  word-break: break-all;
  text-align: center;
}
.del-mini-code.code-long  { font-size: 52px; }
.del-mini-code.code-xlong { font-size: 36px; }
.del-warn {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-2);
  text-align: center;
  max-width: 360px;
}
