:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #050505;
  color: #f5f5f5;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text-muted: rgba(255, 255, 255, 0.6);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
}

body {
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.06), transparent 24%),
    #050505;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  height: 100dvh;
  padding: 16px;
}

.player-card {
  width: min(100%, 1180px);
  height: calc(100dvh - 32px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.player-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.status-pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
}

.status-pill.loading {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.status-pill.live {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.status-pill.error {
  background: rgba(255, 92, 92, 0.18);
  color: #ffd2d2;
}

.video-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: #0a0a0a;
}

.video-shell .plyr {
  width: 100%;
  height: 100%;
}

.video-shell .plyr__video-wrapper {
  width: 100%;
  height: 100%;
  background: #000;
}

.video-shell .plyr video,
.video-shell video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.empty-state h1,
.empty-state p {
  margin: 0;
}

.empty-state h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.empty-state p {
  max-width: 420px;
  color: var(--text-muted);
  line-height: 1.7;
}

.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-actions,
.secondary-actions {
  display: flex;
  gap: 12px;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--surface);
  color: #fff;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.primary-btn {
  background: #ffffff;
  color: #0a0a0a;
  border-color: transparent;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  background: var(--surface-strong);
}

.primary-btn:hover {
  background: #e9e9e9;
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.status-line {
  color: var(--text-muted);
  font-size: 14px;
  min-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advanced-panel {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  flex: 0 0 auto;
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span,
.toggle-row span {
  color: var(--text-muted);
  font-size: 13px;
}

select,
input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 14px;
  color: #fff;
}

input[type="range"] {
  width: 100%;
  accent-color: #fff;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 14px;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .player-card {
    height: calc(100dvh - 24px);
  }

  .video-shell {
    border-radius: 22px;
  }

  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-actions,
  .secondary-actions {
    width: 100%;
  }

  .primary-actions button,
  .secondary-actions button {
    flex: 1;
  }

  .advanced-grid {
    grid-template-columns: 1fr;
  }
}
