/* style.css - ShareTheAir Design System & Styling */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-base: #0a0f1d;
  --bg-surface: rgba(18, 24, 43, 0.75);
  --bg-surface-elevated: rgba(28, 36, 62, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-glass-subtle: rgba(255, 255, 255, 0.06);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #090d16;

  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.2);

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
}

/* Dynamischer Hintergrund mit dezentem Glow */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -10%;
  width: 70vw;
  height: 70vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(139, 92, 246, 0.05) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(245, 158, 11, 0.05) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Glass Panel Utility */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Views Management */
.view-section {
  display: none;
  width: 100%;
  flex: 1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

/* =======================================================
   1. STARTSEITE / WELCOME VIEW
   ======================================================= */
.welcome-container {
  max-width: 900px;
  width: 92%;
  margin: auto;
  padding: 24px 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

/* =======================================================
   SUBTILES SPRACHAUSWAHL-DROPDOWN (TOP-RIGHT & DEZENT)
   ======================================================= */
.welcome-top-nav {
  position: absolute;
  top: 18px;
  right: 24px;
  z-index: 100;
}

.subtle-lang-dropdown {
  position: relative;
  display: inline-block;
  user-select: none;
  -webkit-user-select: none;
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, sans-serif);
}

.subtle-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-full, 9999px);
  padding: 4px 10px;
  color: rgba(248, 250, 252, 0.65);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.subtle-lang-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.subtle-lang-btn:focus-visible {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.subtle-globe {
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.8;
}

.subtle-lang-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(241, 245, 249, 0.85);
  letter-spacing: -0.01em;
}

.subtle-lang-btn:hover .subtle-lang-label {
  color: #ffffff;
}

.subtle-arrow {
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 1px;
}

.subtle-lang-dropdown.is-open .subtle-arrow {
  transform: rotate(180deg);
  color: #ffffff;
}

.subtle-lang-dropdown.is-open .subtle-lang-btn {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.18);
  color: #ffffff;
}

/* Dropdown Menu Popup */
.subtle-lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 144px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 12px rgba(99, 102, 241, 0.08);
  padding: 4px;
  list-style: none !important;
  margin: 0 !important;
  display: none !important;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
}

.subtle-lang-dropdown.is-open .subtle-lang-menu {
  display: flex !important;
}

.subtle-lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 7px;
  color: rgba(248, 250, 252, 0.75);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  border: 1px solid transparent;
  outline: none;
  list-style: none !important;
}

.subtle-lang-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subtle-lang-item-left span:first-child {
  font-size: 1.05rem;
  line-height: 1;
}

.subtle-lang-item:hover,
.subtle-lang-item:focus {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(2px);
}

.subtle-lang-item.is-selected {
  background: rgba(99, 102, 241, 0.18);
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(99, 102, 241, 0.3);
}

.subtle-check {
  font-size: 0.78rem;
  color: var(--accent-gold, #f59e0b);
  display: none;
}

.subtle-lang-item.is-selected .subtle-check {
  display: inline;
}

@media (max-width: 600px) {
  .welcome-top-nav {
    top: 12px;
    right: 14px;
  }
}

.brand-header {
  text-align: center;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.brand-title {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-bottom: 12px;
}

.brand-tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
}

/* Teilnehmer Selector Card */
.selector-card {
  width: 100%;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.count-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.count-display span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #f59e0b, #10b981, #3b82f6, #8b5cf6);
  outline: none;
  cursor: pointer;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.5);
  border: 3px solid var(--accent-blue);
  cursor: grab;
  transition: transform 0.15s ease;
}

.custom-range::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}

.range-ticks {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 4px;
}

/* Modus Auswahl Kacheln */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}

.mode-card {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s, box-shadow 0.25s;
}

.mode-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}

.mode-icon-badge {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
}

.mode-card h3 {
  font-size: 1.35rem;
}

.mode-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  flex: 1;
}

.mode-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.mode-card:hover .mode-action-btn {
  background: #ffffff;
  color: #0f172a;
  border-color: #ffffff;
}

/* Rechtlicher Hinweis & AGB Footer */
.welcome-legal-notice {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.welcome-legal-notice a.legal-link {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
  font-weight: 600;
}

.welcome-legal-notice a.legal-link:hover {
  color: var(--text-primary);
}

/* =======================================================
   2. SETUP VIEW (MODUS 1: TABLET)
   ======================================================= */
.setup-container {
  max-width: 860px;
  width: 92%;
  margin: auto;
  padding: 36px 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.setup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.back-btn:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.names-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.name-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass-subtle);
  transition: border-color 0.2s;
}

.name-input-group:focus-within {
  border-color: var(--border-glass);
  background: rgba(255, 255, 255, 0.06);
}

.name-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

.name-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 4px 0;
  outline: none;
  transition: border-color 0.2s;
}

.name-input:focus {
  border-bottom-color: var(--accent-blue);
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(59, 130, 246, 0.45);
}

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

/* =======================================================
   3. SETUP VIEW (MODUS 2: HOST LOBBY)
   ======================================================= */
.lobby-container {
  max-width: 960px;
  width: 92%;
  margin: auto;
  padding: 36px 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}

@media (max-width: 800px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }
}

.lobby-info-card {
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.room-code-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  width: 100%;
}

.room-code-badge span {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.room-code-text {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
}

.qr-wrapper {
  margin: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.join-link-row {
  display: flex;
  width: 100%;
  gap: 8px;
}

.join-link-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-glass-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  outline: none;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.lobby-participants-card {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lobby-participants-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.lobby-participant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass-subtle);
}

.empty-list-notice {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* =======================================================
   4. MEETING SCREEN (TABLET / HOST VIEW)
   ======================================================= */
.meeting-screen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  padding: 18px 24px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Top Bar */
.meeting-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.meeting-brand {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.paused {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.total-time-badge {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.pause-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pause-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}

.pause-btn.is-paused {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.csv-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.csv-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.end-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.end-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Meeting Arena: 3 Spalten (Links, Center Chart, Rechts) über die gesamte Höhe */
.meeting-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 28px;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 100px);
  padding: 6px 0;
}

/* Teilnehmer Spalten: Verteilt über die volle verfügbare Höhe */
.participants-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Platziert bei 2 pro Seite Buttons in den Ecken, bei 3 zusätzlich mittig */
  gap: 16px;
  height: 100%;
  padding: 6px 4px;
  box-sizing: border-box;
}

.participants-column:has(> .participant-btn:only-child) {
  justify-content: center;
}

/* Teilnehmer Button: Ergonomisch, großzügige Touch-Fläche */
.participant-btn {
  position: relative;
  display: flex;
  align-items: center;
  padding: 18px 22px;
  min-height: 84px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 2px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, border-color 0.2s;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  width: 100%;
}

/* Spezifische Höhenanpassung je nach Teilnehmerdichte */
.arena-density-low .participant-btn {
  min-height: 110px;
  padding: 22px 26px;
}

.arena-density-high .participant-btn {
  min-height: 62px;
  padding: 10px 16px;
}

.participant-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.18);
}

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

/* Farbstreifen am linken Rand jedes Buttons */
.participant-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 10px;
  background-color: var(--p-color);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  transition: width 0.2s ease;
}

/* Spezifikationsanforderung: Der Button der sprechenden Person wird mit einem schwarzen Rahmen markiert */
.participant-btn.is-speaking {
  /* Markanter, kontraststarker schwarzer Rahmen */
  outline: 4px solid #000000;
  outline-offset: 3px;
  border-color: #ffffff !important;
  box-shadow: 0 0 0 7px rgba(0, 0, 0, 0.75), 0 10px 36px var(--p-shadow);
  transform: scale(1.02);
  z-index: 2;
  animation: pulse-speaking 2s infinite ease-in-out;
}

.participant-btn.is-speaking::before {
  width: 16px;
}

/* Button Layout & Avatar */
.p-btn-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding-left: 6px;
}

.p-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--p-avatar-bg, rgba(255, 255, 255, 0.12));
  border: 2px solid var(--p-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}

.arena-density-high .p-avatar {
  width: 40px;
  height: 40px;
  font-size: 1.35rem;
}

.arena-density-low .p-avatar {
  width: 60px;
  height: 60px;
  font-size: 2.1rem;
}

.participant-btn.is-speaking .p-avatar {
  transform: scale(1.12) rotate(-3deg);
  box-shadow: 0 6px 20px var(--p-shadow);
}

.p-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.p-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.p-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arena-density-low .p-name {
  font-size: 1.35rem;
}

.arena-density-high .p-name {
  font-size: 1rem;
}

.speaking-badge {
  display: none;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: #000000;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  flex-shrink: 0;
}

.participant-btn.is-speaking .speaking-badge {
  display: inline-block;
  animation: blink 1.2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.p-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.p-duration {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.arena-density-low .p-duration {
  font-size: 1.5rem;
}

.arena-density-high .p-duration {
  font-size: 1.05rem;
}

.p-percentage {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Center Chart Container */
.chart-center-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
}

.chart-wrapper {
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1 / 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SVG Chart Styles */
.speech-chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-center-circle {
  fill: #0d1326;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 2px;
}

.chart-center-status {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  fill: var(--text-muted);
}

.chart-center-status.active {
  fill: var(--accent-green);
}

.chart-center-status.paused {
  fill: var(--accent-gold);
}

.chart-center-speaker {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
}

.chart-center-time {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  fill: #ffffff;
}

.chart-center-sub {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-muted);
}

.chart-pulse-ring.pulsing {
  animation: ring-pulse 1.8s infinite ease-out;
}

@keyframes ring-pulse {
  0% {
    r: 102px;
    opacity: 0.8;
  }
  100% {
    r: 116px;
    opacity: 0;
  }
}

.chart-segment {
  transition: all 0.3s ease;
  cursor: pointer;
}

.chart-segment:hover {
  opacity: 0.85;
}

/* =======================================================
   5. SMARTPHONE PARTICIPANT VIEW (MODUS 2 CLIENT)
   ======================================================= */
.client-screen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-height: 100vh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
}

.client-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-glass-subtle);
}

.client-brand {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
}

.client-connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.client-connection-pill.reconnecting {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.client-connection-pill.disconnected {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.client-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  margin: auto 0;
}

.client-identity-card {
  text-align: center;
}

.client-user-name {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
}

.client-user-stats {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Ergonomischer Riesen-Button für Smartphone */
.big-speak-btn {
  width: 230px;
  height: 230px;
  border-radius: 50%;
  border: none;
  background: var(--client-color, #3b82f6);
  color: var(--client-text-color, #ffffff);
  box-shadow: 0 12px 40px var(--client-shadow, rgba(59, 130, 246, 0.4));
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
  outline: none;
  position: relative;
}

.big-speak-btn:active {
  transform: scale(0.94);
}

.big-speak-btn.is-active {
  outline: 6px solid #000000;
  outline-offset: 4px;
  box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.7), 0 16px 50px var(--client-shadow, rgba(59, 130, 246, 0.5));
  animation: mobile-pulse 1.6s infinite ease-in-out;
}

@keyframes mobile-pulse {
  0%, 100% {
    transform: scale(1.02);
  }
  50% {
    transform: scale(1.06);
  }
}

.big-speak-icon {
  font-size: 3.2rem;
  line-height: 1;
}

.big-speak-label {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
}

.big-speak-sub {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
}

.client-room-info {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.client-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wakelock-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

/* =======================================================
   6. SUMMARY MODAL
   ======================================================= */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-header {
  text-align: center;
}

.summary-stats-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
}

.summary-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.summary-bar-bg {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.summary-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.modal-actions button {
  flex: 1;
}

/* =======================================================
   RESPONSIVES DESIGN (IPAD & MOBILE)
   ======================================================= */
@media (max-width: 1024px) {
  .meeting-arena {
    gap: 12px;
  }
  .participant-btn {
    padding: 12px 16px;
    min-height: 64px;
  }
  .p-name {
    font-size: 1.05rem;
  }
  .p-duration {
    font-size: 1.1rem;
  }
}

@media (max-width: 768px) {
  .meeting-screen {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  .meeting-arena {
    grid-template-columns: 1fr;
  }
  .chart-center-container {
    order: -1;
    margin-bottom: 12px;
  }
  .chart-wrapper {
    max-width: 300px;
  }
}
