:root {
  color-scheme: dark;
  --bg: #02030a;
  --panel: #090b14;
  --text: #edf7ff;
  --muted: #89a3bd;
  --cyan: #00eaff;
  --pink: #ff27d8;
  --yellow: #fcff00;
  --ok: #42ffb4;
  --danger: #ff7c9f;
  --line: #15314a;
  --shadow-neon-cyan: 0 0 6px rgba(0, 234, 255, 0.65), 0 0 16px rgba(0, 234, 255, 0.28);
  --shadow-neon-pink: 0 0 6px rgba(255, 39, 216, 0.58), 0 0 16px rgba(255, 39, 216, 0.28);
  --shadow-neon-yellow: 0 0 6px rgba(252, 255, 0, 0.58), 0 0 14px rgba(252, 255, 0, 0.24);
  font-family: "Segoe UI", "Inter", Tahoma, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--bg);
  color: var(--text);
  transition: padding 180ms ease, gap 180ms ease;
}

.ambient-bg {
  display: none;
}

.site-header,
.layout {
  width: min(1600px, 100%);
  margin: 0 auto;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 2px solid var(--cyan);
  background: var(--panel);
  box-shadow: var(--shadow-neon-cyan);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.brand-mark {
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--yellow);
  border: 2px solid var(--pink);
  background: #05070f;
  box-shadow: var(--shadow-neon-pink);
}

.brand-text {
  display: grid;
  gap: 0.06rem;
}

.brand-title {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  color: var(--cyan);
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 0.73rem;
  letter-spacing: 0.09em;
  color: var(--muted);
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.view-controls {
  display: inline-flex;
  border: 1px solid var(--line);
}

.btn {
  min-height: 2rem;
  padding: 0.3rem 0.72rem;
  border: 1px solid var(--cyan);
  background: #050710;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.btn:hover {
  border-color: var(--yellow);
  color: var(--yellow);
  box-shadow: var(--shadow-neon-yellow);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #02030a, 0 0 0 4px var(--yellow);
}

.btn-view {
  border-color: var(--line);
}

.btn-view.active {
  border-color: var(--pink);
  color: var(--pink);
  box-shadow: var(--shadow-neon-pink);
}

.btn-secondary {
  border-color: var(--pink);
  color: var(--pink);
}

.status-badge,
.chat-connection {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.25rem 0.58rem;
  border: 1px solid var(--line);
  background: #050710;
  font-size: 0.71rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.status-connecting,
.chat-connecting {
  color: var(--yellow);
  border-color: var(--yellow);
  box-shadow: var(--shadow-neon-yellow);
}

.status-live,
.chat-live {
  color: var(--ok);
  border-color: var(--ok);
  box-shadow: 0 0 6px rgba(66, 255, 180, 0.62), 0 0 14px rgba(66, 255, 180, 0.24);
}

.status-error,
.chat-error {
  color: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 6px rgba(255, 124, 159, 0.6), 0 0 14px rgba(255, 124, 159, 0.24);
}

.layout {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: minmax(0, 2.2fr) minmax(320px, 1fr);
  align-items: stretch;
  transition: grid-template-columns 220ms ease, gap 220ms ease, min-height 220ms ease;
}

.panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.58rem;
  padding: 0.62rem;
  border: 2px solid var(--pink);
  background: var(--panel);
  box-shadow: var(--shadow-neon-pink);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 220ms ease,
    opacity 220ms ease;
}

.panel.panel-enter {
  animation: panel-enter 220ms ease-out;
}

.stream-panel {
  border-color: var(--cyan);
  box-shadow: var(--shadow-neon-cyan);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel h2 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-shell {
  min-width: 0;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--cyan);
  background: #000;
  overflow: hidden;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.6), var(--shadow-neon-cyan);
  transition: min-height 220ms ease, height 220ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.player-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.chat-shell {
  min-height: clamp(340px, 60vh, 820px);
  border: 2px solid var(--pink);
  overflow: hidden;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.6), var(--shadow-neon-pink);
  background: #000;
  transition: min-height 220ms ease, height 220ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.chat-shell iframe {
  width: 100%;
  height: 100%;
  min-height: inherit;
  border: 0;
}

body[data-view="video"] .layout {
  grid-template-columns: 1fr;
}

body[data-view="video"] .chat-panel {
  display: none;
}

body[data-view="chat"] .layout {
  grid-template-columns: 1fr;
}

body[data-view="chat"] .stream-panel {
  display: none;
}

body[data-view="chat"] .chat-shell {
  min-height: calc(100vh - 160px);
}

body.theatre-mode {
  padding: 0;
  gap: 0;
}

body.theatre-mode .site-header,
body.theatre-mode .layout {
  width: 100%;
  max-width: none;
}

body.theatre-mode .site-header {
  border-left: 0;
  border-right: 0;
  border-top: 0;
  padding: 0.65rem 0.8rem;
}

body.theatre-mode .layout {
  min-height: calc(100vh - 70px);
  gap: 0;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
}

body.theatre-mode[data-view="video"] .layout,
body.theatre-mode[data-view="chat"] .layout {
  grid-template-columns: 1fr;
}

body.theatre-mode .panel {
  border-top: 0;
  border-bottom: 0;
}

body.theatre-mode .stream-panel {
  border-left: 0;
}

body.theatre-mode .chat-panel {
  border-right: 0;
}

body.theatre-mode .player-shell {
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  aspect-ratio: auto;
  min-height: calc(100vh - 132px);
}

body.theatre-mode .chat-shell {
  min-height: 0;
  height: calc(100vh - 152px);
}

body.theatre-mode[data-view="video"] .stream-panel,
body.theatre-mode[data-view="chat"] .chat-panel {
  border-left: 0;
  border-right: 0;
}

body.theatre-mode[data-view="video"] .player-shell,
body.theatre-mode[data-view="chat"] .chat-shell {
  border-left: 0;
  border-right: 0;
  min-height: calc(100vh - 132px);
  height: calc(100vh - 152px);
}

@media (max-width: 1140px) {
  .layout {
    grid-template-columns: 1fr;
  }

  body.theatre-mode .layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  body.theatre-mode .player-shell {
    aspect-ratio: 16 / 9;
    min-height: auto;
  }

  body.theatre-mode .chat-shell {
    height: auto;
    min-height: clamp(280px, 50vh, 540px);
  }
}

@media (max-width: 930px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  body {
    padding: 0.45rem;
    gap: 0.45rem;
  }

  .view-controls {
    flex-wrap: wrap;
  }

  .btn {
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
  }
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

