:root {
  --bg: #08080f;
  --bg-2: #0f0f1a;
  --panel: #141422;
  --panel-2: #1b1b2e;
  --text: #f5f3ff;
  --muted: #9b97b5;
  --line: #26263c;
  --accent: #ff2d78;
  --accent-2: #a855f7;
  --accent-soft: rgba(255, 45, 120, 0.16);
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(255, 45, 120, 0.18), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(168, 85, 247, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button, input, select { font: inherit; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  background: rgba(8, 8, 15, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 190px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(255, 45, 120, 0.35);
}

.brand h1 { margin: 0; font-size: 18px; letter-spacing: 0.4px; }
.brand h1 span { color: var(--accent); }
.brand p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); }

.searchbox {
  position: relative;
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  max-width: 640px;
}

.searchbox input {
  width: 100%;
  padding: 12px 42px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.searchbox input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-icon {
  position: absolute;
  left: 15px;
  font-size: 18px;
  color: var(--muted);
  pointer-events: none;
}

.icon-btn {
  position: absolute;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.sort { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }

select {
  padding: 9px 30px 9px 11px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  cursor: pointer;
}
select:focus { border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--panel-2); border-color: #3a3a58; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }
.btn.icon-only { padding: 10px 12px; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.pill {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
}

/* --------------------------------------------------------------- filters */

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

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.filter-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-grid select { width: 100%; text-transform: none; letter-spacing: 0; }

.filter-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

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

/* ------------------------------------------------------------------ main */

.wrap { max-width: 1440px; margin: 0 auto; padding: 18px 22px 60px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips:empty { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 45, 120, 0.35);
  border-radius: 999px;
}
.chip button {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.chip button:hover { color: var(--text); }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

.status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}
.status.loading .dot { background: var(--accent); animation: pulse 1s infinite; }
.status.error .dot { background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }

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

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

/* ------------------------------------------------------------------ card */

.card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.card:hover, .card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(255, 45, 120, 0.6);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  outline: none;
}

.thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #1c1c30, #26263f);
  overflow: hidden;
}

.thumb img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s;
}
.card:hover .thumb img { transform: scale(1.05); }

.thumb .fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 44px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, #23233a, #171726);
}

.badge {
  position: absolute;
  z-index: 2;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-radius: 6px;
  backdrop-filter: blur(6px);
}

.badge.live {
  top: 10px;
  left: 10px;
  color: #fff;
  background: rgba(255, 45, 120, 0.92);
}

.badge.viewers {
  right: 10px;
  bottom: 10px;
  color: #fff;
  background: rgba(5, 5, 10, 0.65);
}

.badge.game {
  left: 10px;
  bottom: 10px;
  color: #ddd;
  background: rgba(5, 5, 10, 0.65);
  max-width: calc(100% - 90px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card .play-hint {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, 0.55));
  transition: opacity 0.16s;
}
.card:hover .play-hint, .card:focus-visible .play-hint { opacity: 1; }

.play-hint span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding-left: 4px;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(255, 45, 120, 0.5);
}

.card-meta { display: flex; gap: 10px; padding: 11px 12px 13px; }

.avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.card-meta h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* skeleton */
.skeleton .thumb, .skeleton .line {
  background: linear-gradient(90deg, #171728 25%, #222238 50%, #171728 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
.skeleton .line { height: 10px; margin: 8px 12px; border-radius: 6px; }
.skeleton .line.short { width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ----------------------------------------------------------------- empty */

.empty { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 54px; }
.empty h2 { margin: 12px 0 4px; color: var(--text); font-size: 20px; }
.empty p { margin: 0; }

.more-wrap { display: flex; justify-content: center; margin-top: 26px; }

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 3, 7, 0.82);
  backdrop-filter: blur(6px);
}

.modal[hidden] { display: none; }

.modal-card {
  position: relative;
  width: min(1060px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.modal-close:hover { background: rgba(0, 0, 0, 0.75); }

.video-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-shell video { width: 100%; height: 100%; display: block; background: #000; }

.video-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: #cfcbe6;
  background: radial-gradient(circle at center, rgba(30, 30, 50, 0.5), #000);
  font-size: 14px;
  pointer-events: none;
}
.video-msg[hidden] { display: none; }

.player-body { padding: 18px 20px 22px; }

.player-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
}
.player-head h2 { margin: 0; font-size: 20px; }
.muted { color: var(--muted); margin: 3px 0 0; font-size: 12.5px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.tag {
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag.hot { color: #ffd0e0; background: var(--accent-soft); border-color: rgba(255, 45, 120, 0.4); }
.tag.vip { color: #ffe6b0; background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); }
.tag.ok { color: #b9f6ca; background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); }

.warning {
  margin: 15px 0 0;
  padding: 11px 13px;
  font-size: 12.5px;
  color: #ffe0a8;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 10px;
}

.player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
}
.player-controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
}

.url {
  margin: 12px 0 0;
  padding: 9px 11px;
  font: 11.5px/1.4 ui-monospace, "SFMono-Regular", Menlo, monospace;
  color: #b9b4d6;
  background: #0c0c16;
  border: 1px solid var(--line);
  border-radius: 9px;
  word-break: break-all;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  transform: translateX(-50%);
  padding: 10px 16px;
  font-size: 13px;
  background: #1d1d30;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 780px) {
  .topbar { padding: 12px 14px; gap: 10px; }
  .brand p { display: none; }
  .brand { min-width: 0; }
  .searchbox { order: 3; flex-basis: 100%; max-width: none; }
  .top-actions { margin-left: auto; }
  .filters { margin: 12px 14px 0; }
  .wrap { padding: 14px 14px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; border-radius: 0; width: 100%; }
  .modal-card { min-height: 100vh; }
  .video-shell { aspect-ratio: auto; height: min(66vh, 640px); }
  .player-head { flex-direction: column; }
  .badges { justify-content: flex-start; }
}
