:root {
  --bg: #040711;
  --glass: linear-gradient(155deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  --glass-solid: rgba(12, 18, 34, 0.78);
  --stroke: rgba(255, 255, 255, 0.11);
  --stroke-hi: rgba(255, 255, 255, 0.22);
  --cyan: #38bdf8;
  --indigo: #818cf8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --text: #f8fafc;
  --muted: #94a3b8;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  padding: 14px 14px 104px;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.ambient::before,
.ambient::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
}

.ambient::before {
  width: 340px;
  height: 340px;
  top: -110px;
  right: -80px;
  background: radial-gradient(circle, var(--cyan), transparent 70%);
}

.ambient::after {
  width: 360px;
  height: 360px;
  bottom: -120px;
  left: -90px;
  background: radial-gradient(circle, var(--indigo), transparent 70%);
}

.shell {
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: 0.4px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--cyan), var(--indigo));
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.35);
}

.brand-mark svg {
  width: 16px;
  height: 16px;
  fill: #04101d;
}

.top-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  direction: ltr;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.live {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse 1.8s infinite;
}

.dot.buffering,
.dot.reconnecting {
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  border: 1px solid var(--stroke);
  border-radius: 24px;
  padding: 16px;
  box-shadow: inset 0 1px 0 var(--stroke-hi), 0 18px 40px rgba(0, 0, 0, 0.38);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.panel-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text);
}

.player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #02050d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 14px;
}

.player-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stage-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(8, 13, 28, 0.45), rgba(4, 7, 17, 0.82));
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  transition: opacity 0.25s var(--ease);
}

.stage-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.orb-play {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, var(--cyan), var(--indigo));
  color: #04101d;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(56, 189, 248, 0.42);
  transition: transform 0.18s var(--ease);
}

.orb-play:active { transform: scale(0.92); }
.orb-play svg { width: 24px; height: 24px; fill: currentColor; }

.overlay-name {
  font-weight: 700;
  font-size: 0.96rem;
}

.overlay-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.metrics {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr;
  gap: 8px;
  margin-bottom: 12px;
}

.metric {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 15px;
  padding: 10px;
  min-width: 0;
}

.metric span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 3px;
}

.metric strong {
  display: block;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meter {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 6px;
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 0.35s var(--ease);
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.action-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

button {
  border: none;
  border-radius: 15px;
  padding: 11px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform 0.16s var(--ease), background 0.18s ease, opacity 0.18s ease;
}

button:active { transform: scale(0.95); }
button svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn-cyan {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #031524;
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.28);
}

.btn-indigo {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  color: #fff;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.28);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--stroke);
  color: var(--text);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.14);
  border: 1px solid rgba(251, 113, 133, 0.28);
  color: #fda4af;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
}

.share-bar {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.09);
  border: 1px solid rgba(56, 189, 248, 0.26);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.share-bar.show { display: flex; }

.share-link {
  flex: 1;
  min-width: 0;
  font-size: 0.76rem;
  color: var(--cyan);
  direction: ltr;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.h-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 6px;
  scrollbar-width: none;
}

.h-scroll::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--stroke);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--text);
}

.chip-fav {
  background: rgba(250, 204, 21, 0.1);
  border-color: rgba(250, 204, 21, 0.28);
  color: var(--text);
}

.search-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.input {
  width: 100%;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--stroke);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 15px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.input:focus {
  border-color: var(--cyan);
  background: rgba(0, 0, 0, 0.48);
}

.input-ltr { direction: ltr; text-align: left; }

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 430px;
  overflow-y: auto;
}

.row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.row-card.active {
  border-color: rgba(56, 189, 248, 0.48);
  background: rgba(56, 189, 248, 0.1);
}

.row-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.row-title {
  font-weight: 700;
  font-size: 0.89rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  font-size: 0.73rem;
  color: var(--muted);
  direction: ltr;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.row-acts {
  display: flex;
  align-items: center;
  gap: 6px;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 5px;
  padding: 5px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--stroke);
  margin-bottom: 12px;
}

.seg-btn {
  background: transparent;
  color: var(--muted);
  padding: 9px 6px;
  border-radius: 12px;
  font-size: 0.82rem;
}

.seg-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: var(--cyan);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.health-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.logs {
  background: rgba(2, 6, 18, 0.75);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 12px;
  height: 155px;
  overflow-y: auto;
  direction: ltr;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.73rem;
  line-height: 1.55;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

.tab { display: none; }
.tab.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise 0.24s var(--ease);
}

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

.dock {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 560px;
  padding: 6px;
  border-radius: 26px;
  background: rgba(11, 17, 32, 0.78);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 18px 44px rgba(0, 0, 0, 0.6);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 50;
}

.dock-btn {
  background: transparent;
  color: var(--muted);
  border-radius: 20px;
  padding: 9px 4px;
  flex-direction: column;
  gap: 4px;
  font-size: 0.71rem;
  font-weight: 700;
}

.dock-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s var(--ease);
}

.dock-btn.active {
  background: linear-gradient(155deg, rgba(56, 189, 248, 0.22), rgba(129, 140, 248, 0.16));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.dock-btn.active svg {
  color: var(--cyan);
  transform: translateY(-1px) scale(1.06);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 14, 0.65);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  z-index: 80;
}

.sheet-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 105%);
  width: 100%;
  max-width: 580px;
  background: rgba(11, 17, 32, 0.94);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--stroke-hi);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 12px 18px 26px;
  transition: transform 0.3s var(--ease);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet.show { transform: translate(-50%, 0); }

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.24);
  margin: 0 auto 6px;
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: radial-gradient(circle at 50% 10%, rgba(56, 189, 248, 0.16), #040711 60%);
  backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.28s ease;
}

.lock-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.lock-box {
  width: 100%;
  max-width: 310px;
  text-align: center;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 22px 0 12px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  transition: all 0.16s var(--ease);
}

.pin-dot.filled {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.7);
  transform: scale(1.1);
}

.pin-err {
  min-height: 18px;
  font-size: 0.78rem;
  color: var(--red);
  margin-bottom: 12px;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  direction: ltr;
}

.pad-key {
  height: 60px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 700;
}

.pad-key:active {
  background: rgba(56, 189, 248, 0.24);
  border-color: var(--cyan);
}

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -24px);
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.24s var(--ease);
  z-index: 150;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

select.mini-sel {
  width: 100%;
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--stroke);
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  outline: none;
}

select.mini-sel option { background: #0b1120; color: var(--text); }
