:root {
  --bg0: #0f1c18;
  --bg1: #173028;
  --ink: #e8f3ee;
  --muted: #9bb5aa;
  --line: rgba(232, 243, 238, 0.12);
  --accent: #3ecf8e;
  --accent-ink: #062217;
  --danger: #ff7b72;
  --card: rgba(20, 38, 32, 0.72);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "DM Sans", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg0);
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(62, 207, 142, 0.22), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(72, 145, 255, 0.14), transparent 55%),
    linear-gradient(160deg, var(--bg0), var(--bg1) 55%, #0b1411);
  z-index: -1;
}

main {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

header {
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.sub {
  margin: 0.55rem 0 0;
  color: var(--muted);
  max-width: 42rem;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

button, .button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  color: var(--accent-ink);
  background: var(--accent);
}

button.ghost, .button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.status > div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.status .wide { grid-column: 1 / -1; }
.status span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}
.status strong {
  font-size: 1rem;
  word-break: break-word;
}

.toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

#search {
  flex: 1;
  min-width: min(100%, 280px);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  padding: 0.85rem 1.1rem;
  font: inherit;
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.status-filter {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.status-filter:hover {
  color: var(--ink);
  border-color: rgba(255,255,255,0.22);
}

.status-filter.active {
  color: var(--ink);
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.1);
}

.status-filter.online.active {
  color: #b8f5c8;
  border-color: rgba(52, 199, 89, 0.55);
  background: rgba(52, 199, 89, 0.14);
  box-shadow: inset 0 0 0 1px rgba(52, 199, 89, 0.18);
}

.status-filter.offline.active {
  color: #ffc9c9;
  border-color: rgba(255, 69, 58, 0.55);
  background: rgba(255, 69, 58, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 69, 58, 0.18);
}

.status-filter.unknown.active {
  color: #ffe6a8;
  border-color: rgba(255, 204, 0, 0.5);
  background: rgba(255, 204, 0, 0.12);
}

.message {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.message.error { color: var(--danger); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.9rem;
}

.card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0.85rem;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem;
  box-shadow: var(--shadow);
}

.logo-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
}

.logo, .logo-fallback {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
}

.logo[hidden], .logo-fallback[hidden] { display: none; }

.meta { min-width: 0; grid-column: 2; }
.name-row {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.05rem;
  line-height: 1.2;
}

.name {
  margin: 0;
  min-width: 0;
}

.status-dot {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}

.status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
}

.status-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22);
}

.status-dot.unknown {
  background: #6b7280;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.2);
}
.group {
  margin: 0.25rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.url {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.card-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.copy, .play {
  justify-self: start;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.play {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 700;
}

.player-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 12, 9, 0.72);
  backdrop-filter: blur(8px);
}

.player-modal[hidden] {
  display: none;
}

.player-dialog {
  width: min(920px, 100%);
  background: #12241e;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.player-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.1rem 0.7rem;
}

.player-eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.player-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.player-stage {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
}

.player-stage video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}

.player-status {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  margin: 0;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.85rem;
}

.player-status[hidden] {
  display: none;
}

.player-status.error {
  background: rgba(120, 20, 20, 0.85);
}

.player-url {
  margin: 0;
  padding: 0.85rem 1.1rem 1.1rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.empty {
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.origins {
  margin: 0 0 1.1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.03);
}

.origins-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.origins-head h2 {
  margin: 0;
  font-size: 1rem;
}

.origins-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.origins-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.origin-tab-wrap {
  display: inline-flex;
  align-items: stretch;
  gap: 0.25rem;
}

.origin-edit {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 0 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.origin-tab-wrap.active .origin-edit {
  border-color: rgba(6, 34, 23, 0.25);
  background: rgba(255,255,255,0.35);
  color: var(--accent-ink);
}

.origin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.origin-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.origin-tab small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.origin-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

.origin-tab.active small {
  color: rgba(6, 34, 23, 0.72);
}

@media (max-width: 720px) {
  .status { grid-template-columns: 1fr; }
  .status .wide { grid-column: auto; }
}
