/* Brett-Seiten (Analyse, Spielen, Editor): Brett so groß wie die Fensterhöhe erlaubt, Seitenleiste füllt
   den Rest und ist genau so hoch wie das Brett; Spielerleisten über und unter dem Brett; Vollbild. */
.analyse-body, .play-body {
  /* Höhe: Kopf 105 + Titelband 57 + Abstände 44 + zwei Spielerleisten 72; Breite: Platz für die Seitenleiste */
  --board: max(280px, min(calc(calc(100 * var(--vh)) - 280px), calc(min(calc(100 * var(--vw)), var(--wrap)) - 96px - 366px)));
  display: grid; gap: 0 16px; align-items: stretch;
}
.analyse-body { grid-template-columns: 18px var(--board) minmax(300px, 1fr); }
.play-body { grid-template-columns: var(--board) minmax(300px, 1fr); }
.board-col { position: relative; min-width: 0; }
.evalbar { margin: 36px 0; position: relative; background: #333; border-radius: 9px; overflow: hidden; }

/* Seitenleiste: eigene Größe zählt nicht für die Zeilenhöhe (contain), die Zugliste nimmt den freien Platz */
.analyse-body .side, .play-body .side { contain: size; display: flex; flex-direction: column; gap: 12px; min-width: 0; overflow: auto; }
.side > * { flex: none; }
.tview { display: grid; grid-template-columns: 42px 1fr 1fr; align-content: start; overflow: auto; font-size: 14px; }
.analyse-body .tview { flex: 1 1 0; min-height: 168px; }
.play-body .side > .setup:last-child { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.play-moves { flex: 1 1 0; min-height: 60px; border-radius: 0; }
.play-moves .move { cursor: default; }
.play .fld .row .btn { flex: none; }

/* Spielerleiste */
.pbar { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 2px; font-size: 14px; color: var(--text2); }
.pbar .chip { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #1a1a1a; background: #fff; }
.pbar .chip.black { background: #2a2c2e; }
.pbar.active .chip { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.pbar .name { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar .lead { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pbar .info { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pbar .info.strong { color: var(--accent); font-weight: 700; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1.15); } }

/* Knöpfe unter der Zugliste: Symbole mittig */
.ctl { display: flex; gap: 6px; }
.ctl .btn { flex: 1; display: grid; place-items: center; padding: 7px 0; }
.icon { display: block; }

.editor .side { display: grid; min-width: 0; }
/* wie Analyse und Spielen: Seitenleiste direkt neben dem Brett statt am rechten Rand */
@media (min-width: 861px), (min-width: 700px) and (min-aspect-ratio: 4/5) {
  .editor { grid-template-columns: min(calc((calc(100 * var(--vh)) - 226px) / 1.3), calc(100% - 370px)) minmax(270px, 350px); justify-content: start; }
  .editor .editor-board { width: 100%; }
}
/* Editor: Brett plus zwei Palettenreihen (je 1/7 der Brettbreite) passen in die Fensterhöhe */
.editor-board { display: grid; gap: 8px; width: min(calc((calc(100 * var(--vh)) - 226px) / 1.3), 100%); min-width: 280px; }

/* Titelband auf Brett-Seiten: eine Zeile, damit das Brett die Höhe bekommt */
.band.compact .inner { padding-top: 14px; padding-bottom: 14px; display: flex; align-items: baseline; gap: 6px 18px; flex-wrap: wrap; }
.band.compact h1 { font-size: 24px; letter-spacing: -.3px; border-left-width: 6px; padding-left: 14px; }
.band.compact .lead { margin: 0; font-size: 14px; }
main.tight { padding-top: 8px; padding-bottom: 24px; }

/* Vollbild (z): nur das Brett auf Schwarz, Spielerleisten als Beschriftung wie im Wallpaper */
.focus-exit { display: none; }
#app.focus { background: #000; }
#app.focus header.top, #app.focus .band, #app.focus .foot, #app.focus .side, #app.focus .evalbar, #app.focus .help { display: none; }
#app.focus main { max-width: none; width: 100%; min-height: calc(100 * var(--vh)); padding: 0; display: grid; place-items: center; }
#app.focus .analyse-body, #app.focus .play-body { display: block; }
#app.focus .board-col { width: min(calc(calc(100 * var(--vh)) - 120px), calc(96 * var(--vw))); margin: 0 auto; }
#app.focus .pbar { height: auto; padding: 12px 2px; font-size: clamp(14px, calc(1.9 * var(--vh)), 24px); color: rgba(235, 232, 226, .75); letter-spacing: .02em; }
#app.focus .pbar .name { color: inherit; font-weight: 400; }
#app.focus .pbar .chip { border-color: rgba(235, 232, 226, .6); }
#app.focus .pbar.active .chip { box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--accent); }
#app.focus .pbar .lead, #app.focus .pbar .info { color: rgba(235, 232, 226, .45); font-size: inherit; }
#app.focus .pbar .info.strong { color: #19e28f; }
#app.focus .focus-exit {
  display: grid; place-items: center; position: fixed; top: 14px; right: 18px; z-index: 50; width: 40px; height: 40px;
  color: #fff; background: none; border: 1px solid rgba(255, 255, 255, .25); border-radius: 50%; cursor: pointer; opacity: .3; transition: opacity .2s;
}
#app.focus .focus-exit:hover, #app.focus .focus-exit:focus-visible { opacity: 1; }

/* schmale oder hochkant-lange Fenster: Brett über die volle Breite, Seitenleiste darunter.
   Fast quadratische Bildschirme (Pixel Fold aufgeklappt) behalten Brett und Leiste nebeneinander, siehe fold.css. */
@media (max-width: 699px), (max-width: 900px) and (max-aspect-ratio: 4/5) {
  .analyse-body, .play-body { --board: 100%; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .analyse-body { grid-template-columns: 12px minmax(0, 1fr); }
  .analyse-body .side { grid-column: 1 / -1; }
  .analyse-body .side, .play-body .side { contain: none; overflow: visible; }
  .analyse-body .tview, .play-moves { flex: none; max-height: calc(46 * var(--vh)); }
  .play-body .side > .setup:last-child { flex: none; }
  .editor-board { width: 100%; }
}
.play-result { font-size: 20.8px; font-weight: 700; color: var(--text); }
