:root {
  color-scheme: light;
  --ink: #1c2024;
  --muted: #65707a;
  --line: #dce2e7;
  --paper: #fffaf0;
  --panel: #ffffff;
  --sun: #f7b733;
  --leaf: #28785c;
  --coral: #ef6f61;
  --blue: #326fd1;
  --shadow: 0 18px 60px rgba(28, 32, 36, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #17221f;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--sun);
  color: #17221f;
  font-size: 26px;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.event-pill {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-align: left;
}

.nav-tab.active {
  background: #fff;
  color: var(--ink);
}

.event-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.rail-link {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-weight: 850;
}

.admin-unlock-fab {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 30;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 34, 31, 0.82);
  color: #fff;
  font-size: 22px;
  font-weight: 950;
  box-shadow: 0 10px 25px rgba(28, 32, 36, 0.18);
}

.guest-mode .app-shell {
  grid-template-columns: 1fr;
}

.guest-mode .rail {
  display: none;
}

.guest-mode main {
  padding: 0;
}

.guest-mode .booth-layout {
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.8fr);
  gap: 0;
}

.guest-mode .camera-stage {
  min-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

.guest-mode #camera,
.guest-mode .camera-fallback {
  min-height: 100vh;
}

.guest-mode .session-panel {
  min-height: 100vh;
  border-width: 0;
  border-radius: 0;
  box-shadow: none;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 253, 250, 0.98)),
    radial-gradient(circle at 90% 8%, rgba(247, 183, 51, 0.2), transparent 32%);
}

.guest-mode #demoPhotoBtn {
  display: none;
}

.guest-mode-banner {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(40, 120, 92, 0.22);
  border-radius: 8px;
  background: rgba(40, 120, 92, 0.08);
  color: var(--muted);
  font-size: 13px;
}

.guest-mode .guest-mode-banner {
  display: flex;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #74d68a;
}

main {
  min-width: 0;
  padding: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.unlock-view.active {
  display: grid;
  min-height: calc(100vh - 48px);
  place-items: center;
}

.unlock-panel {
  display: grid;
  width: min(520px, 100%);
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.unlock-panel h1 {
  margin-bottom: 0;
}

.booth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 420px;
  gap: 20px;
  min-height: calc(100vh - 48px);
}

.camera-stage {
  position: relative;
  overflow: hidden;
  min-height: 620px;
  border-radius: 8px;
  background: #101718;
  box-shadow: var(--shadow);
}

.camera-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
}

#camera,
.camera-fallback {
  width: 100%;
  height: 100%;
  min-height: 620px;
}

#camera {
  display: block;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 32px;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.11), transparent 26%),
    linear-gradient(130deg, rgba(247, 183, 51, 0.26), transparent 42%),
    linear-gradient(40deg, rgba(40, 120, 92, 0.4), transparent 50%),
    #11191a;
}

.camera-fallback strong {
  color: #fff;
  font-size: clamp(34px, 6vw, 74px);
  letter-spacing: 0;
}

.stage-topbar,
.stage-bottombar {
  position: absolute;
  left: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stage-topbar {
  top: 18px;
  color: #fff;
  font-weight: 800;
}

.stage-topbar span {
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.stage-bottombar {
  bottom: 18px;
}

.stage-orbit {
  position: absolute;
  inset: 80px;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.stage-orbit span {
  position: absolute;
  width: min(58vw, 520px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  animation: boothPulse 4.8s ease-in-out infinite;
}

.stage-orbit span:nth-child(2) {
  width: min(44vw, 390px);
  animation-delay: 0.8s;
}

.stage-orbit span:nth-child(3) {
  width: min(30vw, 270px);
  animation-delay: 1.6s;
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: clamp(96px, 22vw, 240px);
  font-weight: 950;
  text-shadow: 0 14px 44px rgba(0, 0, 0, 0.38);
}

.session-panel,
.setup-grid,
.ai-modes article,
.stats-grid article,
.admin-list,
.gallery-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 35px rgba(28, 32, 36, 0.06);
}

.session-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
}

.booth-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.booth-status-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.booth-status-grid span,
.delivery-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.booth-status-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--leaf);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 4.7vw, 58px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 44px);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.intro {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.booth-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.booth-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.booth-step span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #eef3f1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.booth-step strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.booth-step.active {
  border-color: rgba(247, 183, 51, 0.75);
  background: rgba(247, 183, 51, 0.13);
  color: var(--ink);
}

.booth-step.active span,
.booth-step.complete span {
  background: var(--ink);
  color: #fff;
}

.scene-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.standard-booth .scene-strip,
.standard-booth .scene-studio {
  display: none;
}

.consent-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.checkline {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.checkline input {
  width: 18px;
  min-height: 18px;
  margin: 1px 0 0;
}

.scene-card {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 12px;
  color: #fff;
  text-align: left;
  background: #25312f;
  box-shadow: inset 0 -42px 70px rgba(0, 0, 0, 0.2);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.scene-card:hover {
  transform: translateY(-2px);
}

.scene-card.active {
  border-color: var(--sun);
  box-shadow: 0 12px 30px rgba(28, 32, 36, 0.16), inset 0 -42px 70px rgba(0, 0, 0, 0.16);
}

.scene-gloss {
  position: absolute;
  inset: 0;
  margin: 0 !important;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.2), transparent 42%);
  opacity: 0.75;
}

.scene-card strong,
.scene-card span {
  position: relative;
  display: block;
}

.scene-card span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 850;
}

.primary-btn {
  background: var(--ink);
  color: #fff;
}

#startSessionBtn {
  position: relative;
  min-height: 58px;
  overflow: hidden;
  background: linear-gradient(135deg, #17221f, #2a5c47);
  box-shadow: 0 14px 34px rgba(23, 34, 31, 0.22);
}

#startSessionBtn::after {
  content: "";
  position: absolute;
  inset: -60% -35%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: translateX(-70%);
  animation: buttonSheen 3.2s ease-in-out infinite;
}

.secondary-btn {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
}

.compact {
  min-height: 42px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

#startSessionBtn:disabled::after {
  animation: none;
  opacity: 0;
}

.review-area {
  display: grid;
  gap: 12px;
  min-height: 180px;
}

.empty-review {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.processing-card {
  display: grid;
  min-height: 180px;
  place-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f7faf8);
  text-align: center;
}

.processing-card p {
  max-width: 260px;
  margin-bottom: 0;
  color: var(--muted);
}

.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #e5ece8;
  border-top-color: var(--leaf);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

.session-result {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-box {
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-box canvas {
  width: 96px !important;
  height: 96px !important;
}

.qr-box img {
  width: 96px;
  height: 96px;
}

.session-link {
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 13px;
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.thumb-wrap {
  position: relative;
  flex: 0 0 auto;
}

.thumb-row img {
  width: 94px;
  height: 94px;
  border-radius: 8px;
  object-fit: cover;
}

.thumb-wrap span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(28, 32, 36, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.session-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.delivery-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.delivery-strip span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-transform: none;
  line-height: 1.3;
}

@keyframes boothPulse {
  0%,
  100% {
    opacity: 0.18;
    transform: scale(0.94);
  }
  50% {
    opacity: 0.42;
    transform: scale(1.02);
  }
}

@keyframes buttonSheen {
  0%,
  55% {
    transform: translateX(-70%);
  }
  100% {
    transform: translateX(70%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.ai-modes,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.ai-modes article,
.stats-grid article {
  padding: 18px;
}

.ai-modes span {
  color: var(--coral);
  font-weight: 950;
}

.ai-modes p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.scene-studio {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.scene-builder {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
}

.setup-scene-list {
  display: grid;
  gap: 8px;
}

.setup-scene-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
}

.setup-scene-row strong,
.setup-scene-row span {
  display: block;
}

.setup-scene-row span {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-swatch {
  width: 44px;
  height: 44px;
  border: 2px solid transparent;
  border-radius: 8px;
}

.scene-swatch.active {
  border-color: var(--ink);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gallery-gate {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gallery-gate p,
.gallery-gate h3 {
  margin-bottom: 6px;
}

.gallery-session-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gallery-session-header h3,
.gallery-session-header p {
  margin-bottom: 4px;
}

.gallery-card {
  overflow: hidden;
}

.gallery-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #dde4e8;
}

.gallery-card div {
  padding: 12px;
}

.gallery-card strong,
.gallery-card span {
  display: block;
}

.gallery-card span {
  color: var(--muted);
  font-size: 13px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 0;
}

.stats-grid strong {
  display: block;
  font-size: 38px;
}

.stats-grid span {
  color: var(--muted);
  font-weight: 800;
}

.admin-list {
  display: grid;
  gap: 0;
  margin-top: 14px;
  overflow: hidden;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 14px;
  margin-top: 14px;
}

.ops-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.activity-list {
  display: grid;
  gap: 8px;
}

.activity-item,
.health-list div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.activity-item:first-child,
.health-list div:first-child {
  border-top: 0;
}

.activity-item span,
.health-list span,
.activity-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.health-list div {
  grid-template-columns: minmax(0, 1fr) auto;
}

.small {
  min-height: 90px;
}

.admin-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.admin-row:first-child {
  border-top: 0;
}

.admin-row img {
  width: 92px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
}

.admin-row p {
  margin-bottom: 3px;
  color: var(--muted);
}

.admin-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font-weight: 800;
}

.mini-btn.danger {
  color: #b8322a;
}

.photo-approval-strip {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.photo-chip {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.photo-chip.approved {
  border-color: rgba(40, 120, 92, 0.35);
  background: rgba(40, 120, 92, 0.12);
  color: var(--leaf);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .event-pill {
    display: none;
  }

  .booth-layout,
  .setup-grid,
  .scene-builder,
  .ai-modes,
  .stats-grid,
  .ops-grid,
  .gallery-gate {
    grid-template-columns: 1fr;
  }

  .camera-stage,
  #camera,
  .camera-fallback {
    min-height: 54vh;
  }

  .session-panel {
    padding: 16px;
  }

  .guest-mode .booth-layout {
    grid-template-columns: 1fr;
  }

  .guest-mode .camera-stage,
  .guest-mode #camera,
  .guest-mode .camera-fallback {
    min-height: 52vh;
  }

  .guest-mode .session-panel {
    min-height: 48vh;
  }

  .booth-status-grid,
  .delivery-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  main {
    padding: 12px;
  }

  .brand span {
    display: none;
  }

  .nav-tab {
    padding: 10px 8px;
    text-align: center;
  }

  .stage-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stage-topbar span {
    max-width: 100%;
  }

  .stage-bottombar,
  .section-head,
  .admin-row,
  .gallery-session-header {
    align-items: stretch;
    flex-direction: column;
  }

  .stage-bottombar,
  .admin-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .control-row,
  .scene-strip,
  .session-result,
  .booth-steps,
  .result-actions {
    grid-template-columns: 1fr;
  }

  .guest-mode .session-panel {
    justify-content: start;
  }

  .stage-orbit {
    inset: 40px;
  }
}
