:root {
  --bg: #08121F;
  --card: #101B2B;
  --line: #212A37;
  --text: #FFFFFF;
  --muted: #8A94A6;
  --blue: #0C35F8;
  --green: #4FB889;
  --yellow: #D9A441;
  --red: #D25C5C;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Manrope, system-ui, sans-serif; font-size: 16px; line-height: 1.45; }
body { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
a { color: var(--text); }
.boot { padding: 40px 16px; color: var(--muted); text-align: center; }

.page { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.brand { font-weight: 700; font-size: 22px; letter-spacing: .02em; }
.brand b { color: var(--blue); }
.sub { color: var(--muted); font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.card h2, .card h3 { margin: 0 0 8px; font-size: 17px; }
.kicker { color: var(--blue); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
ol.how { margin: 8px 0 0; padding-left: 20px; }
ol.how li { margin: 4px 0; }

.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 10px 14px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); }
.btn.danger { border-color: var(--red); color: var(--text); }
.btn.big { width: 100%; padding: 14px; font-size: 17px; }
.btn.small { padding: 6px 10px; font-size: 14px; }
.input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.input:focus { outline: 2px solid var(--blue); outline-offset: 0; }
.num { width: 80px; }
label.f { display: block; font-size: 14px; color: var(--muted); margin: 8px 0 4px; }

/* Konto */
.bank { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.bank .count { font-size: 22px; font-weight: 700; }
.bank .count b { color: var(--text); }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-size: 13px; color: var(--muted); }
.pill.live { border-color: var(--green); color: var(--green); }
.pill.warn { border-color: var(--yellow); color: var(--yellow); }

.ticker { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.ticker li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.ticker li:first-child { border-top: 0; }
.ticker .hm { color: var(--muted); min-width: 42px; }
.ticker .k-rain, .ticker .k-finale, .ticker .k-open { color: var(--yellow); font-weight: 600; }

/* Admin */
table.pl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.pl td, table.pl th { padding: 8px 4px; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.pl th { color: var(--muted); font-weight: 600; border-top: 0; }
.linkline { word-break: break-all; font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 80px); background: var(--card); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px); transition: transform .25s ease, visibility 0s .25s; visibility: hidden; z-index: 10; }
#toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .25s ease; }
#toast.err { border-color: var(--red); }


.page.wide { max-width: 980px; }
h3.sec { margin: 20px 0 4px; font-size: 17px; }
.badge { display: inline-block; border-radius: 99px; padding: 4px 12px; font-size: 14px; font-weight: 700; background: var(--tc); color: #FFFFFF; }
.roundbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 4px 0 12px; font-size: 15px; }
.roundbar .pill { margin-left: 6px; }

/* Motive */
.motifs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.motif { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--tc); border-radius: 12px; padding: 10px; min-width: 0; }
.motif.mine { border-color: var(--tc); }
.motif .mname { font-weight: 700; }
.motif .pct { font-size: 16px; }
canvas.mini { width: 48px; height: 48px; flex: none; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 4px; }
canvas.tiny { width: 36px; height: 36px; flex: none; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 3px; }

/* Wand */
.board { position: relative; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); background: #FFFFFF; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.board.tappable { cursor: crosshair; }
.board canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.board .board-lines { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, rgba(8, 18, 31, .10) 1px, transparent 1px), linear-gradient(to bottom, rgba(8, 18, 31, .10) 1px, transparent 1px); background-size: calc(100% / 16) calc(100% / 16); }
.board .board-cursor { position: absolute; display: none; pointer-events: none; box-shadow: inset 0 0 0 2px #FFFFFF, inset 0 0 0 4px var(--blue); }
.board .board-flash { position: absolute; pointer-events: none; border: 3px solid; animation: flash 1.4s ease-out forwards; }
@keyframes flash { from { opacity: 1; transform: scale(2.4); } to { opacity: 0; transform: scale(1); } }
.cellinfo { min-height: 22px; margin: 8px 2px 0; font-size: 14px; color: var(--muted); }

.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 12px 0; }
.sw { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; padding: 0; }
.sw.on { outline: 3px solid var(--text); outline-offset: 2px; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); padding: 6px 0; }
.toggle input { width: 20px; height: 20px; flex: none; accent-color: var(--blue); }
details.rules summary { cursor: pointer; font-weight: 700; }

/* Galerie */
.total .score { font-size: 30px; font-weight: 700; margin: 4px 0; }
.total .winner { margin-top: 8px; font-size: 20px; font-weight: 700; }
.rounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card.round { margin: 0; border-top: 4px solid var(--tc, var(--line)); display: flex; flex-direction: column; gap: 10px; }
.card.round .row { justify-content: space-between; }
.roundimg canvas.result { width: 100%; aspect-ratio: 1; image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 4px; display: block; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vs .side { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 8px; border: 1px solid var(--line); }
.vs .side.won { border-color: var(--text); }

/* Bildschirm */
body.is-screen { overflow: hidden; }
.screen { height: 100vh; display: flex; flex-direction: column; padding: 20px 28px; gap: 12px; }
.screen-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.screen-head .head { margin: 0; gap: 24px; }
.screen-head .brand { font-size: 34px; }
.screen-head .roundbar { font-size: 22px; margin: 0; }
.arena { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 28px; align-items: center; }
.arena .stage { height: 100%; display: flex; align-items: center; justify-content: center; }
.arena .stage .board { height: min(100%, 52vw); width: auto; }
.tside { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.tside .kicker { font-size: 20px; }
.tside canvas.target { width: min(16vw, 220px); height: min(16vw, 220px); image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 6px; box-shadow: 0 0 0 4px var(--tc); }
.tside .mname { font-size: 22px; font-weight: 700; }
.big-num { font-size: 56px; font-weight: 700; line-height: 1; }
.screen-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; height: 120px; overflow: hidden; }
.feed { list-style: none; margin: 0; padding: 0; columns: 2; font-size: 15px; }
.feed li { padding: 2px 0; break-inside: avoid; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; border: 1px solid var(--line); }
.screen.lobby { justify-content: center; }
.lobby-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 1100px; width: 100%; margin: 0 auto; }
.lobby-teams .card { border-top: 6px solid var(--tc); }
.lobby-teams .kicker { font-size: 28px; }
.lobby-teams .members { font-size: 24px; margin-top: 8px; }
.center { text-align: center; font-size: 20px; }
.screen.finale { overflow: auto; }
.screen.finale .rounds { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  body.is-screen { overflow: auto; }
  .screen { height: auto; padding: 16px; }
  .screen-head { flex-direction: column; }
  .arena { grid-template-columns: 1fr; }
  .arena .stage .board { width: 100%; height: auto; }
  .screen-foot, .lobby-teams { grid-template-columns: 1fr; height: auto; }
  .screen.finale .rounds { grid-template-columns: 1fr; }
}

.badge.sm { padding: 1px 8px; font-size: 12px; }
.plist .pl-item { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.plist .pl-item:first-child { border-top: 0; }
.motif { align-items: flex-start; }
.motif .grow { min-width: 0; }
.motif .mname { hyphens: auto; -webkit-hyphens: auto; }
@media (max-width: 420px) { .motif { padding: 8px; gap: 8px; } canvas.mini { width: 40px; height: 40px; } .motif .mname { font-size: 15px; } }

/* Galerie auf dem Fernseher: alles auf einen Blick */
.gallery.big .total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 24px; padding: 12px 18px; margin: 0 0 12px; }
.gallery.big .total .score { margin: 0; }
.gallery.big .total .winner { margin: 0; font-size: 26px; }
.gallery.big .rounds { gap: 12px; }
.gallery.big .card.round { padding: 10px 12px; gap: 6px; }
.gallery.big .roundimg { text-align: center; }
.gallery.big .roundimg canvas.result { width: auto; height: calc((100vh - 480px) / 2); max-width: 100%; margin: 0 auto; }
.gallery.big .vs .side { padding: 4px; }
