/* ArtTherapy - Therapeutisches Malen */
* { box-sizing: border-box; margin: 0; padding: 0; cursor: none !important; }

body {
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #0d0a08;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  position: fixed !important;
  top: 0; left: 0;
}

/* ===== PAUSE-OVERLAY ===== */
/* Therapeut:in drückt Q → Leinwand wird gedimmt, Malen gesperrt */
/* opacity + pointer-events genügen für sanften Fade — kein display:none nötig */
#pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 10, 8, 0.52);
  z-index: 80;           /* unter transition-overlay (100), über Canvas */
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;  /* default: kein Event-Capture */
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  transition: opacity 0.35s ease;
  opacity: 0;
}
#pause-overlay.active {
  opacity: 1;
  pointer-events: all;   /* alle Klick/Touch-Events abfangen → Malen blockiert */
  cursor: default !important;
}

/* Sanfte Atem-Kreise im Pause-Overlay: therapeutische Beruhigung während der Gesprächspause */
#pause-overlay::before,
#pause-overlay::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 230, 200, 0.06);
  animation: none;
  pointer-events: none;
}
#pause-overlay.active::before {
  width: 160px; height: 160px;
  top: calc(50% - 80px); left: calc(50% - 80px);
  animation: pauseBreath 8s ease-in-out infinite;
}
#pause-overlay.active::after {
  width: 280px; height: 280px;
  top: calc(50% - 140px); left: calc(50% - 140px);
  animation: pauseBreath 8s ease-in-out infinite 0.5s;
  border-color: rgba(255, 230, 200, 0.035);
}
@keyframes pauseBreath {
  0%, 100% { transform: scale(1);    opacity: 0.5; }
  50%       { transform: scale(1.22); opacity: 1;   }
}

#pause-hint {
  font-size: 56px;
  color: rgba(255, 240, 220, 0.28);
  letter-spacing: 6px;
  pointer-events: none;
  user-select: none;
  position: relative;  /* über den ::before/::after Kreisen */
}
#pause-resume-hint {
  margin-top: 18px;
  font-family: Georgia, serif;
  font-size: 14px;
  font-style: italic;
  color: rgba(255, 240, 220, 0.22);
  letter-spacing: 0.07em;
  pointer-events: none;
  user-select: none;
  position: relative;  /* über den ::before/::after Kreisen */
}

/* ===== TRANSITION ===== */
#transition-overlay {
  position: fixed;
  inset: 0;
  background: #F5F0EB;   /* Standard: warmes Creme (helle Leinwandfarben) */
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.7s ease;
}
#transition-overlay.fade-in {
  opacity: 1;
  pointer-events: all;
}
/* Nacht-Canvas: dunkler Übergang statt weissem Blitz — verhindert Blendeeffekt */
body.canvas-nacht #transition-overlay {
  background: #1a161e;
}

/* ===== UI OVERLAY ===== */
#ui-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* Dwell-Dot für DOMDwell */
.dwell-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 200;
  width: 0; height: 0;
}

/* Setup-Link für Therapeuten — nur in Ankommen-Phase sichtbar */
#setup-link {
  display: none;
  position: fixed;
  top: 28px;
  right: 28px;
  z-index: 15;
  pointer-events: all;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: rgba(255, 220, 180, 0.38);
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.10em;
  padding: 12px 16px;
  border-radius: 12px;
  transition: color 0.3s, background 0.3s;
  -webkit-tap-highlight-color: transparent;
}
#setup-link:hover, #setup-link:active {
  color: rgba(255, 220, 180, 0.75);
  background: rgba(255, 220, 180, 0.08);
}
#setup-link svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
body.arrive-phase #setup-link { display: flex; }

/* Sprache-Button: oben links, nur in Ankommen-Phase */
#lang-btn {
  display: none;
  position: fixed;
  top: 28px;
  left: 28px;
  z-index: 15;
  pointer-events: all;
  background: none;
  border: none;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  color: rgba(255, 220, 180, 0.38);
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.10em;
  padding: 12px 16px;
  border-radius: 12px;
  transition: color 0.3s, background 0.3s;
  -webkit-tap-highlight-color: transparent;
  flex-direction: row;
}
#lang-btn:hover, #lang-btn:active {
  color: rgba(255, 220, 180, 0.75);
  background: rgba(255, 220, 180, 0.08);
}
#lang-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
body.arrive-phase #lang-btn { display: flex; }

/* Anleitung-Link: unten links, nur in Ankommen-Phase */
#anleitung-link {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 15;
  pointer-events: all;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: rgba(255, 220, 180, 0.38);
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.10em;
  padding: 12px 16px;
  border-radius: 12px;
  transition: color 0.3s, background 0.3s;
  -webkit-tap-highlight-color: transparent;
}
#anleitung-link:hover, #anleitung-link:active {
  color: rgba(255, 220, 180, 0.75);
  background: rgba(255, 220, 180, 0.08);
}
#anleitung-link svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
body.arrive-phase #anleitung-link { display: flex; }

/* Rechtliches-Link: gleiche Optik wie Anleitung, rechts daneben (Ankommen-Phase) */
#legal-link {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 188px;
  z-index: 15;
  pointer-events: all;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: rgba(255, 220, 180, 0.38);
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.10em;
  padding: 12px 16px;
  border-radius: 12px;
  transition: color 0.3s, background 0.3s;
  -webkit-tap-highlight-color: transparent;
}
#legal-link:hover, #legal-link:active {
  color: rgba(255, 220, 180, 0.75);
  background: rgba(255, 220, 180, 0.08);
}
#legal-link svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
body.arrive-phase #legal-link { display: flex; }
@media (max-width: 560px) {
  #legal-link span[data-i18n] { display: none; }
  #legal-link { left: 156px; padding: 12px; }
}

/* Vollbild-Button: nur in Ankommen-Phase, unten rechts */
#fullscreen-btn {
  display: none;
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 15;
  pointer-events: all;
  background: none;
  border: none;
  cursor: pointer;
  align-items: center;
  gap: 7px;
  color: rgba(255, 220, 180, 0.38);
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.10em;
  padding: 12px 16px;
  border-radius: 12px;
  transition: color 0.3s, background 0.3s;
  -webkit-tap-highlight-color: transparent;
  flex-direction: row;
}
#fullscreen-btn:hover, #fullscreen-btn:active {
  color: rgba(255, 220, 180, 0.75);
  background: rgba(255, 220, 180, 0.08);
}
#fullscreen-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.arrive-phase #fullscreen-btn { display: flex; }

/* ===== ANKOMMEN ===== */
#arrive-ui {
  position: absolute;
  bottom: 80px;
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
}
#arrive-ui.visible {
  opacity: 1;
  pointer-events: all;
}

#arrive-weiter {
  width: 156px; height: 156px;
  border-radius: 50%;
  background: rgba(255, 195, 130, 0.10);
  border: 1.5px solid rgba(255, 200, 150, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  transition: background 0.4s, border-color 0.4s;
  position: relative;
  overflow: hidden;
  animation: arriveWeiterPulse 4.5s ease-in-out infinite;
}
/* Sanfter Puls: lädt zum Dwell ein */
@keyframes arriveWeiterPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 200, 140, 0);    border-color: rgba(255, 200, 150, 0.32); }
  45%       { box-shadow: 0 0 28px 6px rgba(255, 195, 120, 0.14); border-color: rgba(255, 200, 150, 0.55); }
  55%       { box-shadow: 0 0 28px 6px rgba(255, 195, 120, 0.14); border-color: rgba(255, 200, 150, 0.55); }
}
#arrive-weiter:hover {
  animation: none;
  background: rgba(255, 195, 130, 0.20);
  border-color: rgba(255, 200, 150, 0.55);
}
#arrive-weiter svg {
  width: 57px; height: 57px;
  stroke: rgba(255, 220, 180, 0.82);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#arrive-greeting {
  font-family: Georgia, serif;
  font-size: 20px;
  font-style: italic;
  color: rgba(255, 220, 180, 0.55);
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: -4px;
  min-height: 28px;
}

/* Stimmungs-Auswahl Ankommen */
#arrive-mood {
  display: flex;
  gap: 30px;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.mood-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.20);
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.22);
}
.mood-btn:hover, .mood-btn.active {
  transform: scale(1.22);
  border-color: rgba(255,255,255,0.65);
  box-shadow: 0 4px 20px rgba(0,0,0,0.30);
}
.mood-btn .dwell-dot {
  /* inset:0 ENTFERNT — es überschrieb die globale top/left:50%-Zentrierung,
     wodurch der Dwell-Punkt aus der oberen linken Ecke wuchs/schrumpfte
     (sichtbar als "wandernder Punkt"). Jetzt zentriert wie alle Dwell-Dots. */
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
}
#arrive-mood-label {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(255, 218, 170, 0.65);
  letter-spacing: 0.12em;
  text-align: center;
  min-height: 20px;
  transition: opacity 0.5s;
}
#arrive-hint {
  font-family: Georgia, serif;
  font-size: 13px;
  color: rgba(255, 220, 180, 0.45);
  letter-spacing: 0.13em;
  text-align: center;
  transition: opacity 0.8s ease;
}

/* ===== AUSDRUCK ===== */
#express-ui {
  display: none;
  position: absolute;
  inset: 0;
}
#express-ui.visible {
  display: block;
}

/* ── UI-Controls-Wrapper ─────────────────────────────────────────────────
   Enthält alle Bedienelemente außer dem Toggle-Button.
   visibility:hidden propagiert zu Kindern → pointer-events werden gesperrt.
   Verzögerter visibility-Übergang: opacity faded erst aus, dann verschwindet
   das Element (kein abruptes Verschwinden während Animation).             */
#ui-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;   /* Kinder setzen pointer-events:all selbst */
  transition: opacity 0.40s ease;
}
#express-ui.ui-hidden #ui-controls {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.40s ease, visibility 0s linear 0.40s;
}

/* ── Sanfter Einstieg ────────────────────────────────────────────────────
   Beim Betreten der Malfläche erscheinen die UI-Gruppen nicht auf einen
   Schlag, sondern ruhig gestaffelt: erst die Leinwand (unter dem UI), dann
   Timer, Farben, Seitenknöpfe und zuletzt die Werkzeugleiste. Reizreduktion
   für den Erstkontakt. Nur opacity (keine transform-Konflikte mit zentrierten
   Elementen). Klasse wird in app.js nach ~4,5 s wieder entfernt.            */
@keyframes atSoftIn { from { opacity: 0; } to { opacity: 1; } }
#ui-controls.at-soft-intro #session-timer,
#ui-controls.at-soft-intro #color-panel,
#ui-controls.at-soft-intro #brush-size-btns,
#ui-controls.at-soft-intro #rhythm-btn,
#ui-controls.at-soft-intro #sound-btn,
#ui-controls.at-soft-intro #finish-btn,
#ui-controls.at-soft-intro #undo-btn,
#ui-controls.at-soft-intro #tool-panel {
  animation: atSoftIn 1.5s ease both;
}
#ui-controls.at-soft-intro #session-timer   { animation-delay: 0.30s; }
#ui-controls.at-soft-intro #color-panel      { animation-delay: 0.90s; }
#ui-controls.at-soft-intro #brush-size-btns  { animation-delay: 1.50s; }
#ui-controls.at-soft-intro #rhythm-btn       { animation-delay: 1.70s; }
#ui-controls.at-soft-intro #sound-btn        { animation-delay: 1.90s; }
#ui-controls.at-soft-intro #finish-btn       { animation-delay: 2.10s; }
#ui-controls.at-soft-intro #undo-btn         { animation-delay: 2.30s; }
#ui-controls.at-soft-intro #tool-panel       { animation-delay: 2.80s; }
@media (prefers-reduced-motion: reduce) {
  #ui-controls.at-soft-intro #session-timer,
  #ui-controls.at-soft-intro #color-panel,
  #ui-controls.at-soft-intro #brush-size-btns,
  #ui-controls.at-soft-intro #rhythm-btn,
  #ui-controls.at-soft-intro #sound-btn,
  #ui-controls.at-soft-intro #finish-btn,
  #ui-controls.at-soft-intro #undo-btn,
  #ui-controls.at-soft-intro #tool-panel { animation: none; }
}

/* ── UI-Toggle-Button ────────────────────────────────────────────────────
   Schmale Lasche am linken Rand, vertikal zentriert.
   Immer sichtbar — auch wenn #ui-controls ausgeblendet ist.
   Längere Dwell-Zeit (1800 ms in app.js) schützt vor Eye-Gaze-Fehlklicks. */
#ui-toggle-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 62px;
  border-radius: 0 16px 16px 0;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-left: none;
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow: hidden;
  transition: background 0.3s ease, border-color 0.3s ease;
}
#ui-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.20);
}
#ui-toggle-btn svg {
  width: 14px; height: 14px;
  stroke: rgba(255, 255, 255, 0.55);
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s;
  flex-shrink: 0;
}

/* UI sichtbar → Chevron-links (Ausblenden) zeigen */
#ui-toggle-btn .icon-show { display: none; }

/* UI ausgeblendet → Chevron-rechts (Einblenden) zeigen, Button etwas prominenter */
#express-ui.ui-hidden #ui-toggle-btn {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.20);
}
#express-ui.ui-hidden #ui-toggle-btn .icon-hide { display: none; }
#express-ui.ui-hidden #ui-toggle-btn .icon-show { display: block; }
#express-ui.ui-hidden #ui-toggle-btn svg {
  stroke: rgba(255, 255, 255, 0.80);
}

/* Modus-Panel oben links */
#mode-panel {
  position: absolute;
  top: 24px; left: 24px;
  display: flex;
  gap: 16px;
}

.mode-btn {
  width: 94px; height: 94px;
  border-radius: 26px;
  background: rgba(255,255,255,0.76);
  border: none;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.09);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.mode-btn.active {
  background: rgba(255,255,255,0.97);
  box-shadow: 0 5px 22px rgba(0,0,0,0.14);
}
.mode-btn svg {
  width: 34px; height: 34px;
  stroke: #666; fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mode-btn .btn-label {
  font-family: Georgia, serif;
  font-size: 11px;
  color: #888;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Abschluss-Button oben Mitte */
#finish-btn {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 94px; height: 94px;
  border-radius: 50%;
  background: rgba(255,255,255,0.70);
  border: none;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.09);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all 0.2s;
  overflow: hidden;
}
#finish-btn svg {
  width: 34px; height: 34px;
  stroke: #666; fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#finish-btn .btn-label {
  font-family: Georgia, serif;
  font-size: 11px;
  color: #888;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Zeit abgelaufen: sanftes Aufleuchten des Fertig-Buttons (3s) */
#finish-btn.time-up {
  animation: timeUpPulse 1.2s ease-in-out 2;
  box-shadow: 0 0 0 0 rgba(255, 180, 80, 0.5);
}
@keyframes timeUpPulse {
  0%   { box-shadow: 0 3px 14px rgba(0,0,0,0.09); }
  50%  { box-shadow: 0 0 28px 8px rgba(255, 180, 80, 0.45); }
  100% { box-shadow: 0 3px 14px rgba(0,0,0,0.09); }
}

/* Rückgängig oben rechts */
#undo-btn {
  position: absolute;
  top: 24px; right: 24px;
  width: 94px; height: 94px;
  border-radius: 50%;
  background: rgba(255,255,255,0.70);
  border: none;
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 14px rgba(0,0,0,0.09);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all 0.2s;
  overflow: hidden;
}
#undo-btn svg {
  width: 34px; height: 34px;
  stroke: #777; fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Farb-Panel rechts */
#color-panel {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  pointer-events: all;
  max-height: 82vh;
  overflow-y: auto;
  scrollbar-width: none;   /* Firefox */
  -ms-overflow-style: none;
  /* Padding gibt scale(1.13) der aktiven Farbtaste Raum — HORIZONTAL und VERTIKAL.
     overflow-y:auto erzwingt overflow-x:auto (CSS-Spec) → Clipping an ALLEN
     Padding-Box-Kanten. Ohne vertikales Padding wird der oberste/unterste (aktive,
     scale 1.13) Button oben/unten gerade abgeschnitten (wirkt als Vollfarb-Block).
     14px vertikal: 94px-Button skaliert auf 106px (+6px je Seite) → kein Clipping. */
  padding: 14px 8px;
}
#color-panel::-webkit-scrollbar { display: none; }

.color-btn {
  width: 94px; height: 94px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.50);
  pointer-events: all;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(0,0,0,0.13);
  position: relative;
  overflow: hidden;
}
.color-btn.active {
  border-color: rgba(255,255,255,0.95);
  transform: scale(1.13);
  box-shadow: 0 6px 26px rgba(0,0,0,0.20);
}

/* Pinselgröße-Buttons (links unten, über Rhythmus) */
#brush-size-btns {
  position: absolute;
  left: 24px;
  bottom: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: all;
}
.brush-size-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.70);
  border: none;
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.09);
  transition: transform 0.18s, background 0.18s, opacity 0.25s;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.brush-size-btn:hover { background: rgba(255,255,255,0.88); transform: scale(1.08); }
.brush-size-btn:active { transform: scale(0.94); }
.brush-size-btn.at-limit { opacity: 0.32; }
.brush-size-btn svg {
  width: 22px; height: 22px;
  stroke: #888; fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* Rhythmus-Puls-Schalter (links) */
#rhythm-btn {
  position: absolute;
  left: 24px;
  bottom: 162px;
  width: 94px; height: 94px;
  border-radius: 50%;
  background: rgba(255,255,255,0.70);
  border: none;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.09);
  transition: all 0.3s;
  overflow: hidden;
}
#rhythm-btn.active {
  background: rgba(106, 158, 196, 0.85);
  box-shadow: 0 6px 28px rgba(106,158,196,0.35);
}
#rhythm-btn svg {
  width: 34px; height: 34px;
  stroke: #666; fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s;
}
#rhythm-btn.active svg { stroke: white; }

/* Ton-Master-Schalter: gleiche Optik wie Rhythmus-Button, in der linken Spalte darunter. */
#sound-btn {
  position: absolute;
  left: 24px;
  bottom: 44px;
  width: 94px; height: 94px;
  border-radius: 50%;
  background: rgba(255,255,255,0.70);
  border: none;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.09);
  transition: all 0.3s;
  overflow: hidden;
  cursor: pointer;
  z-index: 12;
}
#sound-btn svg {
  width: 34px; height: 34px;
  stroke: #666; fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s;
}
#sound-btn .btn-label {
  font-family: Georgia, serif;
  font-size: 11px;
  color: #888;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
/* Schrägstrich nur im Stumm-Zustand; Schallwelle nur im An-Zustand. */
#sound-btn .sound-slash { display: none; }
#sound-btn.sound-off .sound-wave { display: none; }
#sound-btn.sound-off .sound-slash { display: inline; }
#sound-btn.sound-off svg { stroke: #c0603a; }
body.canvas-nacht #sound-btn { background: rgba(50, 42, 68, 0.78); }
body.canvas-nacht #sound-btn svg { stroke: rgba(200, 188, 228, 0.72); }
#rhythm-btn .btn-label {
  font-family: Georgia, serif;
  font-size: 11px;
  color: #888;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: color 0.3s;
}
#rhythm-btn.active .btn-label { color: rgba(255,255,255,0.8); }

/* Werkzeug-Panel unten Mitte */
#tool-panel {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  pointer-events: all;
  /* Scrollbar für viele Werkzeuge auf kleinen Bildschirmen */
  /* 320px Abzug = ~160px Rand je Seite. Die linke Spalte (Rhythmus/Ton bei
     left:24 + 94px = endet bei 118) und die Farbkreise rechts brauchen Abstand;
     bei 240px lag der Panel-Rand auf 120px → nur ~2px Lücke (gequetscht). */
  max-width: calc(100vw - 320px); /* Platz für Farb- und Rhythmus/Ton-Spalte */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Vertikales Padding: overflow-x:auto erzwingt overflow-y:auto → sonst wird die
     aktive Werkzeugtaste (scale 1.06: 112→119px, large 138→146px) oben/unten
     abgeschnitten (wirkt als nicht-transparenter Block). 8px gibt scale Raum. */
  padding: 8px 4px;
}
#tool-panel::-webkit-scrollbar { display: none; }

.tool-btn {
  width: 112px; height: 112px;
  border-radius: 31px;
  background: rgba(255,255,255,0.80);
  border: none;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.09);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.tool-btn.active {
  background: rgba(255,255,255,0.98);
  box-shadow: 0 6px 24px rgba(0,0,0,0.16);
  transform: scale(1.06);
}
.tool-btn svg {
  width: 39px; height: 39px;
  stroke: #666; fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool-btn .btn-label {
  font-family: Georgia, serif;
  font-size: 11px;
  color: #888;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Atem-Indikator */
/* Sitzungs-Timer: dezent oben in der Mitte — für Therapeut:in */
#session-timer {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: rgba(255, 220, 180, 0.28);
  pointer-events: none;
  user-select: none;
  transition: color 0.8s;
}

/* Timer-Fortschrittsbalken: sehr dezenter Streifen am unteren Rand der Leinwand.
   Nur sichtbar (width > 0) wenn sessionTimeLimit > 0 — sonst unsichtbar. */
#timer-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(to right,
    rgba(255, 200, 110, 0.0) 0%,
    rgba(255, 200, 110, 0.32) 40%,
    rgba(255, 200, 110, 0.40) 100%);
  border-radius: 0 2px 2px 0;
  transition: width 1.2s linear, background 1.0s ease;
  pointer-events: none;
  z-index: 2;
}
/* Letzten 2 Min: wärmerer Ton */
#timer-bar.warning {
  background: linear-gradient(to right,
    rgba(255, 160, 60, 0.0) 0%,
    rgba(255, 160, 60, 0.45) 40%,
    rgba(255, 160, 60, 0.55) 100%);
}
/* Nacht-Modus: kühler, blau-lila Ton */
body.canvas-nacht #timer-bar {
  background: linear-gradient(to right,
    rgba(160, 180, 255, 0.0) 0%,
    rgba(160, 180, 255, 0.28) 40%,
    rgba(160, 180, 255, 0.38) 100%);
}
body.canvas-nacht #timer-bar.warning {
  background: linear-gradient(to right,
    rgba(200, 160, 255, 0.0) 0%,
    rgba(200, 160, 255, 0.40) 40%,
    rgba(200, 160, 255, 0.50) 100%);
}

/* Etwas sichtbarer wenn Maus in der Nähe des Zentrums ist — via JS ggf. steuerbar */

#breath-indicator {
  position: absolute;
  bottom: 28px; right: 28px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(120, 165, 200, 0.25);
  border: 1.5px solid rgba(120, 165, 200, 0.38);
  opacity: 0;
  transition: opacity 1.8s ease;
  /* 12s-Zyklus = 5 Atemzüge/min = ~0,083 Hz — die im KONZEPT (6.5) genannte
     HRV-Resonanzfrequenz (~0,08 Hz). Lädt zu langsamer Resonanzatmung ein.
     (Erscheint weiterhin erst nach 8s Inaktivität — das ist eine separate Schwelle.) */
  animation: breathe 12s ease-in-out infinite;
  pointer-events: none;
}
#breath-indicator.visible { opacity: 1; }
@keyframes breathe {
  0%, 100% { transform: scale(0.72); }
  50% { transform: scale(1.22); }
}

/* ===== WÜRDIGUNG ===== */
#close-ui {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.97);
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  /* Bug-Fix: oben verankert (war center). Bei center verschiebt sich das
     Bild, wenn unten Inhalt wächst (Engagement-Text/Notiz-Tags beim Klick)
     oder das Vorschaubild async lädt. flex-start hält das Bild stabil. */
  justify-content: flex-start;
  gap: clamp(12px, 2.5vh, 28px);   /* weniger Abstand auf kleinen Bildschirmen */
  padding: 28px 0;
  overflow-y: auto;                 /* Scrollbar wenn Inhalt nicht passt (z.B. kleines Tablet) */
  pointer-events: all;
}
#close-ui.visible { display: flex; }

#artwork-title {
  font-family: Georgia, serif;
  font-size: 19px;
  font-style: italic;
  color: rgba(255, 218, 170, 0.72);
  letter-spacing: 0.10em;
  text-align: center;
  outline: none;              /* Kein Fokus-Ring wenn editierbar */
}
#artwork-title[contenteditable="true"]:focus {
  color: rgba(255, 218, 170, 0.95);
  border-bottom: 1px solid rgba(255, 218, 170, 0.25);
}

#artwork-affirmation {
  font-family: Georgia, serif;
  font-size: 14px;
  font-style: italic;
  color: rgba(255, 218, 170, 0.55);
  letter-spacing: 0.08em;
  text-align: center;
  max-width: 420px;
  line-height: 1.7;
  margin-top: -4px;
}

#artwork-frame {
  position: relative;          /* für Zoom-Hint-Overlay */
  border-radius: 3px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 0 0 5px rgba(255,255,255,0.04),
    0 24px 90px rgba(0,0,0,0.75);
}
/* Zoom-Hint: kleines Lupe-Symbol in der Ecke — dezenter Hinweis dass Klick vergrößert */
.artwork-zoom-hint {
  position: absolute;
  bottom: 9px; right: 9px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.42;
  transition: opacity 0.22s ease;
  pointer-events: none;
  user-select: none;
}
.artwork-zoom-hint svg {
  width: 15px; height: 15px;
  stroke: rgba(255,255,255,0.82);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#close-ui.visible #artwork-frame:hover .artwork-zoom-hint {
  opacity: 0.82;
}
/* Sanftes Einblenden des Kunstwerks beim Öffnen der Würdigungs-Ansicht */
#close-ui.visible #artwork-frame {
  animation: artwork-appear 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes artwork-appear {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

#artwork-display {
  display: block;
  max-width: min(82vw, 960px);
  max-height: min(55vh, calc(100vh - 490px));  /* Platz für Titel, Notiz-Textarea (3 Zeilen), Engagement, Stats-Bar + Buttons */
  object-fit: contain;
}

/* Therapeuten-Notizfeld in der Würdigungs-Ansicht:
   dezent, dunkel, aus dem Bild-Flow herausgehalten.
   Textarea für mehrzeilige klinische Dokumentation (Enter = Zeilenumbruch, kein Shortcut).
   pointer-events: all — Klick/Tipp möglich, kein Dwell-Ziel */

/* Wrapper: Textarea + Kopieren-Button nebeneinander */
#close-note-wrap {
  position: relative;
  display: inline-block;
  width: min(420px, 86vw);
}
#close-note {
  width: 100%;
  padding: 10px 44px 10px 14px; /* rechts: 44px Platz für Kopieren-Button */
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.60);
  font-family: Georgia, serif;
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.03em;
  line-height: 1.55;
  outline: none;
  text-align: left;
  pointer-events: all;
  resize: none;
  display: block;
  box-sizing: border-box;
  /* Maximalhöhe: verhindert dass lange Notizen die Close-Buttons aus dem Sichtfeld schieben.
     Scrollbar erscheint innerhalb der Textarea — Close-UI-Layout bleibt stabil. */
  max-height: clamp(72px, 18vh, 160px);
  overflow-y: auto;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
#close-note::placeholder {
  color: rgba(255,255,255,0.22);
  font-style: italic;
}
/* Gespeichert-Signal: kurzes grünes Aufleuchten des Randes nach 600ms Debounce */
#close-note.note-saved {
  border-color: rgba(120, 220, 140, 0.55);
  transition: border-color 0.3s ease;
}

/* Notiz-Kopieren-Button: kleines Icon in der rechten unteren Ecke der Textarea */
#note-copy-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: rgba(255,255,255,0.08);
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.38;
  transition: opacity 0.18s, background 0.18s;
  pointer-events: all;
}
#note-copy-btn:hover,
#note-copy-btn:focus-visible { opacity: 0.85; background: rgba(255,255,255,0.14); outline: none; }
#note-copy-btn svg {
  width: 14px; height: 14px;
  stroke: rgba(255,255,255,0.85);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#note-copy-btn.copied { opacity: 1; background: rgba(100,210,130,0.28); }

/* Session-Statistik-Zeile: Dauer · Striche · Farben · Pausen */
#session-stats-bar {
  display: none;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.06em;
  text-align: center;
  margin-top: 9px;
  margin-bottom: 2px;
  padding: 2px 0;
  user-select: none;
  pointer-events: none;
  max-width: min(480px, 92vw);
}
#close-note:focus {
  border-color: rgba(255,255,255,0.32);
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.78);
}

/* Quick-Tags: Therapeuten-Schnellnotizen — Klick/Tipp, kein Dwell */
#close-note-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 7px;
  max-width: min(480px, 92vw);
}
.note-tag {
  padding: 3px 11px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.38);
  font-size: 11px;
  font-family: Georgia, serif;
  font-style: italic;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.note-tag:hover, .note-tag:active {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.72);
  border-color: rgba(255,255,255,0.30);
}

/* Engagement-Bewertung: 3-stufige Selektor-Leiste (Zurückhaltend / Offen / Aktiv) */
#engagement-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  max-width: min(480px, 92vw);
}
.engagement-label {
  font-family: Georgia, serif;
  font-size: 10px;
  font-style: italic;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 4px;
  white-space: nowrap;
}
.engage-btn {
  padding: 4px 13px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.38);
  font-size: 11px;
  font-family: Georgia, serif;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  user-select: none;
  white-space: nowrap;
}
.engage-btn:hover {
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.65);
  border-color: rgba(255,255,255,0.26);
}
/* Aktiv-Zustand: warm leuchtend — deutlich markiert aber nicht aufdringlich */
#engage-low.active  { background: rgba(140,180,220,0.22); color: rgba(180,215,255,0.85); border-color: rgba(140,180,220,0.45); }
#engage-mid.active  { background: rgba(180,200,140,0.22); color: rgba(210,230,170,0.85); border-color: rgba(180,200,140,0.45); }
#engage-high.active { background: rgba(220,170,100,0.26); color: rgba(255,210,140,0.90); border-color: rgba(220,170,100,0.50); }

#close-controls {
  display: flex;
  gap: 20px;
  pointer-events: all;
  /* Sticky am unteren Rand wenn close-UI scrollt (kleine Tablets/Phones) */
  position: sticky;
  bottom: 12px;
  z-index: 2;
}

.close-btn {
  width: 107px; height: 107px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  pointer-events: all;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: Georgia, serif;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  /* Transition für Hover und Speichern-Bestätigung — sanftes Ein- und Ausblenden */
  transition: background 0.5s ease, border-color 0.5s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.close-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.33);
}
/* Speichern-Bestätigung: kurzes grünes Aufleuchten (wichtig für Eye-Gaze-Nutzer) */
.close-btn.saved {
  background: rgba(80,200,100,0.22);
  border-color: rgba(100,220,120,0.55);
}
.close-btn svg {
  width: 34px; height: 34px;
  stroke: rgba(255,255,255,0.72); fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.5s ease;
}
.close-btn.saved svg {
  stroke: rgba(130,235,150,0.90);
}

/* ===== ARTWORK LIGHTBOX ===== */
/* Vollbild-Anzeige des Kunstwerks — Klick auf #artwork-display in der Würdigungs-Ansicht.
   z-index 90: über close-ui (20) und pause-overlay (80), unter transition-overlay (100). */
#artwork-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.90);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
#artwork-lightbox.active {
  opacity: 1;
  pointer-events: all;
}
#lightbox-img {
  /* CSS transform rotate() ändert nur die visuelle Darstellung, NICHT die Layout-Box.
     Damit ein 90° gedrehtes Bild nicht aus dem Viewport ragt, muss die Element-Größe
     kleiner als min(vw, vh) sein — dann passen auch gedrehte Dimensionen in den Viewport. */
  width: min(97vw, 97vh);
  height: auto;
  max-width: min(97vw, 97vh);
  max-height: min(97vw, 97vh);
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 24px 100px rgba(0,0,0,0.95), 0 0 0 1px rgba(255,255,255,0.06);
  animation: lightbox-appear 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
  cursor: pointer;     /* Zeigt an dass Klick dreht */
}
@keyframes lightbox-appear {
  from { transform: scale(0.93); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
/* Klick-Hinweis: #artwork-display bekommt dezenten Glow wenn Lightbox verfügbar */
#artwork-display {
  transition: box-shadow 0.25s ease;
}
#close-ui.visible #artwork-display:hover {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.18), 0 0 24px rgba(255,255,255,0.08);
}

/* ===== DOM-CURSOR ===== */
/* Dezenter schwarz/weißer Punkt, in allen Phasen sichtbar,
   auch über #close-ui (z-index 9999 > alles).
   Transform-basierte Positionierung: kein Layout-Reflow pro Frame (Compositor-Thread). */
#cursor-dot {
  position: fixed;
  left: 0; top: 0;               /* Null-Ursprung — Position via transform */
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-1000px, -1000px);  /* off-screen bis erstes mousemove */
  will-change: transform;
}

/* ===== PALETTE-LABEL FLASH ===== */
/* Kurzes Einblenden beim Palettenwechsel (P-Taste) */
#palette-label {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: rgba(255, 218, 170, 0.85);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  white-space: nowrap;
}
#palette-label.visible {
  opacity: 1;
}

/* ===== MANDALA-SEGMENT-BADGE ===== */
/* Kleine Zahl die immer zeigt wieviele Segmente aktiv sind (nur im Mandala-Modus sichtbar) */
.seg-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(100, 80, 160, 0.18);
  color: rgba(80, 60, 140, 0.70);
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  font-weight: bold;
  padding: 1px 4px;
  line-height: 1.4;
  pointer-events: none;
  display: none;
  letter-spacing: 0.04em;
}
#mode-mandala.active .seg-badge {
  display: block;
}

/* ===== BRUSH-LABEL FLASH ===== */
/* Kurzes Einblenden bei brushScale-Wechsel (+/- Taste) */
#brush-label {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: rgba(255, 220, 160, 0.80);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  white-space: nowrap;
}
#brush-label.visible {
  opacity: 1;
}

/* ===== KLIENT-BADGE ===== */
/* Dezente Erinnerung an den aktuellen Klienten für den Therapeuten.
   Erscheint kurz stark am Session-Start, blendet auf niedrige Deckkraft ab.
   Position: oben links, unterhalb des UI-Toggle-Buttons. */
#client-badge {
  position: absolute;
  top: 72px;
  left: 16px;
  font-family: Georgia, serif;
  font-size: 12px;
  font-style: italic;
  letter-spacing: 0.10em;
  color: rgba(255, 218, 170, 0.90);
  background: rgba(0, 0, 0, 0.28);
  border-radius: 8px;
  padding: 4px 10px;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 1.5s ease;
  white-space: nowrap;
  z-index: 12;
}
#client-badge.visible-strong { opacity: 0.82; }
#client-badge.visible-dim    { opacity: 0.22; }

/* ===== TASTATURHILFE ===== */
#keys-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
}
#keys-overlay.visible { display: flex; }

#keys-panel {
  background: rgba(30,24,20,0.94);
  border: 1px solid rgba(255,200,140,0.18);
  border-radius: 18px;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 250px;
  max-height: 85vh;
  overflow-y: auto;
}
.keys-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: Georgia, serif;
  font-size: 14px;
  color: rgba(255,218,170,0.82);
}
.keys-row kbd {
  background: rgba(255,200,140,0.15);
  border: 1px solid rgba(255,200,140,0.30);
  border-radius: 6px;
  padding: 3px 9px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: rgba(255,220,170,0.95);
  min-width: 44px;
  text-align: center;
}
.keys-hint {
  font-size: 11px;
  color: rgba(255,200,150,0.40);
  margin-top: 6px;
  justify-content: center;
}
/* Abschnitts-Überschrift im Tastatur-Panel */
.keys-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255,200,140,0.38);
  margin-top: 4px;
  gap: 0;
}
.keys-section:first-child { margin-top: 0; }

/* ===== RESPONSIVE ===== */
/* Kleines Display / Tablet Hochformat */
@media (max-width: 700px) or (max-height: 500px) {
  .color-btn { width: 70px; height: 70px; }
  /* padding: 70 * 0.065 ≈ 4.6px Überlauf je Seite → 6px reicht */
  #color-panel { gap: 12px; right: 14px; padding: 12px 6px; }
  .tool-btn { width: 52px; height: 52px; }
  #tool-panel { gap: 6px; padding: 8px 10px; }
  .tool-btn svg { width: 22px; height: 22px; }
  .btn-label { font-size: 8px; }
}

@media (max-width: 480px) {
  .color-btn { width: 56px; height: 56px; }
  /* padding: 56 * 0.065 ≈ 3.6px Überlauf je Seite → 5px reicht */
  #color-panel { gap: 8px; right: 8px; padding: 10px 5px; }
  .tool-btn { width: 44px; height: 44px; }
}

/* ===== THERAPEUTEN-UI-KONFIGURATION: SCHALTFLÄCHEN-GRÖSSE =====
   data-btn-size="small"  → kompakte Buttons (gut bei vielen Tools)
   data-btn-size="normal" → Standard (94px / 112px) — kein Override nötig
   data-btn-size="large"  → großzügiger (ideal für Eye-Gaze / motorische Einschränkung) */

/* Ankommen-Phase: arrive-weiter + mood-btn skalieren ebenfalls mit btn-size.
   arrive-weiter ist die wichtigste Schaltfläche für Eye-Gaze-Nutzer in der Ankommen-Phase. */
body[data-btn-size="large"] #arrive-weiter { width: 186px; height: 186px; }
body[data-btn-size="large"] #arrive-weiter svg { width: 68px; height: 68px; }
body[data-btn-size="small"] #arrive-weiter { width: 120px; height: 120px; }
body[data-btn-size="small"] #arrive-weiter svg { width: 44px; height: 44px; }
body[data-btn-size="large"] .mood-btn { width: 84px; height: 84px; }
body[data-btn-size="small"] .mood-btn { width: 50px; height: 50px; }

/* Klein: Modus- und Werkzeug-Buttons ~20% kleiner */
body[data-btn-size="small"] .mode-btn {
  width: 76px; height: 76px;
  border-radius: 22px;
}
body[data-btn-size="small"] .tool-btn {
  width: 90px; height: 90px;
  border-radius: 26px;
}
body[data-btn-size="small"] .mode-btn svg,
body[data-btn-size="small"] .tool-btn svg { width: 30px; height: 30px; }
body[data-btn-size="small"] #finish-btn,
body[data-btn-size="small"] #undo-btn    { width: 76px; height: 76px; }
body[data-btn-size="small"] #finish-btn svg,
body[data-btn-size="small"] #undo-btn svg { width: 28px; height: 28px; }

/* Groß: Modus- und Werkzeug-Buttons ~25% größer — maximale Treffsicherheit */
body[data-btn-size="large"] .mode-btn {
  width: 118px; height: 118px;
  border-radius: 32px;
}
body[data-btn-size="large"] .tool-btn {
  width: 138px; height: 138px;
  border-radius: 38px;
}
body[data-btn-size="large"] .mode-btn svg,
body[data-btn-size="large"] .tool-btn svg { width: 46px; height: 46px; }
body[data-btn-size="large"] .tool-btn .btn-label,
body[data-btn-size="large"] .mode-btn .btn-label { font-size: 13px; }
body[data-btn-size="large"] #finish-btn,
body[data-btn-size="large"] #undo-btn    { width: 118px; height: 118px; }
body[data-btn-size="large"] #finish-btn svg,
body[data-btn-size="large"] #undo-btn svg { width: 42px; height: 42px; }
body[data-btn-size="large"] #mode-panel  { gap: 20px; }
body[data-btn-size="large"] #tool-panel  { gap: 18px; }
/* Farb-Buttons bei großen Schaltflächen ebenfalls skalieren */
body[data-btn-size="large"] .color-btn  { width: 110px; height: 110px; }
body[data-btn-size="large"] #color-panel { padding: 16px 10px; }
/* Kleine Farb-Buttons bei kleiner Schaltflächengröße */
body[data-btn-size="small"] .color-btn  { width: 80px; height: 80px; }
body[data-btn-size="small"] #color-panel { padding: 12px 6px; }
/* Pinselgröße-Buttons ebenfalls skalieren */
body[data-btn-size="small"] .brush-size-btn { width: 44px; height: 44px; }
body[data-btn-size="small"] .brush-size-btn svg { width: 18px; height: 18px; }
body[data-btn-size="large"] .brush-size-btn { width: 64px; height: 64px; }
body[data-btn-size="large"] .brush-size-btn svg { width: 28px; height: 28px; }

/* Würdigungs-Buttons (Close-UI) bei großen/kleinen Schaltflächen skalieren */
body[data-btn-size="large"] .close-btn { width: 128px; height: 128px; }
body[data-btn-size="large"] .close-btn svg { width: 42px; height: 42px; }
body[data-btn-size="small"] .close-btn { width: 88px; height: 88px; }
body[data-btn-size="small"] .close-btn svg { width: 28px; height: 28px; }

/* Rhythmus-Button bei großen/kleinen Schaltflächen skalieren — bleibt konsistent mit
   den übrigen Buttons (normal=94px, large=118px, small=76px) */
body[data-btn-size="large"] #rhythm-btn { width: 118px; height: 118px; }
body[data-btn-size="large"] #rhythm-btn svg { width: 42px; height: 42px; }
body[data-btn-size="large"] #rhythm-btn .btn-label { font-size: 13px; }
body[data-btn-size="small"] #rhythm-btn { width: 76px; height: 76px; }
body[data-btn-size="small"] #rhythm-btn svg { width: 26px; height: 26px; }
body[data-btn-size="small"] #rhythm-btn .btn-label { font-size: 10px; }

/* Pinselgröße-Buttons nach oben/unten verschieben wenn Rhythmus-Button höher/kleiner ist.
   Berechnung: rhythm-btn.bottom(148) + rhythm-btn.height + 16px Abstand.
   Normal: 148+94+16=258 (Basisregel).  Large: 148+118+16=282.  Small: 148+76+16=240.
   Die nachfolgende no-rhythm-Regel hat gleiche Spezifität → schlägt diese beim
   kombinierten Fall (no-rhythm + large/small) und positioniert Buttons bei 158px. */
body[data-btn-size="large"] #brush-size-btns { bottom: 304px; }
body[data-btn-size="small"] #brush-size-btns { bottom: 262px; }

/* Pinselgröße-Buttons nach unten verschieben wenn Rhythmus-Button versteckt ist.
   Kommt nach den data-btn-size-Regeln → gleiche Spezifität, später im File → gewinnt
   beim kombinierten Fall (no-rhythm + large/small). */
body.no-rhythm #brush-size-btns { bottom: 158px; }

/* ===== NACHT-MODUS ===== */
/* Wenn Leinwandfarbe "Nacht" gewählt: body-Hintergrund dunkel + Timer heller */
body.canvas-nacht {
  background: #1a161e;
}
body.canvas-nacht #session-timer {
  color: rgba(180, 200, 240, 0.35);
}
body.canvas-nacht #cursor-dot {
  background: rgba(220, 210, 255, 0.70);
  border-color: rgba(50, 40, 80, 0.80);
}
/* Würdigungs-Ansicht: dunkler Hintergrund → heller Cursor für Sichtbarkeit */
body.close-phase #cursor-dot {
  background: rgba(255, 255, 255, 0.80);
  border-color: rgba(30, 20, 10, 0.65);
}

/* Nacht-UI: Buttons dunkler und violett-getönt — weniger Kontrast, mehr Immersion */
body.canvas-nacht .mode-btn,
body.canvas-nacht .tool-btn,
body.canvas-nacht #finish-btn,
body.canvas-nacht #undo-btn,
body.canvas-nacht .brush-size-btn {
  background: rgba(50, 42, 68, 0.78);
  box-shadow: 0 3px 14px rgba(0,0,0,0.40);
}
body.canvas-nacht .mode-btn.active,
body.canvas-nacht .tool-btn.active {
  background: rgba(85, 68, 120, 0.92);
  box-shadow: 0 5px 22px rgba(0,0,0,0.50);
}
body.canvas-nacht #rhythm-btn {
  background: rgba(50, 42, 68, 0.78);
}
body.canvas-nacht #rhythm-btn.active {
  background: rgba(60, 100, 150, 0.82);
  box-shadow: 0 6px 28px rgba(60,100,150,0.35);
}
body.canvas-nacht .mode-btn svg,
body.canvas-nacht .tool-btn svg,
body.canvas-nacht #finish-btn svg,
body.canvas-nacht #undo-btn svg,
body.canvas-nacht #rhythm-btn svg,
body.canvas-nacht .brush-size-btn svg {
  stroke: rgba(200, 188, 228, 0.72);
}
body.canvas-nacht .mode-btn .btn-label,
body.canvas-nacht .tool-btn .btn-label,
body.canvas-nacht #finish-btn .btn-label,
body.canvas-nacht #rhythm-btn .btn-label {
  color: rgba(190, 178, 220, 0.65);
}
body.canvas-nacht #ui-toggle-btn {
  background: rgba(60, 50, 80, 0.40);
  border-color: rgba(150, 130, 200, 0.15);
}
body.canvas-nacht #ui-toggle-btn svg {
  stroke: rgba(180, 165, 220, 0.55);
}

/* ===== DOPPELTIPP-HINWEIS ===== */
/* Kleiner dezenter Puls wenn Undo durch Doppeltipp ausgelöst wird — sichtbares Feedback */
@keyframes undo-flash {
  0%   { box-shadow: 0 0 0 0 rgba(255, 180, 100, 0); }
  30%  { box-shadow: 0 0 0 18px rgba(255, 180, 100, 0.28); }
  100% { box-shadow: 0 0 0 32px rgba(255, 180, 100, 0); }
}
#undo-btn.double-tap-flash {
  animation: undo-flash 0.55s ease-out both;
}

/* Undo-Button: gedimmt wenn kein Verlauf vorhanden — Eye-Gaze-Signal ohne Zahl-Badge */
#undo-btn.no-history {
  opacity: 0.30;
}

/* Undo-Button: kurzes Schütteln wenn Verlauf leer ("Nichts mehr rückgängig") */
@keyframes undo-empty-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(3px); }
}
#undo-btn.undo-empty {
  animation: undo-empty-shake 0.42s ease both;
}

/* Brush-Size-Button: kurzes vertikales Schütteln bei Limit-Erreichen */
@keyframes brush-limit-nudge {
  0%, 100% { transform: translateY(0); }
  25%       { transform: translateY(-3px); }
  75%       { transform: translateY(3px); }
}
.brush-size-btn.limit-nudge {
  animation: brush-limit-nudge 0.30s ease both;
}

/* ── Reduced Motion (vestibuläre Sicherheit / Anfallsschutz) ──────────────
   Die Zielgruppe schließt Menschen mit Bewegungsempfindlichkeit ein. Wer im
   System „Bewegung reduzieren" aktiviert hat, bekommt die endlosen Puls-/Atem-
   und Feedback-Shake-Animationen abgeschaltet; Entrance-Animationen springen
   sofort zum sichtbaren Endzustand (kein Verstecken). Bewusst UNBERÜHRT:
   der Dwell-Fortschrittsring (JS-getrieben, essenzielles Augensteuerungs-
   Feedback) und sanfte box-shadow-Glows (keine Vestibulär-Bewegung). Block
   steht am Dateiende → überschreibt die Original-Deklarationen per Source-Order. */
@media (prefers-reduced-motion: reduce) {
  /* Endlose Puls-/Atem-Animationen + Feedback-Shakes ganz aus
     (Element bleibt im Ruhezustand sichtbar — nur Transform/Scale entfällt). */
  #breath-indicator,
  #pause-overlay.active::before,
  #pause-overlay.active::after,
  #undo-btn.undo-empty,
  .brush-size-btn.limit-nudge {
    animation: none;
  }
  /* Entrance-Animationen: sofort sichtbarer Endzustand, keine Bewegung
     (animation läuft weiter → springt zu opacity:1/scale:1, kein Verstecken). */
  #close-ui.visible #artwork-frame,
  #lightbox-img {
    animation-duration: 0.01ms;
  }
}

/* ── Sichtbarer Tastatur-Fokus (Canvas-Bedienelemente) ────────────────────
   Native <button> bekommen auf dem dunklen Canvas oft einen kontrastarmen
   Browser-Standard-Fokusring. :focus-visible zeigt den Ring NUR bei Tastatur-
   Navigation (Maus/Touch/Dwell lösen ihn nicht aus → ruhige Optik bleibt).
   Heller 3px-Ring garantiert Sichtbarkeit für Tastatur-/Switch-Nutzer. */
.tool-btn:focus-visible,
.mode-btn:focus-visible,
.brush-size-btn:focus-visible,
.close-btn:focus-visible,
.color-btn:focus-visible,
.mood-btn:focus-visible,
#arrive-weiter:focus-visible,
#finish-btn:focus-visible,
#undo-btn:focus-visible,
#rhythm-btn:focus-visible,
#sound-btn:focus-visible,
#ui-toggle-btn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}
