/* Fenster: Einstellungen, Anleitung, Grundgerüst der Dialoge, Match-Statistik */

/* Optionen: Fenster in der Mitte, je Zeile Beschriftung links und Schalter rechts */
#options .opt-panel { max-width: 460px; }
.opt-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.modal .opt-head h2 { border: 0; padding-bottom: 14px; margin: 0; }
.close { padding: 0 10px; font-size: 24px; line-height: 32px; background: transparent; border-color: transparent; color: var(--muted); }
.close:hover:not(:disabled) { color: var(--fg); background: var(--btn-hover); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.opt-label { font-weight: 600; font-size: 15px; }
.opt-label small { display: block; margin-top: 2px; font-weight: 500; font-size: 12px; color: var(--muted); }
.opt-label kbd { margin-left: 8px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; font: 600 11px "Inter", sans-serif;
  color: var(--muted); background: var(--btn); vertical-align: 2px; }
#linesSeg { flex: 0 0 auto; }
#linesSeg button { flex: 0 0 auto; padding: 9px 14px; font-size: 17px; }
/* Schalter: Schiene mit Knopf, an = Amber */
.switch { flex: 0 0 auto; position: relative; width: 52px; height: 30px; padding: 0; border-radius: 999px; background: rgba(255,255,255,.1); }
.switch i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--fg);
  box-shadow: 0 1px 4px rgba(0,0,0,.4); transition: transform .18s ease; }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.switch.on i { transform: translateX(22px); background: var(--accent-ink); }
.opt-btns { margin-top: 18px; }

/* Anleitung: Fenster mit Tabs „Spiel“ (Allgemeines, Spielmodi) und „Steuerung“ (Tasten, Gesten, Hilfslinien) */
#guide .guide-panel { max-width: 860px; }
/* Oben nur eine Linie: die über den Abschnitten direkt unter den Tabs */
#guide .opt-head { border-bottom: 0; margin-bottom: 0; }
.modal#guide .opt-head h2 { padding-bottom: 10px; }
/* Hauptmenü hinter einem Fenster: blendet aus und zoomt weg (kleiner), beim Schließen zurück – gleiches Timing
   wie die Fenster */
#menu > .panel { transition: opacity .26s ease-out, transform .3s cubic-bezier(.2, .8, .3, 1); }
body.dialog-open #menu > .panel { opacity: 0; transform: scale(.93); visibility: hidden;
  transition: opacity .3s ease-out, transform .34s cubic-bezier(.2, .8, .3, 1), visibility 0s .34s; }
.guide-tabs { display: flex; gap: 6px; margin: 2px 0 14px; }
.guide-tabs button { padding: 8px 16px; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 18px;
  letter-spacing: .05em; text-transform: uppercase; line-height: 1; border-radius: 999px; color: var(--muted); }
.guide-tabs button[aria-selected="true"] { background: rgba(255,181,71,.14); border-color: var(--accent); color: #fff; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 26px; }
.guide-grid section { padding: 16px 0 14px; border-top: 1px solid var(--line); }
.guide-grid h3 { margin: 0 0 6px; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 22px; line-height: 1;
  letter-spacing: .03em; text-transform: uppercase; color: #fff; }
.guide-grid p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.guide-grid p b { color: var(--fg); font-weight: 600; }
.guide-grid p + p { margin-top: 6px; }
.keys { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.keys td { padding: 4px 10px 4px 0; vertical-align: top; color: var(--muted); }
.keys td:first-child { color: var(--fg); white-space: nowrap; width: 1%; }
.keys kbd { display: inline-block; min-width: 22px; margin: 0 1px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px;
  font: 600 11.5px/1.5 "Inter", sans-serif; text-align: center; color: var(--fg); background: var(--btn); }
.legend { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.9; }
.legend span { display: inline-block; width: 22px; height: 0; border-top: 2px solid; vertical-align: middle; margin-right: 6px; }
/* Linienarten wie auf dem Tisch: Weiße weiß, Objektkugeln grün */
.legend .cue { border-color: #fff; }
.legend .cue-after { border-color: #fff; border-top-style: dashed; }
.legend .object { border-color: #3aa856; border-top-style: dashed; }
.legend .other { border-color: #3aa856; border-top-style: dotted; }
.touch-only { display: none; }
@media (max-width: 640px) {
  .guide-grid { grid-template-columns: 1fr; }
  #guide .guide-panel { padding: 20px 18px; }
}

/* Menü und Dialoge */
/* Fenster (.dialog) blenden beim Öffnen ganz leicht ein und zoomen dabei von etwas größer auf ihre Größe;
   läuft bei jedem Einblenden neu, da .hidden sie aus dem Layout nimmt. Beim Schließen umgekehrt: eine Kopie
   (.closing, s. closeDialog in hud.js) blendet aus und wird wieder etwas größer */
/* Animierte Flächen bekommen ihre eigene Ebene schon vorab, nicht erst im ersten Bild der Animation. Nur für
   transform: will-change für opacity am Fenster würde die Unschärfe dahinter (backdrop-filter) auf das Fenster
   selbst beschränken */
.modal > .panel { will-change: transform; }
.modal.dialog { animation: dialog-fade .3s ease-out; }
.modal.dialog > .panel { animation: dialog-zoom .34s cubic-bezier(.2, .8, .3, 1); }
/* Während der Animation ragt der vergrößerte Kasten über den Rand: keine Scrollbalken dafür */
.modal.dialog.opening, .modal.dialog.closing { overflow: hidden; }
.modal.dialog.closing { pointer-events: none; animation: dialog-fade .26s ease-in reverse forwards; }
.modal.dialog.closing > .panel { animation: dialog-zoom .26s ease-in reverse forwards; }
@keyframes dialog-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-zoom { from { transform: scale(1.07); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal.dialog, .modal.dialog > .panel { animation-duration: .01s !important; }
  #menu > .panel, body.dialog-open #menu > .panel { transform: none; } }
/* Passt ein Dialog nicht auf den Bildschirm, lässt er sich scrollen (margin: auto zentriert nur, solange Platz ist) */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; background: rgba(0,0,0,0.45); overflow-y: auto;
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); }
.modal .panel { padding: 26px 30px; max-width: 540px; width: 100%; margin: auto; border-radius: 22px; background: var(--panel);
  box-shadow: 0 24px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,236,210,.06); }
.modal h1 { margin: 0 0 4px; font-size: 34px; line-height: 1; }
.modal h2 { margin: 0 0 12px; font-size: 32px; line-height: 1; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.modal p { margin: 8px 0; }
.modal .fb { color: var(--accent); font-weight: 600; }
.modal input { font: inherit; font-size: 16px; color: var(--fg); background: var(--btn); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; outline: none; }
.modal input:focus { border-color: rgba(255,181,71,.6); background: var(--btn-hover); }
.row { display: flex; gap: 10px; margin: 12px 0; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 11px 10px; font-size: 19px; line-height: 1; border-radius: 12px; }
.seg button.on { background: rgba(255,181,71,.14); border-color: var(--accent); color: #fff; }

/* Match-Statistik im Dialog nach jedem Frame: Spieler links und rechts, Bezeichnung in der Mitte */
.match-names { display: flex; justify-content: space-between; gap: 16px; margin: 4px 0 0; padding: 0 4px 9px; font-weight: 600; }
.match-names span { max-width: 50%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-stats { width: 100%; margin: 0 0 4px; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
/* gleich breite Spalten links und rechts: die Bezeichnung steht genau in der Mitte */
.match-stats col.mid { width: 50%; }
.match-stats th, .match-stats td { padding: 7px 4px; border-top: 1px solid var(--line); }
.match-stats td:first-child { text-align: left; }
.match-stats td:last-child { text-align: right; }
.match-stats tbody th { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: center; }
.match-stats td { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 22px; line-height: 1; color: var(--muted); }
.match-stats td.lead { color: var(--accent); }
