:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #1a2980;
  color: #fff;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(115deg, #1a2980, #26d0ce);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1rem;
}

h1 {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
}

.panel {
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 15%);
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 15%);
  backdrop-filter: blur(0.35rem);
}

.streams {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stream-panel {
  padding: 0.35rem;
  text-align: center;
}

.stream-panel h2 {
  margin: 0.2rem;
  color: #10205f;
}

.stream {
  display: block;
  width: 100%;
  border-radius: 0.55rem;
  object-fit: cover;
  transition: opacity 150ms ease;
}

.stream:hover {
  opacity: 0.9;
}

.recordings {
  padding: 1.25rem;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.thumbnail-card {
  min-width: 0;
  padding: 0.45rem;
  border-radius: 0.55rem;
  transition: background-color 150ms ease, transform 150ms ease;
}

.thumbnail-card:hover,
.thumbnail-card:focus-visible {
  background: rgb(255 255 255 / 18%);
  transform: translateY(-1px);
  outline: none;
}

.thumbnail-card img {
  display: block;
  width: 100%;
  height: 8rem;
  margin-bottom: 0.45rem;
  border-radius: 0.4rem;
  background: rgb(0 0 0 / 25%);
  object-fit: cover;
}

.thumbnail-card span {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.75rem;
}

.load-more-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.button {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 0.45rem;
  background: #2563eb;
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.button:hover,
.button:focus-visible {
  background: #1d4ed8;
  outline: 2px solid rgb(255 255 255 / 80%);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-muted {
  background: rgb(255 255 255 / 20%);
}

.button-muted:hover,
.button-muted:focus-visible {
  background: rgb(255 255 255 / 30%);
}

.empty-message,
.load-error {
  text-align: center;
}

.load-error {
  min-height: 1.2rem;
  color: #fee2e2;
  font-size: 0.85rem;
}

[hidden] {
  display: none !important;
}

.fullscreen {
  position: relative;
  display: flex;
  width: 100vw;
  height: 100vh;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fullscreen img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.floating-button {
  position: fixed;
  z-index: 2;
  top: 1.25rem;
  left: 1.25rem;
  background: rgb(0 0 0 / 65%);
}

.video-page {
  padding-top: 2rem;
}

.video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.video-header h1 {
  margin: 0;
  text-align: left;
  font-size: 1.35rem;
}

.button-row {
  display: flex;
  gap: 0.65rem;
}

.video-frame {
  overflow: hidden;
  border-radius: 0.75rem;
  background: #000;
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 20%);
}

.video-frame video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 10rem);
}

.video-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin-top: 1.25rem;
  padding: 1rem;
}

.video-info div {
  display: flex;
  gap: 0.65rem;
}

.video-info dt {
  color: rgb(255 255 255 / 75%);
}

.video-info dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.video-info .filename {
  grid-column: 1 / -1;
}

@media (max-width: 1000px) {
  .thumbnail-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 0.75rem 0.35rem;
  }

  .streams {
    grid-template-columns: 1fr;
  }

  .recordings {
    padding: 0.75rem;
  }

  .thumbnail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-header {
    align-items: flex-start;
    padding-inline: 0.4rem;
  }

  .button-row {
    flex-direction: column;
  }

  .video-info {
    grid-template-columns: 1fr;
  }

  .video-info .filename {
    grid-column: auto;
  }
}
