/* Streaming workspace. Loaded after the shared site styles. */
#streams-dialog .stream-card-media > .stream-card-live,
#streams-dialog .stream-card-media > .stream-card-viewers { width: auto; height: auto; aspect-ratio: auto; min-height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; line-height: 18px; }
#streams-dialog .stream-card-media > .stream-card-live { background: #d93658; }
#streams-dialog .stream-card-media > .stream-card-viewers { background: rgba(10,10,15,.8); }
#streams-dialog .stream-card-copy { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 16px; }
#streams-dialog .stream-card-copy > span { align-self: flex-start; font-size: 12px; }
#streams-dialog .stream-card-copy strong { font-size: 16px; overflow-wrap: anywhere; }
#streams-dialog .stream-card-copy p { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
#streams-dialog .stream-card-enter { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; width: 100%; margin-top: 4px; padding: 12px 16px; border: 1px solid #ffffff40; border-radius: 12px; color: #fff; background: #ffffff18; font-size: 16px; cursor: pointer; }
#streams-dialog .stream-card-enter:hover { background: #ffffff30; }
@media (max-width: 820px) {
  #streams-dialog[data-stream-view="list"]:not(.is-preparing) { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; overflow-y: auto; }
  #streams-dialog[data-stream-view="list"]:not(.is-preparing) > .play-head { padding: 20px 64px 20px 20px; }
  #streams-dialog[data-stream-view="list"]:not(.is-preparing) > .dialog-close { top: 12px; right: 12px; width: 44px; height: 44px; }
  #streams-dialog[data-stream-view="list"] .streams-scene-list { display: flex; flex-direction: column; min-width: 0; gap: 18px; padding: 0; }
  #streams-dialog[data-stream-view="list"]:not(.is-preparing) .play-body { padding: 20px 16px; }
  #streams-dialog[data-stream-view="list"] .streams-discovery-head { display: block; }
  #streams-dialog[data-stream-view="list"] .streams-discovery-head p { margin-top: 10px; font-size: 14px; }
  #streams-dialog[data-stream-view="list"] [data-stream-go-live] { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin: 0; padding: 12px 16px; border-radius: 14px; font-size: 16px; line-height: 24px; box-sizing: border-box; }
  #streams-dialog[data-stream-view="list"] .streams-categories { display: flex; flex-wrap: wrap; overflow: visible; gap: 8px; padding: 0; }
  #streams-dialog[data-stream-view="list"] .streams-categories button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; max-width: 100%; padding: 10px 14px; font-size: 14px; line-height: 20px; border-radius: 12px; white-space: normal; }
  #streams-dialog[data-stream-view="list"] .stream-card-copy strong { font-size: 16px; }
  #streams-dialog[data-stream-view="list"] .stream-card-copy p { font-size: 14px; }
}
@media (max-width: 360px) {
  #streams-dialog[data-stream-view="list"] .stream-card { display: block; }
  #streams-dialog[data-stream-view="list"] .stream-card-media { width: 100%; aspect-ratio: 16 / 8; }
  #streams-dialog[data-stream-view="list"] .stream-card-media > span:not(.stream-card-live):not(.stream-card-viewers),
  #streams-dialog[data-stream-view="list"] .stream-card-media > img { width: 52px; height: 52px; }
  #streams-dialog[data-stream-view="list"] .stream-card-copy { padding: 14px; }
  #streams-dialog[data-stream-view="list"] .stream-card-enter { white-space: nowrap; }
}
#streams-dialog .streams-stage-tools button svg { width: 22px; height: 22px; display: block; }
/* One touch-target system, shared by preparation and the live player. */
@media (max-width: 820px) {
  #streams-dialog .streams-stage-tools { gap: 8px; }
  #streams-dialog .streams-stage-tools button,
  #streams-dialog .streams-chat-quick button,
  #streams-dialog .streams-chat-head > button { box-sizing: border-box; display: inline-grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; line-height: 1; vertical-align: middle; }
  #streams-dialog.is-preparing .streams-preview-controls { align-items: stretch; gap: 12px; }
  #streams-dialog.is-preparing .streams-preview-controls > button { flex: 1 1 0; min-width: 0; width: auto; min-height: 76px; grid-template-rows: 28px 20px; gap: 6px; padding: 10px 4px; align-content: center; }
  #streams-dialog.is-preparing .streams-preview-controls .dice-ctl-icon { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
  #streams-dialog.is-preparing .streams-preview-controls .dice-ctl-label { font-size: 12px; line-height: 20px; }
}
#streams-dialog .streams-viewer-menu { position: absolute; z-index: 9; top: 64px; right: 12px; color: #fff; }
#streams-dialog .streams-viewer-menu > summary { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #666; border-radius: 50%; background: rgba(18,18,22,.8); cursor: pointer; list-style: none; }
#streams-dialog .streams-viewer-menu > summary::-webkit-details-marker { display: none; }
#streams-dialog .streams-viewer-menu-items { position: absolute; top: 52px; right: 0; display: grid; width: min(260px,calc(100vw - 32px)); padding: 6px; border: 1px solid #555; border-radius: 16px; background: #242428; box-shadow: 0 12px 32px #0008; }
#streams-dialog .streams-viewer-menu-items button { width: 100%; min-height: 48px; padding: 12px; border: 0; border-radius: 10px; color: #fff; background: transparent; font-size: 14px; text-align: left; }
#streams-dialog .streams-viewer-menu-items button:hover { background: #3b3b43; }
#streams-dialog .streams-viewer-menu-items [data-stream-leave] { color: #ffabb8; }
#streams-dialog .streams-stage:has(.streams-viewer-menu[open]) { overflow: visible; z-index: 12; }
#streams-dialog .streams-viewer-menu-items { max-height: calc(100dvh - 160px); overflow-y: auto; }
#streams-dialog.is-fullscreen .streams-live-badge { top: max(16px,env(safe-area-inset-top)); right: 16px; left: auto; }
.streams-host-overlay-tools { display: none; }
#streams-dialog.is-fullscreen .streams-host-overlay-tools { position: absolute; top: max(12px,env(safe-area-inset-top)); left: 12px; z-index: 8; display: flex; gap: 8px; }
#streams-dialog .streams-host-overlay-tools button { min-width: 44px; min-height: 44px; padding: 8px 12px; border: 1px solid #777; border-radius: 24px; background: rgba(18,18,22,.8); color: #fff; font-size: 14px; }
html:has(#streams-dialog.is-preparing[open]), body:has(#streams-dialog.is-preparing[open]) { overflow: hidden; }
html:has(#streams-dialog[open]), body:has(#streams-dialog[open]) { overflow: hidden; }
#streams-dialog.is-preparing { width: min(920px, calc(100% - 32px)); background: #141416; color: #f4f4f5; }
#streams-dialog.is-preparing > .play-head { display: none; }
#streams-dialog.is-preparing > .dialog-close { z-index: 10; top: 16px; right: 16px; color: #eee; background: #303034; width: 44px; height: 44px; }
#streams-dialog.is-preparing .play-body { padding: 0; background: #141416; }
#streams-dialog.is-preparing .streams-setup { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; padding: 24px; margin: 0; width: 100%; max-width: none; color: #f4f4f5; }
#streams-dialog.is-preparing .streams-setup-heading { grid-column: 1 / -1; margin: 0; padding-right: 48px; }
#streams-dialog.is-preparing .streams-setup-heading h3 { margin: 0; color: #fff; font-size: 24px; }
#streams-dialog.is-preparing .streams-setup-heading p { margin: 6px 0 0; color: #a9a9b2; font-size: 14px; }
#streams-dialog.is-preparing .streams-setup-camera { min-width: 0; width: 100%; }
#streams-dialog.is-preparing .streams-setup-camera .streams-preview { width: 100%; max-width: 100%; grid-template-columns: minmax(0,1fr); }
#streams-dialog.is-preparing .streams-setup-actions .plain-action { background: #303036; color: #eee; }
#streams-dialog.is-preparing .streams-preview { position: relative; display: grid; place-items: center; aspect-ratio: 4/3; height: auto; min-height: 220px; margin: 0; border: 1px solid #36363b; border-radius: 18px; overflow: hidden; background: #09090b; }
#streams-dialog.is-preparing .streams-preview video { width: 100%; height: 100%; object-fit: contain; }
#streams-dialog.is-preparing .streams-camera-prompt { display: grid; justify-items: center; gap: 10px; padding: 20px; text-align: center; }
#streams-dialog.is-preparing .streams-camera-prompt > svg { width: 30px; height: 30px; color: #f599ae; }
#streams-dialog.is-preparing .streams-camera-prompt strong { font-size: 16px; }
#streams-dialog.is-preparing .streams-camera-prompt p { max-width: 300px; margin: 0; color: #b2b2bc; font-size: 14px; line-height: 1.45; }
#streams-dialog.is-preparing .streams-camera-prompt button { min-height: 44px; padding: 10px 18px; font-size: 14px; }
#streams-dialog.is-preparing .streams-preview-controls { display: flex; justify-content: center; gap: 16px; margin: 0; padding: 12px 0 0; }
#streams-dialog.is-preparing .streams-preview-controls button { display: grid; justify-items: center; gap: 6px; min-width: 64px; min-height: 54px; padding: 8px; border: 1px solid #3b3b43; border-radius: 12px; color: #eee; background: #25252b; }
#streams-dialog.is-preparing .streams-preview-controls button span { color: inherit; font-size: 12px; }
#streams-dialog.is-preparing .streams-preview-controls button svg { width: 22px; height: 22px; }
#streams-dialog.is-preparing .streams-preview-controls .is-off { color: #ff9fac; background: #3c232c; }
#streams-dialog.is-preparing .streams-setup-fields { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
#streams-dialog.is-preparing .field { margin: 0; display: grid; gap: 8px; }
#streams-dialog.is-preparing .field > span { color: #dddde3; font-size: 14px; }
#streams-dialog.is-preparing .field :is(input,select) { width: 100%; min-width: 0; min-height: 48px; padding: 12px; border: 1px solid #404048; border-radius: 12px; background: #242429; color: #fff; font-size: 16px; color-scheme: dark; }
#streams-dialog.is-preparing .streams-setup-options { border-top: 1px solid #33333a; }
#streams-dialog.is-preparing .streams-setup-options summary { min-height: 48px; padding: 14px 0; font-size: 14px; cursor: pointer; }
#streams-dialog.is-preparing .streams-check { margin-top: 16px; color: #ddd; font-size: 14px; min-height: 44px; }
#streams-dialog.is-preparing .streams-check input { width: 20px; height: 20px; accent-color: #f17d97; }
#streams-dialog.is-preparing .form-error:empty { display: none; }
#streams-dialog.is-preparing .streams-setup-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; border-top: 1px solid #33333b; margin: 0; padding: 18px 0 0; }
#streams-dialog.is-preparing .streams-setup-actions > span { color: #a9a9b2; font-size: 12px; }
#streams-dialog.is-preparing .streams-setup-actions button { min-height: 48px; padding-inline: 22px; font-size: 16px; }
#streams-dialog.is-preparing .plain-action { color: #eee; background: #303036; border: 1px solid #45454c; }
#streams-dialog.is-preparing .streams-camera-prompt { min-width: 0; width: 100%; }
#streams-dialog.is-preparing .streams-camera-prompt button { min-width: 0; max-width: 100%; white-space: normal; }
@media (max-width: 680px) {
  #streams-dialog.is-preparing { position: fixed; inset: 0; margin: 0; width: 100%; max-width: none; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; overflow-y: auto; }
  #streams-dialog.is-preparing .streams-setup { grid-template-columns: minmax(0,1fr); gap: 18px; padding: 20px 16px 0; }
  #streams-dialog.is-preparing .streams-preview { aspect-ratio: 16/9; min-height: 190px; }
  #streams-dialog.is-preparing .streams-camera-prompt { gap: 8px; padding: 12px; }
  #streams-dialog.is-preparing .streams-camera-prompt > svg { display: none; }
  #streams-dialog.is-preparing .streams-setup-actions { position: sticky; bottom: 0; z-index: 5; grid-template-columns: auto 1fr; padding: 12px 0 max(12px,env(safe-area-inset-bottom)); background: #141416; }
  #streams-dialog.is-preparing .streams-setup-actions > span { grid-column: 1 / -1; text-align: center; }
  #streams-dialog.is-preparing .streams-setup-actions button { padding-inline: 12px; white-space: nowrap; }
}
#streams-dialog .streams-player-status {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: center;
  justify-items: center; gap: 12px; padding: 24px; color: #fff;
  background: rgba(0, 0, 0, .55); text-align: center;
}
#streams-dialog .streams-player-status:empty { display: none; }
#streams-dialog .streams-player-status button {
  min-height: 44px; padding: 10px 20px; border: 1px solid #777;
  border-radius: 24px; background: #f1f1f1; color: #101010; font-size: 1rem; cursor: pointer;
}
#streams-dialog .streams-stage-tools { z-index: 4; }
#streams-dialog .streams-chat-extras { flex: 0 1 auto; max-height: 210px; overflow: auto; overscroll-behavior: contain; }
#streams-dialog .streams-chat-extras:has(.streams-poll-compose) { max-height: 55%; }
#streams-dialog .streams-chat-tabs { display: flex; flex: none; gap: 8px; padding: 0 12px 6px; }
#streams-dialog .streams-chat-tabs button {
  min-height: 44px; padding: 8px 16px; border: 0; border-radius: 22px;
  color: #bbb; background: transparent; font-size: .875rem; cursor: pointer;
}
#streams-dialog .streams-chat-tabs button.active { color: #fff; background: #333; }
#streams-dialog .streams-chat-expand { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: #292929; color: #fff; font-size: 22px; cursor: pointer; }
#streams-dialog .streams-chat-preview {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px;
  border: 1px solid #383838; border-radius: 14px; color: #f1f1f1; background: #212121;
  text-align: left; cursor: pointer;
}
#streams-dialog .streams-chat-preview > span { display: grid; min-width: 0; flex: none; gap: 4px; }
#streams-dialog .streams-chat-preview small { color: #aaa; font-size: .75rem; }
#streams-dialog .streams-chat-preview > p { min-width: 0; flex: 1; }
#streams-dialog .streams-chat-preview strong { font-size: 1rem; }
#streams-dialog .streams-chat-preview p { margin: 6px 0 0; color: #bbb; font-size: .875rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#streams-dialog .streams-studio-settings { color: inherit; }
#streams-dialog .streams-studio-settings > summary { min-height: 44px; padding: 12px; cursor: pointer; font-size: .875rem; }
#streams-dialog .streams-studio-settings[open] { max-height: 280px; overflow: auto; }
#streams-dialog .streams-confirm-backdrop { position: absolute; z-index: 60; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.78); }
#streams-dialog .streams-end-confirm { width: min(100%, 380px); display: grid; gap: 16px; padding: 24px; border: 1px solid #444; border-radius: 20px; color: #fff; background: #212121; }
#streams-dialog .streams-end-confirm h3 { margin: 0; color: #fff; font-size: 1.25rem; }
#streams-dialog .streams-end-confirm p { margin: 0; color: #ccc; font-size: 1rem; line-height: 1.5; }
#streams-dialog .streams-end-confirm button { min-height: 44px; }
#streams-dialog .streams-end-confirm .plain-action { color: #eee; }
#streams-dialog button:disabled { cursor: default; opacity: .5; }
#streams-dialog :is(button, input, select, summary):focus-visible { outline: 2px solid #f3bb59; outline-offset: 2px; }
#streams-dialog .streams-chat-form input { min-width: 0; }
#streams-dialog .streams-chat-status { flex: none; padding: 8px 14px; color: #ffdda0; background: #302619; font-size: .875rem; line-height: 1.4; }
#streams-dialog .streams-chat-status[hidden] { display: none; }
#streams-dialog .streams-chat-meta button, #streams-dialog .streams-pinned button { min-width: 44px; min-height: 44px; }
#streams-dialog .streams-chat-meta { flex-wrap: wrap; }
#streams-dialog .streams-chat-panel { overscroll-behavior: contain; overflow-wrap: anywhere; }
#streams-dialog .streams-chat-quick > span { flex: 1; min-width: 0; }

@media (min-width: 821px) and (min-height: 561px), (min-width: 1101px) {
  #streams-dialog .streams-chat-column { height: min(740px, 75dvh); }
  #streams-dialog .streams-chat-column .streams-chat-panel { min-height: 80px; }
  #streams-dialog .streams-chat-head { gap: 5px; }
  #streams-dialog .streams-chat-head > div { min-width: 0; }
  #streams-dialog .streams-chat-head strong { white-space: normal; }
  #streams-dialog .streams-chat-quick button { width: 44px; height: 44px; flex: none; }
  #streams-dialog .streams-chat-quick span { font-size: .875rem; }
  #streams-dialog .streams-chat-line, #streams-dialog .streams-chat-form input { font-size: 1rem; }
  #streams-dialog .streams-chat-expand { display: none; }
}

@media (max-width: 820px), (max-width: 1100px) and (max-height: 560px) {
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) {
    position: fixed; top: var(--stream-top, 0px); left: 0; right: auto; bottom: auto;
    width: 100%; max-width: none; height: var(--stream-height, 100dvh); max-height: none;
    margin: 0; padding: 0; border: 0; border-radius: 0; overflow: hidden;
    color: #f1f1f1; background: #0f0f0f;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .play-head { display: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) > .dialog-close {
    position: absolute; z-index: 45; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right));
    width: 44px; height: 44px; border: 1px solid #666; color: #fff; background: rgba(15,15,15,.75);
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .play-body {
    height: 100%; min-height: 0; padding: 0; overflow: hidden; color: #f1f1f1; background: #0f0f0f;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-scene {
    position: relative; display: flex; height: 100%; min-height: 0; gap: 0; padding: 0;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-live-layout {
    display: flex; flex-direction: column; flex: 1; width: 100%; min-width: 0; height: 100%; min-height: 0; gap: 0; overflow: hidden;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-video-column { display: contents; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .dice-call-stage.streams-stage {
    position: relative; top: auto; z-index: 1; flex: 0 0 auto; width: 100%; height: auto; min-height: 0; max-height: 38%;
    margin: 0; aspect-ratio: 16 / 9; border: 0; border-radius: 0; background: #000; box-shadow: none;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-stage video { object-fit: contain; background: #000; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-stage-tools { right: 10px; bottom: 8px; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-stage-tools button { width: 44px; height: 44px; background: rgba(15,15,15,.75); }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-column {
    display: flex; position: relative; flex: 1 1 0; width: 100%; height: auto; min-height: 0; max-height: none;
    margin: 0; padding: 0; overflow: hidden; border: 0; border-top: 1px solid #333; border-radius: 0;
    color: #f1f1f1; background: #0f0f0f; box-shadow: none;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-handle { display: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-head {
    flex: none; min-height: 56px; gap: 4px; padding: 4px 8px 4px 14px; border: 0; background: #0f0f0f;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-head > div { min-width: 0; flex: 1; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-head strong { font-size: 1rem; white-space: normal; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-head div > span { display: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-audience { margin: 0; padding: 0; color: #aaa; background: none; font-size: .75rem; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-close { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; margin: 0; color: #f1f1f1; background: transparent; font-size: 24px; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-tabs { border-bottom: 1px solid #272727; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-extras { max-height: 25%; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-extras:has(.streams-poll-compose) { max-height: 55%; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-panel {
    flex: 1 1 0; height: auto; min-height: 0; max-height: none; padding: 8px; overflow-y: auto; background: #0f0f0f;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-message { padding: 6px; gap: 8px; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-line { color: #eee; font-size: 1rem; line-height: 1.4; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-meta strong { font-size: .875rem; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-meta time { color: #aaa; font-size: .75rem; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-quick { flex: none; display: flex; min-height: 48px; gap: 2px; padding: 2px 8px; border-top: 1px solid #272727; background: #0f0f0f; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-quick button { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; color: #eee; background: transparent; font-size: 22px; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-quick button.active { color: #131313; background: #f5c976; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-quick span { color: #aaa; font-size: .75rem; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-form {
    flex: none; display: flex; gap: 4px; margin: 0 10px max(8px, env(safe-area-inset-bottom)); padding: 4px 4px 4px 14px;
    border: 1px solid #444; border-radius: 28px; background: #212121;
  }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-form input { flex: 1; width: 0; min-width: 0; min-height: 44px; padding: 0; color: #fff; background: none; font-size: 1rem; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-send-button { flex: none; width: 44px; height: 44px; color: #151515; background: #f1f1f1; box-shadow: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-chat-unread { position: absolute; bottom: 118px; z-index: 4; min-height: 44px; font-size: .875rem; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-poll-card { color: #eee; background: #232323; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-poll-card :is(input, button) { min-height: 44px; font-size: .875rem; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .streams-poll-card input { font-size: 1rem; }
  #streams-dialog[data-stream-view="watch"].has-open-chat :is(.streams-watch-footer, .streams-watch-actions) { display: none; }
  #streams-dialog[data-stream-view="watch"] .streams-watch-footer { flex: none; }
  #streams-dialog[data-stream-view="watch"] .streams-watch-title p { font-size: .875rem; }
  #streams-dialog[data-stream-view="watch"] .streams-host-row strong { font-size: 1rem; }
  #streams-dialog[data-stream-view="watch"] .streams-host-row small { font-size: .75rem; }
  #streams-dialog[data-stream-view="watch"] .streams-subscribe { min-height: 44px; font-size: .875rem; }
  #streams-dialog[data-stream-view="watch"] .streams-watch-actions { flex: none; min-height: 64px; }
  #streams-dialog[data-stream-view="watch"] .streams-action-pill { min-height: 44px; gap: 7px; font-size: .875rem; }
  #streams-dialog[data-stream-view="watch"] .streams-action-pill b { font-size: 20px; font-weight: 500; }
  #streams-dialog[data-stream-view="watch"] .streams-chat-preview { flex: none; width: calc(100% - 24px); margin: 12px 12px max(16px, env(safe-area-inset-bottom)); }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]) .is-chat-closed { overflow-y: auto; }
  #streams-dialog[data-stream-view="watch"] .streams-gift-menu {
    position: absolute; z-index: 50; top: auto; left: 0; right: 0; bottom: 0; max-height: 85%;
    margin: 0; padding: 16px 14px max(16px, env(safe-area-inset-bottom)); overflow-y: auto;
  }
  #streams-dialog[data-stream-view="watch"] .streams-gift-menu input { font-size: 1rem; min-height: 44px; }
  #streams-dialog[data-stream-view="watch"] .streams-gift-menu button { min-height: 44px; }
  #streams-dialog[data-stream-view="host"] .streams-live-meta { display: none; }
  #streams-dialog[data-stream-view="host"] .is-chat-closed .streams-live-meta { display: flex; flex: none; padding: 12px; color: #eee; }
  #streams-dialog[data-stream-view="host"] .is-chat-closed .streams-title-field input { font-size: 1rem; min-height: 44px; }
  #streams-dialog[data-stream-view="host"] .streams-action-row { flex: none; display: flex; flex-wrap: nowrap; min-height: 56px; gap: 6px; margin: 0; padding: 6px 10px; overflow-x: auto; background: #181818; }
  #streams-dialog[data-stream-view="host"] .streams-action-row :is(button, .streams-host-controls) { flex-shrink: 0; }
  #streams-dialog[data-stream-view="host"] .streams-action-row button { min-height: 44px; font-size: .875rem; }
  #streams-dialog[data-stream-view="host"] .streams-action-row .streams-stat-row { display: none; }
  #streams-dialog[data-stream-view="host"] .streams-studio-settings { flex: none; background: #181818; border-top: 1px solid #333; }
  #streams-dialog[data-stream-view="host"] .streams-studio-settings[open] { max-height: 35%; }
  #streams-dialog[data-stream-view="host"] .streams-host-settings { padding: 10px; color: #eee; }
  #streams-dialog[data-stream-view="host"] .streams-host-settings label { font-size: .875rem; }
  #streams-dialog[data-stream-view="host"] .streams-host-settings select { min-height: 44px; font-size: 1rem; }
  #streams-dialog[data-stream-view="host"] .streams-viewer-row { flex-wrap: wrap; color: #eee; }
  #streams-dialog[data-stream-view="host"] .streams-viewer-row button { min-height: 44px; font-size: .875rem; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]).has-expanded-chat :is(.streams-action-row, .streams-studio-settings, .dice-note) { display: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]).has-expanded-chat .dice-call-stage.streams-stage { display: block; height: 24%; max-height: 24%; aspect-ratio: auto; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]).has-expanded-chat > .dialog-close { display: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]).has-expanded-chat .streams-chat-head { padding-top: max(4px, env(safe-area-inset-top)); }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]):is(.keyboard-open, .is-composing) :is(.streams-action-row, .streams-studio-settings, .streams-chat-quick, .streams-chat-tabs, .dice-note) { display: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]):is(.keyboard-open, .is-composing) .dice-call-stage.streams-stage { display: block; height: 30%; min-height: 90px; max-height: 34%; aspect-ratio: auto; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]):is(.keyboard-open, .is-composing) .streams-chat-extras { display: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]).keyboard-open > .dialog-close { display: none; }
  #streams-dialog:is([data-stream-view="watch"], [data-stream-view="host"]).keyboard-open .streams-chat-unread { bottom: 72px; }
}

/* Fullscreen owns both the player and conversation, never the video alone. */
#streams-dialog #streams-body:fullscreen { width: 100vw; height: 100dvh; padding: 0; overflow: hidden; background: #0f0f0f; color: #fff; }
#streams-dialog #streams-body:fullscreen .streams-scene { height: 100%; }
#streams-dialog #streams-body:fullscreen .streams-live-layout { height: 100%; min-height: 0; }
#streams-dialog #streams-body:fullscreen .streams-chat-column { height: 100%; max-height: none; min-height: 0; }
#streams-dialog #streams-body:fullscreen .streams-chat-panel { min-height: 0; }
#streams-dialog #streams-body:fullscreen .streams-video-column { justify-content: center; }
#streams-dialog #streams-body:fullscreen .is-chat-closed .streams-stage { flex: 1 1 0; height: auto; min-height: 0; max-height: none; aspect-ratio: auto; }
#streams-dialog #streams-body:fullscreen :is(.streams-watch-footer, .streams-watch-actions) { display: none; }
#streams-dialog.is-theater { position: fixed; inset: 0; width: 100%; max-width: none; height: var(--stream-height, 100dvh); max-height: none; margin: 0; border: 0; border-radius: 0; }
#streams-dialog.is-theater .play-head { display: none; }
#streams-dialog.is-theater .play-body { height: 100%; }
@media (max-width: 820px), (max-width: 1100px) and (max-height: 560px) {
  #streams-dialog #streams-body:fullscreen .streams-chat-column { height: auto; flex: 1 1 0; }
  #streams-dialog[data-stream-view="watch"] .streams-chat-head { min-height: 48px; }
  #streams-dialog[data-stream-view="watch"] .streams-chat-tabs { padding-bottom: 2px; }
  #streams-dialog[data-stream-view="watch"] .streams-chat-quick { min-height: 44px; padding-block: 0; }
}

@media (max-width: 1100px) and (orientation: landscape) {
  #streams-dialog[data-stream-view="watch"].has-open-chat:not(.has-expanded-chat):not(.keyboard-open) .streams-live-layout { flex-direction: row; }
  #streams-dialog[data-stream-view="watch"].has-open-chat:not(.has-expanded-chat):not(.keyboard-open) .dice-call-stage.streams-stage { width: 52%; height: 100%; max-height: none; aspect-ratio: auto; }
  #streams-dialog[data-stream-view="watch"].has-open-chat:not(.has-expanded-chat):not(.keyboard-open) .streams-chat-column { width: 48%; border-top: 0; border-left: 1px solid #333; }
  #streams-dialog[data-stream-view="watch"].has-open-chat:not(.has-expanded-chat):not(.keyboard-open) > .dialog-close { right: calc(48% + 8px); }
  #streams-dialog[data-stream-view="watch"].has-open-chat .streams-chat-quick { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #streams-dialog .streams-gift-burst, #streams-dialog .streams-heart-bursts span { animation-duration: .01ms; }
}

@media (max-width: 820px), (max-width: 1100px) and (max-height: 560px) {
  #streams-dialog .streams-chat-head { align-items: center; }
  #streams-dialog .streams-chat-head .streams-audience { white-space: nowrap; }
  #streams-dialog .streams-chat-quick { align-items: center; gap: 4px; }
  #streams-dialog .streams-chat-quick button { flex-shrink: 0; }
  #streams-dialog .streams-stage-tools button { font-size: 20px; }
}

/* Mobile immersive view: the conversation floats over the complete picture. */
@media (max-width: 820px), (max-width: 1100px) and (max-height: 560px) {
  #streams-dialog.is-fullscreen .streams-live-layout { position: relative; display: block; height: 100%; }
  #streams-dialog.is-fullscreen .streams-video-column { display: contents; }
  #streams-dialog.is-fullscreen #streams-body .dice-call-stage.streams-stage { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
  #streams-dialog.is-fullscreen .streams-stage-tools { top: max(12px,env(safe-area-inset-top)); bottom: auto; left: 12px; right: auto; }
  #streams-dialog.is-fullscreen #streams-body .streams-chat-column { position: absolute; inset: auto 0 0; z-index: 6; width: 100%; height: 48%; max-height: 48%; border: 0; background: linear-gradient(transparent,rgba(0,0,0,.72)); box-shadow: none; }
  #streams-dialog.is-fullscreen .streams-chat-panel { background: transparent; }
  #streams-dialog.is-fullscreen .streams-chat-head { background: rgba(15,15,18,.78); border-radius: 12px 12px 0 0; color: #fff; }
  #streams-dialog.is-fullscreen .streams-chat-message { background: transparent; text-shadow: 0 1px 3px #000; }
  #streams-dialog.is-fullscreen .streams-chat-line { color: #fff; }
  #streams-dialog.is-fullscreen .streams-chat-form { background: rgba(20,20,24,.72); border-color: #777; }
  #streams-dialog.is-fullscreen :is(.streams-chat-tabs,.streams-watch-footer,.streams-watch-actions,.streams-chat-expand,.streams-chat-preview) { display: none; }
  #streams-dialog.is-fullscreen #streams-body .streams-chat-quick { display: flex; background: transparent; border: 0; }
  #streams-dialog.is-fullscreen .streams-chat-quick > span { color: #eee; text-shadow: 0 1px 3px #000; }
  #streams-dialog.is-fullscreen .streams-chat-quick button { background: rgba(20,20,24,.6); }
  #streams-dialog.is-fullscreen .streams-chat-quick button.active { color: #111; background: #f5c976; }
  #streams-dialog.is-fullscreen .streams-gift-menu { position: absolute; z-index: 20; inset: auto 8px max(8px,env(safe-area-inset-bottom)); width: auto; max-height: 75%; overflow-y: auto; padding: 16px; color: #fff; background: #202024; border: 1px solid #555; border-radius: 20px; }
  #streams-dialog.is-fullscreen .streams-gift-menu input { color: #fff; background: #34343b; font-size: 16px; }
  #streams-dialog.is-fullscreen .streams-gift-menu button { min-height: 44px; }
  #streams-dialog.is-fullscreen .is-chat-closed .streams-chat-column { display: none; }
  #streams-dialog.is-fullscreen > .dialog-close { right: 8px; }
  #streams-dialog.is-fullscreen.keyboard-open #streams-body .streams-chat-column { height: 65%; max-height: 65%; }
  #streams-dialog.is-fullscreen #streams-body:fullscreen { height: var(--stream-height,100dvh); }
  #streams-dialog.is-fullscreen .streams-live-badge { top: 68px; left: 12px; right: auto; }
  #streams-dialog.is-fullscreen .streams-viewer-menu { top: 68px; right: 12px; }
  #streams-dialog.is-fullscreen .streams-chat-head { padding-right: 8px; }
}
