/* Spieleabend – Moderation (mod.html)
   Sachliches dunkles Admin-Design. Die Variablennamen --bg, --panel, --panel-2, --line,
   --text, --muted, --accent, --ok, --danger nutzen auch die Mechaniken (engines/*.js) –
   nicht umbenennen. */
:root {
  --bg: #0f1217;
  --panel: #161b22;
  --panel-2: #1c222b;
  --hover: #232a35;
  --line: #2a313c;
  --line-strong: #3a4350;
  --text: #e6e9ef;
  --muted: #8b95a7;
  --accent: #4d8dff;
  --accent-text: #ffffff;
  --accent-soft: rgba(77, 141, 255, 0.14);
  --ok: #3ccf8e;
  --warn: #f0b429;
  --danger: #f2646f;
  --radius: 8px;
  --font: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --control-h: 36px;
  --sidebar-w: 228px;
  --sidebar-w-collapsed: 60px;
  --topbar-h: 56px;
  color-scheme: dark;
}

/* Touch (Tablet-Modus): größere Bedienflächen */
@media (pointer: coarse) {
  :root { --control-h: 44px; }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

code { font-size: 0.92em; color: var(--text); }

/* ----- Symbole ----- */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ----- Seitenleiste ----- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: width 0.15s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-brand .icon { color: var(--accent); }

.nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
  padding: 10px;
  overflow-y: auto;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--control-h);
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  justify-content: flex-start;
  white-space: nowrap;
}

.nav button:hover { background: var(--hover); color: var(--text); border: 0; }
.nav .nav-area { font-weight: 600; color: var(--text); margin-top: 6px; }
.nav .nav-area:first-child { margin-top: 0; }
.nav .nav-area.active { color: var(--accent); }
.nav .nav-area.active[aria-current="page"] { background: var(--accent-soft); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; }
.nav-sub button { padding-left: 42px; }
.nav-sub button[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-spacer { flex: 1; min-height: 16px; }

/* Eingeklappt (Live): nur Symbole, beim Überfahren als Überlagerung aufklappen */
body.nav-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.nav-collapsed .sidebar:hover,
body.nav-collapsed .sidebar:focus-within {
  width: var(--sidebar-w);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.45);
}
body.nav-collapsed .sidebar:not(:hover):not(:focus-within) .nav-label,
body.nav-collapsed .sidebar:not(:hover):not(:focus-within) .nav-sub { display: none; }
body.nav-collapsed .sidebar:not(:hover):not(:focus-within) .sidebar-brand { padding: 0 20px; }

/* ----- Rahmen rechts der Seitenleiste ----- */
.shell { margin-left: var(--sidebar-w); min-width: 0; transition: margin-left 0.15s ease; }
body.nav-collapsed .shell { margin-left: var(--sidebar-w-collapsed); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topbar-h);
  padding: 8px 24px;
  background: rgba(15, 18, 23, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}

.page-title { flex: 1; min-width: 0; margin: 0; font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.session-chip, .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.session-chip .icon, .chip .icon { width: 16px; height: 16px; }

.status-chips { display: flex; gap: 6px; }

.chip { background: transparent; color: var(--muted); }
.chip.ok { color: var(--text); border-color: rgba(60, 207, 142, 0.45); }
.chip.ok .icon { color: var(--ok); }
.chip.off { border-style: dashed; }
.chip.off .icon { color: var(--warn); }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-h);
  padding: 0;
}

.icon-button.off { color: var(--muted); }

#open-view { display: inline-flex; align-items: center; gap: 8px; }
#open-view .icon { width: 16px; height: 16px; }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

body.nav-collapsed main { max-width: none; }

.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }

/* ----- Grundelemente ----- */
section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  min-width: 0;
}

section h2 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

button, .file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

button:hover, .file-button:hover { background: var(--hover); border-color: var(--muted); }
button:active { transform: translateY(1px); }
button:focus-visible, .file-button:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:disabled:hover { background: var(--panel-2); border-color: var(--line-strong); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button.primary:hover { background: #6a9fff; border-color: #6a9fff; }
button.primary kbd { color: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.5); }

button.danger { border-color: rgba(242, 100, 111, 0.6); color: var(--danger); background: transparent; }
button.danger:hover { background: rgba(242, 100, 111, 0.1); border-color: var(--danger); }

input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"], select {
  min-height: var(--control-h);
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 10px;
  min-width: 0;
}

input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

input[type="color"] {
  width: 52px;
  height: var(--control-h);
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
}

input[type="range"] { accent-color: var(--accent); }

/* minmax(0, 1fr): Rasterspalten dürfen schmaler als ihr Inhalt werden, damit lange
   einzeilige Texte mit „…“ gekürzt werden statt über den Rand zu laufen */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: 0.85rem; color: var(--muted); }

textarea {
  width: 100%;
  min-height: 110px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 10px;
  resize: vertical;
}

textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled { opacity: 0.6; }

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.35em;
  margin-left: 0.4em;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.75em;
  color: var(--muted);
  text-align: center;
}

.hint { font-size: 0.85rem; color: var(--muted); }
.empty { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.status { font-size: 0.85rem; color: var(--muted); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-h);
  cursor: pointer;
}

.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.segmented { display: flex; }
.segmented button { flex: 1; padding: 0 8px; border-radius: 0; font-size: 0.85rem; }
.segmented button:first-child { border-radius: 6px 0 0 6px; }
.segmented button:last-child { border-radius: 0 6px 6px 0; }
.segmented button + button { border-left: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

.file-button { position: relative; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid rgba(77, 141, 255, 0.45);
  border-radius: 8px;
  background: var(--accent-soft);
}

.notice span { flex: 1; min-width: 220px; }
.notice.error { border-color: var(--danger); background: rgba(242, 100, 111, 0.1); }

/* Rückmeldung bei längeren Aktionen (busy() in core.js), Popover unten rechts */
.busy-toast {
  inset: auto 20px 20px auto;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.busy-toast:not(:popover-open) { display: none; }
.busy-toast.done { border-color: var(--ok); }
.busy-mark {
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}
.busy-toast.done .busy-mark {
  width: 9px;
  height: 15px;
  margin: 0 4px 3px;
  border: solid var(--ok);
  border-width: 0 3px 3px 0;
  border-radius: 0;
  transform: rotate(45deg);
  animation: none;
}
#busy-text { min-width: 0; }
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .busy-mark { animation-duration: 2.4s; }
}

.warning {
  display: none;
  padding: 10px 24px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
}

.warning.visible { display: block; }

/* Bereiche, die in der aktuellen Sitzungsart nicht gebraucht werden */
.mode-hidden { display: none !important; }

/* Einzelmodus */
.test-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 24px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent);
  font-weight: 600;
}

.test-banner span { flex: 1; min-width: 240px; }
.test-plan-notice p { margin: 0; }

/* ----- Live: Cockpit – Szenen | Spiel | Übersicht ----- */
#page-live { gap: 0; }
body.nav-collapsed main { padding: 16px; }

.cockpit {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.cockpit.side-collapsed { grid-template-columns: 172px minmax(0, 1fr) 56px; }

.cockpit-scenes, .cockpit-side {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  max-height: calc(100vh - var(--topbar-h) - 32px);
  overflow-y: auto;
}

.cockpit-scenes {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 12px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.scene-group { display: grid; gap: 4px; }
.scene-group-title { padding: 0 4px 2px; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.scene-group button { justify-content: space-between; width: 100%; min-height: calc(var(--control-h) + 4px); padding: 0 10px; }

.cockpit-scenes button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.cockpit-scenes button[aria-pressed="true"] kbd { color: var(--accent-text); border-color: rgba(255, 255, 255, 0.6); }

.scene-options { display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.85rem; }
.scene-options .toggle { min-height: 32px; }
.scene-options .field input { width: 100%; }

.cockpit-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }

.auto-scene {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--warn);
  border-radius: 8px;
  background: rgba(240, 180, 41, 0.12);
  font-weight: 600;
}
.auto-scene span { flex: 1; min-width: 220px; }

/* Rechte Spalte */
.cockpit-side { display: grid; align-content: start; gap: 12px; }
.side-section { padding: 12px 14px; }
.side-section h2 { margin-bottom: 10px; }
.side-section .plan-head { margin-bottom: 8px; }

.side-toggle { justify-content: flex-start; gap: 8px; width: 100%; color: var(--muted); }
.side-toggle-icon { font-size: 1.2rem; line-height: 1; }
.cockpit.side-collapsed .cockpit-side > .side-section { display: none; }
.cockpit.side-collapsed .side-toggle { justify-content: center; padding: 0; }
.cockpit.side-collapsed .side-toggle-label { display: none; }
.cockpit.side-collapsed .side-toggle-icon { transform: rotate(180deg); }
.side-mini { display: grid; gap: 6px; }
.side-mini-score {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  border-left: 4px solid var(--team-color);
  background: var(--panel-2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.toggle.small { min-height: 0; font-size: 0.85rem; color: var(--muted); }
.toggle.small input { width: 16px; height: 16px; }

.preview-frame {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border-radius: 6px;
  border-color: var(--line);
  background: #000;
  color: var(--muted);
  font-size: 0.85rem;
}
.preview-frame.off { display: flex; aspect-ratio: auto; min-height: 36px; background: var(--panel-2); }
.preview-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 720px;
  border: 0;
  transform: scale(var(--preview-scale, 0.25));
  transform-origin: 0 0;
  pointer-events: none;
}

/* Punkte kompakt in der rechten Spalte */
.cockpit-side .teams { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.cockpit-side .team { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 10px 12px; border-top-width: 1px; border-left: 4px solid var(--team-color); }
.cockpit-side .team-head { gap: 8px; min-width: 0; }
.cockpit-side .emblem { width: 1.6rem; height: 1.6rem; font-size: 1.3rem; }
.cockpit-side .team-name { font-size: 0.95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cockpit-side .team-members { display: none; }
.cockpit-side .team-score { grid-column: 2; grid-row: 1; margin: 0; font-size: 1.8rem; }
.cockpit-side .score-buttons { grid-column: 1 / -1; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.cockpit-side .score-buttons button { padding: 0; font-size: 0.85rem; }
.cockpit-side .custom { grid-column: 1 / -1; margin-top: 0; }
.cockpit-side .custom input { min-width: 0; }

.cockpit-side .timer-clock { font-size: 2.2rem; }
.cockpit-side .history { max-height: 260px; }
.cockpit-side .history-time { display: none; }

/* ----- Teams ----- */
.teams {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.team {
  border: 1px solid var(--line);
  border-top: 4px solid var(--team-color);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-2);
}

.team-head { display: flex; align-items: center; gap: 12px; }

.emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.8rem;
  line-height: 1;
  flex: none;
}

.emblem img { width: 100%; height: 100%; object-fit: contain; }

.team-name { font-size: 1.1rem; font-weight: 600; }
.team-members { margin-top: 4px; font-size: 0.85rem; color: var(--muted); }

.team-score {
  margin: 10px 0 14px;
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.score-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.score-buttons button { font-variant-numeric: tabular-nums; font-weight: 600; }
.score-buttons .minus { color: var(--danger); }

.custom { display: flex; gap: 6px; margin-top: 8px; }
.custom input { flex: 1; }

/* ----- Vorbereitung: Sitzung, Teams, Teilnehmende ----- */
.session-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: end; }
.session-title-field input { width: 100%; }
.session-current { font-size: 1rem; color: var(--text); font-weight: 600; }

.editor-grid { display: grid; gap: 12px; }

.editor-row {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 12px;
  align-items: end;
}

.editor-row input[type="text"] { width: 100%; }

.logo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.logo-preview {
  width: 60px;
  height: 60px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 2.4rem;
}

.add-player { display: flex; gap: 8px; }
.add-player input { flex: 1; }

.player-summary { margin: 12px 0 10px; }

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--player-color, var(--line-strong));
  border-radius: 6px;
}

.player-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.assign { display: flex; gap: 4px; }
.assign button { padding: 0 10px; font-size: 0.85rem; }

.assign button[aria-pressed="true"] {
  background: var(--team-color, var(--muted));
  border-color: var(--team-color, var(--muted));
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.player .remove { padding: 0 10px; background: transparent; color: var(--muted); }
.player .remove:hover { color: var(--danger); border-color: var(--danger); }

/* ----- Listen für Spieleplan und Katalog ----- */
.plan {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.plan-head h2 { margin: 0; }

.game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  grid-template-columns: minmax(0, 1fr);
}

.game-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  min-width: 0;
  padding: 4px 6px 4px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.game-item:hover { border-color: var(--line-strong); }
.game-item[draggable="true"] { cursor: grab; }
.game-item.static { cursor: default; }
.game-item.missing { border-color: var(--danger); }
.game-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.game-item.selected, .game-item.current { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.game-item.dragging { opacity: 0.4; }
.game-item.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.game-item.drop-after { box-shadow: 0 3px 0 var(--accent); }
.game-item.done .game-title { color: var(--muted); }

.game-number { min-width: 1.8em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.game-icon { font-size: 1.1rem; }
.game-icon img, #current-icon img { display: block; width: 1.6em; height: 1.6em; object-fit: contain; }
.library-icon img { display: block; width: 2.6rem; height: 2.6rem; object-fit: contain; }
.game-editor-head.identity { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; }
.game-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-points { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.game-status {
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
  color: var(--ok);
  white-space: nowrap;
}

.game-move { display: grid; gap: 2px; }
.game-move button { min-height: 0; padding: 0 8px; font-size: 0.7rem; line-height: 1.5; }

.game-item .add { min-height: 30px; padding: 0 10px; font-size: 0.85rem; }

/* Spiele gruppiert nach Mechanik: einklappbare Überschrift */
.game-group { list-style: none; }
.game-group button {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; min-height: 32px;
  margin-top: 6px; padding: 0 4px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: left;
  font-size: 0.8rem;
}
.game-group button:hover { background: transparent; border-color: var(--line-strong); }
.game-list > .game-group:first-child button { margin-top: 0; }
.game-group-name { flex: 1; min-width: 0; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-group-count, .game-group-toggle { color: var(--muted); font-variant-numeric: tabular-nums; }

.game-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }

.game-editor-head {
  display: grid;
  grid-template-columns: 1fr 140px 120px;
  gap: 12px;
  align-items: end;
}

.game-editor-head input { width: 100%; }

.entry-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 600;
}

.readonly {
  min-height: 2.6em;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  white-space: pre-line;
}

.order-list {
  margin: 0;
  padding: 8px 12px 8px 36px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

.order-list li { padding: 2px 0; }
.order-list li.current { color: var(--accent); font-weight: 600; }
.order-list li.past { color: var(--muted); }
.order-list:empty { display: none; }

.order-details {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.order-details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.order-details[open] { display: grid; gap: 10px; }
.order-details .order-list { border: 0; padding-left: 28px; }

.engine-editor-field { margin-top: 14px; }

.engine-editor {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
}

.new-game {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
}

.new-game input, .new-game select { width: 100%; }

.catalog-actions { margin-top: 14px; }
.folder-ok { color: var(--ok); }
.save-error { color: var(--danger); }

/* ----- Bausteine für Editoren: Rundenliste und Bildfeld ----- */
.rl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; color: var(--text); }
.rl-toolbar { display: flex; gap: 8px; }
.rl-toolbar input { flex: 1; min-width: 0; }
.rl-toolbar button { font-size: 0.85rem; }
.rl-hint { font-size: 0.85rem; color: var(--muted); }
/* Massenimport („Liste einfügen …“) */
.rl-import { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--panel-2); }
.rl-import textarea { min-height: 140px; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; white-space: pre; }
.rl-import-columns { display: flex; flex-wrap: wrap; gap: 6px; }
.rl-import-columns span { padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 0.8rem; color: var(--text); }
.rl-import-preview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.rl-import-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; max-height: 260px; overflow: auto; margin: 0; padding: 0; list-style: none; font-size: 0.85rem; }
.rl-import-lines li { display: flex; gap: 8px; min-width: 0; padding: 3px 6px; border-left: 3px solid var(--ok); }
.rl-import-lines li.warn { border-left-color: var(--warn); }
.rl-import-lines li.duplicate { border-left-color: var(--line-strong); color: var(--muted); }
.rl-import-lines li.error { border-left-color: var(--danger); color: var(--danger); }
.rl-import-line { flex: none; min-width: 4.5em; color: var(--muted); font-variant-numeric: tabular-nums; }
.rl-import-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-import-lines li.error .rl-import-text, .rl-import-lines li.warn .rl-import-text { white-space: normal; }
.rl-import-note { font-size: 0.85rem; color: var(--ok); }
.rl-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
/* Gruppenüberschrift (z. B. Kategorie), klappt ihre Runden ein und aus */
.rl-group {
  justify-content: flex-start; gap: 10px; width: 100%; margin-top: 8px; padding: 0 8px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: left;
}
.rl-group:hover { background: transparent; }
.rl-group:first-child { margin-top: 0; }
.rl-group-name { font-weight: 600; color: var(--text); }
.rl-group-info { flex: 1; min-width: 0; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rl-group-toggle { color: var(--muted); width: 1em; }

.rl-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 2px 4px 2px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.rl-row-open {
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  text-align: left;
}

.rl-row-open:hover { background: transparent; }
.rl-row-number { min-width: 2.4em; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rl-row-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-row-warning { color: var(--warn); }
.rl-row > button { min-height: 30px; padding: 0 8px; font-size: 0.8rem; }

.rl-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--panel-2);
}

.rl-card-head { display: flex; align-items: center; gap: 8px; }
.rl-card-head strong { flex: 1; }
.rl-card-head button { min-height: 30px; padding: 0 10px; font-size: 0.85rem; }
.rl-card-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.rl-card-body textarea { min-height: 70px; }
.rl-card-body input[type="text"] { width: 100%; }

.ui-image-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-image-field button, .ui-image-field .file-button { min-height: 30px; padding: 0 10px; font-size: 0.85rem; }

.ui-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.ui-image-field.compact .ui-thumb { width: 40px; height: 40px; }
.ui-thumb img { width: 100%; height: 100%; object-fit: contain; }
.ui-thumb.empty { font-size: 0.75rem; color: var(--muted); }

/* ----- Dialoge: Neue Sitzung, Fragenauswahl ----- */
.session-chip { background: var(--panel-2); }

.session-dialog {
  width: min(780px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px 22px 22px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.session-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.session-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.session-head h2 { margin: 0; font-size: 1.1rem; }
.pick-dialog { width: min(860px, calc(100vw - 32px)); }
.pick-dialog .segmented { margin: 14px 0; }
.pick-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.pick-random { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pick-random input { width: 6em; }
.pick-tools { display: flex; gap: 8px; align-items: center; }
.pick-tools input { flex: 1; min-width: 0; }
.pick-tools button { font-size: 0.85rem; }
.pick-list {
  list-style: none; margin: 0; padding: 4px; max-height: 320px; overflow: auto;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
}
.pick-list label {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 5px 6px; border-radius: 4px; cursor: pointer;
}
.pick-list label:hover { background: var(--panel-2); }
.pick-list input { flex: none; width: 18px; height: 18px; accent-color: var(--accent); }
.pick-list .pick-number { min-width: 2.4em; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.pick-list .pick-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list .pick-new { color: var(--ok); font-size: 0.8rem; white-space: nowrap; }
.pick-list .pick-played, .order-played { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.pick-prefer { margin-top: 4px; }
.pick-list .pick-levels { color: var(--muted); font-size: 0.8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pick-tools .hint { flex: 1; margin: 0; }
.pick-new-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pick-editor-box { padding: 12px; border: 1px solid var(--accent); border-radius: 8px; }
.pick-editor-box h3 { margin: 0 0 10px; font-size: 0.95rem; }
.pick-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.pick-actions .hint { flex: 1; min-width: 200px; margin: 0; }

/* ----- Start: Fortsetzen, Kacheln, Weitere ----- */
#page-start { max-width: 980px; margin: 0 auto; }
.start-head h2 { margin: 8px 0 4px; font-size: 1.5rem; font-weight: 600; }
.start-head .hint { margin: 0; }

.start-continue {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-color: rgba(77, 141, 255, 0.55);
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--panel);
}
.start-continue-body { flex: 1; min-width: 240px; }
.start-kicker { font-size: 0.8rem; color: var(--muted); }
.start-continue-text { font-size: 1rem; font-weight: 600; }
.start-continue button { min-width: 160px; }

.start-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.start-tile {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  padding: 20px;
  border-radius: 10px;
  background: var(--panel);
  border-color: var(--line);
  text-align: left;
}
.start-tile:hover { border-color: var(--accent); background: var(--panel-2); }
.start-tile .icon { width: 30px; height: 30px; color: var(--accent); }
.start-tile strong { font-size: 1.1rem; }
.start-tile span { color: var(--muted); font-size: 0.9rem; }
.start-keep { color: var(--muted); font-size: 0.9rem; }

/* ----- Spielbibliothek ----- */
.library-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.library-profile { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.library-profile select { min-width: 200px; }
.library-toolbar input[type="search"] { flex: 1; min-width: 220px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.library-grid .empty { grid-column: 1 / -1; }
.library-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  align-items: start;
  justify-content: stretch;
  gap: 4px 12px;
  min-height: 132px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--panel);
  border-color: var(--line);
  text-align: left;
}
.library-tile:hover { border-color: var(--accent); background: var(--panel-2); }
.library-icon { grid-row: 1 / 3; font-size: 2rem; line-height: 1; }
.library-title { font-weight: 600; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-summary {
  color: var(--muted);
  font-size: 0.88rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.library-meta { grid-column: 1 / -1; font-size: 0.8rem; color: var(--muted); padding-top: 6px; border-top: 1px solid var(--line); }

/* ----- Checkliste ----- */
#page-prep-check { max-width: 900px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.check-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.check-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  color: var(--muted);
  font-weight: 700;
}
.check-step.done .check-mark { border-color: var(--ok); background: var(--ok); color: #08130d; }
.check-step.optional .check-mark { border-style: dashed; }
.check-body { display: grid; gap: 6px; min-width: 0; }
.check-head { display: flex; align-items: center; gap: 8px; }
.check-head strong { font-size: 1rem; }
.check-optional { font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 8px; }
.check-text { color: var(--muted); }
.check-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.check-actions select { min-width: 220px; }
.check-tech { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.check-tech li { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.check-tech button { min-height: 28px; padding: 0 10px; font-size: 0.85rem; }
.check-tech-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.check-tech .ok .check-tech-dot { background: var(--ok); }
.check-tech .open .check-tech-dot { background: var(--warn); }
.check-go { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.check-go .status { flex: 1; min-width: 200px; }
.check-go button { min-width: 180px; min-height: 44px; font-size: 1rem; }

/* ----- Live: aktuelles Spiel ----- */

/* Spontaner Abend: Spiel wählen unter Live */
.quick-points { width: 4.2em; min-height: 30px; padding: 0 6px; }
.quick-list .game-item { gap: 6px; }

#current-section .entry-title .game-points { margin-left: auto; font-size: 1.05rem; color: var(--accent); }

.duel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  align-items: end;
}

.duel-team {
  padding: 8px 12px;
  border-left: 4px solid var(--team-color);
  border-radius: 6px;
  background: var(--panel-2);
}

.duel-team select { width: 100%; }

/* Spieler-Handys (remote.js): QR-Code, Plätze mit Verbindungsstatus */
.remote-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.remote-start { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.remote-start .hint { flex: 1; min-width: 200px; }
.remote-qr { width: 112px; height: 112px; padding: 0; border: none; border-radius: 6px; background: #fff; overflow: hidden; }
.remote-qr svg { display: block; width: 100%; height: 100%; }
.remote-info { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.remote-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.remote-head strong { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.remote-seats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.remote-seat { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 8px; border-left: 4px solid var(--team-color); border-radius: 4px; background: var(--panel); }
.remote-seat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.remote-seat-state { font-size: 0.85rem; color: var(--muted); }
.remote-seat.ok .remote-seat-state { color: var(--ok); }
.remote-seat.lost .remote-seat-state { color: var(--warn); }
.remote-seat button { min-height: 28px; padding: 0 8px; font-size: 0.8rem; }
.remote-buzzer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 6px 8px; border-radius: 4px; background: var(--panel); }
.remote-buzzer-state { flex: 1; min-width: 160px; font-size: 0.9rem; color: var(--muted); }
.remote-buzzer button { min-height: 30px; padding: 0 10px; font-size: 0.85rem; }
.remote-options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.remote-error { font-size: 0.85rem; color: var(--danger); }
.remote-state { font-weight: 600; }
.remote-secret-row { align-items: flex-end; }
.remote-secret-row .field { flex: 1; min-width: 260px; }
#remote-config-line { overflow-wrap: anywhere; }
.remote-state.ok { color: var(--ok); }
.remote-state.error { color: var(--danger); }

.match { display: grid; gap: 10px; }

.match-teams {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.match-team {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  border-left: 4px solid var(--team-color);
  border-radius: 6px;
  background: var(--panel-2);
}

.match-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.match-score {
  min-width: 1.6em;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.match-team button { font-weight: 700; }
.match-hint { font-size: 0.85rem; color: var(--muted); }

.match-suggest {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  font-weight: 600;
}

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.engine-control:empty { display: none; }

.engine-control {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
}

.result-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.result-buttons .win {
  background: var(--team-color);
  border-color: var(--team-color);
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.result-done {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--ok);
  border-radius: 6px;
  font-weight: 600;
}

/* ----- Live: Joker und Auto-Countdown ----- */
.game-extras { display: grid; gap: 8px; }
.game-extras:has(> [hidden]:first-child + [hidden]) { display: none; }
.joker-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.joker-title { font-weight: 600; font-size: 0.85rem; color: var(--muted); }
.joker-team { display: flex; align-items: center; gap: 6px; padding-left: 8px; border-left: 3px solid var(--team-color); }
.joker-name { font-size: 0.85rem; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.joker-button { min-height: 32px; padding: 0 10px; font-size: 0.85rem; }
.joker-button[aria-pressed="true"] { background: var(--team-color); border-color: var(--team-color); color: #fff; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.joker-note { flex-basis: 100%; font-size: 0.85rem; color: var(--muted); }
.joker-note.error { color: var(--warn); }
.catalog-jokers { display: flex; gap: 12px; flex-wrap: wrap; }
.catalog-joker { display: flex; align-items: center; gap: 6px; color: var(--text); }
.catalog-joker input { width: 4.5em; }
.game-editor-head.extras { grid-template-columns: 220px minmax(0, 1fr); }

/* ----- Live: Timer ----- */
.timer-panel { display: grid; gap: 10px; }
.timer-panel h2 { margin: 0; }

.timer-clock {
  padding: 4px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.timer-clock.running { color: var(--ok); }
.timer-clock.warning { color: var(--warn); }
.timer-clock.done { color: var(--danger); animation: timer-blink 1s steps(2) infinite; }

@keyframes timer-blink {
  50% { opacity: 0.3; }
}

.timer-controls, .timer-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.timer-controls #timer-toggle { flex: 1; }
.timer-presets button { flex: 1; padding: 0 4px; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.timer-presets button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.timer-custom { display: flex; gap: 6px; }
.timer-custom input { flex: 1; width: 0; }

/* ----- Live: Verlauf ----- */
.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
  max-height: 320px;
  overflow: auto;
}

.history li.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 4px 3px 12px;
  border-left: 3px solid var(--team-color, var(--line-strong));
  border-radius: 4px;
  background: var(--panel-2);
  font-size: 0.9rem;
}

.history-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-text { flex: 1; min-width: 0; }
.history-delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.history button { min-height: 28px; padding: 0 10px; font-size: 0.8rem; }

/* ----- Design des Abends ----- */
.theme-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.theme-presets button {
  display: grid;
  justify-content: stretch;
  gap: 8px;
  padding: 8px;
  text-align: left;
}

.theme-presets button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.theme-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  border-radius: 4px;
  font-weight: 800;
}

.theme-swatch i { width: 14px; height: 14px; border-radius: 50%; }

.theme-layout {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 340px);
  gap: 20px;
  align-items: start;
}

.theme-editor { display: grid; gap: 14px; }

.theme-colors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.theme-color { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--muted); }
.theme-color input { flex: none; }

.theme-preview {
  position: relative;
  overflow: hidden;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  text-align: center;
}

.theme-preview-logo { position: absolute; top: 8px; left: 8px; max-width: 80px; max-height: 32px; object-fit: contain; }
.theme-preview-logo.tr { left: auto; right: 8px; }
.theme-preview-logo.bl { top: auto; bottom: 8px; }
.theme-preview-logo.br { top: auto; bottom: 8px; left: auto; right: 8px; }
.theme-preview-kicker { font-size: 0.7rem; letter-spacing: 0.3em; text-transform: uppercase; }
.theme-preview-title { font-size: 2rem; font-weight: 900; line-height: 1.1; }
.theme-preview-row { display: flex; gap: 10px; align-items: center; margin-top: 6px; font-size: 0.85rem; }
.theme-preview-chip { padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; }
.theme-preview-points { font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }

/* Branding: Logo und Hintergrundbild */
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.brand-box { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; }
.brand-box h3 { margin: 0; font-size: 0.9rem; font-weight: 600; }
.brand-image-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-thumb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 120px; height: 68px; overflow: hidden; flex: none;
  border: 1px solid var(--line); border-radius: 6px;
  background: repeating-conic-gradient(#252b35 0% 25%, #1c222b 0% 50%) 0 0 / 16px 16px;
  color: var(--muted); font-size: 0.8rem;
}
.brand-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-thumb.cover img { width: 100%; height: 100%; object-fit: cover; }
.brand-box .segmented button { font-size: 0.8rem; padding: 0 4px; }
.brand-dim { display: flex; align-items: center; gap: 10px; }
.brand-dim input { flex: 1; min-width: 0; }
/* Profile */
.profile-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.profile-head input { width: 100%; }
.pool-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pool-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 2px 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel-2); color: var(--text); }
.pool-chip .pool-remove { min-height: 28px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); }
.pool-chip .pool-remove:hover { color: var(--danger); background: transparent; }
.pool-box { display: grid; gap: 6px; }
.pool-toggle { border-radius: 999px; }
.pool-toggle.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }
.profile-favorites { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px; }
.favorite-toggle { width: 100%; justify-content: flex-start; min-height: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favorite-toggle.on { border-color: var(--warn); color: var(--text); }
.profile-history-list { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 2px; }
.profile-history-list li { display: flex; gap: 12px; align-items: center; padding: 4px 8px; border-radius: 4px; background: var(--panel-2); }
#profile-swatch { width: 80px; height: 36px; flex: none; }

/* ----- Einstellungen ----- */
.camera-setup { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.camera-setup .stack { gap: 12px; }
.camera-preview {
  width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; border: 1px solid var(--line);
  object-fit: cover;
}
.camera-preview.contain { object-fit: contain; }
.camera-preview.mirror { transform: scaleX(-1); }
.camera-status { font-size: 0.85rem; color: var(--muted); }
.camera-status.error { color: var(--danger); }

.spotify-steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 4px; color: var(--muted); font-size: 0.9rem; }
.spotify-copy { display: inline-flex; align-items: center; gap: 6px; }
.spotify-copy button { min-height: 26px; padding: 0 8px; font-size: 0.8rem; }
.spotify-paste { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px; border: 1px solid var(--accent); border-radius: 8px; }
.spotify-state { font-weight: 600; white-space: pre-line; }
.spotify-state.ok { color: var(--ok); }
.spotify-state.error { color: var(--danger); }
.spotify-device { min-width: 260px; flex: 1; }
#spotify-device-row { align-items: flex-end; margin-top: 12px; }
#page-set-connections .field { margin-top: 12px; }

.sound-volume { min-width: 200px; }

.sound-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sound-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
}

.sound-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sound-table code { color: var(--text); }
.sound-table .found { color: var(--ok); white-space: nowrap; }
.sound-table .missing { color: var(--muted); white-space: nowrap; }
.sound-table button { min-height: 28px; padding: 0 10px; }
.sound-table input { width: 18px; height: 18px; accent-color: var(--accent); }
.sound-set-table td { padding: 6px 8px; }
.sound-set-table .sound-group th { padding-top: 14px; color: var(--text); font-size: 0.95rem; }
.sound-event { min-width: 0; }
.sound-event strong { display: block; font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
.sound-when { display: block; color: var(--muted); font-size: 0.8rem; }
.sound-files { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sound-chip {
  display: inline-flex; align-items: center; gap: 2px; min-width: 0;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2);
}
.sound-chip button { border: 0; background: transparent; white-space: nowrap; }
.sound-chip.inherited { border-style: dashed; opacity: 0.75; }
.sound-chip.missing { border-color: var(--danger); }
.sound-origin { padding-right: 8px; color: var(--muted); font-size: 0.75rem; }
.sound-note { color: var(--muted); font-size: 0.85rem; }
.sound-actions { white-space: nowrap; }
.sound-actions > * { margin-right: 6px; }
.sound-actions .toggle { display: inline-flex; vertical-align: middle; }
.music-quick { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.music-quick input[type=range] { width: 100%; }
.music-status { overflow: hidden; color: var(--muted); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }

.maintenance-list { display: grid; gap: 12px; }
.maintenance-item { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: center; }

/* ----- Tastenkürzel-Übersicht ----- */
.link-button { justify-content: flex-start; min-height: 30px; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font-size: 0.85rem; }
.link-button:hover { background: transparent; color: var(--text); }
.keys-dialog { width: min(640px, calc(100vw - 32px)); }
.keys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.keys-grid h3 { margin: 0 0 8px; font-size: 0.9rem; }
.keys-grid dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin: 0; align-items: center; }
.keys-grid dt { white-space: nowrap; }
.keys-grid dt kbd { margin: 0; }
.keys-grid dd { margin: 0; color: var(--muted); }

/* ----- Touch (Tablet-Modus): kein Aufklappen per Überfahren, kleine Knöpfe größer ----- */
@media (hover: none) {
  body.nav-collapsed .sidebar:hover, body.nav-collapsed .sidebar:focus-within { width: var(--sidebar-w-collapsed); box-shadow: none; }
  body.nav-collapsed .sidebar .nav-label, body.nav-collapsed .sidebar .nav-sub { display: none; }
}

@media (pointer: coarse) {
  .game-move { grid-auto-flow: column; }
  .game-move button { min-height: 40px; padding: 0 12px; font-size: 0.85rem; }
  .rl-row > button, .rl-card-head button, .history button, .sound-table button,
  .game-item .add, .check-tech button, .spotify-copy button, .ui-image-field button,
  .ui-image-field .file-button, .game-group button, .link-button { min-height: 40px; }
  .quick-points { min-height: 40px; }
  .toggle input, .pick-list input, .sound-table input { width: 22px; height: 22px; }
  .pick-list label { min-height: 40px; }
}

/* ----- Schmale Fenster ----- */
@media (max-width: 1400px) {
  .status-chips span { display: none; }
  .chip { padding: 0 9px; }
  #status { display: none; }
}

/* Breite Bildschirme: mehr Platz für Szenen und Übersicht (größere Vorschau) */
@media (min-width: 1600px) {
  .cockpit { grid-template-columns: 200px minmax(0, 1fr) 420px; }
  .cockpit.side-collapsed { grid-template-columns: 200px minmax(0, 1fr) 56px; }
}

/* Schmalere Laptops: Übersicht unter das Spiel */
@media (max-width: 1180px) {
  .cockpit, .cockpit.side-collapsed { grid-template-columns: 150px minmax(0, 1fr); }
  .cockpit-side { grid-column: 1 / -1; position: static; max-height: none; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .side-toggle, .side-mini { display: none; }
  .cockpit.side-collapsed .cockpit-side > .side-section { display: block; }
}

@media (max-width: 900px) {
  .cockpit, .cockpit.side-collapsed { grid-template-columns: minmax(0, 1fr); }
  .cockpit-scenes { position: static; max-height: none; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 900px) {
  body .sidebar { width: var(--sidebar-w-collapsed); }
  body .sidebar:hover, body .sidebar:focus-within { width: var(--sidebar-w); box-shadow: 8px 0 24px rgba(0, 0, 0, 0.45); }
  .sidebar:not(:hover):not(:focus-within) .nav-label,
  .sidebar:not(:hover):not(:focus-within) .nav-sub { display: none; }
  body .shell { margin-left: var(--sidebar-w-collapsed); }
  .plan, .info-grid, .camera-setup, .theme-layout, .session-row, .maintenance-item, .start-tiles { grid-template-columns: minmax(0, 1fr); }
  .game-editor-head { grid-template-columns: minmax(0, 1fr); }
  main { padding: 16px; }
  .topbar { padding: 8px 16px; }
}

@media (max-width: 700px) {
  .sound-table .hint-column { display: none; }
  #status { display: none; }
}

@media (max-width: 560px) {
  .editor-row { grid-template-columns: 1fr 80px auto; }
  .player { flex-wrap: wrap; }
}

/* ----- Anmeldung (nur online, account.js) ----- */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  overflow-y: auto;
}
.auth-box {
  width: min(400px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.auth-brand { font-size: 1.4rem; font-weight: 700; color: var(--text); text-align: center; }
.auth-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.auth-form[hidden] { display: none; }
.auth-form h2 { margin: 0; font-size: 1.05rem; color: var(--text); }
.auth-form input { width: 100%; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-message { margin: 0; min-height: 1.2em; font-size: 0.9rem; color: var(--muted); }
.auth-message.error { color: var(--danger); }
.auth-message.ok { color: var(--ok); }
.auth-note { margin: 0; font-size: 0.8rem; color: var(--muted); text-align: center; }
button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
}
button.link:hover { text-decoration: underline; background: none; }
.account-password { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 360px; }

/* ----- Import ins Konto (import.js) ----- */
.import-dialog ul { margin: 0 0 12px; padding-left: 20px; color: var(--text); }
.import-dialog li { margin: 4px 0; }
.import-skipped p { margin: 6px 0; font-size: 0.85rem; color: var(--muted); }
.import-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
