/* Promptschmiede — Oberflaeche. Dunkel, scharf, dicht, ruhig. */

:root {
  --grund: #0d0e10;
  --flaeche: #16181c;
  --flaeche2: #1d2026;
  --linie: #282c33;
  --linie-hell: #3a3f48;
  --text: #e8e9eb;
  --text-leise: #878d96;
  --glut: #e8622c;
  --glut-leise: #7a3418;
  --gut: #4ea672;
  --schlecht: #c0453c;

  --serif: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

/* Muss ueber allen Flex- und Grid-Regeln stehen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
}

body {
  background: var(--grund);
  color: var(--text);
  font: 15px/1.5 var(--serif);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ol, ul, pre, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }

.zahl, code, kbd, pre, table, input, select, textarea { font-family: var(--mono); }

/* --------------------------------------------------------------- Fokus */

:focus-visible {
  outline: 2px solid var(--glut);
  outline-offset: 2px;
}

.sprung {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--flaeche2);
  color: var(--text);
  padding: 8px 16px;
  border: 1px solid var(--linie-hell);
  z-index: 10;
}
.sprung:focus { left: 8px; top: 8px; }

/* ----------------------------------------------------------------- Kopf */

.kopf {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--linie);
  background: var(--grund);
}

/* Kopfzeile und Reiter stehen auf derselben Fluchtlinie wie der Inhalt
   darunter (.spalte). Sonst faengt oben links etwas an, was mit nichts
   darunter eine Kante teilt — das sieht man sofort, auch ohne es zu benennen. */
.kopf-oben {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding: 16px 24px 8px;
}

.marke {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-leise);
}

.projektleiste {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.projektleiste-name { font-size: 13px; }

.projektleiste-code {
  font-size: 13px;
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 2px 8px;
  letter-spacing: .06em;
}

/* --------------------------------------------------------------- Reiter */

.reiter {
  display: flex;
  gap: 0;
  /* 8px hier + 8px Knopfrand + 8px Knopfpolster = 24px, genau die Fluchtlinie
     von .spalte und .kopf-oben. */
  padding: 0 8px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.reiter::-webkit-scrollbar { display: none; }

.reiter-knopf {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  margin: 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-leise);
  font: 15px/1.5 var(--serif);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms linear;
}
.reiter-knopf:hover { color: var(--text); }
.reiter-knopf[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--glut);
}
.reiter-knopf[aria-disabled="true"] {
  color: var(--linie-hell);
  cursor: default;
}
.reiter-knopf[aria-disabled="true"]:hover { color: var(--linie-hell); }

.reiter-zahl {
  font-size: 12px;
  color: var(--grund);
  background: var(--text-leise);
  border-radius: 2px;
  padding: 0 4px;
  min-width: 16px;
  text-align: center;
}
.reiter-knopf[aria-current="page"] .reiter-zahl { background: var(--text); }

/* --------------------------------------------------------------- Buehne */

.buehne {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ansicht { flex: 1 1 auto; min-height: 0; }

.ansicht-blaetterbar { overflow-y: auto; overflow-x: hidden; }

.spalte {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.seitentitel {
  font-size: 32px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -.01em;
}

.abschnitt {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
}

.lead {
  font-size: 15px;
  color: var(--text-leise);
  max-width: 68ch;
  margin-top: -16px;
}

.hilfe {
  font-size: 13px;
  color: var(--text-leise);
  line-height: 1.5;
}

.leer-satz {
  font-size: 13px;
  color: var(--text-leise);
  padding: 16px;
}

.etikett {
  font-size: 12px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-leise);
  font-family: var(--serif);
}

/* --------------------------------------------------------------- Panels */

.panel {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-eng { padding: 0; gap: 0; }

.panel-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--linie);
}

.panel-kopf-rechts {
  display: flex;
  align-items: center;
  gap: 16px;
}

.zwei-wege {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* --------------------------------------------------------------- Felder */

.feldgruppe {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.feldgruppe-breit { align-self: stretch; }
.feldgruppe-breit .feld { width: 100%; }

.feld {
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: 2px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--mono);
  padding: 8px;
  width: 100%;
  min-width: 0;
  transition: border-color 120ms linear;
}
.panel .feldgruppe > .feld { min-width: 240px; }

.feld::placeholder { color: var(--linie-hell); }
.feld:hover { border-color: var(--linie-hell); }
.feld:focus {
  border-color: var(--glut);
  outline: none;
}
.feld:focus-visible {
  outline: 2px solid var(--glut);
  outline-offset: 2px;
}

.feld-schmal { min-width: 0 !important; width: 96px; }
.feld-code { letter-spacing: .12em; text-transform: uppercase; }

select.feld {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-leise) 50%),
                    linear-gradient(135deg, var(--text-leise) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* --------------------------------------------------------------- Knoepfe */

.knopf {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--flaeche2);
  color: var(--text);
  border: 1px solid var(--linie);
  border-radius: 2px;
  font: 15px/1.4 var(--serif);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 120ms linear;
}
.knopf:hover { border-color: var(--linie-hell); }
.knopf:disabled { color: var(--text-leise); cursor: default; }
.knopf:disabled:hover { border-color: var(--linie); }

.knopf-klein {
  font-size: 13px;
  padding: 4px 8px;
}

.knopf-gross { padding: 8px 24px; }

.knopf-glut {
  background: var(--glut);
  border-color: var(--glut);
  color: #17120f;
  font-weight: 600;
}
.knopf-glut:hover { border-color: var(--text); }
.knopf-glut:disabled { background: var(--glut-leise); border-color: var(--glut-leise); color: #d9cfc9; }

kbd {
  font-size: 12px;
  line-height: 1;
  padding: 3px 5px;
  border: 1px solid var(--linie-hell);
  border-radius: 4px;
  background: var(--grund);
  color: var(--text-leise);
}
.knopf-glut kbd { border-color: #b34d21; background: #d6592a; color: #17120f; }

/* --------------------------------------------------------------- Start */

.panel-token { gap: 16px; }

.token-zeile {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.token-zeile .feldgruppe { flex: 1 1 320px; }

.token-stand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  background: var(--flaeche2);
  border: 1px solid var(--linie);
  border-radius: 2px;
  padding: 8px 16px;
}

.punkt {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--gut);
  flex: 0 0 auto;
}
.token-stand .knopf { margin-left: auto; }

/* ------------------------------------------------------------ Werkstatt */

.steuerzeile {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.steuerzeile-schub { flex: 1 1 0; min-width: 0; }
.steuerzeile .feldgruppe > .feld { min-width: 0; }
.steuerzeile #feld-umfang { min-width: 264px; }

.werte {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--linie);
  border: 1px solid var(--linie);
  border-radius: 2px;
}

.wert {
  background: var(--flaeche);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wert-zahl {
  font-size: 15px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.wert-zahl[data-ton="leise"] { color: var(--text-leise); }
.wert-zahl[data-ton="gut"] { color: var(--gut); }
.wert-zahl[data-ton="schlecht"] { color: var(--schlecht); }

.protokoll {
  height: 264px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 24px;
  font-size: 13px;
  line-height: 1.7;
  background: var(--grund);
}
.protokoll:focus-visible { outline-offset: -2px; }

.zeile {
  display: flex;
  gap: 16px;
  overflow-wrap: anywhere;
}
.zeile-uhr { color: var(--linie-hell); flex: 0 0 auto; }
.zeile-text { color: var(--text-leise); min-width: 0; }
.zeile:last-child .zeile-text { color: var(--text); }

/* -------------------------------------------------------------- Tabelle */

.tabellenrahmen { overflow-x: auto; }

.tabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tabelle th {
  text-align: left;
  font-weight: 500;
  font-family: var(--serif);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-leise);
  background: var(--flaeche2);
  padding: 8px 16px;
  border-bottom: 1px solid var(--linie);
  white-space: nowrap;
}

.tabelle td {
  padding: 8px 16px;
  border-bottom: 1px solid var(--linie);
  color: var(--text-leise);
  vertical-align: top;
}
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle td.stark { color: var(--text); }
.tabelle .rechts { text-align: right; }
.tabelle td.gut { color: var(--gut); }
.tabelle td.schlecht { color: var(--schlecht); }

/* ------------------------------------------------------------- Bewerten */

.ansicht-bewerten {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.duell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.duell-kopf {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid var(--linie);
}

.duell-betrieb {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.duell-name { font-size: 15px; }
.duell-branche { font-size: 13px; color: var(--text-leise); }

.arena {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--linie);
}

.seite {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--grund);
}

.seite-kopf {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-bottom: 1px solid var(--linie);
  background: var(--flaeche2);
}

.buchstabe {
  font-family: var(--mono);
  font-size: 20px;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: .04em;
}

.rahmen {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 0;
  background: #ffffff;
  display: block;
}

.urteil {
  flex: 0 0 auto;
  border-top: 1px solid var(--linie);
  background: var(--flaeche);
  /* Knapp halten: jeder Pixel hier fehlt den Entwuerfen darueber, und die
     will man sehen — nicht die Knopfleiste. */
  padding: 12px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.urteil-knoepfe {
  display: flex;
  align-items: center;
  gap: 16px;
}

.knopf-urteil {
  flex: 1 1 0;
  min-width: 0;
  font-size: 15px;
  padding: 12px 16px;
}

.knopf-egal { flex: 0 0 auto; color: var(--text-leise); }

.urteil .feldgruppe { gap: 4px; }
.urteil .feld { font-size: 13px; }

/* Die Begruendung des Roboters. Der Platz bleibt immer reserviert, damit
   beim Einblenden nichts springt. Sichtbar wird sie erst nach dem Klick. */
.roboter {
  font-size: 13px;
  line-height: 20px;
  height: 20px;
  font-family: var(--mono);
  color: var(--text-leise);
  border-left: 2px solid var(--linie-hell);
  padding-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  visibility: hidden;
}
.roboter[data-sichtbar="ja"] { visibility: visible; }

.leerstand {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
}
.leerstand .spalte { align-items: flex-start; }
.leerstand .knopf { align-self: flex-start; }

/* --------------------------------------------------------------- Prompt */

.prompt {
  margin: 0;
  padding: 24px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 480px;
  overflow-y: auto;
  background: var(--grund);
}

.block {
  border-bottom: 1px solid var(--linie);
}
.block:last-child { border-bottom: 0; }

.block > summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 16px 24px;
  cursor: pointer;
  list-style: none;
  transition: background-color 120ms linear;
}
.block > summary::-webkit-details-marker { display: none; }
.block > summary:hover { background: var(--flaeche2); }
.block > summary:focus-visible { outline-offset: -2px; }

.block-pfeil {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-leise);
  width: 12px;
  flex: 0 0 auto;
}
.block[open] .block-pfeil { color: var(--text); }

.block-name {
  font-size: 15px;
  color: var(--text);
}

.block-inhalt {
  padding: 0 24px 16px 44px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-leise);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
}

.lektionen {
  display: flex;
  flex-direction: column;
}

.lektion {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--linie);
  font-size: 13px;
}
.lektion:last-child { border-bottom: 0; }

.lektion-nummer {
  font-family: var(--mono);
  color: var(--text-leise);
  flex: 0 0 auto;
  min-width: 40px;
}
.lektion-text { color: var(--text); line-height: 1.6; }
.lektion-runde { color: var(--text-leise); }

/* -------------------------------------------------------------- Meldung */

.meldung {
  position: fixed;
  /* Oben rechts, unter der Kopfzeile. Unten links stuende sie genau auf dem
     Notizfeld im Bewerten-Bildschirm. */
  right: 24px;
  top: 96px;
  z-index: 20;
  max-width: min(480px, calc(100vw - 48px));
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--flaeche2);
  /* Der Ton sitzt im Rahmen ringsum und im Punkt, nicht als Streifen an einer
     Kante. Solche Seitenstreifen sind das deutlichste Erkennungszeichen von
     maschinell gebauten Oberflaechen. */
  border: 1px solid var(--schlecht);
  border-radius: 2px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
}
.meldung::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: var(--schlecht);
}
.meldung[data-ton="gut"] { border-color: var(--gut); }
.meldung[data-ton="gut"]::before { background: var(--gut); }

/* ---------------------------------------------------------------- Schmal */

@media (max-width: 900px) {
  .zwei-wege { grid-template-columns: 1fr; }

  .ansicht-bewerten { overflow-y: auto; }
  .duell { min-height: 100%; }

  .arena {
    grid-template-columns: 1fr;
    gap: 0;
    background: var(--grund);
    flex: 0 0 auto;
  }
  .seite { border-bottom: 1px solid var(--linie); }
  .rahmen { height: 60vh; min-height: 320px; flex: 0 0 auto; }

  .urteil {
    position: sticky;
    bottom: 0;
    z-index: 5;
  }

  .urteil-knoepfe { flex-wrap: wrap; }
  .knopf-urteil { flex: 1 1 160px; padding: 8px 16px; }
  .knopf-egal { flex: 1 1 100%; }

  .spalte { padding: 24px 16px 48px; }
  .panel { padding: 16px; }
  .panel-kopf, .prompt, .protokoll { padding-left: 16px; padding-right: 16px; }
  .block > summary { padding-left: 16px; padding-right: 16px; }
  .block-inhalt { padding-left: 36px; padding-right: 16px; }
  .lektion { padding-left: 16px; padding-right: 16px; }
  .kopf-oben { padding: 16px 16px 8px; }
  .seitentitel { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
