:root {
  --font-ui: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --bg: #08131f;
  --bg-accent: #0f2742;
  --surface: rgba(12, 23, 36, 0.9);
  --surface-strong: rgba(15, 29, 45, 0.96);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #edf4ff;
  --muted: #a7bad7;
  --primary: #55b0ff;
  --primary-ink: #041522;
  --danger: #d12f2f;
  --danger-ink: #ffffff;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] {
  --bg: #f2f7ff;
  --bg-accent: #d7e8ff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(21, 53, 90, 0.15);
  --line-strong: rgba(21, 53, 90, 0.28);
  --text: #12243a;
  --muted: #4f6a89;
  --primary: #1d78d6;
  --primary-ink: #f7fbff;
  --danger: #c92525;
  --danger-ink: #ffffff;
  --shadow: 0 12px 30px rgba(18, 36, 58, 0.15);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(1100px 500px at -5% -10%, var(--bg-accent) 0%, transparent 60%),
    radial-gradient(900px 420px at 105% -20%, rgba(85, 176, 255, 0.12) 0%, transparent 55%),
    var(--bg);
}

.topbar {
  width: min(1200px, 94vw);
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.wrap {
  width: min(1200px, 94vw);
  margin: 14px auto 22px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
}

.wrap.single {
  grid-template-columns: 1fr;
  max-width: 860px;
}

.panel {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

h1, h2 {
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}

.sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
}

#camera {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #08101a;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.hidden { display: none !important; }

.actions {
  display: flex;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 18px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  font-weight: 650;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.btn.primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: transparent;
  font-weight: 750;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#themeToggle {
  font-size: 14px;
  padding: 10px 14px;
}

#uploadPhotos {
  animation: choosePhotosGlow 3.2s ease-in-out infinite;
}

#uploadSelected.highlight-ready {
  position: relative;
  overflow: hidden;
  animation: uploadSelectedGlow 2.6s ease-in-out infinite;
}

#uploadSelected.highlight-ready::after {
  content: "";
  position: absolute;
  top: -30%;
  left: -40%;
  width: 38%;
  height: 160%;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.28) 45%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.28) 55%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(0) skewX(-18deg);
  animation: uploadSelectedShimmer 1.8s linear infinite;
  pointer-events: none;
}

@keyframes choosePhotosGlow {
  0% { box-shadow: 0 0 0 rgba(71, 163, 255, 0); }
  50% { box-shadow: 0 0 18px rgba(71, 163, 255, 0.4); }
  100% { box-shadow: 0 0 0 rgba(71, 163, 255, 0); }
}

@keyframes uploadSelectedGlow {
  0% { box-shadow: 0 0 0 rgba(71, 163, 255, 0); filter: saturate(1); }
  50% { box-shadow: 0 0 20px rgba(71, 163, 255, 0.5); filter: saturate(1.15); }
  100% { box-shadow: 0 0 0 rgba(71, 163, 255, 0); filter: saturate(1); }
}

@keyframes uploadSelectedShimmer {
  0% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  10% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateX(420%) skewX(-18deg); opacity: 0; }
}

.status {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}
.upload-progress {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.upload-progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.upload-progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #55b0ff 0%, #7df2d8 55%, #ffd166 100%);
  transition: width 180ms ease;
}

.upload-progress.busy .upload-progress-bar span {
  width: 42%;
  animation: uploadProgressIndeterminate 1.1s ease-in-out infinite;
  transform-origin: left center;
}

@keyframes uploadProgressIndeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(260%); }
}

.upload-progress-text {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.selected-wrap { margin-top: 16px; }

.selected-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.selected-tile { display: grid; gap: 6px; }

.selected-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1522;
}

.selected-remove {
  border: 1px solid var(--danger);
  background: var(--danger);
  color: var(--danger-ink);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.slideshow-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

select {
  margin-left: 6px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface-strong) 85%, transparent);
  color: var(--text);
  padding: 6px;
}

.slide-frame {
  margin-top: 8px;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #060c14;
}

.slide-frame.fullscreen {
  height: calc(100vh - 118px);
  aspect-ratio: auto;
  margin-top: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

#slideImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 12px;
  text-align: center;
}

.welcome-slide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.2;
  font-weight: 750;
  color: #ffffff;
  background: linear-gradient(135deg, #143a6b, #0a1f3b 55%, #1f5a9e);
}

.meta { margin-top: 8px; color: var(--muted); font-size: 13px; }

.slideshow-fullscreen {
  min-height: 100vh;
  overflow: hidden;
}

.slideshow-root {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.slideshow-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.countdown {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.slideshow-root .meta {
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-strong);
}

@media (max-width: 900px) {
  .topbar { width: min(96vw, 860px); margin-top: 12px; }
  .wrap { grid-template-columns: 1fr; width: min(96vw, 860px); margin-top: 10px; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; text-align: center; }
}

.booth-layout {
  grid-template-columns: 1fr 1fr;
}

.booth-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #08111d;
}

#boothCamera {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.booth-countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(80px, 18vw, 170px);
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.2);
}

.strip-canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1726;
}

@media (max-width: 1000px) {
  .booth-layout {
    grid-template-columns: 1fr;
  }
}
