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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #101214;
}

.panel {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid #2d353a;
  border-radius: 8px;
  background: #171b1f;
}

h1 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

p {
  color: #b9c3c9;
}

.primary,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #2eb67d;
  color: #06100b;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.watch-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  background: #0f1113;
  transition: grid-template-columns 180ms ease;
}

.player-area {
  position: relative;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #050607;
}

video {
  width: 100%;
  max-height: calc(100vh - 32px);
  background: #000;
  aspect-ratio: 16 / 9;
}

.side {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100vh;
  border-left: 1px solid #2a3035;
  background: #15191d;
  min-width: 0;
}

.side header {
  padding: 18px;
  border-bottom: 1px solid #2a3035;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.side header h1 {
  font-size: 20px;
  margin-bottom: 6px;
}

.viewer-count {
  color: #8fd8b7;
  font-weight: 700;
}

.chat-toggle {
  min-height: 34px;
  padding: 0 12px;
  background: #263038;
  color: #e7eef2;
  white-space: nowrap;
}

.chat-handle {
  position: absolute;
  top: 50%;
  left: -18px;
  z-index: 3;
  width: 18px;
  height: 88px;
  min-height: 88px;
  padding: 0;
  border-radius: 8px 0 0 8px;
  background: #2eb67d;
  box-shadow: 0 0 18px rgba(46, 182, 125, 0.28);
  transform: translateY(-50%);
  cursor: ew-resize;
  display: none;
}

.chat-handle::before {
  content: "";
  width: 4px;
  height: 42px;
  border-radius: 999px;
  background: rgba(6, 16, 11, 0.72);
}

.chat-collapsed {
  grid-template-columns: minmax(0, 1fr) 44px;
}

.chat-collapsed .side {
  grid-template-rows: auto;
  min-height: 0;
}

.chat-collapsed .side header {
  display: none;
}

.chat-collapsed .messages,
.chat-collapsed .chat-form {
  display: none;
}

.chat-collapsed .chat-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.messages {
  overflow-y: auto;
  padding: 14px;
}

.message {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid #242b30;
}

.message b {
  color: #8fd8b7;
}

.message span {
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid #2a3035;
}

input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid #354047;
  border-radius: 6px;
  padding: 0 12px;
  background: #0f1215;
  color: #f4f7f8;
}

.revoked-state {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: #101214;
}

.hidden {
  display: none;
}

@media (max-width: 820px) {
  .watch-shell {
    grid-template-columns: 1fr;
  }

  .side {
    min-height: 420px;
    border-left: 0;
    border-top: 1px solid #2a3035;
  }

  .chat-collapsed .side {
    min-height: 44px;
  }

  .chat-collapsed {
    grid-template-columns: 1fr;
  }

  .chat-collapsed .chat-handle {
    top: -18px;
    left: calc(50% - 44px);
    width: 88px;
    height: 18px;
    min-height: 18px;
    border-radius: 8px 8px 0 0;
    cursor: ns-resize;
  }

  .chat-collapsed .chat-handle::before {
    width: 42px;
    height: 4px;
  }
}
