:root {
  color-scheme: light;
  --bg: #fff9f6;
  --bg-soft: #fff3f7;
  --card: rgba(255, 255, 255, 0.94);
  --card-2: rgba(255, 248, 251, 0.96);
  --border: rgba(214, 177, 108, 0.26);
  --text: #5b3d49;
  --muted: #9b7482;
  --primary: #eda8c4;
  --primary-2: #e38ab0;
  --success: #4fa56d;
  --error: #cc6b84;
  --warning: #d3a34f;
  --shadow: 0 20px 52px rgba(188, 144, 163, 0.18);
  --radius: 24px;
  --gold: #d8b168;
  --gold-soft: rgba(216, 177, 104, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(237, 168, 196, 0.28), transparent 32%),
    radial-gradient(circle at right top, rgba(216, 177, 104, 0.18), transparent 22%),
    linear-gradient(180deg, #fffaf8, #fff3f7 38%, #fff9f4 100%);
  color: var(--text);
}

button, input, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell {
  width: min(1240px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hidden { display: none !important; }
.stack > * + * { margin-top: 14px; }
.eyebrow {
  margin: 0 0 10px;
  color: #c08c2d;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 800;
}
.muted { color: var(--muted); }
.tiny { font-size: 0.88rem; }
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.wrap-gap { flex-wrap: wrap; }
.meta-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.auth-card {
  width: min(560px, 100%);
  margin: 8vh auto 0;
  padding: 32px;
}

.hero {
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.public-hero {
  justify-content: flex-start;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h1, h2, p { margin-top: 0; }
h1 {
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 1.02;
  margin-bottom: 0;
  color: #6c4a58;
}
h2 {
  font-size: 1.18rem;
  margin-bottom: 0;
  color: #805665;
}

.event-fixed-line {
  margin: 12px 0 0;
  color: #b48292;
  font-size: 1.02rem;
  font-weight: 600;
}

form label {
  display: block;
  font-weight: 700;
  color: #7a5966;
}

input[type="password"] {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(216, 177, 104, 0.34);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

input[type="password"]::placeholder {
  color: #c09aa7;
}

button,
.capture-button,
.link-button {
  border: none;
  border-radius: 18px;
  padding: 13px 16px;
  font-weight: 800;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

button:hover,
.capture-button:hover,
.link-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(227, 138, 176, 0.18);
}
button:disabled,
.capture-button.disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: white;
}

.secondary, .link-button {
  background: rgba(255,255,255,0.74);
  color: var(--text);
  border: 1px solid rgba(216, 177, 104, 0.28);
}

.ghost, .small-link {
  background: rgba(255,255,255,0.5);
  color: var(--text);
  border: 1px solid rgba(216, 177, 104, 0.34);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.8);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}
.badge.live { background: rgba(79, 165, 109, 0.16); color: #3f7d54; }
.badge.waiting { background: rgba(216, 177, 104, 0.16); color: #8b6420; }
.badge.ended { background: rgba(204, 107, 132, 0.16); color: #a05568; }

.grid-top {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-top > .card,
.gallery-card { padding: 22px; }

.capture-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.capture-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.camera-box {
  position: relative;
  min-height: 300px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.76), rgba(255,244,248,0.95));
  border: 1px solid rgba(216, 177, 104, 0.24);
}

.camera-placeholder,
.admin-placeholder {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  padding: 18px;
}

#cameraPreview,
#photoCanvas { width: 100%; display: block; background: #23181d; }

.notice,
.upload-message,
.error,
.empty-state {
  border-radius: 16px;
  padding: 12px 14px;
}
.notice,
.empty-state {
  background: rgba(255,255,255,0.62);
  color: var(--muted);
  border: 1px solid rgba(216, 177, 104, 0.16);
}
.error,
.upload-message.error {
  background: rgba(204, 107, 132, 0.14);
  color: #9a4760;
}
.upload-message.info {
  background: rgba(237, 168, 196, 0.18);
  color: #9d5f78;
}
.upload-message.success {
  background: rgba(79, 165, 109, 0.16);
  color: #3f7d54;
}

.gallery-card { margin-top: 18px; }
.gallery {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.media-card {
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(216, 177, 104, 0.18);
  border-radius: 22px;
  overflow: hidden;
}

.media-frame {
  background: rgba(255, 240, 246, 0.7);
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-frame img,
.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-meta {
  padding: 12px 14px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pill,
.mini-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--gold-soft);
  color: #8c6320;
  font-weight: 800;
}

.mini-pill {
  font-size: 0.76rem;
  padding: 5px 8px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-approved { background: rgba(79, 165, 109, 0.16); color: #3f7d54; }
.status-pending { background: rgba(216, 177, 104, 0.16); color: #8b6420; }
.status-hidden { background: rgba(237, 168, 196, 0.18); color: #9d5f78; }
.status-rejected { background: rgba(204, 107, 132, 0.16); color: #a05568; }

.admin-hero { margin-bottom: 18px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card strong { font-size: 1.7rem; }

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-btn {
  background: rgba(255,255,255,0.74);
  color: var(--text);
  border: 1px solid rgba(216, 177, 104, 0.24);
}
.filter-btn.active {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  color: white;
}

.admin-gallery {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.admin-card {
  display: flex;
  flex-direction: column;
}

.admin-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.filename {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.bottom-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  padding-bottom: 12px;
}

.logout-bottom {
  min-width: 180px;
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .grid-top {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100vw - 16px, 1240px);
    padding-top: 16px;
  }

  .hero,
  .grid-top > .card,
  .gallery-card,
  .auth-card {
    padding: 18px;
  }

  .capture-grid,
  .capture-grid.three,
  .admin-actions,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .admin-card-head {
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .admin-gallery {
    grid-template-columns: 1fr;
  }

  .camera-box,
  .camera-placeholder,
  .admin-placeholder {
    min-height: 240px;
  }
}
