/* ============================================================
   CHARGED BY BEAUTY — Peugeot E-408 Foto App
   Prototyp-Styling · mobile-first
   Schrift: Inter (nahe Peugeot New) + Montserrat für Display
   Farben: Peugeot-Blau #00267F, tiefes Anthrazit, Weiß
   ============================================================ */

:root {
  --peugeot-blue: #00267F;
  --peugeot-blue-dark: #001B5C;
  --bg: #0A0A0A;
  --bg-elevated: #161616;
  --bg-card: #1E1E1E;
  --border: #2A2A2A;
  --text: #FFFFFF;
  --text-muted: #A0A0A0;
  --text-dim: #6E6E6E;
  --accent: #FFFFFF;
  --danger: #E53935;
  --radius: 12px;
  --radius-lg: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body {
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: calc(20px + var(--safe-top)) 20px 120px;
  position: relative;
}

/* ---------- STEP SYSTEM ---------- */
.step {
  display: none;
  animation: fadeIn 0.35s ease;
}
.step.is-active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- TYPOGRAFIE ---------- */
.display {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: clamp(44px, 12vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 24px 0 12px;
  text-transform: uppercase;
}

h2 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 8px 0 8px;
  text-transform: uppercase;
}

.lead {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 4px;
}

.sub {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.small {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- WELCOME HERO (Lifestyle-Bild) ---------- */
.welcome-hero {
  position: relative;
  margin: -20px -20px -80px;
  padding: 0;
  background: #0A0A0A;
  aspect-ratio: 1181 / 827;
  overflow: hidden;
  /* Weicher Auslauf nach unten: das Bild verschmilzt sanft in den schwarzen App-Background. */
  -webkit-mask-image: linear-gradient(180deg, #000 60%, rgba(0,0,0,0.9) 80%, rgba(0,0,0,0) 100%);
          mask-image: linear-gradient(180deg, #000 60%, rgba(0,0,0,0.9) 80%, rgba(0,0,0,0) 100%);
}
.car-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}

/* ---------- PRIZE STICKER (Störer) ---------- */
.prize-sticker {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 168px;
  height: 168px;
  padding: 16px 14px;
  background: var(--peugeot-blue);
  color: #FFFFFF;
  border: none;
  border-radius: 58% 42% 54% 46% / 48% 54% 46% 52%;
  transform: rotate(-9deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  box-shadow: 0 14px 32px rgba(0, 38, 127, 0.5);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  animation: stickerWobble 5s ease-in-out infinite;
  z-index: 2;
  transition: transform 0.2s ease;
}
.prize-sticker:hover,
.prize-sticker:active {
  transform: rotate(-5deg) scale(1.05);
}
.prize-sticker-tag {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.92;
}
.prize-sticker strong {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 13px;
  line-height: 1.18;
  letter-spacing: -0.01em;
  text-transform: none;
}
.prize-sticker-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.92;
  margin-top: 2px;
}
@keyframes stickerWobble {
  0%, 100% { transform: rotate(-9deg); }
  50%      { transform: rotate(-6deg); }
}

/* ---------- TITLE ROW (Logo + Headline) ---------- */
.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 4px;
}
.logo-title {
  /* Höhe = Höhe der 2-zeiligen Headline (line-height 0.95 × 2 × font-size) */
  height: calc(2 * clamp(36px, 10vw, 52px) * 0.95);
  width: auto;
  flex-shrink: 0;
  display: block;
}
.title-row .display {
  margin: 0;
  font-size: clamp(36px, 10vw, 52px);
  flex: 1;
  min-width: 0;
}

/* ---------- WELCOME ---------- */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 24px 0 20px;
}

.logo-big {
  width: 56px;
  height: auto;
  margin-bottom: 4px;
}

.welcome .display { margin-top: 4px; }

.welcome .btn { margin-top: 24px; width: 100%; }

/* ---------- PRIZE CARD ---------- */
.prize-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(135deg, var(--peugeot-blue) 0%, var(--peugeot-blue-dark) 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-top: 24px;
  box-shadow: 0 8px 24px rgba(0, 38, 127, 0.3);
}
.prize-card strong {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.prize-card span:not(.prize-tag) {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}
.prize-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  width: fit-content;
  margin-bottom: 4px;
}

.prize-reminder {
  background: rgba(0, 38, 127, 0.12);
  border: 1px solid rgba(0, 38, 127, 0.4);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
.prize-reminder strong {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #FFFFFF;
  letter-spacing: 0.02em;
}
.prize-reminder span {
  color: var(--text-muted);
}
.prize-reminder span strong {
  font-family: inherit;
  color: var(--text);
  font-weight: 600;
}

.check a {
  color: var(--text);
  text-decoration: underline;
}

/* ---------- TOP BAR ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.btn-back {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}
.btn-back:hover, .btn-back:active { background: var(--bg-elevated); }

/* ---------- UPLOADER ---------- */
.uploader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  min-height: 280px;
  transition: border-color 0.2s, background 0.2s;
}
.uploader:hover, .uploader:active {
  border-color: var(--peugeot-blue);
  background: var(--bg-card);
}
.upload-ico {
  width: 48px;
  height: 48px;
  color: var(--text);
  margin-bottom: 8px;
}
.uploader-cta {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.uploader-hint {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- FORM ---------- */
.field {
  display: block;
  margin-bottom: 20px;
}
.field .label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.field input[type="text"],
.field textarea,
.field select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;
  resize: vertical;
  transition: border-color 0.2s, background 0.2s;
}
.field textarea { min-height: 80px; }
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23A0A0A0'><path d='M5 8l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--peugeot-blue);
  background: var(--bg-card);
}
.field-hint {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

.check {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 24px 0;
  cursor: pointer;
  user-select: none;
}
.check input { margin-top: 2px; accent-color: var(--peugeot-blue); width: 20px; height: 20px; }
.check em { color: var(--text-dim); font-style: italic; }

/* ---------- PHOTO PREVIEW ---------- */
.photo-preview {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 0 24px;
  display: grid;
  place-items: center;
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- CANVAS OUTPUT ---------- */
.canvas-wrap {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 0 20px;
  display: grid;
  place-items: center;
}
#output-canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.caption-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}
.caption-head {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.caption-body {
  font-size: 14px;
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: 12px;
  color: var(--text);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 18px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 12px;
  transition: transform 0.1s, background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--peugeot-blue);
  color: #FFFFFF;
}
.btn-primary:not(:disabled):hover { background: var(--peugeot-blue-dark); }

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  padding: 14px 20px;
}
.btn-ghost:hover { color: var(--text); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--peugeot-blue);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 1000;
  max-width: calc(100% - 40px);
  text-align: center;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- FOOTER ---------- */
.app-footer {
  padding: 24px 20px 32px;
  border-top: 1px solid var(--border);
  background: #050505;
}
.app-footer .legal {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-dim);
  text-align: center;
}
.app-footer .legal-brand {
  color: var(--text-muted);
  font-size: 12px;
}
.app-footer .legal-brand strong {
  color: var(--text);
  font-weight: 600;
}
.app-footer .legal-copy {
  font-size: 10.5px;
  color: var(--text-dim);
}
.app-footer .legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  margin-top: 2px;
}
.app-footer .legal-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
}
.app-footer .legal-links a:hover { color: var(--text); text-decoration: underline; }
.app-footer .legal-links span { color: var(--text-dim); }

/* ---------- LOADING ---------- */
.is-loading {
  pointer-events: none;
  opacity: 0.6;
}

/* ============================================================
   LEGAL PAGES (Impressum, Datenschutz, Teilnahmebedingungen)
   Editorial-Stil: ruhig, gut lesbar, wenig visueller Lärm.
   ============================================================ */
body.legal {
  background: var(--bg);
}
.legal-page {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(28px + var(--safe-top)) 22px 60px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  text-align: left;
}
.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 28px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}
.legal-back:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

/* Seitentitel — dezent, keine UPPERCASE, keine Black */
.legal-page h1 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 5.5vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  color: var(--text);
  text-transform: none;
}
.legal-page .legal-subtitle {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: clamp(15px, 3.5vw, 17px);
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Abschnittstitel — ruhig, klare Hierarchie */
.legal-page h2 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: none;
  margin: 32px 0 8px;
  color: var(--text);
}

.legal-page p,
.legal-page li {
  color: var(--text-muted);
  margin: 0 0 12px;
}
.legal-page strong {
  color: var(--text);
  font-weight: 600;
}
.legal-page a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}
.legal-page a:hover {
  text-decoration-color: var(--peugeot-blue);
}
.legal-page ul,
.legal-page ol {
  padding-left: 20px;
  margin: 0 0 16px;
}
.legal-page li {
  margin-bottom: 6px;
}

/* Meta-Zeile (Stand / Offenlegung) */
.legal-meta {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0;
  text-transform: none;
  margin: 14px 0 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
