/* ILSE – Stylesheet
   Grundregel: Alles muss auch ohne Sehen bedienbar sein.
   Hoher Kontrast, sehr große Schrift, keine ablenkenden Elemente. */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* kein blauer Blitz beim Tippen */
  user-select: none;
}

:root {
  --bg: #000;
  --fg: #fff;
  --accent: #ffdd00;   /* Gelb = gut sichtbar auch bei Sehschwäche */
  --danger: #ff4444;
  --ok: #44ff88;
  --radius: 1.5rem;
  --font: system-ui, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden; /* kein Scrollen – alles passt auf einen Bildschirm */
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: clamp(1.4rem, 5vw, 2rem); /* passt sich der Bildschirmgröße an */
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none; /* wir behandeln Berührungen selbst */
}

/* ── Start-Overlay (einmalig beim ersten Laden) ─────────────────────── */
#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  cursor: pointer;
}

#start-overlay.versteckt {
  display: none;
}

#start-name {
  font-size: clamp(4rem, 15vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--accent);
}

#start-hint {
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: var(--fg);
  text-align: center;
  line-height: 1.6;
  animation: blinken 1.8s ease-in-out infinite;
}

#start-wake {
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  color: #888;
  text-align: center;
  margin-top: -.5rem;
}

#start-wake strong {
  color: var(--accent);
}

#start-mic-status {
  font-size: clamp(.8rem, 2.5vw, 1rem);
  color: #555;
  text-align: center;
  min-height: 1.4em;
}

@keyframes blinken {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Haupt-Tipp-Fläche ─────────────────────────────────────────────── */
#tap-surface {
  position: fixed;
  inset: 0; /* füllt den gesamten Bildschirm */
  z-index: 1;
  cursor: pointer;
}

/* ── Zentrales Anzeige-Panel ──────────────────────────────────────── */
#display {
  position: relative;
  z-index: 2;
  pointer-events: none; /* Tipp-Ereignisse gehen durch zum tap-surface */
  width: 100%;
  max-width: 600px;
  padding: 2rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

#ilse-name {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--accent);
}

#status-text {
  font-size: clamp(1.2rem, 4.5vw, 1.8rem);
  min-height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
}

#option-text {
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  font-weight: 700;
  color: var(--accent);
  min-height: 2em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Feedback-Flash (kurze Bestätigung nach Tippen) ─────────────────── */
#feedback {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  border-radius: 0;
}

#feedback.show {
  opacity: 1;
}

#feedback.yes {
  background: #00330066;
  color: var(--ok);
}

#feedback.no {
  background: #33000066;
  color: var(--danger);
}

/* ── Notruf-Overlay ──────────────────────────────────────────────── */
#emergency-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--danger);
  color: #fff;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  text-align: center;
  padding: 2rem;
}

#emergency-overlay.active {
  display: flex;
}

#emergency-count {
  font-size: clamp(5rem, 20vw, 10rem);
  font-weight: 900;
  line-height: 1;
}

#emergency-label {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 700;
}

#emergency-cancel {
  font-size: clamp(1rem, 3.5vw, 1.5rem);
  opacity: 0.8;
}

/* ── Gesprächs-Overlay ──────────────────────────────────────────── */
#gespraech-overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: #0a0a1a;
  color: #fff;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  text-align: center;
  padding: 2rem;
}

#gespraech-overlay.active {
  display: flex;
}

#gespraech-name {
  font-size: clamp(2.5rem, 9vw, 4rem);
  font-weight: 900;
  letter-spacing: .15em;
  color: #7eb8f7;
}

#gespraech-status {
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  color: #aac4e8;
}

#gespraech-text {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  color: #ddeeff;
  min-height: 3em;
  max-width: 480px;
  font-style: italic;
  line-height: 1.5;
}

#gespraech-hint {
  font-size: clamp(.75rem, 2.5vw, 1rem);
  color: #556;
  position: absolute;
  bottom: 1.5rem;
}

/* Schallwellen-Animation */
#gespraech-welle {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 40px;
}

#gespraech-welle span {
  display: block;
  width: 6px;
  border-radius: 99px;
  background: #7eb8f7;
  animation: welle 1.2s ease-in-out infinite;
}

#gespraech-welle span:nth-child(1) { height: 12px; animation-delay: 0s; }
#gespraech-welle span:nth-child(2) { height: 28px; animation-delay: .15s; }
#gespraech-welle span:nth-child(3) { height: 40px; animation-delay: .3s; }
#gespraech-welle span:nth-child(4) { height: 28px; animation-delay: .45s; }
#gespraech-welle span:nth-child(5) { height: 12px; animation-delay: .6s; }

@keyframes welle {
  0%, 100% { transform: scaleY(0.4); opacity: .5; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

/* ── Mikrofon-Indikator ─────────────────────────────────────────── */
#mic-indicator {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #555;
  transition: background 0.3s;
}

#mic-indicator.active {
  background: var(--ok);
  box-shadow: 0 0 0 4px #44ff8844;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px #44ff8844; }
  50%       { box-shadow: 0 0 0 10px #44ff8811; }
}

/* ── Fortschrittsbalken für Hörbuch ────────────────────────────── */
#audiobook-bar {
  display: none;
  width: 90%;
  max-width: 400px;
  height: 0.5rem;
  background: #333;
  border-radius: 99px;
  overflow: hidden;
}

#audiobook-bar.visible {
  display: block;
}

#audiobook-progress {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.5s linear;
}

/* ── Hinweis-Leiste unten ───────────────────────────────────────── */
#hint-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 3;
  pointer-events: none;
  padding: 0.75rem 1rem;
  font-size: clamp(0.75rem, 2.5vw, 1rem);
  color: #666;
  text-align: center;
  display: flex;
  justify-content: space-around;
}
