:root {
  --navy: #0b1e3f;
  --navy-2: #071630;
  --bg: #030812;
  --card: #0e1d38;
  --card-2: #12254a;
  --green: #18e0a0;
  --red: #ff5468;
  --text: #eaf2ff;
  --muted: #8aa0c4;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 60% at 50% 0%, var(--navy) 0%, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.screen { min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--red); min-height: 18px; font-size: 14px; }

/* login */
#login { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; text-align: center; }
.logo { font-size: 64px; }
.login-card h1 { margin: 8px 0 2px; font-size: 24px; }
.login-card input {
  width: 100%; margin: 20px 0 12px; padding: 16px; font-size: 16px;
  background: var(--card); border: 1px solid var(--card-2); border-radius: 12px; color: var(--text);
}

/* header */
header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; background: rgba(7,22,48,.9); backdrop-filter: blur(8px);
}
.brand { font-weight: 700; font-size: 18px; }

/* tabs / layout */
.tab { padding: 16px 16px 100px; max-width: 640px; margin: 0 auto; }

/* cards */
.card { background: var(--card); border: 1px solid var(--card-2); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.status-card .status-row { display: flex; justify-content: space-between; align-items: flex-start; }
.state { font-size: 26px; font-weight: 800; }
.badge { background: var(--card-2); padding: 6px 10px; border-radius: 20px; font-size: 12px; }
.badge.ok { color: var(--green); }
.badge.no { color: var(--red); }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.stat { background: var(--navy-2); border-radius: 12px; padding: 12px 6px; text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 11px; color: var(--muted); }

.times { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.times b { color: var(--text); }

/* dot indicator */
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 12px var(--green); animation: pulse 1.6s infinite; }
.dot.off { background: #47506a; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* buttons */
.controls { display: flex; gap: 12px; margin-bottom: 12px; }
.btn { flex: 1; padding: 16px; font-size: 16px; font-weight: 700; border: none; border-radius: 14px; color: #fff; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.start { background: linear-gradient(135deg, var(--green), #12b07e); color: #04231a; }
.btn.stop { background: linear-gradient(135deg, var(--red), #c8384b); }
.btn.primary { background: linear-gradient(135deg, #2f7bff, #1c53c0); }
.btn.ghost { width: 100%; background: transparent; border: 1px solid var(--card-2); color: var(--text); }

/* logs */
.logs { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px; line-height: 1.5; max-height: 70vh; overflow: auto; margin: 0; }

/* config */
#config { width: 100%; height: 62vh; background: var(--card); color: var(--text); border: 1px solid var(--card-2); border-radius: 12px; padding: 14px; font-family: ui-monospace, monospace; font-size: 13px; line-height: 1.5; }

/* videos */
.videos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.vcard { background: var(--card); border: 1px solid var(--card-2); border-radius: 12px; overflow: hidden; }
.vcard img { width: 100%; aspect-ratio: 9/16; object-fit: cover; background: var(--navy-2); display: block; }
.vcard .meta { padding: 8px 10px; font-size: 12px; }
.vcard a { color: var(--green); text-decoration: none; }

/* bottom nav */
.bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  display: flex; background: rgba(7,22,48,.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--card-2); padding-bottom: env(safe-area-inset-bottom);
}
.navbtn { flex: 1; background: none; border: none; color: var(--muted); font-size: 20px; padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.navbtn span { font-size: 11px; }
.navbtn.active { color: var(--green); }
