:root {
  --bg: #14141c; --panel: #1e1e29; --panel2: #262634; --line: #33334a;
  --text: #ececf3; --muted: #9a9ab0; --accent: #ff8c00; --accent2: #ffa733;
  --ok: #3ecf7a; --err: #ff5d5d; --warn: #f1c40f; --twitch: #9146ff;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, "Segoe UI Emoji", sans-serif; }
a { color: var(--accent2); }
code { background: var(--panel2); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
h1 { font-size: 1.6rem; margin: 6px 0 18px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.topbar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 12px 22px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 800; font-size: 1.15rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--text); text-decoration: none; padding: 6px 12px; border-radius: 8px; }
.nav a:hover { background: var(--panel2); }
.nav a.active { background: var(--accent); color: #111; font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 12px; }
.userbox a { color: var(--text); text-decoration: none; }
.userbox .logout { color: var(--muted); }
.role { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); }
.role-admin { background: rgba(255,140,0,.18); color: var(--accent2); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 22px 40px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 0 24px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.flash-ok { background: rgba(62,207,122,.1); border-color: rgba(62,207,122,.4); color: #b8f5d1; }
.flash-error { background: rgba(255,93,93,.1); border-color: rgba(255,93,93,.45); color: #ffc9c9; }

/* Formulare */
.form label, .card > label { display: block; margin: 12px 0 5px; color: var(--muted); font-size: .9rem; }
.form label.check, label.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin: 12px 0 4px; cursor: pointer; }
input[type=text], input[type=password], input[type=number], input[type=url], select {
  width: 100%; padding: 9px 11px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=color] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; }
input[type=file] { color: var(--muted); font-size: .85rem; max-width: 100%; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.form .btn { margin-top: 16px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 6px 14px 14px; margin: 0 0 14px; }
legend { padding: 0 6px; font-weight: 600; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > div { min-width: 0; }
.grow { flex: 1; min-width: 160px; }
.w-num { width: 90px !important; }

/* Passwort mit Auge */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0;
  color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 6px; display: flex; }
.pw-eye:hover { color: var(--text); background: var(--panel2); }
.pw-eye .eye-closed { display: none; }
.pw-eye.on .eye-open { display: none; }
.pw-eye.on .eye-closed { display: block; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { background: transparent; border-color: rgba(255,93,93,.5); color: #ff9a9a; }
.btn.danger:hover { background: rgba(255,93,93,.12); }
.btn.twitch { background: var(--twitch); border-color: var(--twitch); color: #fff; }
.btn.small { padding: 5px 11px; font-size: .85rem; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 6px; cursor: pointer; padding: 0 6px; line-height: 1.4; font-size: .7rem; }
.icon-btn:disabled { opacity: .3; cursor: default; }
form.inline { display: inline-block; margin: 4px 6px 4px 0; vertical-align: middle; }
.sr-default { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Kopierfeld */
.copy { display: flex; gap: 6px; margin-bottom: 4px; }
.copy input { font-family: Consolas, monospace; font-size: .85rem; }

/* Rad */
.wheel-box { display: flex; justify-content: center; padding: 6px 0 12px; }
.testresult { margin-top: 12px; font-size: 1.15rem; font-weight: 700; min-height: 1.6em; }

/* Status */
.status { list-style: none; padding: 0; margin: 0 0 12px; }
.status li { padding: 5px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--ok); } .dot.off { background: var(--err); } .dot.warn { background: var(--warn); }

/* Felder-Liste */
.field-list { display: flex; flex-direction: column; gap: 8px; }
.field-row { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; }
.field-row.inactive { opacity: .55; }
.field-row .order { display: flex; flex-direction: column; gap: 2px; }
.field-row .mini, label.mini { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); margin: 0; }
.field-row .w-num { width: 74px !important; }
.chance { min-width: 56px; text-align: right; color: var(--accent2); font-weight: 600; font-size: .9rem; }
.img-cell { display: flex; align-items: center; gap: 8px; }
.thumb { width: 34px; height: 34px; object-fit: contain; background: var(--bg); border-radius: 6px; }
.file-small { width: 190px; }
.tc { display: inline-flex; gap: 4px; align-items: center; }
.tc select { width: auto; padding: 6px 8px; font-size: .82rem; }
.sb-input { width: 210px !important; font-size: .85rem; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.pw-reset { display: flex !important; gap: 6px; align-items: center; }
.pw-reset label { display: none; }
.pw-reset .pw-wrap { width: 170px; }
.pw-reset input { padding-top: 5px; padding-bottom: 5px; }
.table td select { width: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .8rem; font-weight: 600; }
.badge-done { background: rgba(62,207,122,.15); color: var(--ok); }
.badge-queued { background: rgba(241,196,15,.15); color: var(--warn); }
.badge-playing { background: rgba(145,70,255,.2); color: #c4a3ff; }

.device-code { font: 800 2.2rem/1.2 Consolas, monospace; letter-spacing: .15em; color: var(--accent2);
  background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 16px; margin: 8px 0; text-align: center; }
.device .btn.twitch { margin-top: 6px; }
.steps { padding-left: 20px; margin: 0 0 10px; }
.steps li { margin-bottom: 8px; }
.steps .copy { margin-top: 6px; }
.sticky-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; padding: 12px 20px; box-shadow: 0 -4px 24px rgba(0,0,0,.35); }
.sticky-save .btn { margin: 0; }
