@font-face {
  font-family: "Vazir";
  src: url("/fonts/Vazir-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("/fonts/Vazir-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("/fonts/Vazir-Bold.woff2") format("woff2");
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("/fonts/Vazir-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #17070d;
  --panel: rgba(38, 13, 23, 0.82);
  --panel-solid: #26101a;
  --glass: rgba(255, 248, 250, 0.08);
  --line: rgba(255, 205, 218, 0.16);
  --text: #fff6f8;
  --muted: #d8aeb9;
  --berry: #ff3f73;
  --berry-2: #ff6f91;
  --cream: #ffe4ec;
  --green: #57d78b;
  --danger: #ff9aae;
  --collapsed-panel-height: 190px;
  color: var(--text);
  background: var(--bg);
  font-family:
    "Vazir", Tahoma, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 5%, rgba(255, 63, 115, 0.24), transparent 18rem),
    radial-gradient(circle at 100% 55%, rgba(255, 111, 145, 0.14), transparent 20rem),
    #17070d;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid rgba(255, 111, 145, 0.62);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player-shell {
  height: 100dvh;
  display: block;
  overflow: hidden;
  position: relative;
}

.stage {
  --video-ratio: 1.7778;
  --video-aspect: 16 / 9;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #050203;
  overflow: hidden;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  background:
    linear-gradient(180deg, rgba(23, 7, 13, 0.78), transparent 24%, transparent 58%, rgba(23, 7, 13, 0.82)),
    radial-gradient(circle at 50% 100%, rgba(255, 63, 115, 0.18), transparent 34rem);
}

.stage video {
  width: min(100%, calc(100dvh * var(--video-ratio)));
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--video-aspect);
  object-fit: contain;
  background: #050203;
}

.stage video:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  object-fit: contain;
  background: #000;
}

.stage video:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  object-fit: contain;
  background: #000;
}

.stage:fullscreen,
.stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #000;
}

.stage.is-player-fullscreen {
  cursor: default;
}

.stage.is-player-fullscreen .top-overlay {
  display: none;
}

.stage.is-player-fullscreen .player-controls {
  bottom: max(22px, env(safe-area-inset-bottom));
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 5;
}

.stage.is-player-fullscreen.is-chrome-hidden {
  cursor: none;
}

.stage.is-player-fullscreen.is-chrome-hidden::after {
  opacity: 0;
}

.stage.is-player-fullscreen.is-chrome-hidden .player-controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

.empty-player {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty-player svg {
  width: 62px;
  height: 62px;
  color: var(--berry-2);
}

.empty-player strong {
  color: var(--text);
  font-size: 21px;
}

.empty-player span {
  max-width: 280px;
  line-height: 1.6;
}

.top-overlay,
.player-controls {
  position: absolute;
  z-index: 2;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
}

.top-overlay {
  top: max(12px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand,
.glass-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: rgba(25, 8, 14, 0.54);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
}

.brand {
  min-width: 0;
  color: var(--cream);
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 900;
  direction: ltr;
}

.brand strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--berry-2), var(--berry));
}

.glass-button {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 13px;
  color: var(--text);
}

.glass-button.active {
  border-color: rgba(255, 111, 145, 0.5);
  background: rgba(255, 63, 115, 0.22);
}

.icon-button {
  width: 42px;
  padding: 0;
  justify-content: center;
}

.player-controls {
  bottom: calc(var(--collapsed-panel-height) + 16px);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}

.play-button {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--berry-2), var(--berry));
  color: white;
  box-shadow: 0 0 34px rgba(255, 63, 115, 0.36);
}

.play-button svg {
  width: 24px;
  height: 24px;
}

.timeline {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.seek {
  width: 100%;
  accent-color: var(--berry);
}

.time {
  color: var(--cream);
  font-size: 12px;
  direction: ltr;
  text-align: left;
}

.bottom-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  max-height: min(72dvh, 620px);
  overflow: auto;
  padding: 8px 14px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  background: rgba(32, 8, 18, 0.92);
  backdrop-filter: blur(22px);
  box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.42);
  transition: max-height 180ms ease, background-color 180ms ease;
  scrollbar-color: rgba(255, 111, 145, 0.5) transparent;
  scrollbar-width: thin;
}

.bottom-panel::-webkit-scrollbar {
  width: 6px;
}

.bottom-panel::-webkit-scrollbar-track {
  background: transparent;
}

.bottom-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 111, 145, 0.42);
}

.bottom-panel.is-collapsed {
  max-height: var(--collapsed-panel-height);
  overflow: hidden;
}

.bottom-panel.is-collapsed .setup-grid,
.bottom-panel.is-collapsed .action-row,
.bottom-panel.is-collapsed .file-picker,
.bottom-panel.is-collapsed .file-state,
.bottom-panel.is-collapsed .people-strip,
.bottom-panel.is-collapsed .chat-list,
.bottom-panel.is-collapsed .host-button,
.bottom-panel.is-collapsed .notice {
  display: none;
}

.bottom-panel.is-collapsed .quick-row {
  grid-template-columns: 1fr 1fr;
}

.bottom-panel.is-collapsed .chat-card {
  margin-top: 10px;
  padding: 9px;
  border-color: rgba(255, 111, 145, 0.18);
  background: rgba(255, 248, 250, 0.05);
}

.bottom-panel.is-collapsed .chat-head {
  display: none;
}

.bottom-panel.is-collapsed .chat-form input {
  min-height: 42px;
}

.bottom-panel.is-collapsed.has-visible-notice {
  max-height: calc(var(--collapsed-panel-height) + 74px);
}

.bottom-panel.is-collapsed.has-visible-notice .notice {
  display: block;
  margin-top: 8px;
}

.panel-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--cream);
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 0 0 10px;
  font-weight: 900;
}

.panel-toggle strong {
  font-size: 12px;
}

.grabber {
  width: 46px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 228, 236, 0.28);
}

.quick-row,
.action-row,
.setup-grid {
  display: grid;
  gap: 10px;
}

.quick-row {
  grid-template-columns: 1fr 1fr auto;
  align-items: stretch;
}

.room-chip,
.host-button,
.file-state,
.chat-card {
  border: 1px solid var(--line);
  background: var(--glass);
  border-radius: 16px;
}

.room-chip {
  padding: 10px 12px;
}

.room-chip span,
label span,
.chat-head span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.room-chip strong {
  color: var(--text);
  direction: ltr;
  display: block;
  font-size: 13px;
}

.host-button {
  padding: 0 12px;
  color: var(--cream);
  font-weight: 800;
}

.setup-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(7, 2, 5, 0.68);
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

input:focus {
  border-color: rgba(255, 111, 145, 0.78);
  box-shadow: 0 0 0 3px rgba(255, 63, 115, 0.14);
}

.action-row {
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
}

.primary-button,
.secondary-button,
.file-picker {
  min-height: 50px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 900;
}

.primary-button {
  border: 0;
  background: linear-gradient(180deg, var(--berry-2), var(--berry));
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
}

.file-picker {
  width: 100%;
  margin-top: 10px;
  border: 1px solid rgba(255, 111, 145, 0.28);
  background: rgba(255, 63, 115, 0.12);
  color: var(--cream);
}

.file-picker input {
  display: none;
}

.file-state {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
}

.file-state svg {
  color: var(--berry-2);
  margin-top: 2px;
}

.file-state svg.good {
  color: var(--green);
}

.file-state svg.bad {
  color: var(--danger);
}

.file-state strong,
.file-state span {
  display: block;
}

.file-state strong {
  font-size: 13px;
  word-break: break-word;
}

.file-state span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.people-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
}

.person {
  min-width: 126px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(255, 111, 145, 0.22);
  border-radius: 15px;
  background: rgba(255, 248, 250, 0.055);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--berry-2), var(--berry));
  color: white;
  font-weight: 900;
}

.person strong,
.person span {
  display: block;
}

.person strong {
  font-size: 12px;
  white-space: nowrap;
}

.person span {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.match {
  background: var(--green);
}

.dot.mismatch {
  background: var(--danger);
}

.chat-card {
  padding: 12px;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.chat-list {
  height: 118px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 10px 0;
  padding-left: 2px;
}

.chat-empty {
  color: var(--muted);
  margin: 8px 0;
  font-size: 12px;
}

.chat-message {
  max-width: 86%;
  justify-self: start;
  padding: 8px 10px;
  border-radius: 15px 15px 15px 4px;
  background: rgba(255, 255, 255, 0.075);
}

.chat-message.mine {
  justify-self: end;
  border-radius: 15px 15px 4px 15px;
  background: rgba(255, 63, 115, 0.24);
}

.chat-message span {
  display: block;
  color: var(--cream);
  font-size: 10px;
  margin-bottom: 3px;
}

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

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-form button {
  width: 46px;
  min-height: 46px;
  border: 0;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--berry-2), var(--berry));
  color: white;
}

.player-fullscreen-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: none;
  place-items: center;
  color: var(--cream);
  background: rgba(25, 8, 14, 0.68);
  backdrop-filter: blur(16px);
}

.stage.is-player-fullscreen .player-controls {
  grid-template-columns: auto 1fr auto;
}

.stage.is-player-fullscreen .player-fullscreen-button {
  display: grid;
}

.notice {
  margin: 10px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

@media (min-width: 760px) {
  body {
    overflow: auto;
  }

  .player-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    grid-template-rows: 1fr;
    overflow: visible;
  }

  .bottom-panel {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    max-height: 100dvh;
    height: 100dvh;
    border-top: 0;
    border-right: 1px solid var(--line);
    border-radius: 28px 0 0 28px;
    padding: 18px;
  }

  .bottom-panel.is-collapsed {
    max-height: 100dvh;
  }

  .bottom-panel.is-collapsed .setup-grid,
  .bottom-panel.is-collapsed .action-row,
  .bottom-panel.is-collapsed .file-state,
  .bottom-panel.is-collapsed .chat-list {
    display: grid;
  }

  .bottom-panel.is-collapsed .file-picker {
    display: inline-flex;
  }

  .bottom-panel.is-collapsed .people-strip {
    display: flex;
  }

  .bottom-panel.is-collapsed .host-button {
    display: block;
  }

  .bottom-panel.is-collapsed .notice {
    display: block;
  }

  .bottom-panel.is-collapsed .quick-row {
    grid-template-columns: 1fr 1fr auto;
  }

  .bottom-panel.is-collapsed .chat-card {
    margin-top: 0;
    padding: 12px;
    border-color: var(--line);
    background: var(--glass);
  }

  .panel-toggle {
    display: none;
  }

  .stage {
    position: relative;
    min-height: 100dvh;
  }

  .player-controls {
    bottom: 18px;
  }

  .chat-list {
    height: 180px;
  }
}

@media (max-width: 430px) {
  .setup-grid,
  .action-row {
    grid-template-columns: 1fr;
  }

  .quick-row {
    grid-template-columns: 1fr 1fr;
  }

  .host-button {
    grid-column: 1 / -1;
    min-height: 40px;
  }

  .brand {
    max-width: 210px;
  }

  .glass-button {
    padding: 0 11px;
  }
}
