/* NYXUS AI - Oberflaeche. Dunkel, ruhig, mit dem Lila der Marke. */

:root {
  --grund: #0d0b14;
  --flaeche: #15121f;
  --flaeche-hell: #1d1930;
  --rand: #2b2542;
  --schrift: #e8e4f5;
  --schrift-still: #9b93b8;
  --lila: #8b5cf6;
  --lila-hell: #a78bfa;
  --gruen: #34d399;
  --rot: #f87171;
  --gelb: #fbbf24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--schrift);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
  height: 100vh;
  overflow: hidden;
}

.versteckt { display: none !important; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--rand);
  background: var(--flaeche-hell);
  color: var(--schrift);
  border-radius: 8px;
  padding: 8px 14px;
  transition: background .15s, border-color .15s;
}
button:hover { background: #262040; border-color: var(--lila); }
button.haupt, button[type="submit"] {
  background: var(--lila);
  border-color: var(--lila);
  color: #fff;
  font-weight: 600;
}
button.haupt:hover, button[type="submit"]:hover { background: var(--lila-hell); }
button.still {
  background: none;
  border: none;
  color: var(--schrift-still);
  text-align: left;
  padding: 6px 8px;
}
button.still:hover { color: var(--lila-hell); background: none; }
button.breit { width: 100%; }
button.stopp { background: var(--rot); border-color: var(--rot); color: #fff; }

input, textarea, select {
  font: inherit;
  background: var(--grund);
  color: var(--schrift);
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--lila); }
textarea { resize: vertical; font-family: inherit; }

/* --- Anmeldung ------------------------------------------------------------ */

.tor {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 30%, #1c1430, var(--grund));
}
.tor-karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: 16px;
  padding: 34px 30px;
  width: min(380px, 90vw);
  display: grid;
  gap: 12px;
}
.tor-logo { font-size: 26px; font-weight: 700; letter-spacing: 2px; text-align: center; }
.tor-logo span { color: var(--lila); }
.tor-text { color: var(--schrift-still); text-align: center; margin: 0 0 6px; font-size: 14px; }
.fehler { color: var(--rot); font-size: 13px; min-height: 18px; margin: 0; text-align: center; }

/* --- Aufbau --------------------------------------------------------------- */

.flaeche {
  display: grid;
  grid-template-columns: 240px 1fr 320px;
  height: 100vh;
}

.seite, .rechts {
  background: var(--flaeche);
  border-right: 1px solid var(--rand);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.rechts { border-right: none; border-left: 1px solid var(--rand); }

.marke { font-size: 19px; font-weight: 700; letter-spacing: 1.5px; }
.marke span { color: var(--lila); }

.liste { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.liste .eintrag {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--schrift-still);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.liste .eintrag:hover { background: var(--flaeche-hell); color: var(--schrift); }
.liste .eintrag.aktiv { background: var(--flaeche-hell); color: var(--lila-hell); }

.seite-fuss { display: flex; flex-direction: column; border-top: 1px solid var(--rand); padding-top: 10px; }

/* --- Mitte ---------------------------------------------------------------- */

.mitte { display: flex; flex-direction: column; overflow: hidden; }

.kopf {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--rand);
  font-size: 13px;
  color: var(--schrift-still);
}
.modell::before {
  content: "●";
  color: var(--gruen);
  margin-right: 7px;
}
.modell.aus::before { color: var(--rot); }

.chat { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }

.blase { max-width: 80%; padding: 12px 16px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.blase.nutzer { align-self: flex-end; background: var(--lila); color: #fff; border-bottom-right-radius: 4px; }
.blase.ki { align-self: flex-start; background: var(--flaeche-hell); border-bottom-left-radius: 4px; }
.blase.system { align-self: center; background: none; color: var(--schrift-still); font-size: 13px; font-style: italic; }
.blase.fehler { align-self: center; background: #3b1a1a; color: #fca5a5; font-size: 13.5px; }

.blase pre {
  background: var(--grund);
  border: 1px solid var(--rand);
  border-radius: 8px;
  padding: 10px;
  overflow-x: auto;
  font-size: 13px;
}

.freigabe {
  align-self: center;
  background: var(--flaeche-hell);
  border: 1px solid var(--gelb);
  border-radius: 12px;
  padding: 14px 16px;
  max-width: 80%;
}
.freigabe h4 { margin: 0 0 6px; color: var(--gelb); font-size: 14px; }
.freigabe pre { font-size: 12px; max-height: 160px; }
.freigabe .knoepfe { display: flex; gap: 8px; margin-top: 10px; }

.eingabe {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--rand);
  background: var(--flaeche);
}
.eingabe textarea { max-height: 180px; }

/* --- Rechts: Plan und Protokoll ------------------------------------------- */

.rechts h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--schrift-still);
}

.plan { font-size: 13.5px; display: flex; flex-direction: column; gap: 6px; }
.plan.leer { color: var(--schrift-still); font-style: italic; }
.plan .schritt-zeile { display: flex; gap: 8px; align-items: flex-start; }
.plan .marke-offen { color: var(--schrift-still); }
.plan .marke-laeuft { color: var(--gelb); }
.plan .marke-fertig { color: var(--gruen); }
.plan .marke-gescheitert { color: var(--rot); }
.plan .fertig-text { color: var(--schrift-still); text-decoration: line-through; }

.protokoll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.werkzeug {
  background: var(--flaeche-hell);
  border-left: 3px solid var(--lila);
  border-radius: 0 8px 8px 0;
  padding: 7px 10px;
}
.werkzeug.fehler { border-left-color: var(--rot); }
.werkzeug.laeuft { border-left-color: var(--gelb); }
.werkzeug .name { font-weight: 600; color: var(--lila-hell); }
.werkzeug.fehler .name { color: var(--rot); }
.werkzeug .wert { color: var(--schrift-still); word-break: break-all; margin-top: 2px; }
.werkzeug .ergebnis {
  color: var(--schrift-still);
  margin-top: 4px;
  max-height: 90px;
  overflow: hidden;
  white-space: pre-wrap;
}

/* --- Dialoge -------------------------------------------------------------- */

dialog {
  background: var(--flaeche);
  color: var(--schrift);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 0;
  width: min(560px, 94vw);
  max-height: 88vh;
}
dialog::backdrop { background: rgba(0, 0, 0, .65); }
.fenster { padding: 22px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; max-height: 88vh; }
.fenster h2 { margin: 0; font-size: 19px; }

fieldset { border: 1px solid var(--rand); border-radius: 10px; padding: 14px; display: grid; gap: 10px; margin: 0; }
legend { padding: 0 6px; color: var(--lila-hell); font-size: 13px; font-weight: 600; }
label { display: grid; gap: 5px; font-size: 13.5px; color: var(--schrift-still); }
label:has(input[type="radio"]) { display: flex; align-items: center; gap: 8px; }
label input[type="radio"] { width: auto; }
.zeile { display: flex; gap: 8px; }
.hinweis { font-size: 12.5px; color: var(--schrift-still); margin: 0; }
.fenster-fuss { display: flex; gap: 10px; justify-content: flex-end; }

.gedaechtnis-liste { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.gedaechtnis-eintrag {
  background: var(--flaeche-hell);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  display: flex; justify-content: space-between; gap: 10px;
}
.gedaechtnis-eintrag b { color: var(--lila-hell); }
.gedaechtnis-eintrag button { padding: 2px 8px; font-size: 12px; }

/* --- Design-Studio -------------------------------------------------------- */

#designFenster { width: min(960px, 96vw); }
.studio { gap: 16px; }

.design-liste {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  max-height: 58vh;
  overflow-y: auto;
}
.design-karte {
  background: var(--flaeche-hell);
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: border-color .15s;
}
.design-karte:hover { border-color: var(--lila); }
.design-karte img {
  width: 100%;
  border-radius: 6px;
  display: block;
  /* Ein helles Karo, damit man durchsichtige Stellen erkennt. */
  background:
    linear-gradient(45deg, #222 25%, transparent 25%, transparent 75%, #222 75%),
    linear-gradient(45deg, #222 25%, #1a1a1a 25%, #1a1a1a 75%, #222 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
.design-name { font-size: 12.5px; color: var(--schrift-still); margin-top: 8px; }

.studio-kopf { display: flex; align-items: center; gap: 14px; }
.studio-kopf h2 { margin: 0; font-size: 17px; flex: 1; }

.studio-flaeche { display: grid; grid-template-columns: 1fr 230px; gap: 16px; align-items: start; }
.buehne-rahmen { display: grid; place-items: center; background: var(--grund); border-radius: 10px; padding: 16px; }
.buehne { position: relative; }
.buehne-bild { position: absolute; inset: 0; width: 100%; height: 100%; }

.griff {
  position: absolute;
  border: 1px dashed transparent;
  cursor: move;
}
.griff:hover { border-color: rgba(167, 139, 250, .7); }
.griff.gewaehlt { border: 1.5px solid var(--lila); background: rgba(139, 92, 246, .12); }

.eigenschaften { display: grid; gap: 10px; max-height: 54vh; overflow-y: auto; }
.eigenschaften input[type="color"] { height: 34px; padding: 2px; }

.blase img.ergebnis-bild {
  display: block;
  max-width: 320px;
  border-radius: 10px;
  margin-top: 8px;
  background: #1a1a1a;
}

/* --- Schmale Fenster ------------------------------------------------------ */

/* --- Kopfknoepfe, Mikrofon ------------------------------------------------ */

.kopf { gap: 12px; }
.kopf-text {
  flex: 1; min-width: 0;
  display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 12px;
}
.kopf-text > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 8px; color: var(--schrift); }
label input[type="checkbox"] { width: auto; }
.kopf-knopf, .handy-knopf {
  background: none;
  border: 1px solid var(--rand);
  padding: 6px 10px;
  font-size: 17px;
  line-height: 1;
  flex: none;
}
.kopf-knopf.an { border-color: var(--lila); background: var(--flaeche-hell); }
.handy-knopf { display: none; }

.mikro {
  flex: none;
  font-size: 18px;
  padding: 8px 12px;
  background: var(--flaeche-hell);
}
.mikro.hoert {
  background: var(--rot);
  border-color: var(--rot);
  animation: hoert 1.1s ease-in-out infinite;
}
@keyframes hoert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .6); }
  50% { box-shadow: 0 0 0 10px rgba(248, 113, 113, 0); }
}

.schleier { display: none; }

@media (max-width: 1100px) {
  .flaeche { grid-template-columns: 200px 1fr; }
  .rechts {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(340px, 88vw);
    z-index: 30;
    transform: translateX(100%);
    transition: transform .2s ease;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  body.plan-offen .rechts { transform: none; }
  body.plan-offen .schleier { display: block; }
  #planKnopf { display: inline-block; }
  .schleier { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; }
}

@media (max-width: 700px) {
  body { height: 100dvh; }
  .flaeche { grid-template-columns: 1fr; height: 100dvh; }
  .seite {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(290px, 84vw);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform .2s ease;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  body.menue-offen .seite { transform: none; }
  body.menue-offen .schleier { display: block; }
  #menueKnopf { display: inline-block; }

  .kopf { padding-top: calc(10px + env(safe-area-inset-top, 0px)); gap: 8px; }
  .eingabe { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
  /* 16px verhindert, dass iOS beim Antippen hineinzoomt. */
  .eingabe textarea { font-size: 16px; }
  .kopf, .eingabe { padding-left: 12px; padding-right: 12px; }
  .chat { padding: 14px 12px; }
  .blase { max-width: 90%; }
  .seite-fuss button, .liste .eintrag { padding: 11px 10px; font-size: 15px; }
  dialog { max-width: 100vw; }
}
