@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;700;800&family=Manrope:wght@400;600;700&display=swap');

:root {
  --bg-logo-navy: #020557;
  --bg-logo-blue: #001896;
  --bg-energy-blue: #002dec;
  --bg-logo-red: #ff0000;
  --bg-postbox-red: #d60033;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.97);
  --ink: #091041;
  --ink-muted: #31406e;
  --border-soft: rgba(2, 5, 87, 0.14);
  --ring: rgba(0, 45, 236, 0.35);
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-card: 0 14px 38px rgba(2, 5, 87, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Manrope', sans-serif;
  background: linear-gradient(145deg, #001896 0%, #002dec 42%, #d60033 100%);
  background-image: linear-gradient(145deg, rgba(2, 5, 87, 0.18), rgba(2, 5, 87, 0.05)), url('./background-image.png');
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--ink);
}

.container {
  width: min(1600px, 100% - 2rem);
  margin: 0 auto;
  padding: 24px 0 28px;
}

#header {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-card);
  padding: 18px 22px 20px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
  animation: riseIn 420ms ease-out both;
}

.brand-strip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 6px;
}

.brand-logo {
  width: clamp(78px, 8vw, 120px);
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(2, 5, 87, 0.18));
}

#header h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.2rem, 1.6vw + 0.8rem, 2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--bg-logo-navy);
  text-align: center;
}

#button-pane {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
  animation: riseIn 520ms ease-out both;
}

.buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.video-button {
  padding: 0;
  border: 2px solid rgba(0, 24, 150, 0.3);
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(2, 5, 87, 0.12);
}

.video-button:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 45, 236, 0.46);
  box-shadow: 0 14px 28px rgba(2, 5, 87, 0.2);
}

.video-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.video-button.toggle-all {
  background: linear-gradient(125deg, #001896, #002dec);
  border-color: #001896;
  color: #fff;
  min-height: 100%;
}

.video-button.toggle-all:hover {
  border-color: #020557;
}

.video-button.active-btn {
  border-color: #d60033;
  box-shadow: 0 0 0 3px rgba(214, 0, 51, 0.2), 0 18px 30px rgba(2, 5, 87, 0.22);
}

.video-button img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.video-button-label {
  padding: 8px 10px;
  background: linear-gradient(0deg, #eef2ff, #ffffff);
  border-top: 1px solid rgba(2, 5, 87, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#video-pane {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.video-container {
  background: var(--surface-strong);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  width: 0;
  opacity: 0;
  display: none;
  box-shadow: var(--shadow-card);
  position: relative;
  animation: streamOut 0.35s ease-out forwards;
}

.video-container.active {
  width: 360px;
  opacity: 1;
  display: block;
  animation: streamIn 0.36s ease-out forwards;
}

.video-container.scale-720 {
  width: 720px;
  display: block;
}

.video-wrapper {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  display: block;
}

.video-info {
  padding: 11px 38px 10px 12px;
  background: linear-gradient(180deg, #ffffff, #f5f7ff);
  border-top: 1px solid rgba(2, 5, 87, 0.08);
  font-size: 12px;
  min-height: 67px;
}

.video-info-row {
  margin: 3px 0;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.video-info-row strong {
  color: var(--ink);
  font-weight: 700;
}

.video-info-row img {
  height: 20px;
  vertical-align: middle;
}

.reload-button {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 24, 150, 0.2);
  color: var(--bg-logo-blue);
  border-radius: 999px;
  font-size: 15px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  transition: transform 240ms ease, color 180ms ease, background 180ms ease;
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 10;
}

.reload-button:hover {
  transform: rotate(180deg);
  color: #fff;
  background: var(--bg-logo-blue);
}

.error-message,
.loading {
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  margin-top: 12px;
  text-align: center;
  animation: riseIn 420ms ease-out both;
}

.error-message {
  padding: 34px 20px;
  color: var(--bg-postbox-red);
  font-size: 17px;
  font-family: 'Sora', sans-serif;
}

.loading {
  padding: 36px 20px;
}

.spinner {
  border: 4px solid #e4e9ff;
  border-top: 4px solid #001896;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 900ms linear infinite;
  margin: 0 auto 14px;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes streamIn {
  from {
    width: 0;
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    width: 360px;
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes streamOut {
  from {
    width: 360px;
    opacity: 1;
  }
  to {
    width: 0;
    opacity: 0;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (max-width: 1024px) {
  body {
    background-attachment: scroll;
  }

  .video-container.scale-720 {
    width: 360px !important;
  }
}

@media (max-width: 768px) {
  .container {
    width: calc(100% - 1rem);
    padding-top: 12px;
  }

  #header {
    padding: 14px 14px 16px;
  }

  .brand-strip {
    justify-content: flex-start;
    margin-bottom: 6px;
  }

  .brand-logo {
    width: clamp(70px, 19vw, 92px);
  }

  .buttons-grid {
    grid-template-columns: repeat(auto-fit, minmax(114px, 1fr));
    gap: 9px;
  }

  .video-container,
  .video-container.active,
  .video-container.scale-720 {
    width: 100% !important;
  }

  .video-button-label {
    font-size: 11px;
    letter-spacing: 0.04em;
  }
}
