:root { color-scheme: dark; font: 16px/1.5 system-ui, sans-serif; background: #100f1e; color: #f4f0ff; }
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 52rem; margin: auto; padding: 1rem; }
section { background: #1d1d34; border: 1px solid #424060; border-radius: .9rem; padding: 1rem; margin: 1rem 0; }
h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
form { display: grid; gap: .65rem; }
input, button { font: inherit; min-height: 44px; }
input:not([type=checkbox]), button { max-width: 100%; border-radius: .5rem; border: 1px solid #767298; padding: .5rem .7rem; }
input:not([type=checkbox]) { width: 100%; background: #151428; color: inherit; }
input[type=checkbox] { min-height: 0; }
button { cursor: pointer; background: #cab9ff; color: #17112b; }
ul, ol { padding: 0; list-style: none; }
li { overflow-wrap: anywhere; margin: .5rem 0; }
#members li { display: flex; gap: .65rem; align-items: center; flex-wrap: wrap; }
#members img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
#messages { max-height: 48vh; overflow-y: auto; }
#messages li { white-space: pre-wrap; background: #151428; padding: .55rem .7rem; border-radius: .5rem; }

#video { display: block; width: 100%; max-height: 68vh; background: #000; margin-bottom: .75rem; }

[hidden] { display: none !important; }
main { max-width: 80rem; }
.room-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.room-header a { color: #cab9ff; }
.screen-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem); gap: 1rem; align-items: start; }
.screen-layout section { margin-top: 0; }
.screen { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; background: #0b0915; border-radius: .65rem; overflow: hidden; }
#video { display: block; width: 100%; height: 100%; max-height: none; margin: 0; object-fit: contain; }
#empty-video { text-align: center; color: #dfd4ff; padding: 1rem; }
.screen-play { display: inline-grid; place-items: center; width: 4rem; height: 4rem; border: 1px solid #a087e6; border-radius: 50%; box-shadow: 0 0 28px #9c7dea45; animation: screen-pulse 3s ease-in-out infinite alternate; }
@keyframes screen-pulse { to { transform: scale(1.09); box-shadow: 0 0 36px #9c7dea80; } }
.screen-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; }
.file-action, #choose-video { margin-top: .75rem; }
.file-action { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: .5rem .75rem; border-radius: .5rem; background: #cab9ff; color: #17112b; cursor: pointer; overflow: hidden; }
.file-action:focus-within { outline: 2px solid #e2d5ff; outline-offset: 3px; }
.file-action input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#follow { position: absolute; z-index: 1; }
.profile { margin-bottom: 1rem; }
.profile summary { cursor: pointer; }
#online-count { font-weight: normal; color: #bbacd6; white-space: nowrap; }
@media(max-width:760px) { .screen-layout { grid-template-columns: minmax(0,1fr); } }
@media(prefers-reduced-motion:reduce) { .screen-play { animation: none; } }

#members .member-profile, #messages .member-profile {
  display: inline-flex; align-items: center; gap: .55rem; min-height: 32px;
  border: 0; padding: .25rem; background: transparent; color: #f0e9ff; text-align: left;
}
.member-profile:hover { text-decoration: underline; }
.member-profile > img, .member-profile > span, .profile-avatar > img, .profile-avatar > span {
  width: 2rem; height: 2rem; flex: none; border-radius: 50%; object-fit: cover;
  background: #563e80; color: white; display: inline-grid; place-items: center;
}
#members small { color: #c8b7df; }
#messages { min-height: 9rem; }
#messages li { width: fit-content; max-width: 94%; min-width: 48%; border: 1px solid #383152; }
#messages .message-mine { margin-left: auto; background: #352650; }
#messages p { margin: .2rem .25rem; }
.message-author { display: flex; align-items: center; gap: .7rem; }
.message-author time { margin-left: auto; color: #c8b7df; font-size: .75rem; }
#compose { display: grid; grid-template-columns: minmax(0,1fr) auto; }
#compose label { grid-column: 1 / -1; }
#profile-dialog {
  width: min(32rem,calc(100% - 2rem)); max-height: 88vh; padding: 0;
  border-radius: 1rem; border: 1px solid #78669a; background: #211a36; color: #f5eaff;
  box-shadow: 0 24px 80px #080612aa;
}
#profile-dialog::backdrop { background: #090613bf; }
#profile-dialog[open] { animation: profile-enter .24s ease-out; }
@keyframes profile-enter { from { opacity: 0; transform: translateY(.6rem); } }
.profile-cover { position: relative; height: 9rem; background: linear-gradient(120deg,#336b76,#593872 60%,#2d2a5d); }
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
#profile-close { position: absolute; top: .65rem; right: .65rem; }
.profile-content { padding: 0 1rem 1rem; }
.profile-avatar { position: relative; margin-top: -2rem; }
.profile-avatar > img, .profile-avatar > span { width: 4.5rem; height: 4.5rem; border: 4px solid #211a36; font-size: 1.8rem; }
#profile-title { margin: .5rem 0 .35rem; overflow-wrap: anywhere; }
#profile-bio { color: #e2d4f4; overflow-wrap: anywhere; white-space: pre-wrap; }
#bio { width: 100%; padding: .6rem; border-radius: .5rem; font: inherit; background: #151428; color: inherit; }
@media(prefers-reduced-motion:reduce) { #profile-dialog[open] { animation: none; } }
