/* Keynote — Live-Website neben den Slides.
   Desktop: iframe links, Slides rechts (Start 60/40).
   Mobil:   gestapelt, iframe oben (Start 50/50).
   Die Grenze ist in beiden Fällen verschiebbar; --teilung setzt app.js. */

:root {
  --grund: #0b0d12;
  --flaeche: #141821;
  --rand: #232936;
  --text: #eef1f6;
  --text-leise: #99a2b3;
  --akzent: #4f8cff;
  --teilung: 60%;
  --griff-dicke: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ------------------------------------------------------------------ Bühne */

.buehne {
  display: grid;
  height: 100dvh;
  grid-template-columns: var(--teilung) var(--griff-dicke) 1fr;
}

/* Waehrend des Ziehens schluckt sonst der iframe den Zeiger, sobald er ihn ueberfaehrt –
   die Grenze bliebe an der Kante haengen. */
body.zieht,
body.zieht * {
  cursor: col-resize;
  user-select: none;
}

body.zieht.quer,
body.zieht.quer * {
  cursor: row-resize;
}

body.zieht #site {
  pointer-events: none;
}

/* ------------------------------------------------------------------ Griff */

.griff {
  position: relative;
  border: 0;
  background: var(--rand);
  cursor: col-resize;
  touch-action: none;
}

/* 6 px trifft niemand zuverlaessig. Der unsichtbare Streifen daneben faengt mit. */
.griff::before {
  position: absolute;
  content: '';
  inset: 0 -7px;
}

.griff:focus-visible {
  background: var(--akzent);
  outline: none;
}

/* Mobil liegt der Fortschritt im Griff – die Trennlinie ist dann die Anzeige. */
.griff .punkte {
  position: absolute;
  inset: 0;
  gap: 2px;
}

.griff .punkte li {
  height: 100%;
  border-radius: 0;
  background: var(--rand);
}

/* --------------------------------------------------------------- iframe */

.rahmen {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: #fff;
}

.rahmen-leiste {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--rand);
  background: var(--flaeche);
  gap: 12px;
  flex: 0 0 38px;
}

.ampel {
  display: flex;
  gap: 6px;
}
.ampel i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--rand);
}

.rahmen-url {
  overflow: hidden;
  flex: 1;
  color: var(--text-leise);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rahmen-flaeche {
  position: relative;
  min-height: 0;
  flex: 1;
}

#site {
  position: absolute;
  border: 0;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ------------------------------------------------------------------ Malen */

/* Liegt immer über dem iframe, nimmt aber nur im Mal-Zustand Zeiger an –
   sonst wäre die Website nicht mehr bedienbar. */
#tafel {
  position: absolute;
  inset: 0;
  /* Ohne die beiden Zeilen behält das Canvas seine Attribut-Breite: bei absolut
     positionierten ersetzten Elementen gewinnt die intrinsische Größe gegen `inset`.
     Es würde beim Verkleinern der Spalte überstehen – und nur teilweise gelöscht. */
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: none;
}

body.malt #tafel {
  cursor: crosshair;
  pointer-events: auto;
}

.malzeug {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nur-vorlesen {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  white-space: nowrap;
}

.farb-knopf {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 2px solid var(--rand);
  border-radius: 50%;
  background: var(--mal-farbe, #ff3b30);
  cursor: pointer;
}

.farb-knopf:hover,
.farb-knopf[aria-expanded='true'] {
  border-color: var(--text-leise);
}

/* Im Mal-Zustand hat die Farbwahl nichts zu suchen – dort löscht der Knopf nur noch. */
body.malt .farb-knopf {
  display: none;
}

.farbwahl {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  padding: 7px;
  border: 1px solid var(--rand);
  border-radius: 10px;
  background: var(--flaeche);
  box-shadow: 0 8px 24px rgb(0 0 0 / 45%);
  gap: 7px;
}

.farbwahl[hidden] {
  display: none;
}

.farbwahl button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}

.farbwahl button[aria-checked='true'] {
  border-color: var(--text);
}

.mal-knopf {
  display: flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--rand);
  border-radius: 7px;
  background: transparent;
  color: var(--text-leise);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.mal-knopf:hover {
  border-color: var(--akzent);
  color: var(--akzent);
}

.mal-knopf[aria-pressed='true'] {
  border-color: var(--mal-farbe);
  color: var(--mal-farbe);
}

.mal-knopf svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.mal-knopf svg[hidden] {
  display: none;
}

/* --------------------------------------------------------------- Slides */

.slides {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 32px 34px 22px;
  background: var(--grund);
  outline: none;
}

.slide-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-leise);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.marke {
  color: var(--akzent);
  font-weight: 600;
}

.slide-inhalt {
  display: flex;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  gap: 18px;
  overflow-y: auto;
}

.slide-inhalt h2 {
  margin: 0;
  font-size: clamp(24px, 2.6vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.slide-inhalt p {
  max-width: 46ch;
  margin: 0;
  color: var(--text-leise);
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.6;
}

.slide-inhalt ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-leise);
  font-size: clamp(15px, 1.1vw, 17px);
  line-height: 1.75;
}

.slide-inhalt li::marker {
  color: var(--akzent);
}

/* Wird eingeblendet, wenn die Slide den iframe umschaltet. */
.sprung {
  align-self: flex-start;
  padding: 4px 10px;
  border: 1px solid var(--rand);
  border-radius: 999px;
  color: var(--text-leise);
  font-size: 12px;
}

/* --------------------------------------------------------------- Fußzeile */

.slide-fuss {
  display: flex;
  align-items: center;
  padding-top: 18px;
  flex-direction: column;
  gap: 16px;
}

/* Auf dem Desktop steht der Fortschritt hier; mobil wandert er in den Griff und
   dieser Platzhalter bleibt leer (und damit unsichtbar). */
.punkte-platz {
  width: 100%;
}

.punkte-platz:empty {
  display: none;
}

/* Pfeile direkt am Zaehler statt an den Aussenkanten. */
.blaettern {
  display: flex;
  align-items: center;
  gap: 14px;
}

.blaettern .zaehler {
  min-width: 4.5ch;
  color: var(--text-leise);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  text-align: center;
}

.slide-fuss button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--rand);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  transition: border-color 0.15s, color 0.15s;
}

.slide-fuss button:hover:not(:disabled) {
  border-color: var(--akzent);
  color: var(--akzent);
}

.slide-fuss button:disabled {
  cursor: default;
  opacity: 0.35;
}

.punkte {
  display: flex;
  margin: 0;
  padding: 0;
  flex: 1;
  gap: 7px;
  list-style: none;
}

.punkte li {
  height: 3px;
  border-radius: 2px;
  background: var(--rand);
  cursor: pointer;
  flex: 1;
  transition: background 0.2s;
}

.punkte li[aria-current='true'] {
  background: var(--akzent);
}

/* ---------------------------------------------------------------- Fehler */

.fehler {
  padding: 16px 18px;
  border: 1px solid var(--rand);
  border-left: 3px solid #ff6b6b;
  border-radius: 10px;
  background: var(--flaeche);
}

.fehler code {
  color: var(--akzent);
  font-size: 13px;
}

/* ----------------------------------------------------------------- Mobil */

@media (max-width: 860px) {
  .buehne {
    grid-template-columns: 1fr;
    grid-template-rows: var(--teilung) var(--griff-dicke) 1fr;
  }

  .griff,
  .griff::before {
    cursor: row-resize;
  }

  .griff::before {
    inset: -9px 0;
  }

  .slides {
    padding: 18px 20px 14px;
  }

  .slide-inhalt {
    justify-content: flex-start;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
