:root {
  color-scheme: dark;
  --bg: #111416;
  --panel: #1a1f22;
  --panel-2: #20272b;
  --text: #f3f0e8;
  --muted: #b7b2a8;
  --line: #343b40;
  --accent: #d8b35d;
  --accent-2: #67c7b8;
  --danger: #e46f62;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.topbar,
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar {
  justify-content: space-between;
  padding: 22px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #15191b;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
}

.topbar p,
.empty-state,
.stream-status,
.search-box span,
.meta {
  color: var(--muted);
}

main {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 32px) 48px;
}

.live-section {
  display: grid;
  gap: 14px;
}

.player-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #050607;
  aspect-ratio: 16 / 9;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  background: #050607;
}

.stream-status {
  position: absolute;
  top: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .stream-status {
    top: 8px;
    left: 8px;
    max-width: calc(100% - 16px);
    padding: 6px 8px;
    font-size: 0.8rem;
  }
}

.stream-status.ok {
  color: var(--accent-2);
}

.stream-status.error {
  color: var(--danger);
}

.stream-status a {
  color: var(--accent-2);
  font-weight: 650;
}

.live-actions,
.section-heading,
.tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.live-actions {
  justify-content: flex-end;
}

button,
.button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 8px 13px;
  background: var(--accent);
  color: #18140b;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  filter: brightness(1.08);
}

.button.ghost,
.tab {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.tab.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.downloads-section {
  margin-top: 32px;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}

h2 {
  font-size: 1.35rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

input {
  min-height: 38px;
  width: min(320px, 58vw);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.thumb {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--panel-2);
  color: var(--muted);
  text-decoration: none;
}

.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-icon {
  font-size: 2rem;
}

.media-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.media-title {
  overflow-wrap: anywhere;
  font-weight: 650;
}

.meta {
  font-size: 0.88rem;
}

.download-link {
  justify-self: start;
  color: var(--accent-2);
  font-weight: 650;
  text-decoration: none;
}

.download-link:hover {
  text-decoration: underline;
}

.empty-state {
  margin-top: 18px;
}

.status-main {
  display: grid;
  gap: 18px;
  max-width: 900px;
}

.status-panel,
.status-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: clamp(18px, 4vw, 28px);
}

.status-panel {
  display: flex;
  align-items: center;
  gap: 18px;
}

.status-indicator {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 8px rgba(183, 178, 168, 0.12);
}

.status-indicator.online {
  background: var(--accent-2);
  box-shadow: 0 0 0 8px rgba(103, 199, 184, 0.16);
}

.status-indicator.offline {
  background: var(--danger);
  box-shadow: 0 0 0 8px rgba(228, 111, 98, 0.16);
}

.status-details {
  display: grid;
  gap: 10px;
}

.status-actions {
  justify-content: flex-start;
}

@media (max-width: 680px) {
  .topbar,
  .top-actions,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .live-actions {
    justify-content: stretch;
  }

  .live-actions > *,
  .topbar .button,
  .status-actions > * {
    text-align: center;
    flex: 1 1 auto;
  }

  input {
    width: 100%;
  }
}
