/* SPDX-License-Identifier: LicenseRef-AGPL-3.0-only-OpenSSL */

/*
 * Everything that lies on top of the game picture while playing. It is made to
 * look and behave like the app: the display (StreamHud.qml), the stream menu
 * (StreamMenuContent.qml, PlayTogetherBar.qml), the chat (StreamChatPanel.qml)
 * and the options (StreamDisplayPanel.qml, DisplayOptions.qml). Sizes and
 * colours are the ones written there.
 */

.stage {
  --g-accent: #8c52ff;
  --g-pink: #f0469b;
  --g-cyan: #00f2ff;
  --g-green: #34d399;
  --g-amber: #fbbf24;
  --g-red: #f0466e;
  --g-sheet: rgba(13, 11, 31, 0.97);
  color: #fff;
  font-size: 14px;
  line-height: 1.25;
}

/* ================================================================ the display */

.hud {
  --hud-accent: #8c52ff;
  --hud-cyan: #00f2ff;
  --hud-green: #34d399;
  --hud-red: #f0466e;
  --hud-glass: rgba(12, 10, 26, 0.72);
  --hud-box: transparent;
  --hud-line: 0 0 0 0 transparent;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  color: #fff;
}

.hud.glass {
  --hud-box: var(--hud-glass);
}

.hud.solid {
  --hud-box: #10101a;
}

/* Something else is in front: the stream menu */
.hud.away {
  visibility: hidden;
}

.hud-veil {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.hud-layer {
  position: absolute;
  inset: 0;
}

.hud-el {
  position: absolute;
}

.hud-holder {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  transform-origin: 0 0;
}

/* Arrange mode: a frame to grab, and the element's own switches */
.hud-frame {
  display: none;
  position: absolute;
  inset: -6px;
  /* As in the app: a dashed cyan line, filled only while it is held */
  border: 2px dashed rgba(0, 242, 255, 0.85);
  border-radius: 14px;
  background: transparent;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
}

.hud.editing .hud-frame {
  display: block;
}

.hud-frame.grabbed {
  border-color: #ffffff;
  background: rgba(0, 242, 255, 0.1);
  cursor: grabbing;
}

.hud-tools {
  position: absolute;
  left: -2px;
  top: -30px;
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

.hud-tools.below {
  top: calc(100% + 6px);
}

.hud-tools.from-right {
  left: auto;
  right: -2px;
}

.hud-tool-title {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  background: #7ff5ff;
  color: #04262a;
  font-size: 12px;
  font-weight: bold;
  line-height: 24px;
}

.stage .hud-tool {
  height: 24px;
  min-width: 24px;
  padding: 0 8px;
  border: 1px solid rgba(0, 242, 255, 0.5);
  border-radius: 12px;
  background: rgba(8, 6, 20, 0.88);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
}

.stage .hud-tool:hover {
  background: var(--hud-accent);
}

/* ---------------------------------------------------------------- players */

.hud-players {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.hud-players.vertical {
  flex-direction: column;
}

.hud-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px 0 6px;
  border-radius: 23px;
  background: var(--hud-box);
  white-space: nowrap;
}

.hud.glass .hud-chip,
.hud.solid .hud-chip {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.hud.glass .hud-chip.control,
.hud.solid .hud-chip.control {
  box-shadow: inset 0 0 0 2px var(--hud-accent);
}

.hud-chip-end {
  width: 4px;
}

.hud-chip-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hud-chip-name {
  font-size: 14px;
  font-weight: bold;
  line-height: 17px;
}

/* Without a box behind it, an outline keeps it readable on any game picture */
.hud.plain .hud-chip-name {
  text-shadow: -1px 0 rgba(0, 0, 0, 0.85), 1px 0 rgba(0, 0, 0, 0.85), 0 -1px rgba(0, 0, 0, 0.85), 0 1px rgba(0, 0, 0, 0.85);
}

.hud-chip-name.control {
  color: var(--hud-cyan);
}

.hud-chip-name.talking {
  color: var(--hud-green);
}

.hud-chip-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  font-weight: bold;
  line-height: 11px;
}

.hud-chip-tags:empty {
  display: none;
}

.hud-tag-host {
  color: var(--hud-cyan);
}

/* Each their own controller: the player the game sees */
.hud-tag-player {
  color: #7dd3fc;
}

.hud-tag-watching {
  opacity: 0.6;
}

.hud-tag-muted {
  color: var(--hud-red);
}

.hud-tag-live {
  padding: 0 4px;
  border-radius: 3px;
  background: #e91916;
  color: #fff;
}

.hud-battery {
  display: flex;
  align-items: center;
  gap: 3px;
}

.hud-battery span {
  opacity: 0.85;
  font-size: 10px;
  font-weight: bold;
  line-height: 12px;
}

.hud-battery-cell {
  position: relative;
  width: 20px;
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 2.5px;
}

.hud-battery-fill {
  position: absolute;
  left: 1px;
  top: 1px;
  height: 6px;
  border-radius: 1px;
}

.hud-battery-nub {
  position: absolute;
  left: 19px;
  top: 2px;
  width: 2px;
  height: 4px;
  background: rgba(255, 255, 255, 0.75);
}

.hud-battery-cell[hidden] {
  display: none;
}

/* On the cable: a plug in the display's cyan instead of the battery */
.hud-plug {
  width: 16px;
  height: 12px;
  fill: none;
  stroke: var(--hud-cyan);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A player's picture as a circle, or their initial; the ring lights up while talking */
.hud-avatar {
  position: relative;
  flex: none;
  border: 0 solid transparent;
  border-radius: 50%;
}

.hud-avatar-face {
  position: absolute;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #8c52ff, #f0469b);
  background-size: cover;
  background-position: center;
  color: #fff;
  font-weight: bold;
  line-height: 1;
}

.hud-avatar-face.picture {
  background-color: #12121c;
}

/* ---------------------------------------------------------------- webcams */

.hud-cams {
  display: flex;
  gap: 8px;
}

.hud-cam {
  position: relative;
  width: 176px;
  height: 99px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: #12121c;
  overflow: hidden;
}

.hud-cam.talking {
  border-color: var(--hud-green);
}

.hud-cam img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hud-cam img:not([src]) {
  visibility: hidden;
}

/* One's own webcam is shown the way a mirror would */
.hud-cam.mirrored img {
  transform: scaleX(-1);
}

.hud-cam-name {
  position: absolute;
  left: 4px;
  bottom: 4px;
  max-width: 164px;
  height: 18px;
  padding: 0 6px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 11px;
  font-weight: bold;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- controllers */

.hud-pads {
  display: flex;
  gap: 10px;
}

.hud-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-pad-name {
  height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 11px;
  font-weight: bold;
  line-height: 18px;
  white-space: nowrap;
}

.hud-pad-name.control {
  background: var(--hud-accent);
}

.hud-pad-name.console {
  background: rgba(0, 102, 115, 0.85);
}

.pad {
  position: relative;
  flex: none;
  overflow: hidden;
}

.pad-inner {
  position: absolute;
  left: 0;
  top: 0;
  width: 807px;
  height: 651px;
  transform-origin: 0 0;
}

.pad-group {
  position: absolute;
}

.pad-sprite {
  position: absolute;
  background-repeat: no-repeat;
}

/* ---------------------------------------------------------------- notes */

.hud-toasts {
  position: absolute;
  left: 0;
  right: 0;
  top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.hud-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 17px;
  background: var(--hud-glass);
  font-size: 14px;
  font-weight: bold;
  white-space: nowrap;
  animation: hud-toast 4.4s linear forwards;
}

.hud-toast.joined {
  border-color: var(--hud-green);
}

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

.hud-toast.joined .hud-toast-dot {
  background: var(--hud-green);
}

/* In over 200 ms, there for 3800, out over 400 */
@keyframes hud-toast {
  0% {
    opacity: 0;
  }
  4.5%,
  91% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.hud-notes {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: min(460px, 45%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.hud-note {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 14px 7px 10px;
  border-radius: 14px;
  background: var(--hud-box);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 14px;
  line-height: 17px;
  animation: hud-note 7.7s linear forwards;
}

.hud.plain .hud-note {
  background: rgba(0, 0, 0, 0.45);
  box-shadow: none;
}

.hud-note-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.hud.plain .hud-note-text {
  text-shadow: -1px 0 rgba(0, 0, 0, 0.6), 1px 0 rgba(0, 0, 0, 0.6), 0 -1px rgba(0, 0, 0, 0.6), 0 1px rgba(0, 0, 0, 0.6);
}

/* In over 200 ms, there for 7000, out over 500 */
@keyframes hud-note {
  0% {
    opacity: 0;
  }
  2.6%,
  93.5% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- arranging */

/* The app's bar while arranging: one line with Reset and Done, at four fifths of the height */
.hud-card {
  position: absolute;
  left: 50%;
  top: 80%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 40px);
  height: 42px;
  padding: 0 6px 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(0, 242, 255, 0.5);
  border-radius: 21px;
  background: rgba(8, 6, 20, 0.88);
  pointer-events: auto;
  white-space: nowrap;
}

.hud-card[hidden] {
  display: none;
}

.hud-card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: bold;
}

.stage .hud-card-reset,
.stage .hud-card-done {
  flex: none;
  height: 30px;
  padding: 0 14px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.stage .hud-card-reset {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
}

.stage .hud-card-reset:hover {
  background: rgba(255, 255, 255, 0.16);
}

.stage .hud-card-done {
  background: var(--hud-cyan);
  color: #04262a;
  font-size: 15px;
}

.stage .hud-card-done:hover {
  background: #7ff5ff;
}

/* ================================================================ controls */

/* The browser's own looks off; each control below says what it looks like */
:where(.stage) button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

:where(.stage) button:disabled {
  cursor: default;
}

:where(.stage) select,
:where(.stage) input {
  margin: 0;
  color: inherit;
  font: inherit;
}

/* A button of the app's forms: a pill, flat or filled with the accent colour */
.gbtn {
  flex: none;
  height: 40px;
  padding: 0 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.gbtn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.gbtn.flat {
  padding: 0 12px;
  background: none;
}

.gbtn.flat:hover {
  background: rgba(255, 255, 255, 0.08);
}

.gbtn.highlighted {
  background: var(--g-accent);
}

.gbtn.highlighted:hover {
  background: #9a66ff;
}

.gbtn:focus-visible {
  outline: 2px solid var(--g-cyan);
  outline-offset: 2px;
}

.gbtn:disabled {
  opacity: 0.38;
}


/* A choice of several, with the app's outline and arrow */
.gcombo {
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  height: 56px;
  padding: 0 40px 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='5' viewBox='0 0 10 5'%3E%3Cpath d='M0 0h10L5 5z' fill='%23fff'/%3E%3C/svg%3E") no-repeat right 15px center;
  font-size: 15px;
  text-overflow: ellipsis;
  cursor: pointer;
}

.gcombo:hover {
  border-color: rgba(255, 255, 255, 0.85);
}

.gcombo:focus-visible {
  outline: none;
  border-color: var(--g-cyan);
  box-shadow: inset 0 0 0 1px var(--g-cyan);
}

.gcombo option {
  background: #1b1733;
  color: #fff;
}

/* A line of text to fill in */
.gfield {
  min-width: 0;
  height: 56px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  background: transparent;
  font-size: 15px;
  outline: none;
}

.gfield:hover {
  border-color: rgba(255, 255, 255, 0.85);
}

.gfield:focus {
  border-color: var(--g-accent);
  box-shadow: inset 0 0 0 1px var(--g-accent);
}

.gfield::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

/* On or off */
.gswitch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-size: 15px;
  cursor: pointer;
}

.gswitch.disabled {
  opacity: 0.38;
  cursor: default;
}

.gswitch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gswitch-track {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  margin-left: 8px;
  border: 2px solid #938f99;
  border-radius: 16px;
  background: #1d1b26;
  transition: background 0.12s, border-color 0.12s;
}

.gswitch-knob {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #b6b3bd;
  transition: left 0.12s, top 0.12s, width 0.12s, height 0.12s, background 0.12s;
}

.gswitch input:checked + .gswitch-track {
  border-color: #b79df7;
  background: #b79df7;
}

.gswitch input:checked + .gswitch-track .gswitch-knob {
  left: 22px;
  top: 2px;
  width: 24px;
  height: 24px;
  background: #2b1a66;
}

.gswitch input:focus-visible + .gswitch-track {
  outline: 2px solid var(--g-cyan);
  outline-offset: 2px;
}

/* A value on a line, with the app's forms */
.gslider {
  appearance: none;
  -webkit-appearance: none;
  min-width: 60px;
  height: 20px;
  background: transparent;
  cursor: pointer;
  --fill: 100%;
}

.gslider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(var(--g-accent), var(--g-accent)) 0 0 / var(--fill) 100% no-repeat, rgba(140, 82, 255, 0.3);
}

.gslider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(var(--g-accent), var(--g-accent)) 0 0 / var(--fill) 100% no-repeat, rgba(140, 82, 255, 0.3);
}

.gslider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: var(--g-accent);
}

.gslider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--g-accent);
}

.gslider:focus-visible {
  outline: 2px solid var(--g-cyan);
  outline-offset: 4px;
}

/* ================================================================ the stream menu */

/*
 * StreamMenuContent.qml: over the dimmed game, the connection and the two ways
 * out along the top, Play Together in a panel at the side (PlayTogetherBar.qml),
 * and sound, picture, the controller and the overlays in a dock along the
 * bottom. Everything fades in and slides into place in 220 ms. At 800 px and
 * wider the panel stands at the right and the top bar and the dock take the
 * width left of it; narrower (.narrow), the panel takes the whole width between
 * them (js/menu.js places it). The colours are those of css/style.css.
 */
.menu {
  --m-panel: clamp(368px, 28.75%, 420px);
  --m-ease: cubic-bezier(0.33, 1, 0.68, 1);
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  user-select: none;
  -webkit-user-select: none;
}

.menu :focus {
  outline: none;
}

/* The game, dimmed: darker towards the panel */
.menu-dim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 4, 16, 0.3), rgba(6, 4, 16, 0.45) 55%, rgba(6, 4, 16, 0.78));
}

.menu.narrow .menu-dim {
  background: linear-gradient(90deg, rgba(6, 4, 16, 0.3), rgba(6, 4, 16, 0.45) 55%, rgba(6, 4, 16, 0.45));
}

.menu-dim,
.menu-top,
.mpanel,
.mdock {
  opacity: 0;
  transition: opacity 220ms var(--m-ease), transform 220ms var(--m-ease);
}

.menu.open .menu-dim,
.menu.open .menu-top,
.menu.open .mpanel,
.menu.open .mdock {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------------- top: the connection, and the ways out */

.menu-top {
  position: absolute;
  left: 16px;
  top: 16px;
  right: calc(32px + var(--m-panel));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  transform: translateY(-16px);
  pointer-events: none;
}

.menu.narrow .menu-top {
  right: 16px;
}

.menu-top > * {
  pointer-events: auto;
}

.mconn {
  flex: 0 1 auto;
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(14, 11, 30, 0.88);
}

/* Green: playing. Amber and pulsing: on the way, or getting back */
.mconn-dot {
  position: relative;
  flex: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.18);
}

.mconn-dot::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--good);
}

.mconn-dot.waiting {
  background: rgba(245, 185, 66, 0.18);
}

.mconn-dot.waiting::after {
  background: var(--wait);
  animation: mconn-pulse 1.2s ease-in-out infinite;
}

@keyframes mconn-pulse {
  50% {
    opacity: 0.3;
  }
}

.mconn-where {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The app's badges: cyan for the bitrate, red for what went wrong */
.mbadge {
  flex: none;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #e7e4fa;
  font-size: 12px;
  font-weight: 700;
  line-height: 24px;
  white-space: nowrap;
}

.mbadge.play {
  background: rgba(0, 242, 255, 0.11);
  color: #9ef7ff;
}

.mbadge.bad {
  background: rgba(240, 70, 110, 0.14);
  color: #ffc2d1;
}

.mbadge.squeezed {
  display: none;
}

/* On the right, or on a row of their own where they do not fit beside the connection */
.mexits {
  flex: none;
  margin-left: auto;
  display: flex;
  gap: 10px;
}

.mresume,
.mleave {
  position: relative;
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.mresume {
  padding: 0 8px 0 18px;
  background: var(--text);
  color: var(--text-on-light);
}

.mresume:hover {
  background-image: linear-gradient(rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.07));
}

.mresume:active {
  background-image: linear-gradient(rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0.14));
}

/* What also goes back: Escape, or Circle on the controller */
.mresume-key {
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(42, 19, 102, 0.12);
  font-size: 11px;
  font-weight: 800;
}

.mresume-key.glyph {
  padding: 0;
}

.mleave {
  padding: 0 20px;
  border: 1px solid rgba(240, 70, 110, 0.55);
  background: rgba(240, 70, 110, 0.16);
  color: #ffc2d1;
}

.mleave:hover {
  background-image: linear-gradient(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.07));
}

.mleave:active {
  background-image: linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14));
}

/* The focus ring: for the keys and the controller (js/menu.js sets .keys), never for the mouse */
.menu.keys :is(.mresume, .mleave, .mpill, .mdbtn, .mown-btn, .msend):focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- the side: Play Together */

.mpanel {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: var(--m-panel);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(16, 13, 34, 0.96);
  overflow: hidden;
  transform: translateX(40px);
}

.menu.narrow .mpanel {
  left: 16px;
  bottom: auto;
  width: auto;
}

.menu.narrow:not(.open) .mpanel {
  transform: translateY(16px);
}

/* Scrolls where the window is too small for all of it, with a thin bar in the margin */
.mpanel-scroll {
  flex: 1;
  min-height: 0;
  margin: 7px 0;
  padding: 8px 5px 8px 15px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.mpanel-scroll::-webkit-scrollbar {
  width: 10px;
}

.mpanel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.mpanel-scroll::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.18) padding-box;
}

.mpanel-scroll::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

@supports not selector(::-webkit-scrollbar) {
  .mpanel-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  }
}

/* The chat takes what is left */
.mpanel-col {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The small capital heading over a part of the panel */
.mlabel {
  color: var(--heading-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.3px;
  line-height: 13px;
  text-transform: uppercase;
  white-space: nowrap;
}

.mroom {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mroom-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mroom-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mroom-line {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 15px;
}

.mroom-line:empty {
  display: none;
}

/* The app's switch rows (C.ToggleRow): what it is, a line under it, the switch on the right */
.mtoggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  cursor: pointer;
}

.mtoggle[hidden] {
  display: none;
}

.mtoggle-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mtoggle-text b {
  font-size: 13px;
  font-weight: 800;
}

.mtoggle-text small {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 15px;
}

/* The console sleeps: the moon, what it means, and who may wake it */
.masleep {
  display: flex;
  align-items: center;
  gap: 10px;
}

.masleep[hidden] {
  display: none;
}

.masleep-icon {
  flex: none;
  color: #c4b5fd;
}

.masleep-text {
  flex: 1;
  min-width: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.menu button.mwake {
  flex: none;
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--button, #7a3cf5);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.menu button.mwake[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- everybody */

.mplayers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Two side by side, more where the panel has the room (168 px a tile) */
.mtiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(160px, calc(50% - 4px)), 1fr));
  gap: 8px;
}

.ptile {
  position: relative;
  min-width: 0;
  height: 84px;
  border-radius: 10px;
  background: #141126;
  text-align: left;
}

.ptile:not(:disabled):hover {
  background: #1a1630;
}

.ptile:disabled {
  cursor: default;
}

/* The ring: talking, its menu open, in control, or a thin line */
.ptile::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  pointer-events: none;
}

.ptile.control::after {
  border: 2px solid var(--brand-from);
}

.ptile.menu-open::after {
  border: 2px solid var(--heading-soft);
}

.ptile.talking::after {
  border: 2px solid var(--good);
}

.ptile.talking {
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.22);
}

.menu.keys .ptile:focus {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.ptile-face {
  position: absolute;
  left: 50%;
  top: 11px;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brand-from), var(--brand-to));
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.ptile-face.picture,
.mmenu-face.picture {
  background-color: #12121c;
}

/* The webcam covers the picture while it runs, a little inside the rounded frame */
.ptile-cam {
  position: absolute;
  left: 3px;
  top: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  border-radius: 7px;
  object-fit: cover;
}

.ptile-cam:not([src]) {
  visibility: hidden;
}

/* Host, from a browser, only watching */
.ptile-tags {
  position: absolute;
  left: 6px;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  overflow: hidden;
}

.ptag {
  flex: none;
  height: 17px;
  padding: 0 7px;
  border-radius: 8.5px;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  line-height: 17px;
  white-space: nowrap;
}

.ptag.live {
  background: #e91916;
}

.ptag.host {
  background: rgba(122, 60, 245, 0.92);
}

.ptag.player {
  background: rgba(14, 165, 233, 0.92);
}

.ptag.keymouse {
  background: rgba(99, 102, 241, 0.92);
}

.ptag.web {
  background: rgba(16, 140, 98, 0.92);
}

.ptag.watching {
  background: rgba(0, 0, 0, 0.65);
}

/* Name and state along the bottom, rounded with the frame */
.ptile-foot {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 24px;
  padding: 0 7px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 0 0 9px 9px;
  background: rgba(0, 0, 0, 0.62);
}

.ptile-name {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ptile-foot .micon {
  flex: none;
}

.ptile-foot .plays {
  color: #cdb6ff;
}

/* May play, but no controller is connected */
.ptile-foot .plays.nopad {
  opacity: 0.35;
}

.ptile-foot .watches {
  color: var(--text-soft);
}

.ptile-muted {
  flex: none;
  height: 15px;
  padding: 0 6px;
  border-radius: 7.5px;
  background: #d93a61;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 15px;
  white-space: nowrap;
}

/* In voice chat: three bars that move while talking, a dot while quiet */
.ptile-quiet {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.ptile-bars {
  flex: none;
  width: 13px;
  height: 11px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.ptile-bars i {
  width: 3px;
  height: 100%;
  border-radius: 1.5px;
  background: var(--good);
  transform-origin: bottom;
  animation: ptile-talk 0.7s linear infinite;
}

.ptile-bars i:nth-child(2) {
  animation-delay: -0.2s;
}

.ptile-bars i:nth-child(3) {
  animation-delay: -0.4s;
}

@keyframes ptile-talk {
  0%,
  100% {
    transform: scaleY(0.45);
  }
  50% {
    transform: scaleY(1);
  }
}

/* ---------------------------------------------------------------- one's own microphone, voices and webcam */

.mown {
  display: flex;
  gap: 6px;
}

.mown-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 50px;
  padding: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.mown-btn span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mown-btn:hover {
  background-image: linear-gradient(rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06));
}

.mown-btn:active {
  background-image: linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12));
}

/* Switched off (red), running (green), the way out of the voice chat (dim) */
.mown-btn[data-tone="bad"] {
  border-color: rgba(240, 70, 110, 0.5);
  background-color: rgba(240, 70, 110, 0.16);
  color: #ffc2d1;
}

.mown-btn[data-tone="good"] {
  border-color: rgba(52, 211, 153, 0.5);
  background-color: rgba(52, 211, 153, 0.16);
  color: #c9f7e3;
}

.mown-btn[data-tone="dim"] {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.04);
  color: #d9d5f2;
}

.mcamsize {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mcamsize[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- the chat */

.mchat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mchat-rule {
  flex: none;
  height: 1px;
  margin-bottom: 2px;
  background: var(--line);
}

.mchat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.munread {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: #d92f7f;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.mspace {
  flex: 1;
}

/* A small pill: "Open big" */
.mpill {
  position: relative;
  flex: none;
  height: 30px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mpill:hover {
  background-image: linear-gradient(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.07));
}

.mpill:active {
  background-image: linear-gradient(rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14));
}

/* The last messages, newest at the bottom; older ones go out at the top */
.mchat-list {
  flex: 1 1 76px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.mchat-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mchat-line {
  color: #e7e4fa;
  font-size: 13px;
  line-height: 17px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}

.mchat-line b {
  font-weight: 700;
}

.mchat-line a {
  color: var(--focus);
  text-decoration: underline;
}

.menu.keys .mchat-line a:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.mchat-empty {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 16px;
}

.mchat-form {
  flex: none;
  height: 40px;
  padding: 0 3px 0 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: var(--field);
}

.mchat-form:has(.mchat-input:focus) {
  border-color: var(--focus);
  box-shadow: inset 0 0 0 1px var(--focus);
}

.mchat-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  user-select: text;
  -webkit-user-select: text;
}

.mchat-input::placeholder {
  color: var(--text-dim);
  opacity: 1;
}

.msend {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--button);
  color: #fff;
}

.msend:hover:not(:disabled) {
  background: #8a52f7;
}

.msend:active:not(:disabled) {
  background: #6e36dc;
}

.msend:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

/* ---------------------------------------------------------------- bottom: the dock */

.mdock {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: max-content;
  max-width: calc(100% - 48px - var(--m-panel));
  padding: 7px 9px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(14, 11, 30, 0.92);
  transform: translateY(24px);
}

.menu.narrow .mdock {
  max-width: calc(100% - 32px);
}

.mgroup {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mgroup.tight {
  gap: 4px;
}

.mgroup-icon {
  color: #d9d5f2;
  margin: 0 2px;
}

/* A thin upright line between the parts, while the dock is on one line */
.mline {
  position: relative;
  flex: none;
  width: 3px;
  height: 36px;
}

.mline::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 5px;
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.12);
}

/* A button of the dock: an icon, or a word with an icon */
.mdbtn {
  position: relative;
  flex: none;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: #d9d5f2;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mdbtn:hover {
  background: rgba(255, 255, 255, 0.11);
}

.mdbtn:active {
  background: rgba(255, 255, 255, 0.14);
}

.mdbtn.text {
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.mdbtn.text:hover {
  background: rgba(255, 255, 255, 0.11);
}

.mdbtn.text > .micon:first-child {
  color: #cdb6ff;
}

.mdbtn .chev {
  color: var(--text-soft);
}

/* A switch of the dock that is on: full screen, the numbers */
.mdbtn.checked {
  border: 1px solid rgba(140, 82, 255, 0.7);
  background: rgba(122, 60, 245, 0.35);
  color: #fff;
}

.mdbtn.checked:hover {
  background: rgba(122, 60, 245, 0.45);
}

.mvalue {
  flex: none;
  width: 42px;
  padding-right: 2px;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.mzoom {
  flex: none;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

/* Fit, Zoom, Stretch: all three on screen at once */
.mseg {
  flex: none;
  height: 36px;
  padding: 2px;
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
}

.mseg button {
  padding: 0 12px;
  border-radius: 9px;
  color: #d9d5f2;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mseg button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.mseg button.chosen {
  background: var(--button);
  color: #fff;
  font-weight: 800;
}

.menu.keys .mseg button:focus {
  box-shadow: inset 0 0 0 2px var(--focus);
}

/* A bar to drag: a thin track that fills with the gradient */
.mbar {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 88px;
  height: 36px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  --fill: 0%;
}

.mbar::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-from), var(--brand-to)) 0 0 / var(--fill) 100% no-repeat, rgba(255, 255, 255, 0.14);
}

.mbar::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-from), var(--brand-to)) 0 0 / var(--fill) 100% no-repeat, rgba(255, 255, 255, 0.14);
}

.mbar::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border: 2px solid var(--brand-from);
  border-radius: 50%;
  background: #fff;
}

.mbar::-moz-range-thumb {
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  border: 2px solid var(--brand-from);
  border-radius: 50%;
  background: #fff;
}

.mbar:active::-webkit-slider-thumb {
  border-width: 4px;
}

.mbar:active::-moz-range-thumb {
  border-width: 4px;
}

/* ---------------------------------------------------------------- a low window */

/* A phone on its side: top bar, panel and dock below each other, and the menu scrolls */
.menu.stacked {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.menu.stacked .menu-dim {
  position: fixed;
}

.menu.stacked .menu-top,
.menu.stacked .mpanel,
.menu.stacked .mdock {
  position: relative;
  inset: auto;
  flex: none;
}

.menu.stacked .mpanel {
  width: auto;
  height: auto;
}

.menu.stacked .mpanel-scroll {
  overflow: visible;
}

.menu.stacked .mpanel-col {
  min-height: 0;
}

.menu.stacked .mdock {
  align-self: flex-start;
  max-width: 100%;
}

/* ---------------------------------------------------------------- lists */

/* As wide as its longest line, always inside the window (js/menu.js places it) */
.mmenu {
  position: absolute;
  z-index: 3;
  width: max-content;
  min-width: 200px;
  max-width: calc(100% - 16px);
  max-height: calc(100% - 16px);
  padding: 6px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--popup);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.mentry {
  flex: none;
  height: 38px;
  padding: 0 16px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.mentry .micon {
  flex: none;
  color: var(--text-soft);
}

.mentry.chosen {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
}

.mentry.chosen .micon {
  color: #cdb6ff;
}

.mentry.danger {
  color: #ffb3c4;
  font-weight: 700;
}

.mentry.danger .micon {
  color: #ff8fa8;
}

.mentry:hover,
.menu.keys .mentry:focus {
  background: rgba(140, 82, 255, 0.2);
}

.mmenu-line {
  flex: none;
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}

/* A player's menu: who it is, and how they are here */
.mmenu-head {
  position: relative;
  flex: none;
  height: 50px;
  padding: 0 12px 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mmenu-head::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 0;
  height: 1px;
  background: var(--line);
}

.mmenu-face {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brand-from), var(--brand-to));
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.mmenu-who {
  min-width: 0;
}

.mmenu-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 18px;
}

.mmenu-state {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 14px;
}

/* What the page sees of the controller, over the controller's list */
.mmenu-note {
  flex: none;
  width: 0;
  min-width: 100%;
  padding: 6px 10px 6px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 16px;
  white-space: normal;
}

/* ---------------------------------------------------------------- fingers */

/* A phone or a tablet: everything at least 44 px to touch */
@media (pointer: coarse) {
  .mdbtn {
    min-width: 44px;
    height: 44px;
  }

  .mseg {
    height: 44px;
  }

  .mbar,
  .mline {
    height: 44px;
  }

  .mline::after {
    top: 9px;
  }

  .mentry {
    height: 44px;
  }

  .mpill {
    height: 36px;
    border-radius: 18px;
  }

  .mchat-form {
    height: 48px;
  }

  .mchat-input {
    height: 44px;
    font-size: 16px;
  }

  .msend {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }
}

/* The way into the menu for a mouse or a finger; the app has only keys for it */
.menu-handle {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  height: 40px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(14, 11, 30, 0.88);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  transition: opacity 0.25s;
}

.menu-handle:hover {
  border-color: rgba(140, 82, 255, 0.7);
}

.menu-handle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.menu-handle small {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

@media (pointer: coarse) {
  .menu-handle {
    height: 44px;
    border-radius: 22px;
  }
}

.stage.idle .menu-handle {
  opacity: 0;
  pointer-events: none;
}

/* ================================================================ panels in front of the picture */

.gpanel {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--g-sheet);
  overflow: hidden;
}

.gpanel-close {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 24px;
  font-size: 26px;
  line-height: 1;
}

.gpanel-close:hover,
.gpanel-close:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
}

/* ---------------------------------------------------------------- the options */

.options {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max(360px, min(100% - 60px, 1000px));
  height: max(300px, min(100% - 60px, 780px));
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--g-accent);
}

.gpanel-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  margin: 10px 12px 0 22px;
}

.gpanel-title {
  flex: 1;
  font-size: 22px;
  font-weight: bold;
}

.gpanel-note {
  opacity: 0.6;
  font-size: 13px;
}

.gpanel-body {
  flex: 1;
  min-height: 0;
  margin: 8px 18px 18px;
  padding-right: 14px;
  overflow-y: auto;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.ocard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(16, 16, 24, 0.72);
}

.ocard-title {
  align-self: flex-start;
  background: linear-gradient(90deg, #c084fc, #7c86ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 21px;
  font-weight: bold;
}

.ocard-sub {
  opacity: 0.68;
  font-size: 14px;
}

.ocaption {
  margin-top: 8px;
  opacity: 0.55;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.orow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 48px;
}

.orow.buttons {
  margin-top: 10px;
  flex-wrap: wrap;
}

.orow .grow {
  flex: 1;
}

.orow .gbtn {
  font-size: 14px;
}

.orow.buttons .gbtn {
  font-size: 15px;
}

.olabel {
  flex: none;
  font-size: 15px;
}

.ovalue {
  flex: none;
  width: 46px;
  font-size: 15px;
  text-align: right;
}

.ogrid {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 10px;
}

@container options (min-width: 660px) {
  .ogrid {
    grid-template-columns: 1fr 1fr;
  }
}

.gpanel-body {
  container: options / inline-size;
}

/* ---------------------------------------------------------------- the chat */

.chat {
  right: 20px;
  top: 40px;
  width: min(400px, max(300px, 100% - 40px));
  height: max(320px, 100% - 80px);
  max-width: calc(100% - 8px);
  max-height: calc(100% - 44px);
  border: 1px solid rgba(140, 82, 255, 0.7);
  background: rgba(13, 11, 31, 0.96);
}

.chat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  margin: 8px 8px 0 18px;
}

.chat-head-text {
  flex: 1;
  min-width: 0;
}

.chat-title {
  font-size: 20px;
  font-weight: bold;
  line-height: 24px;
}

.chat-sub {
  opacity: 0.55;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-rule {
  flex: none;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.chat-list {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 6px;
  overflow-y: auto;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.chat-empty {
  position: absolute;
  left: 30px;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.chat-empty-icon {
  font-size: 40px;
  line-height: 1.2;
}

.chat-empty b {
  font-size: 15px;
}

.chat-empty span {
  opacity: 0.6;
  font-size: 13px;
}

/* The messages, the emoji and the row to write in: css/chat.css, as in the friends' chats */

/* ---------------------------------------------------------------- a question in front of everything */

.ask-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
}

.ask {
  max-width: calc(100% - 24px);
  padding: 30px;
  border-radius: 28px;
  background: #1b1733;
  text-align: center;
}

.ask-title {
  font-size: 24px;
  font-weight: bold;
}

.ask-text {
  margin-top: 10px;
  font-size: 20px;
  white-space: pre-line;
}

.ask-buttons {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 30px;
}

.ask-button {
  width: 200px;
  max-width: 40vw;
  height: 80px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 24px;
}

.ask-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.ask-button:focus {
  outline: none;
  background: var(--g-accent);
}

/* ================================================================ the rest on the picture */

/* The connection was lost and the page is getting it back by itself */
.banner {
  position: absolute;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 24px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: rgba(10, 10, 20, 0.88);
  font-size: 14px;
  white-space: nowrap;
}

.banner-spin {
  flex: none;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.banner-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-leave {
  flex: none;
  height: 28px;
  margin-left: 6px;
  padding: 0 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-weight: bold;
}

.banner-leave:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* No picture here: a browser that cannot show it, or a player with the controller only */
.stage-note {
  position: absolute;
  left: 0;
  right: 0;
  top: 75%;
  transform: translateY(-50%);
  padding: 0 20px;
  text-align: center;
  pointer-events: none;
}

.stage-note-title {
  font-size: 24px;
}

.stage-note-text {
  margin-top: 10px;
  font-size: 20px;
  white-space: pre-line;
}

/* The console sleeps and the room stays */
.asleep {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 24px;
  text-align: center;
  background: #07060f;
}

.asleep[hidden] {
  display: none;
}

.asleep-moon {
  font-size: 56px;
  color: #c4b5fd;
  line-height: 1;
}

.asleep-title {
  font-size: 26px;
  font-weight: 800;
}

.asleep-text {
  max-width: 560px;
  font-size: 18px;
  color: #d4d4e8;
}

.asleep button {
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--button, #7a3cf5);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.asleep button:hover {
  filter: brightness(1.1);
}

.asleep button:focus-visible {
  outline: 2px solid var(--focus, #9ef7ff);
  outline-offset: 2px;
}

/* Something the player has to know: the microphone could not be opened, the webcam went away */
/* The mouse was just caught for aiming: for a moment, how to get it back (the app's note, at its place) */
.caught-note {
  position: absolute;
  top: 64px;
  left: 50%;
  z-index: 3;
  max-width: calc(100% - 24px);
  height: 40px;
  padding: 0 20px;
  border: 1px solid rgba(140, 82, 255, 0.6);
  border-radius: 20px;
  background: rgba(14, 11, 30, 0.88);
  color: #e7dcff;
  font-size: 14px;
  font-weight: bold;
  line-height: 38px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 0.2s;
  pointer-events: none;
}

.caught-note.shown {
  opacity: 1;
}

.notices {
  position: absolute;
  left: 0;
  right: 0;
  top: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.notice {
  max-width: min(640px, 100% - 24px);
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 17px;
  background: rgba(12, 10, 26, 0.9);
  font-size: 14px;
  text-align: center;
  animation: hud-note 7.7s linear forwards;
}

/* The numbers of the connection, as the app shows them: along the right edge */
.stats {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.9);
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 15px;
}

.stat b {
  font-size: 18px;
}

.stat.rate {
  font-size: 18px;
}

.stat.rate b {
  color: var(--g-accent);
  font-size: 28px;
}

.stat.blue b {
  color: #90caf9;
}

.stat.red b {
  color: #ef9a9a;
}

@media (prefers-reduced-motion: reduce) {
  .menu-dim,
  .menu-top,
  .mpanel,
  .mdock {
    transition: none;
  }

  .mconn-dot.waiting::after,
  .ptile-bars i {
    animation: none;
  }
}

/* One's own chat message on its way, and one the host never answered, as in the app */
.mchat-line.pending {
  opacity: 0.55;
}

.mchat-failed {
  color: #f0466e;
}

.mchat-key {
  color: var(--text-dim);
  font-size: 11px;
}

