html:has(.chat-video-view[open]) {
  overflow: hidden;
}

dialog.chat-video-view[open] {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f0f7f3;
}

.chat-video-view::backdrop {
  background: #071613c2;
}

.chat-video-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.chat-video-title {
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: normal;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-video-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-video-view .chat-video-control {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #9bc0ad60;
  border-radius: 12px;
  background: #173d36eb;
  color: inherit;
  text-decoration: none;
}

.chat-video-view .chat-video-close {
  border-radius: 50%;
}

.chat-video-control svg {
  width: 20px;
  height: 20px;
}

.chat-video-view .chat-video-control:hover:not(:disabled) {
  border-color: #b6d7ca;
  background: #2e6155;
}

.chat-video-view :is(.chat-video-control, input[type="range"]):focus-visible {
  outline: 2px solid #def697;
  outline-offset: 2px;
}

.chat-video-view .chat-video-control:disabled {
  cursor: default;
  opacity: 0.47;
}

.chat-video-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-video-player {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #07110e;
  object-fit: contain;
  cursor: pointer;
}

@supports (width: 1cqw) {
  .chat-video-stage {
    container-type: size;
  }

  .chat-video-stage .chat-video-player {
    width: min(100cqw, calc(100cqh * var(--chat-video-view-ratio, 1.33333)), 92rem);
    height: auto;
    aspect-ratio: var(--chat-video-view-ratio, 4 / 3);
  }
}

.chat-video-footer {
  display: grid;
  justify-self: center;
  gap: 7px;
  width: min(100%, 48rem);
}

.chat-video-controls {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 44px clamp(2.5rem, 11vw, 7rem);
  align-items: center;
  gap: clamp(6px, 1.4vw, 12px);
  min-width: 0;
  padding: 5px 10px 5px 5px;
  border: 1px solid #83a79570;
  border-radius: 16px;
  background: #12322eeb;
}

.chat-video-controls .chat-video-control {
  border-color: transparent;
  background: transparent;
}

.chat-video-controls input[type="range"] {
  min-width: 0;
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: #cdeca8;
  cursor: pointer;
}

.chat-video-controls input[type="range"]:disabled {
  cursor: default;
  opacity: 0.47;
}

.chat-video-time {
  color: #d3e2d9;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chat-video-view-status,
.chat-video-caption {
  max-height: min(6rem, 20dvh);
  margin: 0;
  padding: 6px 10px;
  overflow: auto;
  border-radius: 9px;
  background: #0c2622e8;
  font-size: 13px;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-video-view-status:empty {
  display: none;
}

@media (max-width: 480px) {
  dialog.chat-video-view[open] { gap: 8px; }
  .chat-video-toolbar { gap: 6px; }
  .chat-video-title { font-size: 13px; }
  .chat-video-time { font-size: 11px; }
}
