:root {
  color-scheme: dark;
  --bg: #0e0f11;
  --panel: #17181b;
  --panel-2: #1e2024;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f4f4f2;
  --muted: #8b8d93;
  --accent: #d9ff68;
  --accent-deep: #222b0d;
  --danger: #ff7a72;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

/* Netlify's optional on-site drawer must never cover the movie or chat. */
#netlify-drawer,
.netlify-drawer,
[data-netlify-drawer],
[data-netlify-toolbar],
netlify-drawer,
iframe[title*="Netlify"],
iframe[src*="app.netlify.com"][style*="position: fixed"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.name-gate {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 35%, rgba(217, 255, 104, 0.08), transparent 35%),
    rgba(8, 9, 10, 0.98);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.name-gate.closed {
  visibility: hidden;
  opacity: 0;
}

.name-card {
  width: min(100%, 420px);
  padding: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 25px;
  background: rgba(23, 24, 27, 0.94);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.name-mark,
.brand-mark {
  display: inline-flex;
  gap: 3px;
}

.name-mark {
  margin-bottom: 24px;
}

.name-mark span,
.brand-mark span {
  border: 1.5px solid var(--accent);
  border-radius: 10px;
}

.name-mark span {
  width: 12px;
  height: 27px;
}

.brand-mark span {
  width: 8px;
  height: 17px;
}

.name-mark span:first-child,
.brand-mark span:first-child {
  transform: rotate(-10deg);
}

.name-mark span:last-child,
.brand-mark span:last-child {
  transform: rotate(10deg);
}

.eyebrow {
  margin: 0 0 11px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.18em;
}

.name-card h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 560;
  letter-spacing: -0.05em;
}

.name-card > p:not(.eyebrow) {
  max-width: 320px;
  margin: 0 auto 25px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.name-card form {
  display: grid;
  gap: 10px;
}

.name-card input {
  height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #0e0f11;
  color: var(--text);
  font-size: 14px;
  text-align: center;
}

.primary-button {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: #182006;
  font-size: 13px;
  font-weight: 720;
  cursor: pointer;
}

.name-error {
  display: block;
  min-height: 15px;
  margin-top: 8px;
  color: var(--danger);
  font-size: 10px;
}

.name-card .visit-notice {
  margin: 8px auto 0;
  color: #73767d;
  font-size: 9px;
  line-height: 1.45;
}

.watch-app {
  display: flex;
  width: 100%;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  width: min(100% - 32px, 1280px);
  height: 58px;
  flex: 0 0 58px;
  align-items: center;
  justify-content: space-between;
  margin-inline: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.03em;
}

.room-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #686970;
}

.room-pill[data-state="waiting"] .status-dot {
  background: #e5bd60;
  box-shadow: 0 0 0 4px rgba(229, 189, 96, 0.1);
}

.room-pill[data-state="online"] {
  color: #c6d895;
  border-color: rgba(217, 255, 104, 0.18);
}

.room-pill[data-state="online"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 255, 104, 0.1);
}

.room-pill[data-state="error"] {
  color: var(--danger);
}

.room-pill[data-state="error"] .status-dot {
  background: var(--danger);
}

.watch-layout {
  display: grid;
  width: min(100% - 32px, 1280px);
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(0, 1.62fr) minmax(340px, 0.75fr);
  gap: 14px;
  margin: 0 auto 16px;
}

.movie-pane,
.chat-pane {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
}

.movie-pane {
  display: flex;
  flex-direction: column;
}

.video-shell {
  position: relative;
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: center;
  overflow: hidden;
  background: #050506;
}

video {
  position: relative;
  z-index: 2;
  display: none;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.video-shell.ready video {
  display: block;
}

.video-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 42%, rgba(217, 255, 104, 0.08), transparent 40%),
    linear-gradient(135deg, #0e1010, #070808);
}

.video-shell.ready .video-backdrop {
  display: none;
}

.film-monogram {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border: 1px solid rgba(217, 255, 104, 0.35);
  border-radius: 50%;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 30px;
}

.video-backdrop p {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.2em;
}

.video-backdrop strong {
  font-family: Georgia, serif;
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 400;
}

.video-error {
  position: absolute;
  z-index: 3;
  inset: 50% auto auto 50%;
  width: min(88%, 390px);
  transform: translate(-50%, -50%);
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(15, 16, 18, 0.9);
  text-align: center;
  backdrop-filter: blur(16px);
}

.video-error[hidden] {
  display: none;
}

.video-error > span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  margin: 0 auto 9px;
  border: 1px solid rgba(255, 122, 114, 0.35);
  border-radius: 50%;
  color: var(--danger);
  font-size: 11px;
}

.video-error strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.video-error p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.video-error b {
  color: #b8bac0;
  font-weight: 600;
}

.resume-button {
  position: absolute;
  z-index: 4;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  padding: 11px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  background: rgba(17, 18, 20, 0.9);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.resume-button[hidden] {
  display: none;
}

.resume-button span {
  margin-right: 6px;
  color: var(--accent);
  font-size: 9px;
}

.movie-meta {
  display: flex;
  height: 76px;
  flex: 0 0 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
}

.overline {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.movie-meta h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 620;
  letter-spacing: -0.03em;
}

.viewer-count {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 100px;
  color: #b7b9bd;
  font-size: 10px;
}

.viewer-dots {
  display: flex;
}

.viewer-dots i {
  width: 15px;
  height: 15px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: #484a50;
}

.viewer-dots i:last-child {
  margin-left: -5px;
}

.viewer-count.connected .viewer-dots i {
  background: var(--accent);
}

.chat-pane {
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  height: 66px;
  flex: 0 0 66px;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.chat-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border: 1px solid rgba(217, 255, 104, 0.22);
  border-radius: 50%;
  background: var(--accent-deep);
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 17px;
}

.chat-heading {
  min-width: 0;
  flex: 1;
}

.chat-heading h2 {
  overflow: hidden;
  margin: 0 0 3px;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-heading p {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-heading p::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #62646a;
  content: "";
}

.chat-heading p[data-state="online"] {
  color: #bccd8b;
}

.chat-heading p[data-state="online"]::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 255, 104, 0.09);
}

.sync-button,
.emoji-button,
.send-button,
.message-action,
.reply-preview button,
.emoji-tray button {
  border: 0;
  cursor: pointer;
}

.sync-button {
  display: grid;
  width: 35px;
  height: 35px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: #222328;
  color: #a6a8ad;
}

.sync-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.sync-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.messages {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 12px 10px;
  overscroll-behavior: contain;
  scrollbar-color: #3a3b40 transparent;
  scrollbar-width: thin;
}

.chat-placeholder {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: #5e6065;
  text-align: center;
}

.chat-placeholder[hidden] {
  display: none;
}

.chat-placeholder span {
  color: #77797f;
}

.chat-placeholder p {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
}

.system-message {
  display: flex;
  justify-content: center;
  margin: 11px 0;
}

.system-message span {
  max-width: 86%;
  padding: 5px 9px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.04);
  color: #73757b;
  font-size: 8px;
  line-height: 1.4;
  text-align: center;
}

.message {
  position: relative;
  display: flex;
  width: 100%;
  align-items: flex-end;
  gap: 8px;
  margin: 8px 0;
}

.message.own {
  justify-content: flex-end;
}

.message-avatar {
  display: grid;
  width: 27px;
  height: 27px;
  flex: none;
  place-items: center;
  margin-bottom: 2px;
  border-radius: 50%;
  background: #292a2f;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.message.own .message-avatar {
  display: none;
}

.message-body {
  min-width: 0;
  max-width: min(76%, 430px);
}

.message.own .message-body {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
}

.message-name {
  margin: 0 0 3px 3px;
  color: #8d8f95;
  font-size: 8px;
  font-weight: 620;
}

.message.own .message-name {
  display: none;
}

.bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 9px 11px 7px;
  border: 1px solid var(--line);
  border-radius: 17px 17px 17px 6px;
  background: #222329;
  color: #ededeb;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  touch-action: manipulation;
}

.message.own .bubble {
  border-color: rgba(217, 255, 104, 0.14);
  border-radius: 17px 17px 6px 17px;
  background: #28301b;
}

.bubble-content {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.bubble-text {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.bubble-time {
  flex: none;
  margin-left: auto;
  color: #777a7f;
  font-size: 7px;
  line-height: 1.6;
}

.quoted-message {
  display: block;
  margin-bottom: 6px;
  padding-left: 7px;
  border-left: 2px solid var(--accent);
}

.quoted-message strong,
.quoted-message span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quoted-message strong {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 8px;
}

.quoted-message span {
  max-width: 170px;
  color: #a0a2a7;
  font-size: 8px;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.message:hover .message-actions,
.message:focus-within .message-actions {
  opacity: 1;
}

.message.own .message-actions {
  order: -1;
}

.message-action {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: #24252a;
  color: #9c9ea3;
  font-size: 11px;
}

.typing-line {
  height: 17px;
  flex: 0 0 17px;
  padding: 2px 15px 0;
  color: var(--accent);
  font-size: 8px;
}

.composer-wrap {
  position: relative;
  z-index: 6;
  flex: none;
  padding: 6px 10px max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(23, 24, 27, 0.72), var(--panel) 35%);
}

.reply-preview {
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 8px;
  padding: 6px 7px 6px 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #1e1f23;
}

.reply-preview[hidden] {
  display: none;
}

.reply-bar {
  width: 2px;
  height: 26px;
  flex: none;
  border-radius: 2px;
  background: var(--accent);
}

.reply-preview > div {
  min-width: 0;
  flex: 1;
}

.reply-preview strong,
.reply-preview p {
  display: block;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview strong {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 9px;
}

.reply-preview p {
  color: #97999f;
  font-size: 9px;
}

.reply-preview button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
}

.emoji-tray {
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 7px);
  left: 10px;
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 3px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(30, 31, 35, 0.98);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
}

.emoji-tray[hidden] {
  display: none;
}

.emoji-tray button {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: transparent;
  font-size: 18px;
}

.emoji-tray button:hover {
  background: #292a2f;
}

.composer {
  display: flex;
  min-height: 48px;
  align-items: flex-end;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #202126;
}

.reply-preview:not([hidden]) + .emoji-tray + .composer {
  border-radius: 0 0 15px 15px;
}

.composer textarea {
  width: 100%;
  min-width: 0;
  max-height: 90px;
  min-height: 36px;
  resize: none;
  overflow-y: auto;
  padding: 9px 5px 7px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 18px;
}

.composer textarea::placeholder {
  color: #717379;
}

.emoji-button,
.send-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
}

.emoji-button {
  background: transparent;
  color: #96989e;
}

.send-button {
  background: var(--accent);
  color: #192006;
}

.emoji-button:disabled,
.send-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.emoji-button svg,
.send-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.toast {
  position: fixed;
  z-index: 110;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  max-width: min(88vw, 390px);
  transform: translate(-50%, 20px);
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(32, 33, 37, 0.96);
  color: var(--text);
  font-size: 11px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 760px) {
  .topbar {
    width: 100%;
    height: calc(48px + env(safe-area-inset-top));
    flex-basis: calc(48px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .watch-layout {
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 0;
    margin: 0;
  }

  .movie-pane,
  .chat-pane {
    border: 0;
    border-radius: 0;
  }

  .movie-pane {
    flex: none;
  }

  .video-shell {
    width: 100%;
    height: min(39dvh, 56.25vw);
    flex: none;
  }

  .movie-meta {
    height: 50px;
    flex-basis: 50px;
    padding: 0 12px;
  }

  .overline {
    margin-bottom: 1px;
    font-size: 7px;
  }

  .movie-meta h2 {
    font-size: 14px;
  }

  .viewer-count {
    padding: 5px 8px;
    font-size: 9px;
  }

  .chat-pane {
    min-height: 0;
    flex: 1;
    border-top: 1px solid var(--line);
  }

  .chat-header {
    height: 55px;
    flex-basis: 55px;
    padding-inline: 11px;
  }

  .chat-avatar {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .messages {
    padding: 12px 10px 8px;
  }

  .message-body {
    max-width: 82%;
  }

  .bubble {
    padding: 9px 11px 7px;
    font-size: 13px;
  }

  .message-actions {
    display: none;
  }

  .message-avatar {
    width: 30px;
    height: 30px;
  }

  .typing-line {
    padding-left: 12px;
  }

  .composer-wrap {
    padding: 6px 8px max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
  }

  .composer {
    min-height: 52px;
    padding: 7px;
    border-radius: 20px;
  }

  .composer textarea {
    min-height: 38px;
    padding-block: 10px 8px;
    font-size: 16px;
  }

  .emoji-button,
  .send-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .video-error {
    padding: 12px;
  }

  .video-error > span {
    display: none;
  }

  .video-error strong {
    font-size: 11px;
  }

  .video-error p {
    font-size: 8px;
  }
}

@media (max-width: 430px) {
  .name-card {
    padding: 30px 21px 24px;
    border-radius: 20px;
  }

  .brand > span:last-child {
    display: none;
  }

  .room-pill {
    max-width: 75vw;
  }
}

@media (max-height: 650px) and (max-width: 760px) {
  .video-shell {
    height: min(31dvh, 56.25vw);
  }

  .movie-meta {
    height: 42px;
    flex-basis: 42px;
  }

  .chat-header {
    height: 48px;
    flex-basis: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
