* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --dark:         #1a1836;
  --dark-mid:     #252248;
  --purple:       #b2a2b6;
  --purple-light: #d4c8d8;
  --purple-dim:   #3a3358;
  --gold:         #f0c040;
  --gold-dark:    #c8a030;
  --white:        #ffffff;
  --off-white:    #f4f1f8;
  --card:         #ffffff;
  --text:         #1a1836;
  --muted:        #6b6080;
  --radius:       16px;
}

html, body {
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--off-white);
  color: var(--text);
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
header {
  background: var(--dark);
  color: var(--white);
  text-align: center;
  padding: 16px 20px 28px;
  position: relative;
}

.lang-switcher {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 14px;
}

.lang-btn {
  background: rgba(255,255,255,0.1);
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.lang-btn:hover { background: rgba(255,255,255,0.2); }
.lang-btn.active {
  border-color: var(--purple);
  background: rgba(178,162,182,0.25);
  transform: scale(1.1);
}

/* Spejdernes Lejr logo */
.sl-logo {
  display: block;
  height: 64px;
  width: auto;
  margin: 0 auto 16px;
  object-fit: contain;
}

.activity-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dark);
  background: var(--gold);
  border-radius: 20px;
  padding: 4px 14px;
  margin-bottom: 14px;
}

/* Decorative divider — matches their brand stripe */
.header-stripe {
  width: 80px;
  height: 3px;
  background: var(--purple);
  border-radius: 2px;
  margin: 10px auto 14px;
}

.tagline {
  font-size: 1rem;
  color: var(--purple-light);
  letter-spacing: 0.2px;
}

/* ─── CAFÉ GATE ──────────────────────────────────────────────────────────── */
.cafe-gate {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.cafe-inner {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(26,24,54,0.12);
  border-top: 4px solid var(--gold);
}

.cafe-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.cafe-inner h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 12px;
}

.cafe-inner p {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.cafe-badge {
  display: inline-block;
  background: var(--dark);
  color: var(--gold);
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* ─── MAIN ───────────────────────────────────────────────────────────────── */
main {
  max-width: 520px;
  margin: 0 auto;
  padding: 28px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── STEP CARD ──────────────────────────────────────────────────────────── */
.step {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: 0 2px 16px rgba(26,24,54,0.10);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--dark);
  color: var(--white);
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 12px;
}

.step h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--dark);
}

.step p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ─── CAMERA ─────────────────────────────────────────────────────────────── */
.camera-area {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--dark);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
  cursor: pointer;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--purple);
  gap: 10px;
}

.camera-placeholder span { font-size: 3.5rem; }

.camera-placeholder p {
  font-size: 1rem;
  color: var(--purple-light);
  margin: 0;
}

#video, #preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  gap: 6px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--dark);
  color: var(--white);
  flex: 1;
}

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

.btn-secondary {
  background: var(--off-white);
  color: var(--dark);
  flex: 1;
  border: 1.5px solid #ddd;
}

.btn-secondary:hover { background: #ece8f4; border-color: var(--purple); }

.btn-large {
  padding: 16px 24px;
  font-size: 1.05rem;
  width: 100%;
}

/* ─── TEXTAREA ───────────────────────────────────────────────────────────── */
textarea {
  width: 100%;
  padding: 14px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
  transition: border-color 0.2s;
  margin-bottom: 6px;
}

textarea:focus {
  outline: none;
  border-color: var(--purple);
}

.char-count {
  text-align: right;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ─── LOADING ────────────────────────────────────────────────────────────── */
.loading {
  background: var(--dark);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  box-shadow: 0 2px 16px rgba(26,24,54,0.15);
}

.spinner {
  width: 56px;
  height: 56px;
  border: 5px solid rgba(178,162,182,0.25);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading h2 {
  font-size: 1.3rem;
  color: var(--white);
  margin-bottom: 8px;
}

.loading p {
  color: var(--purple-light);
  margin-bottom: 24px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  max-width: 280px;
  margin: 0 auto;
}

.loading-step {
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--purple);
  font-size: 0.9rem;
  transition: background 0.4s, color 0.4s;
}

.loading-step.active {
  background: rgba(178,162,182,0.2);
  color: var(--white);
  font-weight: 600;
}

.loading-step.done {
  background: rgba(178,162,182,0.12);
  color: var(--purple);
}

/* ─── RESULT ─────────────────────────────────────────────────────────────── */
.result-section {
  border-top: 4px solid var(--gold);
}

.result-section .step-number {
  background: var(--gold);
  color: var(--dark);
  font-size: 1.2rem;
  width: 44px;
  height: 44px;
}

.result-section h2 {
  font-size: 1.5rem;
  color: var(--dark);
  margin-bottom: 12px;
}

.invention-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--dark-mid);
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: -0.2px;
  min-height: 1.6em;
}

.result-image-wrap {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 6px 24px rgba(26,24,54,0.18);
}

.result-image-wrap img {
  width: 100%;
  display: block;
}

.poem-box {
  background: var(--dark);
  border-radius: 12px;
  padding: 20px 22px;
  margin: 4px 0 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.poem-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--purple);
}

.poem-icon {
  font-size: 1.2rem;
  color: var(--purple);
  margin-bottom: 10px;
}

.poem-box p {
  font-size: 1rem;
  line-height: 1.9;
  color: var(--purple-light);
  font-style: italic;
  white-space: pre-line;
  margin: 0;
}

/* ─── PROMPT DETAILS ─────────────────────────────────────────────────────── */
.prompt-details {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.prompt-details summary {
  cursor: pointer;
  color: var(--purple);
  font-weight: 600;
  margin-bottom: 8px;
}

.prompt-details p {
  line-height: 1.6;
  font-style: italic;
}

/* ─── FOOTER ─────────────────────────────────────────────────────────────── */
footer {
  background: var(--dark);
  text-align: center;
  padding: 24px 20px;
  font-size: 0.82rem;
  color: var(--purple);
}

footer img {
  height: 28px;
  display: block;
  margin: 0 auto 10px;
  opacity: 0.7;
}

.footer-activity {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 400px) {
  .sl-logo { height: 48px; }
  .step h2  { font-size: 1.1rem; }
  .btn      { font-size: 0.88rem; padding: 11px 14px; }
}
