:root {
  --bg: #050816;
  --card: rgba(255,255,255,0.08);
  --card-strong: rgba(255,255,255,0.14);
  --text: #ffffff;
  --muted: #cbd5e1;
  --accent: #00d4ff;
  --accent-2: #8b5cf6;
  --pink: #ff4fd8;
  --gold: #ffd166;
  --danger: #fb7185;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(circle at top left, #12305a, var(--bg) 45%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app { width: min(1180px, 96vw); margin: 0 auto; padding: 28px 0; }
.hero { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: end; margin-bottom: 20px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 2px; font-weight: bold; }
h1 { font-size: clamp(44px, 8vw, 92px); line-height: .9; margin: 0; }
.subtitle { color: var(--muted); font-size: 20px; max-width: 720px; }

.party-box, .camera-card, .gallery-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 20px 70px rgba(0,0,0,0.35);
  border-radius: 26px;
  padding: 18px;
  backdrop-filter: blur(10px);
}

.setup-card {
  padding: 0;
  overflow: hidden;
}
.setup-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  cursor: pointer;
  user-select: none;
}
.setup-card summary::-webkit-details-marker { display: none; }
.setup-card summary strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}
.setup-card summary small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}
.setup-toggle-text {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 800;
}
.setup-card:not([open]) .setup-toggle-text::before {
  content: 'Show ';
}
.setup-card:not([open]) .setup-toggle-text {
  font-size: 0;
}
.setup-card:not([open]) .setup-toggle-text::before {
  font-size: 14px;
}
.setup-fields {
  padding: 0 18px 18px;
}
.setup-card:not([open]) {
  align-self: start;
}

.party-box label { display: block; font-weight: bold; margin: 14px 0 8px; }
.party-box label:first-child { margin-top: 0; }
.party-box input,
.party-box select {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.25);
  color: white;
}
.party-box option { color: black; }
.party-box small { display: block; color: var(--muted); margin-top: 8px; }

.frame-preview {
  position: relative;
  margin-bottom: 14px;
  border-radius: 22px;
  padding: 18px 16px 16px;
  text-align: center;
  border: 2px solid rgba(255,255,255,.2);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.1);
  overflow: hidden;
}
.frame-preview::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  pointer-events: none;
}
.frame-preview span {
  display: block;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
}
.frame-preview strong {
  display: block;
  font-size: clamp(28px, 5vw, 52px);
  line-height: 1;
  margin-top: 6px;
  position: relative;
  z-index: 1;
}
.preview-logo {
  position: absolute;
  top: 10px;
  left: 14px;
  width: min(160px, 38%);
  transform: rotate(-45deg);
  transform-origin: top left;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45));
  opacity: 0.95;
  z-index: 1;
}
.preview-logo.hidden { display: none; }
#previewBrand {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 6px;
}
#previewPartyType {
  font-size: 20px;
}
.preview-layout-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.16);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}
.theme-tailgamer-green {
  background: linear-gradient(135deg, rgba(25,183,79,.28), rgba(0,0,0,.35));
}
.theme-tailgamer-green #previewBrand,
.theme-tailgamer-green #previewPartyType { color: #a3ff6f; }
.theme-tailgamer-red {
  background: linear-gradient(135deg, rgba(220,38,38,.30), rgba(0,0,0,.35));
}
.theme-tailgamer-red #previewBrand,
.theme-tailgamer-red #previewPartyType { color: #ffb4b4; }
.theme-tiara-time-blue {
  background: radial-gradient(circle at top right, rgba(255,255,255,0.20), transparent 28%), linear-gradient(145deg, rgba(52,119,255,.40), rgba(74,144,226,.24), rgba(19,40,92,.35));
}
.theme-tiara-time-blue::before {
  content: '✦  ✧  ✦';
  position: absolute;
  top: 10px;
  right: 18px;
  color: rgba(255,255,255,0.78);
  letter-spacing: 6px;
  font-size: 20px;
}
.theme-tiara-time-blue #previewBrand,
.theme-tiara-time-blue #previewPartyType { color: #dbeafe; }
.theme-tiara-time-blue strong {
  color: #ffffff;
  text-shadow: 0 0 16px rgba(255,255,255,0.32);
}

.stage {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 560px);
  height: auto;
  margin: 0 auto;
  aspect-ratio: 4 / 5;
  max-height: 76vh;
}
video, canvas, .stage-frame-overlay { width: 100%; height: 100%; object-fit: fill; }
video, canvas { background: #000; }
canvas { display: none; }
.stage-frame-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 2; }

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  line-height: 0.92;
  font-size: clamp(56px, 16vw, 170px);
  font-weight: 900;
  color: white;
  text-shadow: 0 10px 40px rgba(0,0,0,0.7);
  background: rgba(0,0,0,0.2);
  z-index: 3;
}
.flash {
  position: absolute;
  inset: 0;
  background: white;
  animation: flash .45s ease-out forwards;
}
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.hidden { display: none !important; }

.controls { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
button {
  border: none;
  border-radius: 999px;
  padding: 16px 28px;
  font-size: 20px;
  font-weight: 800;
  color: white;
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.secondary { background: var(--card-strong); border: 1px solid rgba(255,255,255,0.18); }
.small { padding: 10px 18px; font-size: 15px; }
.status { text-align: center; color: var(--muted); min-height: 24px; }
.camera-help {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.camera-help strong { color: white; }
.camera-help ol,
.camera-help ul { margin: 8px 0 0 22px; }
.camera-help li + li { margin-top: 4px; }

.gallery-card { margin-top: 20px; }
.gallery-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.gallery-header h2 { margin: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.gallery img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 16px; border: 1px solid rgba(255,255,255,0.16); }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
}

/* Guest / sharing buttons */
#emailPhotoBtn, #guestPageBtn {
  background: rgba(255,255,255,0.16);
}
.theme-tiara-time-blue .preview-logo {
  position: static;
  transform: none;
  width: min(280px, 70%);
  margin: 0 auto 6px;
}

/* Combined app / landing / ETA additions */
.top-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
}
.top-nav a,
.top-nav strong {
  color: white;
  text-decoration: none;
  font-weight: 900;
}
.top-nav span { color: var(--muted); }
.landing-app { padding-top: 24px; }
.landing-hero {
  padding: 28px 0 18px;
}
.landing-hero h1 { max-width: 980px; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 22px 0;
}
.tool-card {
  display: block;
  min-height: 270px;
  padding: 24px;
  border-radius: 28px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: white;
  text-decoration: none;
  box-shadow: 0 20px 70px rgba(0,0,0,0.35);
}
.tool-card:hover { transform: translateY(-2px); }
.tool-icon { font-size: 54px; }
.tool-card h2 { font-size: 36px; margin: 18px 0 8px; }
.tool-card p { color: var(--muted); font-size: 18px; line-height: 1.45; }
.code-block {
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(0,0,0,0.38);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
}
.left-text { text-align: left; }

.eta-app label,
.eta-panel label {
  display: block;
  font-weight: 900;
  margin: 14px 0 8px;
}
.eta-app input,
.eta-app textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.25);
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}
.eta-app textarea { resize: vertical; }
.eta-app small { color: var(--muted); display: block; margin-top: 8px; }
.eta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 22px;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 14px;
}
.eta-message-box {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 22px;
  padding: 16px;
}
.eta-controls { justify-content: flex-start; }

@media (max-width: 820px) {
  .tool-grid,
  .eta-grid,
  .two-col { grid-template-columns: 1fr; }
  .tool-card { min-height: auto; }
  .top-nav { border-radius: 18px; }
}


/* Custom frame preview UI */
.custom-frame-preview {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
}
.custom-frame-preview::after,
.custom-frame-preview::before { display: none; }
.frame-preview-header {
  display: flex;
  gap: 16px;
  align-items: center;
}
.frame-thumbnail {
  width: 96px;
  height: 120px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(0,0,0,0.24);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 6px;
  flex: 0 0 auto;
}
#captureLayoutDisplay[readonly] {
  opacity: 0.95;
  cursor: default;
}
.preview-layout-badge { display: inline-block; }

@media (max-width: 820px) {
  .frame-preview-header { align-items: flex-start; }
  .frame-thumbnail { width: 84px; height: 108px; }
}
