:root {
  --ink: #0f1d2e;
  --paper: rgba(248, 252, 255, 0.92);
  --line: #cde4f8;
  --shadow: 0 18px 44px rgba(16, 42, 74, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #7a7a7a 0%, #6a6a6a 100%);
}

.bg-art {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 0% 100%, rgba(255, 255, 255, 0.08) 0%, transparent 32%),
              radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.07) 0%, transparent 28%);
}

.booth-wrap {
  width: min(1160px, 96vw);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 10px 30px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 2;
}

.phone-stage {
  width: min(400px, 94vw);
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 16px 12px 14px;
  animation: raise 360ms ease;
}

.screen-head {
  text-align: center;
  margin-bottom: 8px;
}

.screen-head h1 {
  margin: 2px 0 4px;
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.06em;
}

.screen-tag {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1d4f7a;
}

.camera-box {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #d6ebff;
}

#cameraVideo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  transform: scaleX(-1);
  background: #b5ddfb;
}

.template-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 5rem;
  letter-spacing: 0.08em;
  color: white;
  background: rgba(15, 29, 46, 0.35);
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.instruction {
  text-align: center;
  font-size: 0.84rem;
  margin: 8px 0 10px;
  color: #325678;
}

.template-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #def0ff;
}

.template-card {
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  padding: 0;
  cursor: pointer;
}

.template-card img {
  width: 100%;
  height: 68px;
  object-fit: cover;
  display: block;
}

.template-card p {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  padding: 3px 2px;
}

.template-card.selected {
  border-color: #1f58f3;
  box-shadow: 0 0 0 2px rgba(31, 88, 243, 0.25);
}

.action-row {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.btn {
  border: 1px solid #b7d8f8;
  background: linear-gradient(180deg, #dff2ff 0%, #cde9ff 100%);
  color: #1f36d6;
  font-weight: 800;
  font-size: 1.05rem;
  border-radius: 6px;
  width: 100%;
  max-width: 340px;
  padding: 11px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.btn.ghost {
  color: #1d4f7a;
  background: linear-gradient(180deg, #f4fbff 0%, #e8f5ff 100%);
}

.result-card,
.result-preview-card {
  margin-top: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #eaf6ff;
  padding: 12px;
  text-align: center;
}

.result-preview-card-top {
  margin-top: 0;
}

.qr-title {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.qr-button {
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #b7d8f8;
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(180deg, #f7fbff 0%, #dcefff 100%);
  text-decoration: none;
}

.qr-img {
  width: 100%;
  max-width: 220px;
  border: 1px solid #d3e5f7;
  background: white;
  padding: 8px;
}

.result-img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #d3e5f7;
  background: white;
}

.error {
  margin: 8px 0;
  border-radius: 6px;
  padding: 9px;
  background: #ffe4e6;
  color: #881337;
  border: 1px solid #fb7185;
  font-size: 0.86rem;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 520px) {
  .phone-stage {
    border-radius: 8px;
    padding: 12px 8px 10px;
  }

  .template-card img {
    height: 56px;
  }
}
