/* Values come from the Figma file "Watchin" (host room screen). */
:root {
  --bg: #000;
  --panel: #1b1b1b;
  --pill: rgba(166, 166, 166, 0.2);
  --line: rgba(129, 129, 129, 0.3);
  --text: #fff;
  --muted: rgba(129, 129, 129, 0.9);
  --placeholder: rgba(166, 166, 166, 0.5);
  --stage: #fff;
  --stage-text: #0a0101;
  --warn: #f0b24a;
  --medium: 510;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--medium) 16px/normal "SF Pro", "SF Pro Text", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
}

button, input, select { font: inherit; color: inherit; border: 0; min-width: 0; }
button { cursor: pointer; }

h1 { margin: 0 0 12px; font-size: 48px; font-weight: 700; }
h2 { margin: 0 0 8px; font-size: 16px; font-weight: var(--medium); color: var(--muted); }
p { margin: 0; }

hr {
  height: 2.69px;
  margin: 15px 0 14px;
  border: 0;
  border-radius: 50px;
  background: var(--line);
}

.primary {
  display: block;
  width: 100%;
  height: 76px;
  padding: 0 24px;
  border-radius: 65px;
  background: #fff;
  color: #000;
  /* Shrinks with the panel so the longer "Остановить трансляцию" label still fits. */
  font-size: min(24px, 6.4cqw);
  font-weight: 700;
  white-space: nowrap;
}
.secondary {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 10px;
  border-radius: 65px;
  background: var(--pill);
}
.field {
  height: 54.38px;
  padding: 0 31px;
  border-radius: 129px;
  background: var(--pill);
  font-size: 18px;
  outline: 0;
}
.field::placeholder { color: var(--placeholder); }

.warn { color: var(--warn); margin-top: 10px; font-size: 14px; }

/* Glass surfaces: a frosted backdrop plus the thin bright rim the Figma glass effect draws,
   strongest along the top edge. */
aside, select, .link, .field, .secondary, .send, .controls, .stats {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.13),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.5),
    inset 0 -1.5px 1px rgba(255, 255, 255, 0.22),
    inset 0 0 14px rgba(255, 255, 255, 0.07);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  backdrop-filter: blur(32px) saturate(190%);
}

/* ---------- landing and lobby ---------- */

.center {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}
.center p { color: var(--muted); margin-bottom: 28px; }
.center .primary { width: min(409px, 100%); }
#lobbyForm { display: flex; flex-direction: column; gap: 12px; width: min(409px, 100%); }
#lobbyForm .field { text-align: center; }

/* ---------- room ---------- */

#room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 21vw, 370px);
  gap: 12px;
  height: 100%;
  padding: 32px 16px 32px 12px;
}

.player {
  position: relative;
  min-height: 0;
  overflow: clip;
  border-radius: 64px;
  background: var(--stage);
}
.player:has(video.live) { background: #000; }
.player:fullscreen { border-radius: 0; }
.player:-webkit-full-screen { border-radius: 0; }
.player video { width: 100%; height: 100%; object-fit: contain; display: block; }

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  padding: 48px;
  text-align: center;
  color: var(--stage-text);
  font-size: clamp(16px, 1.4vw, 22px);
}
/* The Watchin mark, shown until a film is on screen; 62:53 is the logo's own ratio. */
.placeholder::before {
  content: "";
  flex: none;
  width: clamp(62px, 7vw, 124px);
  aspect-ratio: 62 / 53;
  background: url("assets/w.svg") center / contain no-repeat;
}

.stats {
  position: absolute;
  left: 35px;
  bottom: 25px;
  max-width: calc(100% - 190px);
  padding: 8px 16px;
  border-radius: 54px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats:empty { display: none; }

.controls {
  position: absolute;
  right: 35px;
  bottom: 25px;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 42px;
  padding: 0 16px;
  border-radius: 21px;
  /* The pill's Figma fill, plus a dark tint that keeps the white icons readable over a bright frame. */
  background: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), var(--pill);
}
.player:not(:has(video.live)) .controls { background: rgba(0, 0, 0, 0.6); }
.controls button {
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
}
/* Both icons share one height so they read as a pair. */
.controls svg { display: block; height: 22px; width: auto; }
#mute .cross, #mute.muted .waves { display: none; }
#mute.muted .cross { display: inline; }

aside {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 27.5px 24px 21.6px;
  overflow-y: auto;
  border-radius: 60px;
  background: rgba(0, 0, 0, 0.2);
  container-type: inline-size;
}

.settings { display: flex; flex-direction: column; gap: 16px; margin-top: 23.5px; }
.settings label { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
select {
  height: 35px;
  padding: 0 45px 0 16px;
  border-radius: 54px;
  background: var(--pill) url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2218.2%22%20height%3D%229.76%22%20viewBox%3D%220%200%2018.2%209.76%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M1.27%201.27%209.1%208.49l7.83-7.22%22%20stroke%3D%22%23818181%22%20stroke-width%3D%222.537%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22/%3E%3C/svg%3E") no-repeat right 13px center;
  appearance: none;
  -webkit-appearance: none;
  field-sizing: content;
  outline: 0;
  cursor: pointer;
}
select:disabled { opacity: 0.5; cursor: default; }
select option { background: var(--panel); color: var(--text); }

.link {
  width: 100%;
  height: 38.72px;
  padding: 0 13px;
  border-radius: 129px;
  background: var(--pill);
  outline: 0;
  cursor: pointer;
  text-overflow: ellipsis;
}

#people { list-style: none; margin: 0; padding: 0; color: #fffefe; }
#people li { display: flex; align-items: center; flex-wrap: wrap; padding: 2px 0; }
#people .dot { margin: 0 7px; }

#chat {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
#chat div { padding: 2px 0; }
#chat b { font-weight: 700; }
#chat .system { color: var(--muted); }
#chatEmpty { margin: auto; font-size: clamp(22px, 1.6vw, 29px); font-weight: 700; text-align: center; }

#chatForm { display: flex; gap: 10.5px; }
#chatForm .field { flex: 1; }
.send {
  position: relative;
  flex: none;
  width: 54.38px;
  height: 54.38px;
  padding: 0;
  border-radius: 50%;
  background: none;
}
.send img { position: absolute; left: 0; top: 0; }
.send svg { position: relative; }

@media (max-width: 800px) {
  #room {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .player { aspect-ratio: 16 / 9; border-radius: 32px; }
  .placeholder { gap: 10px; padding: 12px 16px 72px; font-size: 15px; }
  .placeholder::before { width: 50px; }
  .stats { left: 16px; bottom: 76px; max-width: calc(100% - 32px); }
  .controls { right: 16px; bottom: 12px; }
  aside { border-radius: 32px; padding: 20px 16px 16px; }
  .primary { height: 60px; }
}
