:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d1016;
  color: #e8edf5;
  --surface: #141922;
  --frame: #0a0d12;
  --border: #262e3b;
  --muted: #a1aec0;
  --blue: #86b5fc;
  --green: #66d5ad;
  --amber: #efbd76;
  --red: #ee929a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button { color: inherit; font: inherit; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.top {
  background: #11161e;
  border-bottom: 1px solid var(--border);
}

.top-inner,
.layout {
  width: min(100%, 1584px);
  padding-inline: clamp(16px, 4vw, 48px);
  margin-inline: auto;
}

.top-inner {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  min-height: 61px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 14px;
}

.top-actions .logout-button { padding: 6px 10px; }

.room {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .01em;
}

.room-icon {
  position: relative;
  display: inline-block;
  flex: none;
  width: 24px;
  height: 17px;
  border: 1.5px solid var(--blue);
  border-radius: 3px;
  color: var(--blue);
  background: #1a293f;
}

.room-icon::after {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: -5px;
  height: 1.5px;
  background: currentColor;
  content: "";
}

.connection,
.state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

[data-state="live"] { color: var(--green); }
[data-state="pending"],
[data-state="stale"],
[data-state="sleep"] { color: var(--amber); }
[data-state="lost"] { color: var(--red); }

.layout { padding-block: 28px 48px; }
h1,
h2 { margin: 0; line-height: 1.16; }
h1 { font-size: clamp(25px, 3vw, 42px); letter-spacing: -.032em; }

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(100%, 380px);
  padding: clamp(20px, 6vw, 32px);
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 20px 64px rgb(0 0 0 / .28);
}

.login-card h1 {
  margin: 24px 0 20px;
  font-size: 29px;
}

.login-form,
.login-form label { display: grid; }

.login-form { gap: 15px; }

.login-form label {
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

.login-form input {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--frame);
  color: #e8edf5;
  font: inherit;
  font-size: 16px;
}

.login-form input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.login-form .command-button {
  min-height: 42px;
  margin-top: 2px;
}

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

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

.command-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.command-button {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #1a212d;
  color: #dde5f0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.primary-command { border-color: #375477; background: #20334d; color: #e0edff; }
.command-button:hover:not([aria-disabled="true"]) { background: #273345; }
.primary-command:hover:not([aria-disabled="true"]) { background: #2b4466; }
.command-button[aria-disabled="true"] { cursor: default; opacity: .62; }
.command-button[aria-busy="true"] { cursor: progress; }

.command-status {
  margin: -9px 0 15px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.command-status:empty { margin: 0; }
.command-status[data-state="lost"] { color: var(--red); }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-block: 20px 22px;
}

.filters {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.filters button {
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
}

.filters button:hover { background: #171e29; color: #edf1f8; }
.filters button[aria-pressed="true"] {
  background: #19283d;
  border-color: #2b4569;
  color: #e0edff;
}

.filters button span {
  margin-left: 5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.updated {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 13px;
}

.card {
  display: block;
  position: relative;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
}

.card:hover { border-color: #54759c; }
.card:focus-visible { outline-offset: 1px; }

.frame {
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--frame);
}

.card-frame { aspect-ratio: 16 / 9; }
.frame img {
  position: absolute;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-frame[data-state="sleep"] img,
.card-frame[data-state="stale"] img { opacity: .62; }

.frame-message {
  max-width: 90%;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgb(11 15 23 / .9);
  color: #acb8c8;
  font-size: 13px;
  text-align: center;
}

.frame-message:empty { display: none; }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 43px;
  padding: 8px 11px;
  border-top: 1px solid var(--border);
}

.card-indicators { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.locked-label {
  padding: 2px 5px;
  border: 1px solid #56432e;
  border-radius: 5px;
  color: var(--amber);
  font-size: 11px;
}

.card-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .025em;
  font-variant-numeric: tabular-nums;
}

.empty {
  margin: 0;
  padding: 38px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}

.detail {
  width: min(1260px, calc(100% - 34px));
  max-width: none;
  max-height: calc(100dvh - 34px);
  margin: auto;
  padding: 0;
  border: 1px solid #38455a;
  border-radius: 13px;
  background: var(--surface);
  color: inherit;
  box-shadow: 0 18px 60px rgb(0 0 0 / .45);
}

.detail::backdrop { background: rgb(5 7 11 / .78); }

.detail-header,
.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
}

.detail-header { border-bottom: 1px solid var(--border); }
.detail h2 { font-size: 21px; font-variant-numeric: tabular-nums; }
.detail-status { margin: 4px 0 0; font-size: 13px; }
.detail-controls { padding: 9px 16px; border-bottom: 1px solid var(--border); }
.detail-controls .command-status:not(:empty) { margin: 7px 0 0; }
.detail-footer {
  min-height: 42px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.detail-frame { height: min(66vw, calc(100dvh - 205px)); min-height: 120px; }
.detail-frame .frame-message { font-size: 15px; }
.detail-frame:not([data-state="lost"]) img:not([hidden]) + .frame-message { display: none; }

.close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #1a212d;
  color: #dbe3ee;
  cursor: pointer;
  font-size: 27px;
  line-height: 1;
}

.close:hover { background: #293546; }

@media (max-width: 560px) {
  .top-inner { min-height: 55px; padding-block: 8px; }
  .room { font-size: 14px; gap: 8px; }
  .layout { padding-block-start: 22px; }
  .toolbar { margin-block: 16px; }
  .filters { gap: 4px; }
  .filters button { padding: 7px 8px; }
  .command-button { padding: 8px 9px; }
  .detail { width: calc(100% - 20px); }
}
