@font-face {
  font-family: Montserrat;
  font-style: normal;
  font-weight: 900;
  font-display: block;
  src: url("../fonts/montserrat-black.woff2") format("woff2");
}

/* Palette ausschliesslich aus CI-Guide Abschnitt 03.
   --danger ist die einzige Abweichung: bewusst entschieden fuer den
   Loeschen-Knopf, siehe README. */
:root {
  --tf-schwarz: #000;
  --tf-weiss: #fff;
  --tf-text: #111;
  --tf-meta: #666;
  --tf-kante: #e0e0e0;
  --danger: #e24a3b;
  --font: Montserrat, system-ui, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

/* Fliesstext laeuft in 400. Hierarchie entsteht ueber das Gewicht,
   nicht ueber Farbe — auf Schwarz gibt es nur reines Weiss. */
body {
  display: flex;
  background: var(--tf-schwarz);
  color: var(--tf-weiss);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

/* Schwarze Bedienleiste, weisse Buehne. Der Wechsel Schwarz/Weiss
   trennt die beiden Bereiche — keine Trennlinie noetig. */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  width: 20.5rem;
  flex: none;
  overflow: auto;
  background: var(--tf-schwarz);
  padding: 1.6rem 1.4rem 2.4rem;
}

.brand {
  display: grid;
  gap: 0.6rem;
}

/* Wortmarke nach CI 04: Rahmen 0.16em, Innenabstand 0.155em / 0.82em,
   Farbe ueber currentColor, immer einzeilig. */
.wortmarke-ui {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  border: 0.16em solid currentColor;
  padding: 0.155em 0.82em;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Versal-Label nach CI 02.2: 0.8rem, Gewicht 700, Laufweite 0.08em. */
.kicker,
h2 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0.6rem;
}

section {
  display: grid;
  gap: 0.6rem;
}

section[hidden],
[hidden] {
  display: none !important;
}

.seg {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.seg#align-seg {
  grid-template-columns: repeat(3, 1fr);
}

.seg#format-seg {
  grid-template-columns: repeat(4, 1fr);
}

/* Tap-Ziele mindestens 44px, CI 05. */
.seg button,
.text-list button,
.btn {
  min-height: 44px;
  cursor: pointer;
  border-radius: 0;
  font-weight: 700;
}

.seg button {
  background: transparent;
  border: 2px solid var(--tf-weiss);
  padding: 0.4rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.seg button + button {
  margin-left: -2px;
}

/* Hover invertiert Schwarz und Weiss. Kein transform, kein Schatten. */
.seg button:hover,
.btn-ghost:hover {
  background: var(--tf-weiss);
  color: var(--tf-schwarz);
}

.seg button.is-on {
  color: var(--tf-schwarz);
  background: var(--tf-weiss);
}

.seg button.is-on:hover {
  background: transparent;
  color: var(--tf-weiss);
}

/* Fokus nach CI 05: 2px, auf Schwarz weiss, Abstand 3px. Nie outline: none. */
.seg button:focus-visible,
.text-list button:focus-visible,
.btn:focus-visible,
textarea:focus-visible,
input:focus-visible,
#board:focus-visible {
  outline: 2px solid var(--tf-weiss);
  outline-offset: 3px;
  z-index: 1;
}

.text-list {
  display: grid;
  gap: 0.4rem;
  list-style: none;
}

.text-list button {
  width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
  border: 2px solid var(--tf-weiss);
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
}

.text-list button:hover {
  background: var(--tf-weiss);
  color: var(--tf-schwarz);
}

.text-list button.is-on {
  background: var(--tf-weiss);
  color: var(--tf-schwarz);
}

.text-list button.is-on:hover {
  background: transparent;
  color: var(--tf-weiss);
}

.btn {
  width: 100%;
  border: 2px solid var(--tf-weiss);
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn-solid {
  color: var(--tf-schwarz);
  background: var(--tf-weiss);
}

.btn-solid:hover {
  background: transparent;
  color: var(--tf-weiss);
}

.btn-ghost {
  background: transparent;
}

/* Bewusste Abweichung von der CI-Palette, von Philipp entschieden:
   der Loeschen-Knopf bleibt rot. Siehe README. */
.btn.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

.btn.danger:hover {
  background: var(--danger);
  color: var(--tf-schwarz);
}

.field {
  display: grid;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.field span {
  display: flex;
  justify-content: space-between;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field em {
  font-style: normal;
  font-weight: 400;
}

/* Eingabefelder nach CI 05: keine Rahmenbox, nur die Unterkante. */
textarea {
  resize: vertical;
  min-height: 6rem;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--tf-weiss);
  border-radius: 0;
  padding: 0.55rem 0.15rem;
  font-weight: 900;
  line-height: 1.35;
  text-transform: uppercase;
}

input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: var(--tf-weiss);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.check input {
  accent-color: var(--tf-weiss);
  width: 1.1rem;
  height: 1.1rem;
}

.meta,
.disclaimer,
.hint {
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.45;
  max-width: 48ch;
}

.disclaimer {
  margin-top: auto;
  padding-top: 0.5rem;
}

/* Weisse Buehne: schwarze Motive stehen im Kontrast, weisse bekommen
   die feine Kante #e0e0e0 aus CI 03 ("feine Trennkanten, sparsam"). */
.stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-width: 0;
  overflow: hidden;
  background: var(--tf-weiss);
  color: var(--tf-text);
  padding: 1.5rem;
}

.stage-frame {
  width: min(100%, calc((100vh - 4rem) * (var(--board-w, 1600) / var(--board-h, 900))));
  max-height: calc(100vh - 4rem);
  aspect-ratio: var(--board-w, 1600) / var(--board-h, 900);
  border: 1px solid var(--tf-kante);
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#board:active {
  cursor: grabbing;
}

.hint {
  text-align: center;
  color: var(--tf-meta);
}

/* Am Telefon steht die Buehne oben: Wer einen Regler zieht, muss sehen,
   was sich aendert. */
@media (max-width: 840px) {
  body {
    display: flex;
    flex-direction: column;
    height: auto;
  }

  .stage {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 1rem;
  }

  .stage-frame {
    width: 100%;
    max-height: 42vh;
  }

  .sidebar {
    width: 100%;
  }
}
