:root {
  --green: #349947;
  --teal: #007864;
  --bg: #0f1412;
  --card: #18201d;
  --card2: #1f2925;
  --line: #2b3833;
  --text: #e8efeb;
  --muted: #93a39b;
  --danger: #d64545;
  --warn: #f0b429;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px;
  background: linear-gradient(90deg, var(--teal), var(--green)); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #fff; }
.hdr-controls { display: flex; align-items: center; gap: 8px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; padding-bottom: 96px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
h3 { margin: 0 0 10px; font-size: 16px; }
h4 { margin: 18px 0 8px; font-size: 14px; color: var(--green); text-transform: uppercase; letter-spacing: .05em; }
.muted { color: var(--muted); font-size: 13px; }
.warn { color: var(--warn); }
.hidden { display: none !important; }

/* preview */
.preview { position: sticky; top: 56px; z-index: 5; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; margin-right: 6px; }
.badge.live { background: #b81d1d; color: #fff; }
.badge.live::before { content: "\25CF "; animation: blink 1.2s infinite; }
.badge.preview { background: var(--warn); color: #000; }
@keyframes blink { 50% { opacity: .2; } }
.stage { position: relative; background: #000; border-radius: 8px; padding: 10px; overflow-x: auto;
  border: 6px solid #222; box-shadow: inset 0 0 20px #000; text-align: center; }
#sign { display: inline-block; image-rendering: pixelated; vertical-align: middle; }
.stage-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.preview-foot { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.preview-foot #liveInfo { flex: 1; }
label.inline { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }

/* controls */
input[type=text], input[type=number], input[type=password], input[type=time], select {
  width: 100%; background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit; }
input[type=color] { width: 46px; height: 38px; padding: 2px; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; }
input[type=range] { width: 100%; accent-color: var(--green); }
input[type=checkbox] { accent-color: var(--green); width: 18px; height: 18px; }
button { background: var(--green); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
button:hover { filter: brightness(1.1); }
button.ghost { background: transparent; border: 1px solid var(--green); color: #8fe0a0; }
button.danger { background: var(--danger); }
button.icon { padding: 6px 10px; background: var(--card2); border: 1px solid var(--line); color: var(--text); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.preview-head .btn-row { margin-top: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input[type=text] { flex: 1; min-width: 180px; }
.row select { width: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.grid label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.grid label.wide { grid-column: 1 / -1; }
output { color: var(--text); font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 8px; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 8px 8px 0 0; }
.tabs button.active { color: #fff; background: var(--card); border-color: var(--line); border-bottom-color: var(--card); }

/* lists */
.list .entry { display: grid; gap: 8px; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; align-items: center; }
.list .entry.feed { grid-template-columns: auto 1fr 2fr auto; }
.list .entry.route { grid-template-columns: auto 1fr 2fr 2fr auto; }
.list .entry.msg { grid-template-columns: auto 1fr auto auto auto; }
@media (max-width: 700px) { .list .entry.feed, .list .entry.route, .list .entry.msg { grid-template-columns: 1fr; } }
.playlist { list-style: none; padding: 0; margin: 0; }
.playlist li { display: flex; align-items: center; gap: 10px; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; }
.playlist li .name { flex: 1; font-weight: 600; text-transform: capitalize; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips label { display: flex; gap: 6px; align-items: center; background: var(--card2); border: 1px solid var(--line); padding: 6px 10px; border-radius: 20px; cursor: pointer; }
.results { list-style: none; padding: 0; margin: 8px 0; }
.results li { padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.results li:hover { background: var(--card2); }

/* switch */
.switch { position: relative; width: 46px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #555; border-radius: 26px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: #0b3b2f; }
.switch input:checked + span::before { transform: translateX(20px); }

/* status */
table.status { width: 100%; border-collapse: collapse; }
table.status th, table.status td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ok { color: #6be07f; } .err { color: #ff7070; }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: #22302a; border-top: 2px solid var(--green);
  display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; z-index: 20; flex-wrap: wrap; gap: 8px; }
.savebar .btn-row { margin: 0; }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #000; border: 1px solid var(--green);
  padding: 10px 16px; border-radius: 8px; z-index: 30; }
@media (max-width: 700px) {
  .preview { position: static; }
  main { padding: 10px; }
}

/* Same font the LED sign uses */
@font-face { font-family: "TickerFont"; src: url("fonts/DejaVuSans-Bold.ttf") format("truetype"); font-display: block; }

/* sign online indicator */
.online-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-right: 8px; }
.online { width: 10px; height: 10px; border-radius: 50%; background: #999; display: inline-block; }
.online.on { background: #7CFC7C; box-shadow: 0 0 6px #7CFC7C; }
.online.off { background: #ff6b6b; }
button.light { border-color: #fff; color: #fff; padding: 4px 10px; }
#stage { cursor: zoom-in; }

/* password screen */
.lock { position: fixed; inset: 0; z-index: 50; background: radial-gradient(circle at 30% 20%, #12352a, #0b0f0d 70%);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.lock-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px #0008; }
.lock-card .brand { font-size: 20px; }
.lock-card .brand .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.lock-card a { color: #8fe0a0; }
@media (max-width: 700px) { .online-wrap #onlineText { display: none; } }
.lock-card.loading input, .lock-card.loading button, .lock-card.loading label.inline { opacity: .4; pointer-events: none; }

/* per-league rows on the Sports tab */
.league-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px; margin-bottom: 14px; }
.league-row { display: flex; align-items: center; gap: 10px; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.league-row .league-on { display: flex; align-items: center; gap: 8px; flex: 1; font-weight: 600; cursor: pointer; }
.league-row select { width: auto; padding: 6px 8px; font-size: 13px; }
.league-row select:disabled { opacity: .4; }
.league-row .mini { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
@media (max-width: 420px) { .league-row { flex-wrap: wrap; } .league-row .league-on { flex-basis: 100%; } }
