:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2430;
  --line: #2a3441;
  --text: #e6edf3;
  --muted: #8b96a5;
  --accent: #3ea6ff;
  --accent-dim: #1c3a54;
  --danger: #f85149;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

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

button,
input,
select {
  font: inherit;
  color: inherit;
}

.topbar {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand span {
  color: var(--accent);
  margin-left: 2px;
}

.search {
  flex: 1;
  min-width: 120px;
}

.search input {
  width: 100%;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
}

.select {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

select {
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

button {
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 8px 12px;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04121f;
  font-weight: 600;
}

button.ghost {
  background: transparent;
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  align-items: start;
}

.sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 92px);
  overflow: auto;
}

.sidebar h2 {
  margin: 14px 0 8px;
}

.sidebar h2:first-child {
  margin-top: 0;
}

.categories,
.mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.categories button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 7px 8px;
  font-size: 14px;
}

.categories button:hover {
  background: var(--panel-2);
}

.categories button[aria-pressed="true"] {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.categories .n {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.mini-list li {
  padding: 6px 2px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}

.mini-list li:last-child {
  border-bottom: 0;
}

.mini-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 2px 0;
  color: var(--text);
}

.mini-list button:hover {
  color: var(--accent);
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.resultbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
  min-height: 30px;
}

.count {
  color: var(--muted);
  font-size: 13px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
}

.chip button {
  border: 0;
  background: transparent;
  padding: 0 2px;
  color: var(--text);
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 96px;
}

.card:hover {
  border-color: var(--accent);
}

.card .title {
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
}

.card .title:hover {
  color: var(--accent);
}

.card .meta {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.live {
  color: #ffb4a6;
  border-color: #6b2f27;
}

.badge.vod {
  color: #a6d8ff;
  border-color: #274b6b;
}

.card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card .fav {
  border: 0;
  background: transparent;
  padding: 0 4px;
  font-size: 16px;
  color: var(--muted);
}

.card .fav[aria-pressed="true"] {
  color: #f0c33c;
}

.progress {
  height: 4px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.player {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

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

.player-head h2 {
  text-transform: none;
  letter-spacing: 0;
  font-size: 17px;
  color: var(--text);
}

.player-actions {
  display: flex;
  gap: 8px;
}

.video-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

video {
  display: block;
  width: 100%;
  max-height: 62vh;
  background: #000;
}

.player-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: rgba(6, 10, 14, 0.72);
  font-size: 14px;
}

.player-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 0;
}

.note {
  color: var(--muted);
  font-size: 13px;
}

.empty {
  color: var(--muted);
  padding: 26px 4px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 12, 0.86);
  z-index: 50;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.login-card input {
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .categories li {
    flex: 0 1 auto;
  }

  .categories button {
    width: auto;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .search {
    order: 3;
    flex-basis: 100%;
  }

  video {
    max-height: 46vh;
  }
}
