:root {
  --bg: #0f1115;
  --card: #171a21;
  --text: #f2f3f5;
  --muted: #9aa0ac;
  --accent: #ff5a5f;
  --accent-dark: #e14448;
  --border: #262a33;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.center {
  text-align: center;
}

h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.2rem; margin: 24px 0 12px; }
p.muted { color: var(--muted); margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
}

.btn:hover { background: var(--accent-dark); }

.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.small { width: auto; padding: 8px 14px; font-size: 0.85rem; }
.btn.danger { background: #b3261e; }

.actions { display: grid; gap: 12px; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 0.9rem; color: var(--muted); }
.field label .counter { float: right; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0c0e12;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.field textarea { resize: vertical; min-height: 70px; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert.error { background: rgba(179,38,30,0.15); border: 1px solid #b3261e; color: #ff9d97; }
.alert.success { background: rgba(60,179,113,0.15); border: 1px solid #3cb371; color: #9be8b8; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.gallery a, .gallery .thumb-wrap { display: block; position: relative; }
.gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.gallery .delete-form {
  position: absolute;
  top: 4px;
  right: 4px;
}
.gallery .delete-form button {
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 0.8rem;
  cursor: pointer;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.topbar a { color: var(--text); text-decoration: none; }
.topbar .brand { font-weight: 700; }

.event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.event-row:last-child { border-bottom: none; }
.event-row a { color: var(--text); }
.event-row .meta { color: var(--muted); font-size: 0.85rem; }

.link-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

#qr-box { display: flex; justify-content: center; padding: 16px; background: #fff; border-radius: 12px; }

.empty { color: var(--muted); text-align: center; padding: 32px 0; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: var(--border);
  transition: 0.2s;
  border-radius: 999px;
}
.switch .slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: 0.2s;
  border-radius: 50%;
}
.switch input:checked + .slider { background-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.progress-wrap[hidden] { display: none; }
.progress-wrap {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-track {
  flex: 1;
  height: 8px;
  background: #0c0e12;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}
.progress-label {
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 36px;
  text-align: right;
}

.btn.tint-purple {
  background: rgba(168, 85, 247, 0.16);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c9a3fb;
}
.btn.tint-purple:hover { background: rgba(168, 85, 247, 0.24); }

.btn.tint-blue {
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c1fb;
}
.btn.tint-blue:hover { background: rgba(59, 130, 246, 0.24); }

.btn.success { background: #2f9e58; }
.btn.success:hover { background: #278a4c; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { background: inherit; }

.preview-wrap[hidden] { display: none; }
.preview-wrap {
  position: relative;
  margin-top: 14px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.preview-wrap img { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.preview-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.album-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.album-header .muted {
  margin-left: auto;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.85rem;
}
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  animation: live-pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.gallery.small img { aspect-ratio: 1 / 1; }
.photo-caption {
  padding: 6px 2px 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.photo-caption strong { color: var(--text); }
