/* ---- HopeHub general: universelles (mobil+desktop) Frontend im Futurum-Stil ---- */

* {
  box-sizing: border-box;
}

:root {
  --background: #ffffff;
  --foreground: #1a1a2e;
  --surface: #f8f9fc;
  --surface-muted: #f0f2f8;

  --primary: #1a8bc9;
  --primary-foreground: #ffffff;
  --primary-dark: #02608f;

  --secondary: #5a1c6b;
  --secondary-foreground: #ffffff;

  --accent-himbeere: #9a0f40;
  --accent-himbeere-dark: #7a0c33;
  --accent-sonnenblume: #d48900;
  --accent-himmel: #4eb5e3;
  --accent-kuerbis: #d85a30;
  --accent-pink: #d43d6b;

  --muted: #e8eaf0;
  --muted-foreground: #4b5563;

  --border: #d4d8e2;
  --ring: #1a8bc9;

  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  --control-row-height: 2.75rem;

  --font-heading: "Segoe UI", "Helvetica Neue", "Trebuchet MS", Arial, sans-serif;
  --font-body: Arial, Helvetica, sans-serif;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

*:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Header / Footer ---- */
.hopehub-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
}

.hopehub-header-inner {
  max-width: 90rem;
  margin: 0 auto;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
}

.hopehub-header-title {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--foreground);
  margin: 0;
}

.hopehub-footer {
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-family: var(--font-body);
  font-size: 0.8125rem;
}

.hopehub-footer-inner {
  max-width: 90rem;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

/* ---- Layout: mobil einspaltig gestapelt + scrollbar (Default) ---- */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding: 0.75rem;
  max-width: 90rem;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 640px) {
  .app {
    gap: 1rem;
    padding: 1.25rem;
  }
}

/* ---- Desktop/breit: zweispaltig (Video links gro\u00df, rechts Schritte + Steuerung) ---- */
@media (min-width: 1024px) {
  .app {
    grid-template-columns: minmax(0, 2.2fr) minmax(20rem, 1fr);
    grid-template-rows: min-content 1fr;
    grid-template-areas:
      "video steps"
      "video controls";
    align-content: start;
  }

  .video-panel { grid-area: video; align-self: start; }
  #stepsSection { grid-area: steps; }
  #controlsSection { grid-area: controls; align-self: start; }
}

/* ---- Video: aspect-ratio statt fixer H\u00f6he; mobil hochformat-freundlicher ---- */
.video-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface-muted);
  width: 100%;
  aspect-ratio: 4 / 3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.video-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  z-index: 2;
}

@media (min-width: 640px) {
  .video-panel { aspect-ratio: 16 / 9; }
}

#avatarVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: var(--surface-muted);
}

/* ---- Untertitel: Overlay unten im Video, per Checkbox schaltbar ---- */
.subtitle-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  max-height: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(10, 12, 24, 0.82), rgba(10, 12, 24, 0.45) 70%, rgba(10, 12, 24, 0));
  overflow: hidden;
}

body.subtitles-hidden .subtitle-panel {
  display: none;
}

.subtitle-panel .subtitle-text {
  width: 100%;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  min-height: 1.5em;
}

/* ---- Steps-Panel ---- */
.steps-panel {
  height: fit-content;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: white;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.steps-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  color: var(--foreground);
}

.steps-panel ol {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--foreground);
}

/* ---- Controls ---- */
.controls {
  height: fit-content;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: stretch;
  padding: 1.25rem;
  border-radius: var(--radius-xl);
  background: white;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.btn {
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--primary);
  padding: 0 1.25rem;
  height: var(--control-row-height);
  font-size: 1rem;
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover:not(:disabled) {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn.danger {
  background: var(--accent-himbeere);
  color: white;
  border-color: var(--accent-himbeere);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn.danger:hover:not(:disabled) {
  background: var(--accent-himbeere-dark);
  border-color: var(--accent-himbeere-dark);
}

.btn.vad-active {
  border-color: var(--accent-himmel);
  box-shadow: 0 0 8px rgba(78, 181, 227, 0.25);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn.vad-idle {
  border-color: var(--border);
  box-shadow: none;
}

/* ---- Select + Checkbox-Wrap ---- */
.select-wrap,
.check-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--foreground);
  padding: 0 0.875rem;
  height: var(--control-row-height);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 500;
}

.select-wrap select {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  padding: 0.375rem 0.5rem;
}

.check-wrap {
  cursor: pointer;
}

.check-wrap input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---- Statusanzeige ---- */
.controls-status {
  flex: 1 0 0;
  min-width: 0;
  width: 100%;
  height: var(--control-row-height);
  min-height: var(--control-row-height);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--foreground);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Mobil: Controls voll umbrechen ---- */
@media (max-width: 640px) {
  .controls {
    gap: 0.625rem;
  }

  .btn,
  .select-wrap,
  .check-wrap {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
    min-height: var(--control-row-height);
    font-size: 0.9375rem;
  }

  .select-wrap,
  .check-wrap {
    justify-content: space-between;
  }

  .select-wrap select {
    font-size: 16px;
    max-width: 52%;
  }

  .controls-status {
    flex: 1 1 100%;
    order: 999;
    justify-content: center;
    margin-top: 0.25rem;
  }
}
