:root {
  --bg0: #070b14;
  --bg1: #0d1524;
  --panel: rgba(10, 16, 28, 0.82);
  --line: rgba(120, 160, 220, 0.18);
  --text: #e8eef8;
  --muted: #8fa0b8;
  --accent: #2f8cff;
  --accent2: #1ee0a0;
  --focus: #ffcc33;
  --danger: #ff5d6c;
  --hdr: 56px;
  --radius: 10px;
  --font: "Segoe UI", "Trebuchet MS", "Ubuntu", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
}

/* ——— Login (Android wallpaper + logo) ——— */
.login-page { min-height: 100%; display: grid; place-items: center; position: relative; overflow: hidden; }
.login-bg {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6,10,22,.35), rgba(6,10,22,.62) 55%, rgba(6,10,22,.78)),
    url("/assets/img/android/ui/bg_app_wallpaper.jpg") center / cover no-repeat;
  transform: scale(1.02);
  filter: saturate(1.15) contrast(1.05);
}
.login-shell {
  position: relative; z-index: 1;
  width: min(420px, 92vw);
  display: flex; flex-direction: column; align-items: center; gap: 1.25rem;
  animation: rise .55s ease both;
}
.login-logo { width: min(280px, 70vw); height: auto; filter: drop-shadow(0 8px 24px rgba(0,0,0,.45)); }
.login-panel {
  width: 100%;
  background: rgba(18, 10, 36, 0.88);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.4rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.login-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tab {
  flex: 1; border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: .65rem; border-radius: 999px; cursor: pointer; font-weight: 600;
}
.tab.active { color: #041018; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-color: transparent; }
.field-group label { display: block; font-size: .8rem; color: var(--muted); margin: .55rem 0 .3rem; }
.field-group input {
  width: 100%; padding: .8rem .9rem; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--text); font-size: 1rem;
}
.field-group input:focus { outline: 2px solid var(--focus); border-color: transparent; }
.hidden { display: none !important; }
.btn-primary {
  width: 100%; margin-top: 1rem; padding: .85rem 1rem; border: 0; border-radius: 10px;
  background: linear-gradient(90deg, var(--accent), #4aa3ff); color: #fff; font-weight: 700;
  cursor: pointer; font-size: 1rem;
}
.btn-primary:disabled { opacity: .55; cursor: wait; }
.login-msg { margin: .75rem 0 0; color: var(--danger); font-size: .9rem; }
.login-msg.ok { color: var(--accent2); }
.login-hint { margin: 1rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.4; text-align: center; }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* ——— App shell (Android 3-col live) ——— */
.app-page { min-height: 100%; display: flex; flex-direction: column; background:
  linear-gradient(180deg, #0a1220 0%, #070b14 40%, #05070d 100%); }

.app-header {
  height: var(--hdr);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(8,12,22,.92);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-weight: 800; letter-spacing: .04em; font-size: 1.05rem;
  background: linear-gradient(90deg, #fff, #9ec9ff); -webkit-background-clip: text; color: transparent;
}
.hdr-nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
.hdr-item {
  display: flex; align-items: center; gap: .4rem;
  background: transparent; border: 0; color: var(--muted);
  padding: .45rem .7rem; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.hdr-item img { width: 22px; height: 22px; object-fit: contain; }
.hdr-item.active, .hdr-item:focus-visible {
  color: var(--text); background: rgba(47,140,255,.18); outline: none;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.hdr-item:disabled { opacity: .35; cursor: not-allowed; }
.hdr-user { color: var(--muted); font-size: .85rem; }

.live-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 15% 26% 1fr;
  min-height: calc(100vh - var(--hdr));
  gap: 0;
}

.col-cats, .col-channels, .col-preview {
  border-right: 1px solid var(--line);
  min-height: 0;
  display: flex; flex-direction: column;
}
.col-preview { border-right: 0; padding: .75rem; }
.col-title { padding: .75rem .9rem .4rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.col-title-row { display: flex; align-items: center; gap: .5rem; padding-right: .5rem; }
.channel-filter {
  flex: 1; margin: .5rem .5rem .25rem 0; padding: .4rem .55rem;
  border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--text);
}

.cat-list, .channel-list {
  list-style: none; margin: 0; padding: .25rem 0 1rem;
  overflow: auto; flex: 1;
}
.cat-list li, .channel-list li {
  padding: .65rem .9rem; cursor: pointer; border-left: 3px solid transparent;
  color: var(--text); font-size: .92rem;
}
.cat-list li:hover, .channel-list li:hover { background: rgba(255,255,255,.04); }
.cat-list li.active, .channel-list li.active {
  background: rgba(47,140,255,.14);
  border-left-color: var(--accent);
}
.channel-list li {
  display: flex; align-items: center; gap: .65rem;
}
.channel-list img {
  width: 36px; height: 36px; object-fit: contain; border-radius: 6px; background: rgba(0,0,0,.25);
}
.channel-list .meta { min-width: 0; }
.channel-list .meta .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
#player { width: 100%; height: 100%; background: #000; }
.player-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); pointer-events: none; background: rgba(0,0,0,.35);
}
.player-overlay.hide { display: none; }
.now-playing { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .75rem; }
.now-name { font-size: 1.05rem; font-weight: 700; }
.now-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  padding: .5rem .75rem; border-radius: 8px; cursor: pointer;
}
.msx-box {
  margin-top: .75rem; padding: .85rem; border: 1px dashed var(--line); border-radius: 10px;
  display: grid; gap: .5rem;
}
.msx-box input {
  width: 100%; padding: .55rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--text);
}

.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: rgba(20,28,44,.95); border: 1px solid var(--line);
  padding: .7rem 1rem; border-radius: 999px; z-index: 50;
}

@media (max-width: 960px) {
  .live-layout { grid-template-columns: 1fr; }
  .col-cats { max-height: 160px; border-right: 0; border-bottom: 1px solid var(--line); }
  .col-channels { max-height: 280px; border-right: 0; border-bottom: 1px solid var(--line); }
  .cat-list, .channel-list { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .cat-list li, .channel-list li { flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent; }
  .cat-list li.active, .channel-list li.active { border-bottom-color: var(--accent); }
}
