:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --border: #2a2f3a;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #3b82f6;
  --danger: #ef4444;
  --ok: #22c55e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-wrap: wrap;
}

header nav a { color: var(--muted); text-decoration: none; margin-left: 14px; }
header nav a.active, header nav a:hover { color: var(--text); }

main { padding: 20px; max-width: 1200px; margin: 0 auto; }

button, select {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #242935;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
}
button:hover:not(:disabled) { filter: brightness(1.15); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }

.status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status.on .dot { background: var(--ok); }
.status.off .dot { background: var(--danger); }

/* ---------- Board: Zusatz-Buttons links + Deck ---------- */
.board { display: flex; gap: 18px; justify-content: center; align-items: stretch; }
.board .deck { flex: 1; margin: 0; }
.extras {
  display: flex; flex-direction: column; gap: 12px;
  width: 140px; flex: none; padding: 18px 12px;
  border-radius: 22px; border: 1px dashed #3a4050; background: #0a0b0e;
}
.xbtn {
  flex: 1; min-height: 56px;
  border: 2px solid var(--c); border-radius: 999px;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c) 85%, white), var(--c) 55%, color-mix(in srgb, var(--c) 55%, black));
  color: #fff; font-weight: 700; padding: 6px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-shadow: 0 1px 3px rgba(0,0,0,.6); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 40%, transparent);
  transition: transform .05s; overflow: hidden;
}
.xbtn .label {
  max-width: 100%; text-align: center; overflow-wrap: anywhere; line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.xbtn .count { font-size: 11px; font-weight: 500; opacity: .85; }
.xbtn:active, .xbtn.hit { transform: scale(.94); }
.xbtn.nosound { filter: brightness(.45); }
.cfg-extras .xbtn { cursor: pointer; }
.cfg-extras .xbtn.selected { outline: 3px solid #fff; outline-offset: 3px; }
.cfg-extras .xbtn.drop { outline: 3px dashed var(--accent); outline-offset: 3px; }

/* ---------- Deck-Raster (Board + Konfiguration) ---------- */
.deck {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  gap: 12px;
  padding: 18px;
  background: #050608;
  border-radius: 22px;
  border: 1px solid var(--border);
  max-width: calc(var(--cols, 5) * 150px);
  margin: 0 auto;
}
.key {
  aspect-ratio: 1;
  border: none;
  border-radius: 14%;
  padding: 6%;
  background: #15171c;
  color: #fff;
  font-weight: 700;
  font-size: clamp(11px, 1.6vw, 17px);
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  word-break: break-word;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.35);
  transition: transform .05s;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.key:active, .key.hit { transform: scale(.92); }
.key.empty { background: #15171c; color: var(--muted); font-weight: 400; cursor: default; }
.key.nosound { filter: brightness(.45); }
.key.has-image {
  background-size: cover; background-position: center;
  align-items: flex-end; padding: 0;
}
.key.has-image .label {
  width: 100%; padding: 4% 6%; background: rgba(0,0,0,.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.key .dice {
  position: absolute; top: 4%; right: 6%; font-size: clamp(12px, 1.6vw, 18px);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.7));
}
.key .num {
  position: absolute; top: 5%; left: 8%;
  font-size: 10px; font-weight: 500; opacity: .6;
}

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #333a48; padding: 10px 16px; border-radius: 8px;
  opacity: 0; transition: opacity .2s; pointer-events: none;
  max-width: calc(100% - 32px); z-index: 10;
}
#toast.show { opacity: 1; }
#toast.error { background: #7f1d1d; }

.stop-btn { background: var(--danger); border-color: var(--danger); font-weight: 600; }

/* ---------- Konfiguration ---------- */
.toolbar { display: flex; gap: 12px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }
.toolbar .check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin-left: 12px; }
.hint { color: var(--muted); font-size: 14px; }
.hint code { background: var(--panel); padding: 2px 6px; border-radius: 4px; }
.warn { color: #fbbf24; font-size: 14px; }

.cfg .key { cursor: pointer; }
.cfg .key.empty { cursor: pointer; border: 1px dashed #2f3542; }
.cfg .key.empty:hover { border-color: var(--accent); color: var(--text); }
.cfg .key.selected { outline: 3px solid #fff; outline-offset: 3px; }
.cfg .key.inpool { outline: 3px solid #fbbf24; outline-offset: 3px; }
.cfg .key.drop { outline: 3px dashed var(--accent); outline-offset: 3px; }

.editor {
  margin: 22px auto 0;
  max-width: 640px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px 16px;
  align-items: center;
}
.editor h2 { grid-column: 1 / -1; margin: 0; font-size: 17px; }
.editor label { color: var(--muted); font-size: 14px; }
.editor input[type=text] {
  width: 100%; font: inherit; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.editor input[type=color] { width: 54px; height: 36px; border: none; padding: 0; background: none; cursor: pointer; }
.editor .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.editor .row input[type=range] { flex: 1; min-width: 120px; }
.editor .file { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.editor code {
  font-size: 12px; color: var(--muted); background: var(--bg);
  padding: 4px 6px; border-radius: 6px; user-select: all; word-break: break-all;
}
.editor .actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.editor .pool { display: flex; flex-wrap: wrap; gap: 6px; }
.editor .pool label {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 9px; color: var(--text); font-size: 13px;
}
.editor .pool label:has(input:checked) { border-color: #fbbf24; }
.editor .pool .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.editor .thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; border: 1px solid var(--border); }
.editor [hidden] { display: none !important; }
.editor .sounds { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.editor .sounds .item {
  display: flex; align-items: center; gap: 8px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px 4px 10px; font-size: 14px;
}
.editor .sounds .item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor .sounds .item button { padding: 3px 8px; font-size: 13px; }
.editor-empty { text-align: center; color: var(--muted); margin-top: 22px; }

@media (max-width: 700px) {
  main { padding: 12px; }
  .board { flex-direction: column; }
  .extras { flex-direction: row; width: auto; padding: 10px; border-radius: 14px; }
  .xbtn { min-height: 64px; }
  .deck { gap: 6px; padding: 10px; border-radius: 14px; }
  .key.has-image {
  background-size: cover; background-position: center;
  align-items: flex-end; padding: 0;
}
.key.has-image .label {
  width: 100%; padding: 4% 6%; background: rgba(0,0,0,.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.key .dice {
  position: absolute; top: 4%; right: 6%; font-size: clamp(12px, 1.6vw, 18px);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.7));
}
.key .num { display: none; }
  .editor { grid-template-columns: 1fr; }
}

/* ---------- Remote-Download-Seite ---------- */
.remote-page { max-width: 820px; }
.remote-page .panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 22px; margin-bottom: 18px; line-height: 1.55;
}
.remote-page h2 { margin-top: 0; font-size: 19px; }
.remote-page h3 { font-size: 15px; margin-bottom: 6px; }
.remote-page li { margin-bottom: 10px; }
.remote-page code { background: var(--bg); padding: 2px 6px; border-radius: 5px; }
.download-btn {
  display: inline-block; background: var(--accent); color: #fff; text-decoration: none;
  font-weight: 600; padding: 12px 20px; border-radius: 10px; margin-right: 12px;
}
.download-btn:hover { filter: brightness(1.15); }
.addr { display: flex; gap: 8px; align-items: center; margin: 8px 0 4px; flex-wrap: wrap; }
.addr code { font-size: 16px; padding: 6px 10px; user-select: all; }
.legend { list-style: none; padding: 0; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.legend .dot.ok { background: var(--ok); }
.legend .dot.warn { background: #eab308; }
.legend .dot.err { background: var(--danger); }

/* ---------- Seiten ---------- */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 0 auto 14px; font-weight: 600; color: var(--muted);
}
.pager button { padding: 6px 16px; font-size: 16px; }
.pagetabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; align-items: center; }
.pagetabs .tab { padding: 6px 14px; border-radius: 8px 8px 0 0; border-bottom-width: 3px; }
.pagetabs .tab.active { border-bottom-color: var(--accent); color: #fff; background: #2b3242; }
.pagetabs .tab.add { border-style: dashed; }
.pagetabs .tab.del { margin-left: auto; border-radius: 8px; }
.pagetabs .tab.drop { outline: 3px dashed var(--accent); outline-offset: 2px; }
.key.nav { flex-direction: column; gap: 2%; }
.key.nav .arrow { font-size: clamp(22px, 3.2vw, 40px); line-height: 1; }
.key.nav .label { font-size: .8em; opacity: .9; }
.editor .nav-only.hint { line-height: 1.4; }

/* ---------- Wer bist du? ---------- */
.who-btn { font-size: 13px; padding: 6px 10px; }
.log-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
dialog#who-dialog, dialog#copy-page-dialog, dialog.auth-dialog, dialog.account-dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 22px; width: min(380px, calc(100% - 32px));
}
dialog#who-dialog::backdrop, dialog#copy-page-dialog::backdrop, dialog.auth-dialog::backdrop, dialog.account-dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog#who-dialog h2, dialog#copy-page-dialog h2, dialog.account-dialog h2 { margin: 0 0 6px; font-size: 19px; }
dialog#who-dialog input, dialog.auth-dialog input, dialog#copy-page-dialog select {
  width: 100%; font: inherit; padding: 9px 11px; margin: 10px 0 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
dialog#who-dialog .actions, dialog#copy-page-dialog .actions, dialog.auth-dialog .actions, dialog.account-dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Anmeldung & eigene Boards ---------- */
.userbar { display: flex; align-items: center; gap: 8px; }
.userbar .board-select { max-width: 220px; font-size: 13px; padding: 6px 8px; }
.user-btn { font-size: 13px; padding: 6px 10px; }
/* Privates Board: farbiger Strich unter der Kopfzeile, damit man es nicht mit dem öffentlichen verwechselt */
body.private-board header { border-bottom: 3px solid #a855f7; }
body.private-board .board-select { border-color: #a855f7; }
.board-note {
  margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  background: rgba(168, 85, 247, .12); border: 1px solid rgba(168, 85, 247, .45);
}

dialog.auth-dialog label { display: block; color: var(--muted); font-size: 14px; }
dialog.auth-dialog input { margin: 4px 0 12px; }
dialog.auth-dialog .hint { margin: 0 0 12px; font-size: 13px; line-height: 1.4; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.auth-tabs button { flex: 1; }
.auth-tabs button.active { background: var(--accent); border-color: var(--accent); }
.auth-err { color: var(--danger); min-height: 1.2em; margin: 0 0 10px; font-size: 14px; }
dialog#copy-page-dialog select { margin: 4px 0 14px; }
dialog#copy-page-dialog .hint { line-height: 1.4; }

dialog.account-dialog { width: min(640px, calc(100% - 32px)); }
.account-head { display: flex; align-items: center; justify-content: space-between; }
.account h3 { font-size: 15px; margin: 18px 0 6px; }
.account .hint { font-size: 13px; line-height: 1.4; margin: 0 0 8px; }
.account input {
  font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); flex: 1; min-width: 160px;
}
.row.wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.board-list { display: flex; flex-direction: column; gap: 6px; }
.board-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.board-row.current { border-color: #a855f7; }
.board-row .name { font-weight: 600; flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.board-row button { padding: 5px 10px; font-size: 13px; }


/* ---------- Favoriten ---------- */
.viewtabs { display: flex; gap: 6px; justify-content: center; margin: 0 auto 16px; flex-wrap: wrap; }
.viewtabs button { padding: 6px 16px; }
.viewtabs button.active { background: #2b3242; border-color: #fbbf24; color: #fff; }
.viewtabs .count { color: var(--muted); font-size: 13px; }
.viewtabs .edit-btn { margin-left: 12px; font-size: 13px; }
.fav-tools { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.fav-hint { text-align: center; }
.fav-tools[hidden], .pager[hidden], .pagetabs[hidden] { display: none !important; }
#fav-view .pagetabs { justify-content: center; }
.key.fav { flex-direction: column; gap: 4px; }
.key.fav.has-image { justify-content: flex-end; align-items: stretch; }
.key.fav .origin {
  font-size: 10px; font-weight: 500; opacity: .85; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.key.fav.has-image .origin { width: 100%; background: rgba(0,0,0,.55); padding: 0 6% 4%; margin-top: -4px; }
.key.fav .origin.private { color: #e9d5ff; }
.key.xfav { border-radius: 50%; }
.key.xfav .fav-star { top: 15%; left: 15%; }
.key.xfav .dice { top: 15%; right: 15%; }
#favdeck.editing .key { cursor: pointer; }
#favdeck.editing .key[draggable=true] { cursor: grab; }
#favdeck.editing .key.empty { border: 1px dashed #2f3542; }
#favdeck.editing .key.empty:hover { border-color: var(--accent); color: var(--text); }
#favdeck .key.dragging { opacity: .4; }
#favdeck .key.drop { outline: 3px dashed #fbbf24; outline-offset: 3px; }

/* Sprungtasten (private Boards und Favoriten) */
.key.goto .arrow { font-size: clamp(20px, 2.8vw, 34px); }
.key.goto .target { font-size: 10px; font-weight: 500; opacity: .9; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

dialog.fav-nav-dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 22px; width: min(440px, calc(100% - 32px));
}
dialog.fav-nav-dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog.fav-nav-dialog h2 { margin: 0 0 10px; font-size: 19px; }
dialog.fav-nav-dialog label { display: block; color: var(--muted); font-size: 14px; margin-top: 10px; }
dialog.fav-nav-dialog select, dialog.fav-nav-dialog input[type=text] {
  width: 100%; font: inherit; padding: 8px 10px; margin-top: 4px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
dialog.fav-nav-dialog .row { display: flex; gap: 8px; }
dialog.fav-nav-dialog .row select:last-child { width: auto; }
dialog.fav-nav-dialog input[type=color] { margin-top: 4px; }
dialog.fav-nav-dialog .actions { display: flex; gap: 8px; margin-top: 18px; }
dialog.fav-nav-dialog .spacer { flex: 1; }
dialog.fav-nav-dialog [hidden] { display: none !important; }

/* Stern zum Merken: oben links (statt Tastennummer); leer nur beim Drüberfahren, gemerkt immer gelb */
.fav-star {
  position: absolute; top: 4%; left: 4%; z-index: 1; cursor: pointer;
  font-size: clamp(13px, 1.6vw, 18px); line-height: 1; color: #fff; opacity: 0;
  padding: 3px; border-radius: 50%; background: rgba(0,0,0,.45);
  text-shadow: 0 1px 3px rgba(0,0,0,.8); transition: opacity .1s, transform .1s;
}
.has-star .num { display: none; }
.has-star:hover .fav-star, .fav-star.on { opacity: .95; }
.fav-star:hover { transform: scale(1.25); }
.fav-star.on { color: #fbbf24; }
.xbtn { position: relative; }
.xbtn .fav-star { top: 50%; left: 8px; transform: translateY(-50%); }
.xbtn .fav-star:hover { transform: translateY(-50%) scale(1.25); }
@media (hover: none) { .fav-star { opacity: .5; } }


/* ==================== Soundboard 2: Gruppen, Satelliten, Admin ==================== */
:root { --warn: #fbbf24; --purple: #a855f7; }
a { color: #93c5fd; }
header .brand { font-size: 22px; text-decoration: none; }
header .group-name { font-weight: 600; white-space: nowrap; }
header .group-select { font-weight: 600; padding: 6px 8px; }
header nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
header nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; margin-left: 0; }
header nav a.active, header nav a:hover { color: var(--text); background: #262b37; }
header nav a.adm { color: #fbbf24; }
header nav a.sup { color: #f0abfc; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; font-weight: 500; }
.badge.adm { border-color: #a16207; color: var(--warn); }
.badge.sup { border-color: #86198f; color: #f0abfc; }
.badge.ok { border-color: #166534; color: var(--ok); }
.badge.off { border-color: #7f1d1d; color: #fca5a5; }
.warn { color: var(--warn); }
.center { text-align: center; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.check { gap: 8px; margin: 8px 0; color: var(--text); font-size: 14px; cursor: pointer; }
button.ghost { background: transparent; }
a.button { display: inline-block; text-decoration: none; color: var(--text); border: 1px solid var(--border); background: #242935; border-radius: 8px; padding: 8px 14px; }
input[type=text], input[type=password], input[type=number], textarea {
  font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.user-btn .badge { margin-left: 4px; }

/* Board-Reiter über dem Deck */
.board-tabs { display: contents; }
.viewtabs button.private { border-color: rgba(168, 85, 247, .45); }
.viewtabs button.private.active { border-color: var(--purple); }

/* Satellitenleiste */
body.has-satbar { padding-bottom: 64px; }
.satbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 16px; background: #11141b; border-top: 1px solid var(--border);
}
.satbar .lbl { font-size: 13px; color: var(--muted); white-space: nowrap; }
.satbar .sat {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: #1a1e27;
  border-radius: 10px; padding: 5px 10px; font-size: 13px; cursor: pointer; user-select: none;
}
.satbar .sat input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.satbar .sat:has(input:checked) { border-color: var(--accent); background: #17233b; }
.satbar .sat .st { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.satbar .sat.offline { opacity: .45; cursor: not-allowed; }
.satbar .sat.offline .st { background: var(--danger); }
.satbar .sat.playing .st { animation: pulse 1s infinite alternate; }
.satbar button { padding: 5px 10px; font-size: 13px; }
@keyframes pulse { from { box-shadow: 0 0 0 2px rgba(34, 197, 94, .2); } to { box-shadow: 0 0 0 6px rgba(34, 197, 94, .35); } }
#toast { bottom: 76px; }

/* Seiten mit Panels (Geräte, Admin, Superadmin) */
main.page { max-width: 1200px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { font-size: 17px; margin: 0 0 8px; }
.panel h3, main.page h3 { font-size: 15px; margin: 14px 0 8px; }
.panel h3:first-child { margin-top: 0; }
.panel .hint { line-height: 1.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 > .panel, .grid3 > .panel { margin-bottom: 0; }
.grid2, .grid3 { margin-bottom: 16px; }
.span2 { grid-column: span 2; }
.big { font-size: 28px; font-weight: 700; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button.active { background: var(--accent); border-color: var(--accent); }
.toolbar input[type=text] { min-width: 220px; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: none; }
td.row { flex-wrap: nowrap; }
td input[type=text] { width: 100%; min-width: 120px; padding: 5px 8px; }
td input[type=range] { width: 90px; vertical-align: middle; }
td button, td select { padding: 5px 9px; font-size: 13px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.dev { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #141720; }
.dev .ico { font-size: 24px; width: 36px; text-align: center; }
.dev .meta { flex: 1; min-width: 0; }
.dev .meta b { display: block; }
.dev .meta > span { font-size: 12px; color: var(--muted); }
.dev .meta > span b { display: inline; }
.dev .deck-edit { margin-top: 8px; }
.dev [hidden] { display: none !important; }
a.dev.download { color: var(--text); text-decoration: none; }
a.dev.download:hover { border-color: var(--accent); }
.pair-code { margin-top: 14px; padding: 14px; border-radius: 10px; background: #17233b; border: 1px solid var(--accent); text-align: center; }
.pair-code code { display: inline-block; font-size: 30px; letter-spacing: .2em; padding: 6px 16px; margin: 8px 0; background: var(--bg); border-radius: 8px; user-select: all; }
.big-code { font-size: 20px !important; letter-spacing: .2em; padding: 4px 12px !important; user-select: all; }
code { background: var(--bg); border: 1px solid var(--border); padding: 2px 6px; border-radius: 5px; font-size: 12px; }
pre { background: #000; color: #c7f9cc; padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.invite-url { font-size: 13px; padding: 7px 10px; flex: 1; min-width: 240px; user-select: all; word-break: break-all; }
.invite-url.disabled { opacity: .45; text-decoration: line-through; }
.howto { margin-top: 10px; }
.howto summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.howto li { margin-bottom: 8px; line-height: 1.5; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 44px; gap: 8px; align-items: center; font-size: 13px; }
.bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .fill { height: 10px; border-radius: 5px; background: var(--accent); min-width: 2px; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.chart i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .85; min-width: 3px; }
.form label { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 4px; }
.form label.row { color: var(--text); }
.form input[type=text] { width: 100%; }
.form > div:last-child { margin-top: 12px; }
.danger-title { color: #fca5a5; }
.empty-state { text-align: center; margin-top: 12vh; }
.empty-state .hint { max-width: 480px; margin: 0 auto; }
dialog.form-dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 22px; width: min(440px, calc(100% - 32px));
}
dialog.form-dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog.form-dialog h2 { margin: 0 0 8px; font-size: 19px; }
dialog.form-dialog label { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 4px; }
dialog.form-dialog label.row { color: var(--text); }
dialog.form-dialog input[type=text], dialog.form-dialog select { width: 100%; }
dialog.form-dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
body.super header { border-bottom: 3px solid #86198f; }

/* Voting */
.navbadge { display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 5px; border-radius: 999px;
  background: #f59e0b; color: #1c1917; font-size: 11px; font-weight: 700; text-align: center; line-height: 17px; }
.navbadge[hidden] { display: none; }
.key.voting { outline: 3px solid #f59e0b; outline-offset: 2px; }
.key .vbadge {
  position: absolute; bottom: 5%; right: 6%; z-index: 2; font-size: 11px; font-weight: 700; background: #f59e0b; color: #1c1917;
  border-radius: 999px; padding: 1px 7px; text-shadow: none; cursor: pointer;
}
.key .vbadge:hover { filter: brightness(1.15); }
.vote-thumb {
  position: absolute; top: 4%; right: 6%; z-index: 1; cursor: pointer; font-size: clamp(12px, 1.4vw, 16px); line-height: 1;
  padding: 3px; border-radius: 50%; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .1s, transform .1s;
}
.key.random .vote-thumb { right: auto; left: 30%; }
.key:hover .vote-thumb { opacity: .9; }
.vote-thumb:hover { transform: scale(1.25); }
@media (hover: none) { .vote-thumb { display: none; } }
.vote-pop {
  position: absolute; z-index: 20; width: 300px; background: #20242d; border: 1px solid #f59e0b; border-radius: 12px;
  padding: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.6); font-size: 13px;
}
.vote-pop.sheet { position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; z-index: 30; }
.vp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; }
.vp-head button { padding: 2px 8px; }
.vp-reason { font-style: italic; color: #d6d3d1; margin: 6px 0 2px; }
.vp-btns { display: flex; gap: 8px; margin-top: 10px; }
.vp-btns button { flex: 1; font-weight: 600; }
.vp-foot { justify-content: space-between; margin-top: 8px; }
.vp-names { margin-top: 8px; }
.vbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #1f2937; margin: 8px 0 3px; position: relative; }
.vbar .out { background: #dc2626; }
.vbar .keep { background: #16a34a; }
.vbar .quorum { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.vlegend { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
button.vote-out { background: #7f1d1d; border-color: #dc2626; color: #fff; }
button.vote-keep { background: #14532d; border-color: #16a34a; color: #fff; }
button.vote-out.on { background: #dc2626; box-shadow: 0 0 0 2px #fca5a5; }
button.vote-keep.on { background: #16a34a; box-shadow: 0 0 0 2px #86efac; }
.vcard { display: grid; grid-template-columns: 78px 1fr auto; gap: 14px; align-items: center; padding: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel); margin-bottom: 10px; }
.vcard.waiting { border-color: #f59e0b; }
.mini-key { width: 78px; height: 78px; border-radius: 14%; display: grid; place-items: center; font-weight: 700; font-size: 12px;
  text-align: center; padding: 6px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); background-size: cover; background-position: center; overflow-wrap: anywhere; }
.vcard .who { font-size: 12px; color: var(--muted); }
.vcard .reason { font-style: italic; color: #d6d3d1; margin: 2px 0; }
.vcard .side { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.chips button { padding: 3px 10px; font-size: 12px; border-radius: 999px; }
.rule { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.rule:last-of-type { border-bottom: none; }
.rule .hint { display: block; font-size: 12px; }
.rule input[type=number] { width: 80px; }
@media (max-width: 700px) {
  .vcard { grid-template-columns: 60px 1fr; }
  .vcard .mini-key { width: 60px; height: 60px; font-size: 11px; }
  .vcard .side { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .vcard .side button { flex: 1; }
  .rule { grid-template-columns: 1fr; gap: 4px; }
}

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }

/* Kontingente */
.quota { margin: 4px 0 10px; }
.quota-text { font-size: 14px; margin-bottom: 4px; }
.meter { height: 8px; border-radius: 4px; background: #1f2937; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter.high i { background: var(--warn); }
.meter.full i { background: var(--danger); }
.quota-form { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.quota-form input { width: 120px; }

/* Anmelden / Einladung */
body.auth-page { display: flex; min-height: 100vh; align-items: flex-start; justify-content: center; }
.auth { width: min(420px, calc(100% - 32px)); margin-top: 8vh; display: flex; flex-direction: column; gap: 14px; padding: 0; }
.auth-logo { font-size: 46px; text-align: center; }
.auth .panel { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.auth .panel h2 { margin-bottom: 6px; }
.auth label { color: var(--muted); font-size: 13px; margin-top: 6px; }
.auth button.primary { margin-top: 8px; padding: 10px; }
.auth [hidden] { display: none !important; }
.invite { background: linear-gradient(135deg, #2e1065, #1e3a8a); border-radius: 12px; padding: 18px; text-align: center; }
.invite .gname { font-size: 24px; font-weight: 700; margin: 4px 0; }
.invite .hint { color: #c7d2fe; }

@media (max-width: 900px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  header nav { order: 10; flex-basis: 100%; }
}


/* ==================== Handy (schmale Bildschirme) ==================== */
.key, .xbtn, .satbar .sat { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

@media (max-width: 700px) {
  /* Kopfzeile: oben Gruppe, Stop, Konto – darunter das Menü als wischbare Leiste */
  header, header.app { gap: 8px; padding: 8px 10px; }
  header .brand { font-size: 20px; }
  header .group-select, header .group-name { flex: 1; min-width: 0; max-width: none; overflow: hidden; text-overflow: ellipsis; }
  header nav {
    order: 10; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 0 -10px; padding: 0 6px;
  }
  header nav::-webkit-scrollbar { display: none; }
  header nav a { font-size: 13px; padding: 6px 9px; }
  header .user-btn .ub-name, header .user-btn .badge { display: none; }
  header .stop-btn { padding: 7px 12px; }
  .userbar { order: 11; flex-basis: 100%; }
  .userbar .board-select { max-width: none; width: 100%; }

  main, main.page { padding: 10px; }

  /* Board-Reiter wischbar statt umbrechend */
  .viewtabs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; margin: 0 -10px 12px; padding: 0 10px; }
  .viewtabs::-webkit-scrollbar { display: none; }
  .viewtabs button { flex: none; padding: 7px 12px; }

  /* Abspielen: Stream-Deck-Raster aufgeben – Tasten der Seite lückenlos und groß zum Tippen.
     Seitentasten ◀ ▶ übernimmt die Blätterleiste darüber. Beim Bearbeiten der Favoriten bleibt das Raster. */
  .deck.play:not(.editing) {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-width: none;
    gap: 8px; padding: 8px; background: transparent; border: none;
  }
  .deck.play:not(.editing) .key.empty,
  .deck.play:not(.editing) .key.nav:not(.goto) { display: none; }
  .deck.play .key { font-size: 14px; border-radius: 12px; }
  .deck.play .key .dice { font-size: 15px; }
  .pager { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 6px 0; margin-bottom: 6px; }
  .pager button { padding: 8px 20px; }

  /* Zusatz-Zufallsbuttons als wischbare Reihe */
  .extras { overflow-x: auto; gap: 8px; scrollbar-width: none; border-style: solid; }
  .extras::-webkit-scrollbar { display: none; }
  .xbtn { flex: 0 0 auto; min-width: 104px; min-height: 52px; }

  /* Bearbeiten: Raster bleibt (Positionen zählen), aber passt in die Breite */
  .deck.cfg { gap: 5px; padding: 8px; }
  .deck.cfg .key { font-size: 11px; }
  .toolbar { gap: 8px; }
  .pagetabs { flex-wrap: nowrap; overflow-x: auto; }
  .pagetabs .tab { flex: none; }

  /* Satellitenleiste: eine Zeile, wischbar */
  body.has-satbar { padding-bottom: 58px; }
  .satbar { flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px; scrollbar-width: none; }
  .satbar::-webkit-scrollbar { display: none; }
  .satbar .lbl-text { display: none; }
  .satbar .sat { flex: none; padding: 7px 10px; }
  .satbar .spacer { display: none; }
  .satbar button { flex: none; }
  #toast { bottom: 68px; }

  /* Admin-Tabellen als Karten (Spaltenname steht vor jedem Wert) */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs button { flex: none; }
  .table-wrap { background: none; border: none; overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; padding: 6px 12px; }
  .table-wrap td { border: none; padding: 5px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .table-wrap td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; width: 92px; flex: none; }
  .table-wrap td:empty { display: none; }
  .table-wrap td input[type=text], .table-wrap td select { flex: 1; min-width: 0; }
  .toolbar input[type=text] { min-width: 0; flex: 1; }

  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 > .panel.span2, .grid3 > .panel:has(.chart) { grid-column: 1 / -1; }
  .big { font-size: 22px; }
  .bar { grid-template-columns: minmax(70px, 110px) 1fr 36px; }
  .dev { flex-wrap: wrap; }
  .pair-code code { font-size: 24px; }
  .invite-url { min-width: 0; }

  /* iOS zoomt bei Eingabefeldern unter 16px automatisch hinein */
  input[type=text], input[type=password], input[type=number], select, textarea { font-size: 16px; }

  dialog.account-dialog, dialog.form-dialog, dialog.fav-nav-dialog, dialog.auth-dialog {
    width: calc(100% - 16px); max-height: calc(100% - 16px); padding: 16px;
  }
}

@media (max-width: 380px) {
  .deck.play:not(.editing) { grid-template-columns: repeat(3, 1fr); }
  .grid3 { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  /* Kennzahlen (Superadmin) klein nebeneinander */
  #totals { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  #totals .panel { padding: 10px; }
  #totals h3 { font-size: 12px; color: var(--muted); }
  #totals .big { font-size: 18px; }
}
