/* ============================================================
   Übungs-Engine – Styles
   Dunkel, warm, ruhig. Für sensible psychologische Kontexte.
   ============================================================ */

:root {
  /* Farben – warme, gedämpfte Palette */
  --bg-deepest:    #12100e;
  --bg-base:       #1a1410;
  --bg-raised:     #221a15;
  --bg-card:       #2a211b;

  --text-primary:  #f2ebe1;
  --text-secondary:#c2b6a6;
  --text-muted:    #8a7f72;

  --accent:        #d4a574;      /* warmes Altgold */
  --accent-soft:   #b8895a;
  --accent-glow:   rgba(212, 165, 116, 0.15);

  --border-subtle: rgba(242, 235, 225, 0.08);
  --border-medium: rgba(242, 235, 225, 0.14);

  /* Timings */
  --t-fast:   200ms;
  --t-medium: 400ms;
  --t-slow:   700ms;
  --ease:     cubic-bezier(0.4, 0, 0.2, 1);
  --ease-soft: cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  /* Weicher radialer Hintergrund für Atmosphäre */
  background:
    radial-gradient(ellipse at top, #2a1f16 0%, var(--bg-base) 55%, var(--bg-deepest) 100%);
  min-height: 100vh;
  min-height: 100dvh;
}

.app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ============================================================
   Screens – grundsätzliches Layout
   ============================================================ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-slow) var(--ease-soft), visibility var(--t-slow) var(--ease-soft);
  pointer-events: none;
}

.screen.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ============================================================
   Start-Screen
   ============================================================ */
.screen--start .start-inner {
  max-width: 440px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.start-title {
  font-size: clamp(1.75rem, 6vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.2;
  margin: 0;
  color: var(--text-primary);
}

.start-description {
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  max-width: 380px;
}

.start-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  max-width: 320px;
  line-height: 1.5;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  padding: 18px 48px;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: 999px;
  cursor: pointer;
  min-width: 200px;
  min-height: 56px;
  transition: transform var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              box-shadow var(--t-medium) var(--ease);
  box-shadow: 0 0 0 0 var(--accent-glow);
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--accent-soft);
  box-shadow: 0 0 40px 4px var(--accent-glow);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  padding: 16px 36px;
  font-size: 0.95rem;
  font-weight: 400;
  border-radius: 999px;
  cursor: pointer;
  min-height: 52px;
  transition: all var(--t-fast) var(--ease);
}

.btn-secondary:hover {
  background: var(--bg-raised);
  border-color: var(--accent);
}

/* ============================================================
   Play-Screen: Video-Bühne
   ============================================================ */
.screen--play {
  padding: 0;
  justify-content: space-between;
}

.video-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.video-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease-soft);
  background: var(--bg-base);
}

.video-layer.is-active {
  opacity: 1;
}

/* Wenn gar kein Video sichtbar ist, zeigt der Hintergrund einen weichen Glow */
.video-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(212, 165, 116, 0.06) 0%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 1;
}

/* Subtiler Vignetten-Overlay – macht Videos weicher */
.video-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(18, 16, 14, 0.45) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* ============================================================
   Play-Screen: Statusleiste (Fortschritt)
   ============================================================ */
.status-bar {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 20px 24px 0;
}

.progress-track {
  width: 100%;
  height: 2px;
  background: var(--border-subtle);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--t-medium) linear;
  opacity: 0.7;
}

/* ============================================================
   Play-Screen: Controls
   ============================================================ */
.controls {
  position: relative;
  z-index: 10;
  padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.btn-playpause {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(42, 33, 27, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-medium) var(--ease);
  position: relative;
}

.btn-playpause:hover {
  border-color: var(--accent);
}

.btn-playpause:active {
  transform: scale(0.96);
}

.btn-playpause .icon {
  position: absolute;
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: opacity var(--t-medium) var(--ease);
}

.btn-playpause .icon-play { opacity: 0; }
.btn-playpause.is-paused .icon-play { opacity: 1; }
.btn-playpause.is-paused .icon-pause { opacity: 0; }

.btn-close {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  right: 20px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(26, 20, 16, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-medium) var(--ease);
  padding: 0;
}

.btn-close svg {
  width: 20px;
  height: 20px;
}

.btn-close:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* ============================================================
   Frage-Overlay
   ============================================================ */
.question-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(18, 16, 14, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-slow) var(--ease-soft), visibility var(--t-slow) var(--ease-soft);
}

.question-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.question-card {
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
  text-align: center;
}

.question-text {
  font-size: clamp(1.3rem, 4.5vw, 1.6rem);
  font-weight: 300;
  line-height: 1.4;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.01em;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-option {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 20px 24px;
  font-size: 1rem;
  font-weight: 400;
  border-radius: 14px;
  cursor: pointer;
  min-height: 60px;
  transition: all var(--t-fast) var(--ease);
  text-align: center;
  font-family: inherit;
}

.question-option:hover {
  background: var(--bg-raised);
  border-color: var(--accent);
  color: var(--accent);
}

.question-option:active {
  transform: scale(0.99);
}

/* Gestaffelter Einblendeffekt der Optionen */
.question-overlay.is-visible .question-option {
  animation: optionIn var(--t-slow) var(--ease-soft) backwards;
}
.question-overlay.is-visible .question-option:nth-child(1) { animation-delay: 200ms; }
.question-overlay.is-visible .question-option:nth-child(2) { animation-delay: 320ms; }
.question-overlay.is-visible .question-option:nth-child(3) { animation-delay: 440ms; }

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

/* ============================================================
   Seek-Indikator
   ============================================================ */
.seeking-indicator {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-medium) var(--ease);
}

.seeking-indicator.is-visible {
  opacity: 0.6;
  visibility: visible;
}

.seeking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
.seeking-dot:nth-child(2) { animation-delay: 0.2s; }
.seeking-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1); }
}

/* ============================================================
   End-Screen
   ============================================================ */
.end-inner {
  max-width: 420px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.end-title {
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  font-weight: 300;
  line-height: 1.3;
  margin: 0;
  color: var(--text-primary);
}

.end-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 300;
}

/* ============================================================
   Accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================================
   Kleine Screens
   ============================================================ */
@media (max-height: 600px) {
  .start-hint { display: none; }
  .start-inner { gap: 18px; }
}
