/* MaschuTV Control – Handy-App im MaschuStil (Farben aus MaschuTVs Comic-Avatar, Sticker-Konturen) */
:root {
  --blue: #2456e8; --blue-hi: #4f7bff; --navy: #1b2a6b; --char: #26272c; --char-hi: #34363d; --hood: #b8c7e6;
  --gold: #f2cf63; --peach: #f6c7a1; --green: #7bc62d; --ink: #120d0b; --cream: #fff8ec; --red: #ff5a4f; --bg: #15161b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: radial-gradient(900px 420px at 80% -10%, rgba(36,86,232,.35), transparent 60%), var(--bg);
  color: var(--cream); font: 16px/1.45 'Segoe UI', system-ui, sans-serif; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--navy); border-bottom: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.logo { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); background: var(--blue); }
.brand { flex: 1; font-family: 'Segoe UI Black', 'Arial Black', sans-serif; font-size: 18px; text-shadow: 2px 2px 0 var(--ink); }
.brand b { color: var(--gold); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); }
.dot.ok { background: var(--green); }
.pill { font-weight: 900; border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; box-shadow: 2px 2px 0 var(--ink); font-size: 14px; }
.pill.test { background: var(--gold); color: var(--ink); } .pill.live { background: var(--red); color: #fff; }
main { padding: 14px; max-width: 640px; margin: 0 auto; }
.tab { display: none; } .tab.active { display: block; }
h2 { margin: 0 0 10px; font-size: 18px; color: var(--gold); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h3 { margin: 18px 4px 8px; color: var(--gold); font-size: 16px; }
.card { background: linear-gradient(180deg, var(--char-hi), var(--char)); border: 3px solid var(--ink); border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.07); padding: 14px; margin-bottom: 14px; }
.stage .k { color: var(--hood); font-weight: 600; font-size: 13px; }
.stage .v { font-family: 'Segoe UI Black', 'Arial Black', sans-serif; font-size: 26px; text-shadow: 2px 2px 0 var(--ink); }
.stage.busy { background: linear-gradient(180deg, #3a2f12, #2a2410); border-color: var(--ink); }
.stage.busy .v { color: var(--gold); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.chip { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--ink); background: var(--char-hi); color: var(--hood); }
.chip.ok { background: #1d3510; color: var(--green); } .chip.bad { background: #3a1513; color: var(--red); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; font-size: 28px; line-height: 1.1;
  background: var(--blue); color: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 3px 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.3); font-weight: 800; }
.tile span { font-size: 13px; text-align: center; } .tile small { font-weight: 600; opacity: .85; }
.tile.danger { background: #b8322b; }
.tile:active, button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button { font: inherit; font-weight: 800; color: #fff; background: var(--blue); border: 2px solid var(--ink); border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.3); padding: 11px 14px; }
button.big { flex: 1; font-size: 17px; padding: 13px; }
button.ghost { background: var(--char-hi); color: var(--cream); }
button.danger { background: #b8322b; color: #fff; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--hood); font-weight: 600; margin-bottom: 10px; flex: 1; }
input, select { font: inherit; font-size: 16px; color: var(--cream); background: #1b1c21; border: 2px solid var(--ink); border-radius: 10px; padding: 11px 12px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--gold); }
.row { display: flex; gap: 10px; align-items: center; } .row input { flex: 1; }
.two { display: flex; gap: 10px; }
.hint { color: var(--hood); font-size: 13px; }
.badge { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink); background: var(--char-hi); color: var(--hood); }
.badge.ok { background: #1d3510; color: var(--green); } .badge.busy { background: var(--gold); color: var(--ink); } .badge.bad { background: #3a1513; color: var(--red); }
.list .item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--char); border: 2px solid var(--ink); border-radius: 12px; }
.item .t { flex: 1; min-width: 0; } .item .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item button { padding: 7px 10px; font-size: 13px; }
.ok-t { color: var(--green); } .bad-t { color: var(--red); } .gold-t { color: var(--gold); }
.big-num { font-family: 'Segoe UI Black', 'Arial Black', sans-serif; font-size: 40px; color: var(--cream); text-shadow: 3px 3px 0 var(--ink); }
.bar { height: 14px; background: #1b1c21; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .6s; }
.steps { margin: 0 0 12px; padding-left: 20px; color: var(--hood); font-size: 14px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: var(--navy); border-top: 3px solid var(--ink);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 6px; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 22px; padding: 6px 2px; background: transparent;
  border: 2px solid transparent; box-shadow: none; color: var(--hood); }
.tabbar button span { font-size: 12px; font-weight: 700; }
.tabbar button.active { background: var(--blue); color: #fff; border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 9;
  background: var(--gold); color: var(--ink); font-weight: 800; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink);
  padding: 10px 16px; max-width: 90vw; transition: all .25s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); } #toast.err { background: var(--red); color: #fff; }
.modal-back { position: fixed; inset: 0; z-index: 10; background: rgba(1,4,9,.75); display: grid; place-items: center; padding: 18px; }
.modal-back[hidden] { display: none; }
.modal { width: 100%; max-width: 420px; background: var(--char); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 6px 6px 0 var(--ink); padding: 18px; }
.modal p { margin: 0 0 16px; white-space: pre-line; }
.modal .row button { flex: 1; }

/* Schmale Handys: nichts darf breiter als der Bildschirm werden */
html, body { overflow-x: hidden; }
main, .card, .tab { min-width: 0; max-width: 100%; }
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two > *, .row > *, label { min-width: 0; }
.row { flex-wrap: wrap; }
.row button.big { min-width: 60%; }
.top { min-width: 0; } .brand { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { flex: none; }
select { text-overflow: ellipsis; }

/* Glücksrad-Editor auf dem Handy */
.wheelprev { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto 4px;
  background: repeating-conic-gradient(#1c2128 0 25%, #22272e 0 50%) 0 0 / 22px 22px; border: 3px solid var(--ink); border-radius: 14px; }
.result { text-align: center; font-weight: 900; color: var(--gold); text-shadow: 2px 2px 0 var(--ink); min-height: 1.4em; margin: 4px 0 8px; font-size: 18px; }
button.wide { width: 100%; margin-top: 10px; }
.seg-mode { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--cream); font-size: 15px; flex: none; margin: 0; }
label.inline input { width: auto; }
.seg { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px; margin-bottom: 8px;
  background: var(--char); border: 2px solid var(--ink); border-radius: 12px; }
.seg .sw { width: 34px; height: 34px; padding: 0; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.seg .sw input { width: 60px; height: 60px; margin: -12px; padding: 0; border: 0; background: none; }
.seg .lbl { padding: 9px 10px; }
.seg .btns { display: flex; gap: 4px; }
.seg .btns button { padding: 6px 9px; font-size: 14px; box-shadow: 2px 2px 0 var(--ink); }
.seg .w { grid-column: 2 / 4; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--hood); }
.seg .w input { width: 90px; padding: 7px 9px; }
#wPresets button { flex: 1; padding: 9px 6px; font-size: 13px; }
.errors { color: var(--red); font-size: 13px; padding-left: 18px; }
.badge:empty { display: none; }
#wPresets { flex-wrap: wrap; } #wPresets button { flex: 1 1 calc(50% - 10px); }
