:root {
  --bg: #faf6f1;
  --bg-bottom: #f3e9dc;
  --surface: #ffffff;
  --ink: #2b2118;
  --ink-mid: #4a3f33;
  --ink-soft: #7a6a5a;
  --accent: #c9a47a;
  --accent-soft: #e8d6c0;
  --accent-dark: #b9926a;
  --rose: #d49a8a;
  --success: #7a9b7a;
  --error: #b8554a;
  --shadow-soft: 0 8px 30px rgba(43, 33, 24, 0.08);
  --shadow-press: 0 2px 8px rgba(43, 33, 24, 0.12);
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  --radius: 20px;
  --radius-lg: 24px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% 0%, #fffaf3 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 22px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  margin-top: 8px;
}

.hero-portrait {
  display: block;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 22px;
  border: 2px solid var(--accent);
  box-shadow: 0 12px 36px rgba(43, 33, 24, 0.12), 0 0 0 5px rgba(232, 214, 192, 0.4);
  background: var(--accent-soft);
}

.hero-occasion {
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  color: var(--ink-mid);
  margin: 0 0 12px;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(38px, 10vw, 50px);
  letter-spacing: 0.01em;
  margin: 0 0 14px;
  color: var(--ink);
}

.hero-date {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink-mid);
  margin: 0 0 4px;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.hero-location {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink-mid);
  margin: 0 0 20px;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.hero-divider {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  margin: 0 auto;
  opacity: 0.65;
}

/* ── Intro ──────────────────────────────────────────────────────────── */
.intro { text-align: center; }

.intro-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}

/* ── Name field ─────────────────────────────────────────────────────── */
.name-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.name-label {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}

.name-optional {
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: var(--ink-soft);
  opacity: 0.7;
}

.name-input {
  font-family: var(--serif);
  font-size: 18px;
  padding: 14px 18px;
  border: 1.5px solid var(--accent-soft);
  background: var(--surface);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: center;
  outline: none;
  transition: border-color 150ms ease-out;
}

.name-input:focus { border-color: var(--accent); }

.name-input::placeholder {
  color: var(--ink-soft);
  opacity: 0.5;
  font-style: italic;
}

/* ── Upload button (Kreis, wie Kamera) ─────────────────────────────── */
.capture {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.cam-button {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 14px 32px rgba(43, 33, 24, 0.14),
    0 4px 10px rgba(201, 164, 122, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: transform 140ms ease-out, box-shadow 200ms ease-out, background 200ms ease-out;
  user-select: none;
}

@media (hover: hover) {
  .cam-button:hover {
    background: var(--accent-soft);
    box-shadow:
      0 18px 40px rgba(43, 33, 24, 0.18),
      0 6px 14px rgba(201, 164, 122, 0.30),
      inset 0 1px 0 rgba(255, 255, 255, 0.7);
  }
}

.cam-button:active {
  transform: scale(0.97);
  box-shadow:
    0 6px 14px rgba(43, 33, 24, 0.14),
    0 2px 6px rgba(201, 164, 122, 0.20);
}

.cam-caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0;
}

/* ── Modal-Backdrop (umschließt Progress, Success, Error) ──────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 33, 24, 0.28);
  -webkit-backdrop-filter: blur(12px) saturate(115%);
  backdrop-filter: blur(12px) saturate(115%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 90;
  animation: backdrop-in 220ms ease-out;
}

.modal-backdrop[hidden] { display: none; }

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 380px;
  animation: modal-in 280ms cubic-bezier(0.2, 0.8, 0.3, 1);
  margin-top: 0 !important;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

body.modal-open {
  overflow: hidden;
}

/* ── Progress ───────────────────────────────────────────────────────── */
.progress-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.progress-section[hidden] { display: none; }

.progress-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  margin: 0;
  text-align: center;
  color: var(--ink);
}

.progress-bar {
  height: 8px;
  background: var(--accent-soft);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-radius: 999px;
  transition: width 240ms ease-out;
}

.progress-status {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-align: center;
  margin: 0;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.file-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--bg);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.file-size {
  font-size: 11px;
  opacity: 0.7;
}

.file-state {
  font-size: 14px;
  font-weight: 600;
}

.file-pending .file-state { color: var(--accent); }
.file-ok .file-state { color: var(--success); }
.file-error .file-state { color: var(--error); }

/* ── Success / Done card ────────────────────────────────────────────── */
.done-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.done-card[hidden] { display: none; }

.done-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  margin: 0;
  color: var(--ink);
}

.done-card p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.4;
  max-width: 32ch;
}

/* ── Error card ─────────────────────────────────────────────────────── */
.error-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  border: 1px solid rgba(184, 85, 74, 0.18);
}

.error-card[hidden] { display: none; }

.error-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  margin: 0;
  color: var(--ink);
}

.error-card p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.4;
  max-width: 32ch;
}

.error-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.primary-btn {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 22px;
  cursor: pointer;
  transition: background 150ms ease-out, transform 120ms ease-out;
}

@media (hover: hover) {
  .primary-btn:hover { background: var(--accent-dark); }
}
.primary-btn:active { transform: scale(0.98); }
.primary-btn[hidden] { display: none; }

.ghost-btn {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--accent-soft);
  border-radius: var(--radius);
  padding: 12px 22px;
  cursor: pointer;
  transition: background 150ms ease-out, color 150ms ease-out;
}

@media (hover: hover) {
  .ghost-btn:hover {
    background: var(--accent-soft);
    color: var(--ink);
  }
}

/* ── Queue-Badge (Hintergrund-Uploads) ─────────────────────────────── */
.queue-badge {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  box-shadow: 0 6px 22px rgba(43, 33, 24, 0.14);
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-mid);
  z-index: 70;
  animation: queue-in 320ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.queue-badge[hidden] { display: none; }

.queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
  animation: dot-pulse 1.4s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

@keyframes queue-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Forbidden overlay ─────────────────────────────────────────────── */
.forbidden-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  z-index: 100;
}

.forbidden-overlay[hidden] { display: none; }

.forbidden-inner {
  max-width: 380px;
  text-align: center;
}

.forbidden-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  margin: 0 0 12px;
  color: var(--ink);
}

.forbidden-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}

/* ── Motion ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cam-button,
  .progress-fill {
    transition: none !important;
  }
}

@media (max-width: 360px) {
  .hero-portrait { width: 124px; height: 124px; }
  .hero-title { font-size: 36px; }
  .hero-occasion { font-size: 22px; }
  .hero-date,
  .hero-location { font-size: 20px; }
  .cam-button { width: 124px; height: 124px; }
}
