:root {
  --page-bg: #0B1220;
  --panel-bg: rgba(19, 28, 46, 0.52);
  --panel-border: rgba(148, 163, 184, 0.12);
  --text: #E2E8F0;
  --muted-text: #93A4BC;
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-text: #E2E8F0;
  --theme-fade: 1.5s;
  --cs-bg: #f4a13a;
  --cs-text: #1a4a9e;
  --siege-bg: #000000;
  --siege-text: #ffffff;
  --marathon-bg: #b7ff2a;
  --marathon-text: #101010;
  --theme-panel-bg: rgba(19, 28, 46, 0.52);
  --theme-text: #E2E8F0;
  --theme-accent: #E2E8F0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: "Segoe UI Variable", "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html {
  scrollbar-width: thin;
}

body {
  background: var(--page-bg);
  color: var(--text);
  transition: background-color var(--theme-fade) ease;
  padding: 0 24px 24px;
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  height: 100vh;
}

#pageThemeOverlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transition:
    opacity var(--theme-fade) ease,
    background-image var(--theme-fade) ease;
}

#ambientVignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: transparent;
}

#flashbangOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: #ffffff;
  opacity: 0;
}

#flashbangOverlay.flashbang-active {
  animation: flashbangFade 1.35s ease-out forwards;
}

#marathonBootOverlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
}

#marathonBootOverlay.marathon-boot-active {
  animation: marathonBootFade 1.2s linear forwards;
}

#marathonBootOverlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.92));
  opacity: 0;
}

#marathonBootOverlay.marathon-boot-active::before {
  animation: marathonBlackField 1.2s linear forwards;
}

.marathonBlackout {
  position: absolute;
  inset: 0;
  background: #000000;
  opacity: 0;
}

#marathonBootOverlay.marathon-boot-active .marathonBlackout {
  animation: marathonBlackoutWave 1.2s linear forwards;
}

.marathonGrid {
  position: absolute;
  inset: -8%;
  opacity: 0;
  background-image:
    linear-gradient(rgba(183, 255, 42, 0.44) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 82, 255, 0.28) 1px, transparent 1px);
  background-size: 28px 44px, 44px 28px;
  transform-origin: 50% 50%;
  mix-blend-mode: screen;
}

#marathonBootOverlay.marathon-boot-active .marathonGrid {
  animation: marathonGridPresence 1.2s linear forwards;
}

.marathonScanline {
  position: absolute;
  left: 0;
  right: 0;
  top: -24%;
  height: 30%;
  opacity: 0;
  background: linear-gradient(
    to bottom,
    rgba(183, 255, 42, 0) 0%,
    rgba(34, 82, 255, 0.18) 8%,
    rgba(183, 255, 42, 0.52) 18%,
    rgba(183, 255, 42, 0.96) 40%,
    rgba(213, 255, 120, 1) 50%,
    rgba(60, 110, 255, 0.82) 58%,
    rgba(183, 255, 42, 0.96) 68%,
    rgba(183, 255, 42, 0.42) 84%,
    rgba(34, 82, 255, 0.16) 92%,
    rgba(183, 255, 42, 0) 100%
  );
  filter: blur(12px);
  box-shadow:
    0 0 60px rgba(183, 255, 42, 0.92),
    0 0 110px rgba(34, 82, 255, 0.26),
    0 0 140px rgba(183, 255, 42, 0.32);
}

#marathonBootOverlay.marathon-boot-active .marathonScanline {
  animation: marathonScanRoundTrip 1.2s cubic-bezier(0.18, 0.7, 0.2, 1) forwards;
}

.marathonRevealMask {
  position: absolute;
  inset: 0;
  background: #000000;
  opacity: 0;
}

#marathonBootOverlay.marathon-boot-active .marathonRevealMask {
  animation: marathonRevealWave 1.2s linear forwards;
}

.marathonBrackets {
  position: absolute;
  inset: 0;
  opacity: 0;
}

#marathonBootOverlay.marathon-boot-active .marathonBrackets {
  animation: marathonBracketFade 1.2s linear forwards;
}

.marathonBracket {
  position: absolute;
  width: 88px;
  height: 88px;
  border-color: rgba(213, 255, 120, 1);
  filter:
    drop-shadow(0 0 16px rgba(183, 255, 42, 0.7))
    drop-shadow(0 0 10px rgba(34, 82, 255, 0.32));
}

.marathonBracket.tl {
  top: 34px;
  left: 34px;
  border-top: 3px solid;
  border-left: 3px solid;
}

.marathonBracket.tr {
  top: 34px;
  right: 34px;
  border-top: 3px solid;
  border-right: 3px solid;
}

.marathonBracket.bl {
  bottom: 34px;
  left: 34px;
  border-bottom: 3px solid;
  border-left: 3px solid;
}

.marathonBracket.br {
  bottom: 34px;
  right: 34px;
  border-bottom: 3px solid;
  border-right: 3px solid;
}

@keyframes marathonBootFade {
  0% { opacity: 0; }
  2% { opacity: 1; }
  98% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes marathonBlackField {
  0% { opacity: 0; }
  24% { opacity: 0.18; }
  42% { opacity: 0.55; }
  52% { opacity: 1; }
  74% { opacity: 1; }
  92% { opacity: 0.18; }
  100% { opacity: 0; }
}

@keyframes marathonBlackoutWave {
  0% { opacity: 0; clip-path: inset(0 0 100% 0); }
  42% { opacity: 1; clip-path: inset(0 0 8% 0); }
  52% { opacity: 1; clip-path: inset(0 0 0 0); }
  74% { opacity: 1; clip-path: inset(0 0 0 0); }
  92% { opacity: 1; clip-path: inset(100% 0 0 0); }
  100% { opacity: 0; clip-path: inset(100% 0 0 0); }
}

@keyframes marathonGridPresence {
  0% { opacity: 0; transform: scale(1.01); }
  18% { opacity: 0.42; transform: scale(1.015); }
  42% { opacity: 0.7; transform: scale(1.02); }
  52% { opacity: 0.9; transform: scale(1.02); }
  74% { opacity: 0.9; transform: scale(1.02); }
  92% { opacity: 0.3; transform: scale(1.01); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes marathonScanRoundTrip {
  0% { top: -24%; opacity: 0; }
  5% { opacity: 1; }
  42% { top: 98%; opacity: 1; }
  50% { top: 112%; opacity: 0; }
  56% { top: 112%; opacity: 0; }
  62% { top: 112%; opacity: 1; }
  92% { top: -24%; opacity: 1; }
  100% { top: -32%; opacity: 0; }
}

@keyframes marathonRevealWave {
  0% { opacity: 0; clip-path: inset(0 0 0 0); }
  52% { opacity: 1; clip-path: inset(0 0 0 0); }
  74% { opacity: 1; clip-path: inset(0 0 0 0); }
  92% { opacity: 1; clip-path: inset(100% 0 0 0); }
  100% { opacity: 0; clip-path: inset(100% 0 0 0); }
}

@keyframes marathonBracketFade {
  0% { opacity: 0; transform: scale(1.03); }
  8% { opacity: 1; transform: scale(1); }
  58% { opacity: 0.92; transform: scale(1); }
  68% { transform: translate(4px, -2px); }
  73% { transform: translate(-3px, 3px); }
  78% { transform: translate(2px, -4px); }
  83% { transform: translate(-4px, 1px); }
  88% { transform: translate(3px, 2px); }
  93% { transform: translate(-2px, -3px); }
  100% { opacity: 0; transform: translate(0, 0) scale(1); }
}

@keyframes flashbangFade {
  0% { opacity: 0; }
  8% { opacity: 1; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes siegeRoomBlurIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(10px);
  }
  45% {
    opacity: 0.48;
    transform: translateY(4px);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

#imageLightbox {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

#imageLightbox.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.imageLightboxClose {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}

.imageLightboxImg {
  max-width: min(92vw, 1600px);
  max-height: 88vh;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}

.pasteConfirmModal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.pasteConfirmModal.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pasteConfirmCard {
  width: min(92vw, 520px);
  border-radius: 24px;
  padding: 18px;
  background: rgba(19, 28, 46, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.pasteConfirmTitle {
  margin: 0 0 12px;
  font-size: 20px;
  text-align: center;
}

.pasteConfirmPreview {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
}

.pasteConfirmActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.pasteConfirmBtn {
  border: none;
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
}

.pasteConfirmBtn.secondary {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.pasteConfirmBtn.primary {
  background: var(--theme-accent);
  color: #0b1220;
}

#appRoot,
#settingsCog,
#controlsPanel,
#login {
  position: relative;
  z-index: 1;
}

.loginBody {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  height: 100vh;
  padding: 16px;
  overflow: hidden;
  background:
    linear-gradient(rgba(8, 12, 22, 0.58), rgba(8, 12, 22, 0.58)),
    var(--page-bg);
}

#login {
  width: min(100%, 860px);
  max-height: calc(100vh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(19, 28, 46, 0.68);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 28px;
  padding: 22px 30px;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.28);
}

.loginTitle {
  margin: 0 0 12px;
  font-size: clamp(30px, 3.2vw, 42px);
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--text);
  text-align: center;
}

.disclaimer {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--muted-text);
  overflow-wrap: break-word;
}

.loginFields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.loginField input {
  width: 100%;
  font-size: 18px;
  line-height: 1.2;
  padding: 13px 16px 14px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  text-align: center;
}

.loginField input {
  width: 100%;
  font-size: 18px;
  line-height: 1.25;
  padding: 14px 16px 17px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  text-align: center;
}

.loginButtonWrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.loginButtonRow {
  gap: 12px;
  flex-wrap: wrap;
}

#loginButton,
#registerButton {
  border: none;
  border-radius: 16px;
  padding: 14px 22px 15px;
  font-size: 18px;
  line-height: 1.15;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 180px;
}

#topBar {
  height: 48px;
  display: flex;
  align-items: center;
  padding-right: 72px;
  margin-top: 10px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

#appNameWrap {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  height: 48px;
}

#appName {
  font-size: 34px;
  line-height: 1.08;
  font-weight: 650;
  letter-spacing: -0.04em;
  color: currentColor;
  transition:
    color var(--theme-fade) ease,
    text-shadow var(--theme-fade) ease;
}

#appLogoMask {
  width: 38px;
  height: 38px;
  display: inline-block;
  background-color: currentColor;
  mask: url("/images/logo-white.png") center / contain no-repeat;
  -webkit-mask: url("/images/logo-white.png") center / contain no-repeat;
}

body.room-active #appName {
  text-shadow: 0 5px 16px rgba(0, 0, 0, 0.54);
}

#settingsCog {
  position: fixed;
  top: 10px;
  right: 24px;
  z-index: 80;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 16px;
  background: rgba(19, 28, 46, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  padding: 0;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease;
}

#settingsCog:hover {
  transform: translateY(-1px);
  background: rgba(30, 41, 59, 0.82);
}

#settingsCog svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

#controlsPanel {
  position: fixed;
  top: 64px;
  right: 24px;
  z-index: 79;
  width: 320px;
  max-width: calc(100vw - 20px);
  background: rgba(19, 28, 46, 0.78);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.28);
  display: none;
}

#controlsPanel.open {
  display: block;
}

#controlsPanel h3 {
  margin: 0 0 14px;
  font-size: 21px;
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--text);
}

.controlGroup {
  margin-bottom: 14px;
}

.controlGroup label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.24;
  color: var(--muted-text);
}

.controlGroup input[type="range"] {
  width: 100%;
}

#micMeter {
  width: 100%;
  height: 32px;
  display: block;
  background: rgba(10, 15, 25, 0.95);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

#appRoot {
  width: 100%;
  min-height: calc(100dvh - 34px);
  height: calc(100dvh - 34px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#channelStage {
  position: relative;
  min-height: 196px;
  margin-bottom: 12px;
  flex-shrink: 0;
  width: 100%;
}

body.room-active #channelStage {
  min-height: 196px;
  height: 196px;
  margin-bottom: 18px;
  flex-basis: 196px;
}

.viewSection {
  width: 100%;
  transition:
    opacity var(--theme-fade) ease,
    transform var(--theme-fade) ease,
    visibility var(--theme-fade) ease;
}

#landingView,
#joinedView {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Keep stacking order */
#landingView {
  z-index: 1;
}

#joinedView {
  z-index: 2;
}

.viewSection.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.viewSection.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
}

#landingView.is-visible {
  pointer-events: auto;
}

#landingView.is-hidden {
  pointer-events: none;
}

body.preload-room-shell #joinedView {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none !important;
  transform: translateY(0) !important;
}

body.room-active #joinedView.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

body.room-active #joinedView.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px);
}

body.instant-hide-lobby #landingView,
body.instant-hide-lobby .voiceCard,
body.instant-hide-lobby .voiceCardFront,
body.instant-hide-lobby .voiceCardUsers,
body.instant-hide-lobby .voiceCardImage,
body.instant-hide-lobby .voiceCardShade,
body.instant-hide-lobby .voiceCardTint {
  transition: none !important;
}

#cardsGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 28px;
  align-items: stretch;
}

.voiceCard {
  min-height: 196px;
  height: 196px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  position: relative;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    opacity var(--theme-fade) ease;
  overflow: hidden;
  font-family: inherit;
  background: transparent;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
}

.voiceCard:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 48px rgba(0, 0, 0, 0.26);
}

.voiceCardImage,
.voiceCardShade,
.voiceCardTint {
  position: absolute;
  inset: 0;
}

.voiceCardImage {
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 1;
  transition:
    opacity 0.32s ease,
    transform 0.32s ease;
}

.voiceCardShade {
  background: linear-gradient(
    to top,
    rgba(2, 6, 23, 0.72) 0%,
    rgba(2, 6, 23, 0.22) 42%,
    rgba(2, 6, 23, 0.04) 100%
  );
  opacity: 1;
  transition: opacity 0.32s ease;
}

.voiceCardTint {
  opacity: 0;
  transition: opacity 0.32s ease;
}

.voiceCard:hover .voiceCardImage {
  opacity: 0.12;
  transform: scale(1.015);
}

.voiceCard:hover .voiceCardShade {
  opacity: 0.2;
}

.voiceCard:hover .voiceCardTint {
  opacity: 1;
}

.voiceCardFront,
.voiceCardUsers {
  position: relative;
  z-index: 1;
}

.voiceCardFront {
  align-self: flex-start;
  max-width: 80%;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.voiceCardMeta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
  margin-bottom: 8px;
}

.voiceCardTitle {
  font-size: 28px;
  line-height: 1.12;
  margin: 0 0 6px;
  letter-spacing: -0.04em;
  color: #ffffff;
  padding-bottom: 2px;
}

.voiceCardCount {
  font-size: 15px;
  line-height: 1.18;
  color: rgba(255, 255, 255, 0.78);
  padding-bottom: 2px;
}

.voiceCardUsers {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 0.24s ease,
    transform 0.24s ease;
  padding-top: 18px;
  overflow: hidden;
}

.voiceCard:hover .voiceCardUsers {
  opacity: 1;
  transform: translateY(0);
}

.voiceCard:hover .voiceCardFront {
  opacity: 0;
  transform: translateY(-6px);
}

.hoverTitle {
  font-size: 29px;
  text-align: center;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  letter-spacing: -0.03em;
  line-height: 1.18;
  padding-bottom: 4px;
}

.hoverName,
.emptyRoom {
  opacity: 0;
  transform: translateY(8px);
  animation: hoverReveal 0.28s ease forwards;
  animation-delay: calc(var(--stagger, 1) * 40ms);
}

.hoverName {
  font-size: 20px;
  line-height: 1.22;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding-bottom: 2px;
}

.emptyRoom {
  font-size: 18px;
  opacity: 0.88;
  margin-top: 4px;
  line-height: 1.2;
  padding-bottom: 2px;
}

@keyframes hoverReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.csCard {
  color: var(--cs-text);
}

.siegeCard {
  color: var(--siege-text);
}

.marathonCard {
  color: var(--marathon-text);
}

#activeChannelCard,
#chatShell {
  position: relative;
  z-index: 2;
  color: var(--theme-text);
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
  transition:
    background-color var(--theme-fade) ease,
    color var(--theme-fade) ease,
    border-color var(--theme-fade) ease,
    opacity var(--theme-fade) ease,
    transform var(--theme-fade) ease,
    box-shadow var(--theme-fade) ease;
  isolation: isolate;
  width: 100%;
  max-width: 100%;
}

#activeChannelCard {
  width: 100%;
  border-radius: 30px;
  min-height: 196px;
  height: 196px;
  padding: 14px 24px 14px;
  margin: 0;
  overflow: hidden;
  background: var(--theme-panel-bg);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  opacity: 1;
  transform: translateY(0);
}

body.preload-room-shell #activeChannelCard {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

#activeChannelTitle,
#joinedUsersRow,
#leaveChannelButton {
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

body.room-shell-hidden #activeChannelTitle,
body.room-shell-hidden #joinedUsersRow,
body.room-shell-hidden #leaveChannelButton {
  opacity: 0;
  visibility: hidden;
}

body.room-shell-hidden #joinedView,
body.room-shell-hidden #activeChannelCard,
body.room-shell-hidden #chatShell {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#chatShell {
  width: 100%;
  border-radius: 30px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 16px;
  overflow: hidden;
  background: rgba(19, 28, 46, 0.38);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

body.room-active #activeChannelCard,
body.room-active #chatShell {
  background: var(--theme-panel-bg);
  color: var(--theme-text);
}

body.room-active #chatShell {
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

body.siege-room-blur-join #activeChannelCard,
body.siege-room-blur-join #chatShell {
  animation: siegeRoomBlurIn 650ms ease-out forwards;
}

#leaveChannelButton {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 50px;
  height: 42px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: inherit;
  padding: 0;
  z-index: 3;
  line-height: 0;
}

#leaveChannelButton svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  display: block;
}

#activeChannelTitle {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 34px;
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.045em;
  padding: 0 84px;
  width: calc(100% - 180px);
  z-index: 2;
}

#joinedUsersRow {
  display: grid;
  justify-content: center;
  align-items: start;
  align-content: start;
  gap: 14px;
  width: 100%;
  padding-top: 52px;
  position: relative;
  z-index: 2;
}

#joinedUsersRow[data-slots="5"] {
  grid-template-columns: repeat(5, minmax(150px, 190px));
}

#joinedUsersRow[data-slots="3"] {
  grid-template-columns: repeat(3, minmax(150px, 190px));
}

.joinedUserTile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding-top: 0;
}

.joinedUserTile[data-slot="0"] { grid-column: 1; }
.joinedUserTile[data-slot="1"] { grid-column: 2; }
.joinedUserTile[data-slot="2"] { grid-column: 3; }
.joinedUserTile[data-slot="3"] { grid-column: 4; }
.joinedUserTile[data-slot="4"] { grid-column: 5; }

.joinedUserPlaceholder {
  font-size: 18px;
  line-height: 1.2;
  color: var(--muted-text);
}

.joinedUserName {
  font-size: 20px;
  text-align: center;
  line-height: 1.28;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  max-width: 100%;
  letter-spacing: -0.02em;
  padding-bottom: 2px;
}

.selfSuffix {
  font-size: 14px;
  opacity: 0.78;
}

.adminCrowns {
  display: inline-block;
  margin-left: 6px;
  font-size: 14px;
  line-height: 1;
  vertical-align: 1px;
  color: currentColor;
}

.volumeControlRow {
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr 18px;
  align-items: center;
  gap: 10px;
}

.volSymbol {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  color: var(--theme-accent);
}

.userVolumeSlider {
  width: 100%;
  accent-color: var(--theme-accent);
}

.userMuteRow {
  display: flex;
  justify-content: center;
  width: 100%;
}

.userMuteButton,
.adminActionBtn {
  border: none;
  border-radius: 12px;
  padding: 7px 11px;
  cursor: pointer;
  min-width: 44px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.userMuteButton {
  background: var(--theme-accent);
  color: #0b1220;
  border: 1px solid transparent;
  box-shadow: none;
}

.userMuteButton.is-muted {
  background: #ef4444;
  color: #ffffff;
}

.userMuteIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  line-height: 0;
}

.userMuteIcon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}

.adminActionBtn {
  background: rgba(255,255,255,0.08);
  color: var(--theme-accent);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.userActionsRow {
  display: flex;
  gap: 8px;
  align-items: center;
}

.userVolumeSlider:disabled {
  opacity: 0.55;
  cursor: default;
}

.speakingGlow {
  text-shadow: 0 0 10px currentColor;
  font-weight: 700;
}

#messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 16px;
  position: relative;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--theme-accent) rgba(255, 255, 255, 0.06);
}

#messages::-webkit-scrollbar {
  width: 12px;
}

#messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

#messages::-webkit-scrollbar-thumb {
  background: var(--theme-accent);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.messageRow {
  margin-bottom: 16px;
}

.messageSender {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-text);
  margin-bottom: 6px;
  line-height: 1.25;
  padding-bottom: 2px;
}

.messageBubble {
  display: inline-block;
  max-width: min(740px, 100%);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(148, 163, 184, 0.10);
  border-radius: 18px;
  padding: 12px 14px 13px;
  font-size: 16px;
  line-height: 1.58;
  word-break: break-word;
  box-shadow: none;
}

.messageBubble a {
  color: inherit;
}

.messageImage {
  display: block;
  max-width: min(440px, 100%);
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
  margin-top: 8px;
  cursor: pointer;
}

.messageVideo {
  display: block;
  width: min(520px, 100%);
  max-width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 12px;
  margin-top: 8px;
  background: #000;
}

.linkPreview {
  margin-top: 10px;
  display: block;
  max-width: min(560px, 100%);
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(255,255,255,0.03);
  border-radius: 16px;
  overflow: hidden;
}

.linkPreviewMedia {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.linkPreviewBody {
  padding: 12px 14px;
}

.linkPreviewTitle {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.linkPreviewDesc {
  font-size: 13px;
  color: var(--muted-text);
}

#chatInputRow {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

#msgInput {
  flex: 1;
  border: none;
  outline: none;
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--theme-accent);
  font-size: 18px;
  line-height: 1.22;
  padding: 15px 20px 17px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    color var(--theme-fade) ease,
    background-color var(--theme-fade) ease;
}

#msgInput::placeholder {
  color: var(--theme-accent);
  opacity: 0.78;
  transition: color var(--theme-fade) ease;
}

#sendButton {
  border: none;
  border-radius: 18px;
  padding: 13px 18px 14px;
  font-size: 16px;
  line-height: 1.12;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: var(--theme-accent);
  border: 1px solid rgba(148, 163, 184, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    background-color var(--theme-fade) ease,
    color var(--theme-fade) ease,
    border-color var(--theme-fade) ease,
    box-shadow var(--theme-fade) ease;
}

#sendButton:hover {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

@media (max-height: 900px) {
  .loginBody {
    padding: 12px;
  }

  #login {
    max-height: calc(100vh - 24px);
    padding: 18px 24px;
  }

  .loginTitle {
    margin-bottom: 10px;
    font-size: clamp(26px, 3vw, 36px);
  }

  .disclaimer {
    font-size: 13px;
    line-height: 1.42;
    margin-bottom: 12px;
  }

  .loginFields {
    gap: 12px;
    margin-bottom: 12px;
  }

  .loginField input {
    padding: 11px 14px 12px;
    font-size: 17px;
  }

  #loginButton,
  #registerButton {
    padding: 12px 18px 13px;
    font-size: 17px;
    min-width: 170px;
  }
}

@media (max-width: 1100px) {
  .loginFields {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #cardsGrid {
    grid-template-columns: 1fr;
  }

  .voiceCard {
    min-height: 260px;
    height: 260px;
  }

  body.room-active #channelStage {
    min-height: 170px;
    height: 170px;
    flex-basis: 170px;
    margin-bottom: 18px;
  }

  #activeChannelCard {
    min-height: 170px;
    height: 170px;
    padding: 12px 18px 12px;
  }

  #activeChannelTitle {
    top: 12px;
    font-size: 28px;
    height: 36px;
    width: calc(100% - 132px);
    padding: 0 60px;
  }

  #leaveChannelButton {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
  }

  #joinedUsersRow {
    padding-top: 46px;
    gap: 10px;
  }

  #joinedUsersRow[data-slots="5"] {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

  #joinedUsersRow[data-slots="3"] {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

  .joinedUserTile[data-slot="0"] { grid-column: 1; }
  .joinedUserTile[data-slot="1"] { grid-column: 1; }
  .joinedUserTile[data-slot="2"] { grid-column: 2; }
  .joinedUserTile[data-slot="3"] { grid-column: 3; }
  .joinedUserTile[data-slot="4"] { grid-column: 3; }

  .joinedUserName {
    font-size: 17px;
  }

  .selfSuffix,
  .adminCrowns {
    font-size: 12px;
  }

  .volumeControlRow {
    gap: 6px;
    grid-template-columns: 14px 1fr 14px;
  }

  .volSymbol {
    font-size: 14px;
  }

  .userMuteButton,
  .adminActionBtn {
    min-width: 38px;
    min-height: 32px;
    padding: 6px 9px;
  }

  .userMuteIcon,
  .userMuteIcon svg {
    width: 16px;
    height: 16px;
  }

  #chatShell {
    min-height: 160px;
    padding: 16px 16px 14px;
  }

  #messages {
    min-height: 90px;
  }
}


body.room-active .joinedUserPlaceholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding-top: 24px;
}

@media (max-width: 700px) {
  body.room-active #channelStage {
    min-height: 156px;
    height: 156px;
    flex-basis: 156px;
  }

  #activeChannelCard {
    min-height: 156px;
    height: 156px;
    padding: 10px 14px;
  }

  #activeChannelTitle {
    top: 10px;
    font-size: 24px;
    height: 34px;
    width: calc(100% - 104px);
    padding: 0 48px;
  }

  #leaveChannelButton {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }

  #joinedUsersRow {
    padding-top: 42px;
    gap: 8px;
  }

  #chatShell {
    min-height: 150px;
    padding: 14px 14px 12px;
  }
}


/* Siege locked overlay */
/* Disable clicking Siege card */
.voiceCard[data-channel="siege"] {
    cursor: not-allowed;
}

/* Centered hover text for locked Siege */
.siegeLockedHover {
    max-width: 85%;
    margin: 0 auto;
    text-align: center;
    white-space: normal;
    font-weight: 500;
    letter-spacing: 0.5px;
}
