/**
 * Schul-Podcaster - Gemeinsames Stylesheet
 * Version 9.2 - Studio Edition (durchgaengig dunkel)
 *
 * Wird von index.html (Startseite, Login-Dialoge, Admin-Dashboard) und
 * recorder.html (zusammen mit recorder-styles.css) eingebunden.
 *
 * Die Farbwelt stammt aus dem Login-Fenster (naechtliches Studio: tiefes Blau,
 * Indigo, Cyan, warmes Lampen-Bernstein) und gilt seit Version 9.2 fuer das
 * gesamte Produkt. Alle Farben stehen als Tokens unter :root - wer die Optik
 * aendern will, aendert dort und nirgends sonst.
 *
 * listen.html ist weiterhin eine eigenstaendige Datei mit eigenem <style>-Block;
 * sie spiegelt dieselben Tokenwerte (siehe readme/06-frontend.md).
 */

/* ==========================================================================
   1. Design-Tokens
   ========================================================================== */

:root {
  /* --- Flaechen ---------------------------------------------------------- */
  --st-ink:        #060a16;                   /* tiefster Hintergrund */
  --st-ink-2:      #0a1024;                   /* Flaeche eine Stufe heller */
  --st-panel:      rgba(10, 15, 33, 0.86);    /* Glas-Panel, z. B. Dialoge */
  --st-card:       rgba(255, 255, 255, 0.04); /* Karte auf dunklem Grund */
  --st-card-hover: rgba(255, 255, 255, 0.07);
  --st-glass:      rgba(255, 255, 255, 0.055);
  --st-glass-2:    rgba(255, 255, 255, 0.10);
  --st-line:       rgba(255, 255, 255, 0.13);
  --st-line-soft:  rgba(255, 255, 255, 0.08);

  /* --- Akzente ----------------------------------------------------------- */
  --st-indigo:     #6366f1;   /* Primaerfarbe, Gruppen-Login, Speichern */
  --st-indigo-dk:  #4f46e5;
  --st-cyan:       #22d3ee;   /* anhoeren, Fokus, aktive Zustaende */
  --st-amber:      #f5a524;   /* Lampenlicht, aufnehmen, Admin */
  --st-amber-dk:   #d97706;
  --st-green:      #10b981;   /* Erfolg */
  --st-red:        #ef4444;   /* Gefahr, Aufnahme laeuft */
  --st-red-soft:   #ffb4ab;   /* Fehlertext auf dunklem Grund */

  /* --- Text -------------------------------------------------------------- */
  --st-text:       #f2f5fc;
  --st-dim:        #a5b1cf;
  --st-muted:      #7d89a8;

  /* --- Farben, die JavaScript auf ein <canvas> zeichnet -------------------
     Ein Canvas kennt keine CSS-Variablen. recorder.js liest diese Werte
     deshalb beim Zeichnen ueber getComputedStyle() aus - damit bleiben auch
     die Wellenformen an dieses Token-System gebunden. */
  --st-wave:            rgba(99, 102, 241, 0.95); /* Huellkurve */
  --st-wave-axis:       rgba(255, 255, 255, 0.10); /* Mittellinie */
  --st-wave-select:     rgba(34, 211, 238, 0.18); /* ausgewaehlter Bereich */
  --st-wave-select-line:rgba(34, 211, 238, 0.80); /* dessen Kanten */
  --st-wave-live:       #22d3ee;                  /* Pegel waehrend der Aufnahme */
  --st-wave-cursor:     #f5a524;                  /* Abspielzeiger */

  /* --- Bild und Form ----------------------------------------------------- */
  --st-hero:       url("assets/Login.webp");
  --st-radius-s:   12px;
  --st-radius:     16px;
  --st-radius-l:   24px;
  --st-radius-xl:  28px;
  --st-shadow:     0 32px 80px -24px rgba(0, 0, 0, 0.85);
  --st-shadow-s:   0 12px 30px -14px rgba(0, 0, 0, 0.8);

  /* --- Schrift ----------------------------------------------------------- */
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* --- Aliase fuer aeltere Regeln ---------------------------------------- */
  --primary-color: var(--st-indigo);
  --accent-color:  var(--st-cyan);
  --bg-color:      var(--st-ink);
  --text-dark:     var(--st-text);
  --card-bg:       var(--st-card);
  --radius:        var(--st-radius);
}

/* ==========================================================================
   2. Grundlagen
   ========================================================================== */

/* Frueher fehlte dieser Reset. Ohne ihn addiert sich jedes Innenabstands-Pixel
   zur Breite und Elemente mit width:100% laufen auf schmalen Displays ueber. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  background: var(--st-ink);
  color: var(--st-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Sichtbarer Fokus ueberall - vorher fehlte er im Admin-Dashboard komplett. */
:focus-visible {
  outline: 2px solid var(--st-cyan);
  outline-offset: 2px;
}

/* Touch-Geraete: kein Verzoegern und kein Doppeltipp-Zoom auf Bedienelementen. */
button,
a,
input,
select,
label {
  touch-action: manipulation;
}

/* ==========================================================================
   3. Dialoge
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 17, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 1rem;
  /* iPad: Dialoge nicht unter Notch oder Home-Indikator schieben. */
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
           max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 26rem;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: clamp(1.75rem, 4vw, 2.4rem);
  border-radius: var(--st-radius-xl);
  border: 1px solid var(--st-line);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.03) 60%),
    var(--st-panel);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
  color: var(--st-text);
  animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Leuchtende Oberkante wie am Studio-Panel. */
.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--st-indigo), var(--st-cyan), var(--st-amber), transparent);
  opacity: 0.85;
}

.modal-content.large {
  max-width: 820px;
  height: min(80vh, 100%);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--st-line-soft);
}
.modal-content.large .modal-header {
  padding: 1.25rem 1.5rem;
  margin: 0;
  background: rgba(255, 255, 255, 0.04);
}
.modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--st-text);
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--st-glass);
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--st-dim);
  transition: background 0.2s, color 0.2s, transform 0.2s;
  z-index: 10;
}
.close-modal:hover {
  background: rgba(239, 68, 68, 0.22);
  color: var(--st-red-soft);
  transform: rotate(90deg);
}
/* In grossen Dialogen sitzt der Knopf in der Kopfzeile statt absolut. */
.modal-content.large .close-modal {
  position: static;
  transform: none;
}
.modal-content.large .close-modal:hover { transform: none; }

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.modal-content.large .modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Symbol oben im Dialog */
.modal-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  background: linear-gradient(140deg, var(--st-indigo), var(--st-cyan));
  box-shadow: 0 18px 38px -14px rgba(99, 102, 241, 0.85);
}
.modal-icon svg {
  width: 28px;
  height: 28px;
  color: #fff;
}
.modal-icon--admin {
  background: linear-gradient(140deg, var(--st-amber), #e0603a);
  box-shadow: 0 18px 38px -14px rgba(245, 165, 36, 0.7);
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 0.4rem;
  color: #fff;
}

.modal-sub {
  text-align: center;
  margin: 0 0 1.6rem;
  color: var(--st-dim);
  font-size: 0.93rem;
  line-height: 1.5;
}

/* ==========================================================================
   4. Eingabefelder
   ========================================================================== */

.input-field {
  width: 100%;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--st-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--st-text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.input-field::placeholder {
  color: var(--st-muted);
}
.input-field:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.07);
}
.input-field:focus {
  outline: none;
  border-color: var(--st-indigo);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.22);
}

/* Passwortfelder mit Augensymbol */
.password-wrapper {
  position: relative;
  width: 100%;
}
.password-wrapper .input-field {
  padding-right: 46px;
}
.toggle-password {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--st-muted);
  background: none;
  border: none;
  border-radius: 10px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.toggle-password:hover,
.toggle-password.is-visible {
  color: var(--st-cyan);
}
.toggle-password svg {
  width: 20px;
  height: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--st-dim);
}

/* ==========================================================================
   5. Schaltflaechen
   ========================================================================== */

.btn-primary {
  padding: 0.9rem 1.75rem;
  min-height: 48px;
  background: linear-gradient(135deg, var(--st-indigo), var(--st-indigo-dk));
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  box-shadow: 0 16px 34px -14px rgba(99, 102, 241, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px -14px rgba(99, 102, 241, 1);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  padding: 0.7rem 1.4rem;
  min-height: 44px;
  background: var(--st-glass);
  color: var(--st-text);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-s);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-secondary:hover {
  background: var(--st-glass-2);
  border-color: rgba(255, 255, 255, 0.3);
}
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-small {
  padding: 0.5rem 0.9rem;
  min-height: 38px;
  background: var(--st-glass);
  color: var(--st-dim);
  border: 1px solid var(--st-line-soft);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn-small:hover {
  background: var(--st-glass-2);
  border-color: var(--st-line);
  color: var(--st-text);
}
.btn-small.danger {
  color: var(--st-red-soft);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.10);
}
.btn-small.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fff;
}
.btn-small:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bernstein statt Indigo im Admin-Dialog */
.modal-content--admin .btn-primary {
  background: linear-gradient(135deg, var(--st-amber), var(--st-amber-dk));
  box-shadow: 0 16px 34px -14px rgba(245, 165, 36, 0.85);
}
.modal-content--admin .btn-primary:hover {
  box-shadow: 0 22px 44px -14px rgba(245, 165, 36, 0.95);
}

.full-width { width: 100%; }

/* ==========================================================================
   6. Meldungen und Ladeanzeige
   ========================================================================== */

.error-text {
  margin: 0;
  padding: 0.6rem 0.75rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--st-red-soft);
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 10px;
  display: none;
}
.error-text:not(:empty) {
  display: block;
}

.empty-text {
  text-align: center;
  color: var(--st-muted);
  font-style: italic;
  margin: 2rem 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--st-line);
  border-top-color: var(--st-indigo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   7. Admin-Dashboard
   ========================================================================== */

.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: var(--st-text);
  background:
    radial-gradient(90% 60% at 15% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
    radial-gradient(70% 50% at 95% 0%, rgba(245, 165, 36, 0.12), transparent 62%),
    linear-gradient(160deg, #0a1230 0%, #0b1026 45%, var(--st-ink) 100%);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.admin-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
  padding-top: max(2rem, env(safe-area-inset-top));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--st-card);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-l);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.admin-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--st-text);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-header .admin-hint {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--st-muted);
}

.admin-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.admin-card {
  background: var(--st-card);
  border: 1px solid var(--st-line-soft);
  border-radius: var(--st-radius-l);
  padding: 1.6rem;
  transition: border-color 0.2s;
}
.admin-card:hover {
  border-color: var(--st-line);
}
.admin-card.full-width {
  grid-column: 1 / -1;
}
.admin-card h3 {
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--st-line-soft);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--st-text);
}

.settings-form,
.create-group-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* --- eine Klasse als Karte ------------------------------------------------ */
.admin-class {
  background: var(--st-card);
  border: 1px solid var(--st-line-soft);
  border-radius: var(--st-radius-l);
  padding: 1.5rem;
}

.admin-class-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--st-line-soft);
}

.admin-class-head h3 {
  margin: 0 0 0.35rem;
  padding: 0;
  border: none;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--st-text);
}

.admin-class-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--st-dim);
}

/* Passwortfeld mit Speichern-Knopf in einer Zeile */
.pw-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pw-inline .input-field {
  width: 10rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.admin-groups {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--st-line-soft);
  border-radius: var(--st-radius);
  padding: 1rem;
}
.admin-groups h4 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--st-muted);
}

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.6rem;
  background: var(--st-glass);
  border: 1px solid var(--st-line-soft);
  border-radius: var(--st-radius-s);
  transition: background 0.2s, border-color 0.2s;
}
.admin-list-item:last-child { margin-bottom: 0; }
.admin-list-item:hover {
  background: var(--st-card-hover);
  border-color: var(--st-line);
}
.admin-list-item .info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.admin-list-item .info strong {
  color: var(--st-text);
  font-size: 1rem;
}
.admin-list-item .info span {
  font-size: 0.85rem;
  color: var(--st-dim);
}
.admin-list-item .badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
  font-weight: 600;
}
.admin-list-item .badge--warn {
  background: rgba(245, 165, 36, 0.16);
  border-color: rgba(245, 165, 36, 0.4);
  color: #ffd79a;
}
.admin-list-item .actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.add-group-inline {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--st-line);
}
.add-group-inline h5 {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--st-dim);
}
.add-group-fields {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.add-group-fields .input-field {
  flex: 1 1 10rem;
  min-width: 0;
}

.admin-orphans {
  border-color: rgba(245, 165, 36, 0.4);
}

/* --- Aufnahmen im Detail-Dialog ------------------------------------------ */
.details-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.details-list:empty::after {
  content: "Keine Aufnahmen vorhanden.";
  color: var(--st-muted);
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

.recording-detail-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  background: var(--st-glass);
  border: 1px solid var(--st-line-soft);
  border-radius: var(--st-radius-s);
}
.recording-detail-item .rec-name {
  flex: 1 1 12rem;
  min-width: 0;
  font-weight: 500;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.recording-detail-item audio {
  flex: 2 1 16rem;
  min-width: 0;
  height: 40px;
}
.recording-detail-item .delete-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: var(--st-red-soft);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.recording-detail-item .delete-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

/* ==========================================================================
   8. Startseite (Studio-Login)
   Aufbau: Foto + Abdunkelung, Glas-Panel links, Einstiege als grosse Flaechen.
   ========================================================================== */

.page-login {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--st-ink);
  color: var(--st-text);
}

/* --- Buehne: Foto + Verlauf, der links Platz zum Lesen schafft ------------ */
.studio-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  isolation: isolate;
  overflow: hidden;
  /* Farbverlauf als Sofortbild, damit vor dem Laden des Fotos kein
     Weissblitz entsteht (Login.webp ist rund 108 KB gross). */
  background:
    radial-gradient(120% 90% at 78% 42%, rgba(99, 102, 241, 0.30), transparent 60%),
    radial-gradient(80% 60% at 96% 18%, rgba(245, 165, 36, 0.16), transparent 62%),
    linear-gradient(160deg, #0a1230 0%, #0b1026 45%, var(--st-ink) 100%);
}

.studio-shell::before,
.studio-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Das Foto */
.studio-shell::before {
  background-image: var(--st-hero);
  background-size: cover;
  background-position: 68% center;
  background-repeat: no-repeat;
  opacity: 0;
  animation: studioHeroIn 1.2s ease 0.05s forwards;
}

/* Abdunkelung: links dicht (Textbereich), rechts offen (Mikrofon sichtbar) */
.studio-shell::after {
  background:
    linear-gradient(
      100deg,
      rgba(4, 7, 17, 0.94) 0%,
      rgba(5, 9, 22, 0.88) 26%,
      rgba(6, 11, 28, 0.58) 50%,
      rgba(6, 11, 28, 0.18) 72%,
      rgba(6, 11, 28, 0.05) 100%
    ),
    linear-gradient(to top, rgba(4, 7, 17, 0.75), transparent 38%);
}

@keyframes studioHeroIn {
  to { opacity: 1; }
}

/* Feines Korn - nimmt dem Verlauf das Banding */
.studio-grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

/* --- Raster: Panel links, Foto rechts ------------------------------------ */
.studio-grid {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 30rem) 1fr;
  align-items: center;
  gap: 2rem;
  padding: clamp(1.25rem, 4vw, 4.5rem);
  padding-top: max(clamp(1.25rem, 4vw, 4.5rem), env(safe-area-inset-top));
  padding-bottom: max(clamp(1.25rem, 4vw, 4.5rem), env(safe-area-inset-bottom));
}

/* --- Glas-Panel ---------------------------------------------------------- */
.studio-panel {
  position: relative;
  /* Ohne min-width: 0 wuerde die Mindestbreite der Kopfzeile das Panel
     ueber die Rasterspalte hinaus wachsen lassen (Ueberlauf auf Handys). */
  min-width: 0;
  padding: clamp(1.6rem, 3.2vw, 2.5rem);
  border-radius: var(--st-radius-xl);
  border: 1px solid var(--st-line);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.03) 60%),
    rgba(8, 12, 28, 0.55);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow:
    var(--st-shadow),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
}

/* Leuchtende Oberkante - Indigo, Cyan, Bernstein wie das Lampenlicht */
.studio-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--st-indigo), var(--st-cyan), var(--st-amber), transparent);
  opacity: 0.85;
}

/* --- Kopfzeile: Logo, Wortmarke, ON-AIR-Lampe ---------------------------- */
.studio-brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: 0.85rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
}

.studio-mark {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--st-indigo), var(--st-cyan));
  box-shadow: 0 12px 28px -10px rgba(99, 102, 241, 0.9);
}
.studio-mark svg { width: 22px; height: 22px; }

.studio-wordmark {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--st-dim);
  margin-right: auto;
  line-height: 1.4;
  min-width: 0;
}

.studio-tally {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(245, 165, 36, 0.35);
  background: rgba(245, 165, 36, 0.10);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffd79a;
  white-space: nowrap;
}
.studio-tally i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--st-amber);
  box-shadow: 0 0 10px 2px rgba(245, 165, 36, 0.75);
  animation: studioTally 2.4s ease-in-out infinite;
}
@keyframes studioTally {
  0%, 100% { opacity: 1;    box-shadow: 0 0 10px 2px rgba(245, 165, 36, 0.75); }
  50%      { opacity: 0.55; box-shadow: 0 0 4px 1px rgba(245, 165, 36, 0.35); }
}

/* --- Ueberschrift -------------------------------------------------------- */
.studio-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 0.85rem;
}
.studio-title em {
  display: block;
  font-style: normal;
  background: linear-gradient(100deg, var(--st-cyan) 0%, #b7a5ff 45%, var(--st-amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.studio-lead {
  margin: 0 0 clamp(1.5rem, 4vw, 2.1rem);
  max-width: 34ch;
  color: var(--st-dim);
  font-size: 1rem;
  line-height: 1.6;
}

/* --- Einstiegs-Optionen -------------------------------------------------- */
.studio-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.studio-action {
  --acc: var(--st-cyan);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
  min-height: 76px;
  padding: 0.9rem 1.1rem;
  border-radius: 18px;
  border: 1px solid var(--st-line);
  background: var(--st-glass);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.studio-action--rec { --acc: var(--st-amber); }

.studio-action:hover,
.studio-action:focus-visible {
  transform: translateX(5px);
  background: var(--st-glass-2);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.9);
}
.studio-action:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
}
.studio-action:active { transform: translateX(2px) scale(0.995); }

.studio-action-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--acc);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: box-shadow 0.25s, border-color 0.25s;
}
.studio-action-icon svg { width: 22px; height: 22px; }
.studio-action:hover .studio-action-icon {
  box-shadow: 0 0 22px -4px var(--acc);
  border-color: var(--acc);
}

.studio-action > span { min-width: 0; }

.studio-action b {
  display: block;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.studio-action small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: var(--st-dim);
}

.studio-action-go {
  font-size: 1.15rem;
  color: var(--st-dim);
  transform: translateX(-4px);
  opacity: 0.5;
  transition: transform 0.25s, opacity 0.25s, color 0.25s;
}
.studio-action:hover .studio-action-go {
  transform: translateX(0);
  opacity: 1;
  color: var(--acc);
}

/* --- Fusszeile ----------------------------------------------------------- */
.studio-foot {
  margin-top: clamp(1.5rem, 4vw, 2.1rem);
  padding-top: 1.15rem;
  border-top: 1px solid var(--st-line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.studio-hint {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(165, 177, 207, 0.6);
}

.studio-adminlink {
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  color: var(--st-dim);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.studio-adminlink svg { width: 15px; height: 15px; }
.studio-adminlink:hover {
  color: var(--st-text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--st-line);
}

/* --- rechte Spalte: dezente Studio-Notiz --------------------------------- */
.studio-stage-note {
  align-self: end;
  justify-self: end;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
}

/* --- Auftritt: gestaffelt ------------------------------------------------ */
.studio-panel > * {
  animation: studioRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.studio-panel > .studio-brand   { animation-delay: 0.10s; }
.studio-panel > .studio-title   { animation-delay: 0.18s; }
.studio-panel > .studio-lead    { animation-delay: 0.24s; }
.studio-panel > .studio-actions { animation-delay: 0.30s; }
.studio-panel > .studio-foot    { animation-delay: 0.38s; }

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

/* ==========================================================================
   9. Responsive
   ========================================================================== */

/* Tablet quer / kleines Notebook: Panel bleibt links, wird schmaler */
@media (max-width: 1100px) {
  .studio-grid { grid-template-columns: minmax(0, 27rem) 1fr; }
}

/* Ab hier passt kein zweispaltiges Layout mehr: Panel zentriert,
   Foto tritt in den Hintergrund. */
@media (max-width: 860px) {
  .studio-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    padding-left: clamp(1rem, 5vw, 2rem);
    padding-right: clamp(1rem, 5vw, 2rem);
  }
  .studio-panel { max-width: 30rem; width: 100%; }
  .studio-shell::before { background-position: 60% center; }
  .studio-shell::after {
    background: linear-gradient(180deg, rgba(4, 7, 17, 0.86) 0%, rgba(5, 9, 22, 0.9) 55%, rgba(4, 7, 17, 0.95) 100%);
  }
  .studio-stage-note { display: none; }
}

/* iPad und Tablets: mehr Luft, groessere Trefferflaechen */
@media (min-width: 768px) and (max-width: 1024px) {
  .admin-container { padding: 1.5rem; }
  .admin-content { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

@media (max-width: 768px) {
  .admin-container { padding: 1rem; }
  .admin-content { grid-template-columns: 1fr; }
  .admin-class { padding: 1.15rem; }
}

@media (max-width: 600px) {
  /* Login-Dialoge bleiben mittig statt als Sheet von unten */
  .modal { padding: 1rem; }
  .modal-content {
    border-radius: var(--st-radius-l);
    max-width: 100%;
    padding: 1.6rem 1.35rem;
  }
  /* 16px verhindert, dass iOS beim Fokus in das Feld hineinzoomt. */
  .input-field { font-size: 16px; }

  .studio-grid { align-items: start; padding-top: clamp(1.5rem, 8vw, 3rem); }
  .studio-panel { border-radius: var(--st-radius-l); padding: 1.4rem 1.25rem; }
  /* Wortmarke kompakter, damit die Kopfzeile einzeilig bleibt */
  .studio-wordmark { font-size: 0.6rem; letter-spacing: 0.12em; }
  .studio-tally { font-size: 0.58rem; letter-spacing: 0.14em; padding: 0.3rem 0.55rem; }
  .studio-lead { font-size: 0.95rem; }
  .studio-action { min-height: 68px; padding: 0.8rem 0.95rem; gap: 0.8rem; }
  .studio-action-icon { width: 42px; height: 42px; border-radius: 12px; }
  .studio-action b { font-size: 0.97rem; }
  .studio-action small { font-size: 0.8rem; }
  .studio-foot { justify-content: center; }
  .studio-hint { display: none; }

  .admin-header {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .admin-list-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .admin-list-item .actions { width: 100%; }
  .admin-list-item .actions button { flex: 1; min-height: 44px; }
  .pw-inline .input-field { width: 100%; flex: 1 1 8rem; }
  .recording-detail-item { flex-direction: column; align-items: stretch; }
  .recording-detail-item audio { width: 100%; }
  .recording-detail-item .delete-btn { align-self: flex-end; }
}

/* Touch-Geraete: alles, was gedrueckt wird, mindestens 44 px hoch. */
@media (pointer: coarse) {
  .btn-primary,
  .btn-secondary,
  .btn-small,
  .toggle-password,
  .close-modal {
    min-height: 44px;
  }
  .toggle-password,
  .close-modal {
    min-width: 44px;
  }
  .pw-inline .input-field { min-height: 40px; }
}

/* ==========================================================================
   10. Bewegung reduzieren, Kontrast erhoehen
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .studio-shell::before { animation: none; opacity: 1; }
  .studio-panel > *,
  .studio-tally i,
  .modal-content { animation: none !important; }
  .studio-action,
  .studio-action-go,
  .studio-action-icon,
  .btn-primary,
  .close-modal { transition: none; }
}

@media (prefers-contrast: more) {
  :root {
    --st-dim:  #cdd6ea;
    --st-line: rgba(255, 255, 255, 0.35);
  }
  .studio-shell::after {
    background: linear-gradient(100deg, rgba(2, 4, 10, 0.97) 0%, rgba(2, 4, 10, 0.94) 45%, rgba(2, 4, 10, 0.6) 100%);
  }
  .studio-panel { background: rgba(4, 7, 17, 0.92); }
  .modal-content { background: rgba(4, 7, 17, 0.96); }
}
