:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --panel: #161618;
  --border: #2a2a2e;
  --text: #f2f2f3;
  --muted: #9a9a9f;
  --accent: #f2f2f3;
  --accent-text: #0b0b0c;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

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

#app {
  min-height: 100vh;
}

.state {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.state p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 22rem;
  margin: 0;
}

/* Guest view: one photograph, full-bleed, with a save action anchored below it. */

.capture {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
}

.capture-image {
  width: 100%;
  max-width: 640px;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  background: var(--panel);
}

.capture-bar {
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: center;
}

/* Organiser view: a grid of thumbnails plus a download-all action. */

.event {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.progress {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.thumb {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Operator view: the branding form and its live preview. */

.config {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

.config h1 {
  font-size: 1.25rem;
  margin: 0 0 1.25rem;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.field input[type="file"],
.field input[type="number"] {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  color: var(--text);
  font-size: 0.95rem;
}

.field input[type="color"] {
  width: 4rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  padding: 0;
}

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.warn {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #f2b134;
}

.preview {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}

.preview canvas {
  display: block;
  width: 100%;
  height: auto;
}

.actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#save-status {
  color: var(--muted);
  font-size: 0.9rem;
}
