:root {
  --bg: #0b0d12;
  --panel: rgba(16, 18, 24, 0.86);
  --text: #f4f6fb;
  --muted: #a7b0c0;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #6f9a52;
  --danger: #f87171;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  min-height: 100%;
  background:
    radial-gradient(ellipse at 80% 0%, rgba(111, 154, 82, 0.28), transparent 36%),
    var(--bg);
  color: var(--text);
  font-family: Outfit, ui-sans-serif, system-ui, sans-serif;
}

body { min-height: 100vh; }

h1, h2 {
  font-family: Sora, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.03em;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.lede, .form-hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.lede { margin: 8px 0 22px; }

.booth {
  display: grid;
  grid-template-columns: minmax(380px, 460px) 1fr;
  min-height: 100vh;
}

.booth-form {
  padding: 28px 24px 40px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
}

.booth-preview { padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.form-label-row .form-label { margin-bottom: 0; }

.form-input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}

.form-input-prompt { min-height: 140px; resize: vertical; }
.form-input-prompt-extra { min-height: 88px; resize: vertical; }
.form-group.is-invalid .form-input,
.form-group.is-invalid .camera-wrap { border-color: var(--danger); }

.field-error { min-height: 18px; color: var(--danger); font-size: 12px; margin-top: 6px; }
.script-meta { display: flex; justify-content: space-between; gap: 12px; }
.script-count { color: var(--muted); font-size: 12px; }

.camera-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #11141b;
}

.camera-wrap video,
.camera-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: Sora, sans-serif;
  font-size: 96px;
  background: rgba(0,0,0,0.35);
}

.camera-actions, .booth-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.booth-actions { margin-top: 8px; }

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #08110a; }
.btn-secondary { background: rgba(255,255,255,0.08); color: var(--text); }

.prompt-reset, .text-link, .admin-links button {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

.preview-frame {
  position: relative;
  flex: 1;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #10131a;
}

.preview-empty, .preview-busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  gap: 10px;
  text-align: center;
  padding: 24px;
}

.preview-frame img { width: 100%; height: 100%; object-fit: contain; background: #000; }

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.status { margin-top: 10px; color: var(--muted); min-height: 18px; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #151922;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { outline: 1px solid var(--danger); }

.page-slideshow { background: #000; }
.slideshow {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: #000;
}
.slideshow img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.slideshow img.is-on { opacity: 1; }
.slide-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
  padding: 24px;
}
.slide-brand {
  position: absolute;
  left: 28px;
  top: 24px;
  letter-spacing: 0.18em;
  font-weight: 700;
  font-size: 13px;
}

.page-login { display: grid; place-items: center; }
.login-card, .admin-card {
  width: min(440px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
}
.admin { width: min(920px, calc(100% - 32px)); margin: 32px auto 64px; }
.admin-head, .admin-links { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-head { margin-bottom: 24px; }
.admin-card { width: auto; margin-bottom: 18px; }
.btn-danger { background: #8f2d2d; color: #fff; }

.entry-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
}
.entry-tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.entry-tab.is-on {
  background: rgba(111, 154, 82, 0.18);
  color: var(--text);
  border-color: var(--accent);
}
.entry-tab span {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 500;
}
.entry-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.entry-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.entry-bulk { display: flex; flex-wrap: wrap; gap: 8px; }
.entry-row {
  display: grid;
  grid-template-columns: 28px 160px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}
.entry-row img { width: 160px; height: 100px; object-fit: cover; border-radius: 10px; }
.entry-row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

@media (max-width: 900px) {
  .booth { grid-template-columns: 1fr; }
  .booth-form { border-right: 0; border-bottom: 1px solid var(--line); }
  .entry-row { grid-template-columns: 1fr; }
}
