/* SPDX-License-Identifier: LicenseRef-AGPL-3.0-only-OpenSSL */
/*
 * PSRemotePlayTogether in a web browser. The same look as the app (gui/src/qml/controls/Theme.qml):
 * calm dark cards, the gradient only for the name and the one step that starts something,
 * and a colour always means the same thing: purple goes on, green is on or lets in, amber
 * rests or waits, red leaves or removes, cyan is focus and how a room plays.
 */

:root {
  /* Grounds, back to front */
  --ground: #0c0a1d;
  --card: #15122b;
  --card-high: #1a1535;
  --door: #17132e;
  --field: #0f0c22;
  --popup: #1b1735;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* The brand: the one main action per screen, and the name */
  --brand-from: #8c52ff;
  --brand-to: #f0469b;
  --button-from: #7a3cf5;
  --button-to: #c92d7b;
  --button: #7a3cf5;
  --heading-soft: #a9b0ff;
  --focus: #00f2ff;

  /* What things are */
  --good: #34d399;
  --wait: #f5b942;
  --bad: #f0466e;

  /* Text */
  --text: #f3f1ff;
  --text-soft: #b9b4d6;
  --text-dim: #8f8aad;
  --text-on-light: #2a1366;

  --radius-card: 20px;
  --radius-field: 12px;
  --touch: 44px;
  --gutter: 32px;

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(140, 82, 255, 0.2), transparent 70%),
    radial-gradient(800px 400px at 100% 110%, rgba(240, 70, 155, 0.1), transparent 70%),
    var(--ground);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a {
  color: var(--heading-soft);
  text-decoration: underline;
  text-decoration-color: rgba(169, 176, 255, 0.45);
  text-underline-offset: 2px;
}

a:hover {
  color: #ffffff;
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

code {
  padding: 1px 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.88em;
  color: #d8c6ff;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

/* For screen readers only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The name, as in the app bar */
.grad {
  background: linear-gradient(90deg, #a77bff, var(--brand-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dim {
  color: var(--text-dim);
}

/* The small capital heading over a group: "FIND A ROOM", "YOU JOIN AS" */
.label {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.4px;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--heading-soft);
}

/* What went wrong (red), or what is not quite right (amber) */
.problem {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 12px 0 0;
  padding: 10px 14px;
  border: 1px solid rgba(240, 70, 110, 0.45);
  border-radius: 14px;
  background: rgba(240, 70, 110, 0.12);
  color: #ffc2d1;
  font-size: 14px;
  font-weight: 600;
}

.problem::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--bad);
}

.problem.warn {
  border-color: rgba(245, 185, 66, 0.35);
  background: rgba(245, 185, 66, 0.08);
  color: #fbd98c;
}

.problem.warn::before {
  background: var(--wait);
}

/* ---------------------------------------------------------------- before playing */

.front {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* The app bar: the icon, the name and what it is */
.appbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.appbar-in {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px var(--gutter);
}

.appbar img {
  flex: none;
  width: 40px;
  height: 40px;
}

.appbar-name {
  min-width: 0;
}

.appbar h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 1px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.page {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px var(--gutter) 24px;
}

/* A card of the new look: a calm ground for one group of things */
.card {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--card);
}

.card h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

:where(.front, .dialog, .friends) p {
  margin: 0;
}

/* The join, waiting and message cards stand alone in the middle */
.solo {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
}

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

.row.end {
  justify-content: flex-end;
  margin-top: 20px;
}

/* Pushes what follows it to the end of a row: Back on the left, the rest on the right */
.row .row-gap {
  flex: 1 1 0;
}

/* ---------------------------------------------------------------- buttons */

/* A pill at least 44 px high. Ghost unless it says otherwise: "primary" goes on, "brand" (the
   gradient) is the one step that starts something. The same in the windows of the page and in
   the friends panel (css/friends.css), which lie outside the start page */
:where(.front, .dialog, .friends) button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.12s, filter 0.12s;
}

:where(.front, .dialog, .friends) button:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.1);
}

:where(.front, .dialog, .friends) button:active:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.14);
}

:where(.front, .dialog, .friends) button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

:where(.front, .dialog, .friends) button:disabled {
  opacity: 0.45;
  cursor: default;
}

:where(.front, .dialog, .friends) button.primary {
  border-color: transparent;
  background: var(--button);
  color: #ffffff;
  font-weight: 800;
}

:where(.front, .dialog, .friends) button.brand {
  border-color: transparent;
  background: linear-gradient(90deg, var(--button-from), var(--button-to));
  color: #ffffff;
  font-weight: 800;
}

:where(.front, .dialog, .friends) button.primary:hover:not(:disabled),
:where(.front, .dialog, .friends) button.brand:hover:not(:disabled) {
  filter: brightness(1.1);
}

:where(.front, .dialog, .friends) button.primary:active:not(:disabled),
:where(.front, .dialog, .friends) button.brand:active:not(:disabled) {
  filter: brightness(0.9);
}

:where(.front, .dialog, .friends) button.small {
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

:where(.front, .dialog, .friends) button.big {
  min-height: 48px;
  padding: 0 30px;
  font-size: 16px;
}

/* A square button with only an icon; says what it does to screen readers */
:where(.front, .dialog, .friends) button.icon-button {
  flex: none;
  width: var(--touch);
  min-height: var(--touch);
  height: var(--touch);
  padding: 0;
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #d9d5f2;
}

:where(.front, .dialog, .friends) button.icon-button.small {
  width: 34px;
  min-height: 34px;
  height: 34px;
  border-radius: 10px;
}

.icon-button svg {
  display: block;
}

/* ---------------------------------------------------------------- fields */

:where(.front, .dialog, .friends) :is(input[type="text"], input[type="search"], select) {
  width: 100%;
  min-width: 0;
  height: var(--touch);
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  outline: none;
}

:where(.front, .dialog, .friends) :is(input[type="text"], input[type="search"], select):focus,
:where(.front, .dialog, .friends) :is(input[type="text"], input[type="search"], select):focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}

:where(.front, .dialog, .friends) :is(input[type="text"], input[type="search"])::placeholder {
  color: var(--text-dim);
  opacity: 1;
}

:where(.front) input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

:where(.front, .friends) select:not([multiple]) {
  padding-right: 38px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b9b4d6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  cursor: pointer;
}

:where(.front, .friends) select option {
  background: var(--popup);
  color: var(--text);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field > span,
.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

/* A filter that is on or off: a square box, as in the app's list of rooms */
.check {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 36px;
  font-size: 13.5px;
  font-weight: 600;
  color: #e7e4fa;
  cursor: pointer;
}

.check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--button);
  cursor: pointer;
}

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

/* An on/off switch with its words: purple when on. The whole row switches it */
.toggle {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 60px;
  padding: 10px 14px;
  cursor: pointer;
}

.toggle + .toggle {
  border-top: 1px solid var(--line);
}

.toggle.sub {
  min-height: 48px;
  padding-left: 30px;
}

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

.toggle-text b {
  font-size: 14px;
  font-weight: 800;
}

.toggle.sub .toggle-text b {
  font-weight: 700;
  color: #e7e4fa;
}

.toggle-text small {
  font-size: 12.5px;
  color: var(--text-dim);
}

.toggle input {
  flex: none;
  position: relative;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: 13px;
  background: #3a3458;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.12s;
}

.toggle input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cfcbe6;
  transition: transform 0.12s ease-out, background-color 0.12s;
}

.toggle input:checked {
  background: var(--button);
}

.toggle input:checked::before {
  transform: translateX(18px);
  background: #ffffff;
}

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

.toggle input:disabled {
  opacity: 0.45;
  cursor: default;
}

.toggle:has(input:disabled) {
  cursor: default;
}

.toggles {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--field);
}

/* ---------------------------------------------------------------- badges */

/* A small label for what something is; a colour always means the same */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  color: #e7e4fa;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
}

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

/* How one gets in: purple, as the app's "door" badges */
.badge.door {
  background: rgba(140, 82, 255, 0.2);
  color: #d8c6ff;
}

/* A state with a dot in front: open now, being checked, not open (the app's "good", "wait", "neutral") */
.badge.dot::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

.badge.good {
  background: rgba(52, 211, 153, 0.12);
  color: #9ff0cc;
}

.badge.good::before {
  background: #34d399;
}

.badge.wait {
  background: rgba(245, 185, 66, 0.12);
  color: #fbd98c;
}

.badge.wait::before {
  background: #f5b942;
}

.badge.web {
  background: rgba(52, 211, 153, 0.14);
  color: #9ff0cc;
}

.badge.system {
  background: rgba(79, 140, 255, 0.14);
  color: #c4d8ff;
}

.badge.twitch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #7c3aed;
  color: #ffffff;
  font-weight: 800;
}

.badge.twitch i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
}

/* A link that looks like the page's ghost pill, a little smaller */
.room-action .watch-twitch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid rgba(145, 70, 255, 0.55);
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.16);
  color: #e2d6ff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.room-action .watch-twitch:hover {
  background: rgba(124, 58, 237, 0.28);
  color: #ffffff;
}

.room-action .watch-twitch:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- the landing: a link from a friend */

/* Like the app's Join door: dark, with a soft light in the corner */
.landing {
  position: relative;
  overflow: hidden;
  padding: 26px 28px 28px;
  border: 1px solid rgba(124, 134, 255, 0.3);
  border-radius: 24px;
  background: var(--door);
}

.landing::before {
  content: "";
  position: absolute;
  right: -90px;
  top: -90px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 134, 255, 0.22), transparent 70%);
  pointer-events: none;
}

.landing > * {
  position: relative;
}

.door-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* The join and waiting cards: a lone title in line with the icon, a room's lines from the top */
.head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.head .head-text {
  min-height: 48px;
  justify-content: center;
}

.landing h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.door-text {
  max-width: 640px;
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--text-soft);
}

/* The icon in a rounded square, as on the app's doors */
.tile {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(124, 134, 255, 0.16);
  color: var(--heading-soft);
}

/* Like an address bar: paste it and go on */
.address {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 860px;
  min-height: 54px;
  margin-top: 18px;
  padding: 5px 5px 5px 16px;
  border: 1px solid rgba(124, 134, 255, 0.4);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 0 0 4px rgba(124, 134, 255, 0.08);
}

.address:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus), 0 0 0 5px rgba(124, 134, 255, 0.08);
}

.address > svg {
  flex: none;
  color: var(--heading-soft);
}

:where(.front) .address input[type="text"],
:where(.front) .address input[type="text"]:focus {
  flex: 1 1 auto;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

:where(.front) .address button {
  flex: none;
}

.landing .problem {
  max-width: 860px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 20px;
  max-width: 1100px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--text-soft);
}

.steps b {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(140, 82, 255, 0.14);
  color: #cdb6ff;
  font-size: 12.5px;
  font-weight: 800;
}

/* ---------------------------------------------------------------- public rooms */

/* Finding a room beside the list, as on the app's Join page */
.rooms {
  display: grid;
  grid-template-columns: minmax(260px, 290px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* Beside the list: finding a room, and who joins (the app's "You join as") */
.rooms-side {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rooms-aside,
.you-card {
  padding: 16px;
}

.you-card .who {
  gap: 12px;
}

:where(.front) .you-card button.avatar {
  width: 48px;
  height: 48px;
  font-size: 21px;
}

.you-card .toggle {
  margin-top: 12px;
}

.you-noname {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

.you-card .status-line {
  margin-top: 12px;
}

.you-card .problem {
  margin: 12px 0 0;
}

.row.you-more {
  margin-top: 12px;
}

/* The order of the rooms: a row with a round mark each, as the app's */
.order {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.choice:hover {
  background: rgba(255, 255, 255, 0.05);
}

.choice:has(input:checked) {
  background: rgba(140, 82, 255, 0.16);
}

.choice input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #a77bff;
}

.find {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.search {
  position: relative;
}

.search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}

:where(.front) .search input[type="search"] {
  padding-left: 38px;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.rooms-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rooms-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.rooms-head h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.rooms-count {
  font-size: 13px;
  color: var(--text-soft);
}

.rooms-fresh {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-dim);
}

.rooms-about {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

/* Sessions joined before, above the public rooms, as on the app's Join page */
.recent {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.recent h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.recent-room .cover {
  width: 56px;
  height: 56px;
  font-size: 24px;
}

.recent-room .room-action {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

:where(.front) .recent-room .room-action button.icon-button {
  min-width: 0;
  min-height: 34px;
}

.rooms-main .problem {
  margin: 4px 0 0;
}

.rooms-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rooms-empty {
  margin-top: 4px;
  padding: 36px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  color: var(--text-soft);
  font-size: 15px;
  text-align: center;
}

:where(.front) button.rooms-show-all {
  align-self: center;
}

/* One room: the game's picture, what it is, how many play, Join */
.room {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  transition: background-color 0.12s;
}

.room:hover {
  background: var(--card-high);
}

.room-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px 14px;
}

/* The game's cover where the host's app found one, otherwise its initial on the brand gradient */
.cover {
  position: relative;
  flex: none;
  width: 68px;
  height: 68px;
  overflow: hidden;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--brand-from), var(--brand-to));
  color: #ffffff;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The game as it is now: a picture the host sent, wider than a cover */
.cover.live {
  width: 121px;
  background: #000000;
}

.cover img.cover-badge {
  inset: auto;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  box-sizing: border-box;
}

.live-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.62);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.live-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bad);
}

.room-body,
.head-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.room-title {
  overflow: hidden;
  font-size: 16px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-sub,
.head-sub {
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-body .badges,
.head-text .badges {
  margin-top: 3px;
}

/* How many play, of how many */
.room-players {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 104px;
  white-space: nowrap;
}

.room-players {
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.players-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The players: their pictures, or their initials on a colour */
.faces {
  display: flex;
}

.face {
  position: relative;
  width: 24px;
  height: 24px;
  margin-left: -7px;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid var(--card);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #120d26;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.face:first-child {
  margin-left: 0;
}

.face.more {
  background: #3a3458;
  color: var(--text);
  font-size: 9px;
}

.face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-players b {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.room-players.full b {
  color: #ff9db5;
}

.room-players .players-word {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}

.people {
  flex: none;
  width: 15px;
  height: 15px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238f8aad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20a6.5 6.5 0 0 1 13 0'/%3E%3Cpath d='M16 4.6a3.5 3.5 0 0 1 0 6.8M18 14.4a6.5 6.5 0 0 1 3.5 5.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.room-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

:where(.front) .room-action button {
  min-width: 104px;
  min-height: 42px;
}

.room-note {
  max-width: 160px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

/* ---------------------------------------------------------------- joining */

.head h2 {
  overflow-wrap: anywhere;
}

.head .cover {
  width: 64px;
  height: 64px;
}

.head-sub {
  white-space: normal;
}

.intro {
  margin-top: 14px;
  font-size: 14.5px;
  color: var(--text-soft);
}

.join-label {
  margin-top: 22px;
}

.who {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 12px;
}

.who-fields {
  flex: 1;
  min-width: 0;
}

/* The player's picture, or their initial on the brand gradient */
:where(.front) button.avatar {
  flex: none;
  width: 76px;
  height: 76px;
  min-height: 0;
  padding: 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brand-from), var(--brand-to));
  background-size: cover;
  background-position: center;
  color: #ffffff;
  font-size: 34px;
  font-weight: 800;
}

:where(.front) button.avatar:hover:not(:disabled) {
  background-color: transparent;
  filter: brightness(1.08);
}

.who .row {
  margin-top: 8px;
}

/* What the browser sees of the controller */
.status-line {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
}

.status-line .dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-line.ok {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
  color: #9ff0cc;
}

.status-line.ok .dot {
  background: var(--good);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

/* Waiting at the host's door: amber, as on the room being joined in the app */
.card.joining {
  border-color: rgba(245, 185, 66, 0.7);
  background: #1b1631;
  box-shadow: 0 0 0 4px rgba(245, 185, 66, 0.1);
}

.wait-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 10px 12px 14px;
  border-radius: 14px;
  background: rgba(245, 185, 66, 0.1);
}

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

.wait-text b {
  font-size: 14.5px;
  font-weight: 800;
  color: #fde4a8;
}

.wait-text span {
  font-size: 12.5px;
  color: #d8c9a3;
}

.spin {
  flex: none;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(245, 185, 66, 0.25);
  border-top-color: var(--wait);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-button.loading svg {
  animation: spin 0.9s linear infinite;
}

.message-text {
  margin-top: 12px;
  color: var(--text-soft);
}

.message-text.problem {
  color: #ffc2d1;
}

/* ---------------------------------------------------------------- the footer */

.foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px var(--gutter) 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.foot > :first-child {
  flex: 1 1 200px;
}

.foot > :last-child {
  flex: 1 1 260px;
  text-align: right;
}

/* A pill with a tint of its own, as "Support the project" in the app */
.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid rgba(167, 123, 255, 0.6);
  border-radius: 999px;
  background: rgba(140, 82, 255, 0.1);
  color: #d8c6ff;
  font-weight: 700;
  text-decoration: none;
}

.pill-link:hover {
  background: rgba(140, 82, 255, 0.18);
  color: #ffffff;
}

/* The same pill as a button: "Install this page" */
button.pill-link {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.foot-pills {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* How to install on an iPhone or iPad, where the page cannot offer it itself */
.foot-how {
  width: 100%;
  max-width: 1400px;
  margin: -6px auto 0;
  padding: 0 var(--gutter) 18px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

/* ---------------------------------------------------------------- narrower windows */

@media (max-width: 899px) {
  .rooms {
    grid-template-columns: minmax(0, 1fr);
  }

  .rooms-side {
    position: static;
  }

  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

/* As the app: above the list, finding a room and who joins side by side */
@media (min-width: 600px) and (max-width: 899px) {
  .rooms-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* A phone: 16 px at the sides, players and Join below a room */
@media (max-width: 639px) {
  :root {
    --gutter: 16px;
  }

  .appbar-in {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .page {
    gap: 22px;
    padding-top: 18px;
  }

  .card {
    padding: 18px 16px;
  }

  .landing {
    padding: 18px 16px 20px;
  }

  .landing h2 {
    font-size: 22px;
  }

  .door-text {
    font-size: 14.5px;
  }

  .tile {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .address {
    gap: 8px;
    padding-left: 12px;
  }

  :where(.front) .address button {
    padding: 0 16px;
  }

  .room-main {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .room .cover {
    align-self: start;
  }

  .room-body {
    grid-column: 2 / -1;
  }

  .room-sub {
    white-space: normal;
  }

  .room-players {
    grid-row: 2;
    grid-column: 1 / 3;
    justify-content: flex-start;
    align-items: flex-start;
    min-width: 0;
  }

  .room-action {
    grid-row: 2;
    grid-column: 3;
  }

  .head .cover {
    width: 56px;
    height: 56px;
  }

  .head .head-text {
    min-height: 42px;
  }

  .card h2 {
    font-size: 20px;
  }

  .who {
    align-items: flex-start;
  }

  :where(.front) button.avatar {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }

  .wait-strip {
    flex-wrap: wrap;
  }

  .wait-text {
    flex-basis: calc(100% - 34px);
  }

  .wait-strip button {
    margin-left: auto;
  }

  .foot {
    flex-direction: column;
    text-align: center;
  }

  .foot > :first-child,
  .foot > :last-child {
    flex: none;
    text-align: center;
  }
}

/* A small phone: the whole bar for the link */
@media (max-width: 420px) {
  .address > svg {
    display: none;
  }
}

/* Fingers: everything to press at least 44 px */
@media (pointer: coarse) {
  :where(.front, .dialog, .friends) button.small,
  .pill-link {
    min-height: var(--touch);
  }

  :where(.front, .dialog, .friends) button.icon-button.small {
    width: var(--touch);
    height: var(--touch);
    min-height: var(--touch);
  }

  .check {
    min-height: var(--touch);
  }
}

/* No zooming in on a field on a phone */
@media (pointer: coarse), (max-width: 639px) {
  :where(.front, .dialog, .friends) :is(input[type="text"], input[type="search"], select) {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spin,
  .icon-button.loading svg {
    animation-duration: 2.4s;
  }

  .toggle input,
  .toggle input::before,
  :where(.front, .dialog, .friends) button,
  .room {
    transition: none;
  }
}

/* ---------------------------------------------------------------- playing */

.stage {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}

.stage.idle {
  cursor: none;
}

#screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* ---------------------------------------------------------------- a controller on the screen */

.touch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  /* At least 117 units across: the sticks, the D-pad, PS, L3 and R3 side by side
     without touching, on a wide phone as on a tablet */
  --u: min(0.85vw, 1.9vh);
}

.touch > * {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
}

.t-btn,
.t-dpad,
.t-stick {
  background: rgba(20, 18, 32, 0.42);
  border: 1.5px solid rgba(255, 255, 255, 0.34);
  color: rgba(255, 255, 255, 0.86);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: calc(var(--u) * 2.3);
  border-radius: calc(var(--u) * 1.6);
  -webkit-tap-highlight-color: transparent;
}

.t-btn.held,
.t-stick.held .t-knob {
  background: rgba(140, 82, 255, 0.75);
  border-color: #fff;
}

.t-stick {
  width: calc(var(--u) * 19);
  height: calc(var(--u) * 19);
  border-radius: 50%;
  bottom: calc(var(--u) * 5);
}

.t-stick-l {
  left: calc(var(--u) * 5);
}

.t-stick-r {
  right: calc(var(--u) * 24);
}

.t-knob {
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.t-dpad {
  width: calc(var(--u) * 16);
  height: calc(var(--u) * 16);
  left: calc(var(--u) * 26);
  bottom: calc(var(--u) * 4);
  border-radius: 50%;
  background: rgba(20, 18, 32, 0.3);
}

.t-dir {
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 22%;
  background: rgba(255, 255, 255, 0.24);
  pointer-events: none;
}

.t-up {
  left: 35%;
  top: 4%;
}

.t-down {
  left: 35%;
  bottom: 4%;
}

.t-left {
  left: 4%;
  top: 35%;
}

.t-right {
  right: 4%;
  top: 35%;
}

.t-dpad.up .t-up,
.t-dpad.down .t-down,
.t-dpad.left .t-left,
.t-dpad.right .t-right {
  background: rgba(140, 82, 255, 0.9);
}

.t-face {
  width: calc(var(--u) * 20);
  height: calc(var(--u) * 20);
  right: calc(var(--u) * 3);
  bottom: calc(var(--u) * 9);
  background: none;
  border: none;
  pointer-events: none;
}

.t-face .t-btn {
  position: absolute;
  pointer-events: auto;
}

.t-round {
  width: 38%;
  height: 38%;
  border-radius: 50%;
  font-size: calc(var(--u) * 3);
}

.t-tri {
  left: 31%;
  top: 0;
}

.t-cro {
  left: 31%;
  bottom: 0;
}

.t-squ {
  left: 0;
  top: 31%;
}

.t-cir {
  right: 0;
  top: 31%;
}

.t-l1,
.t-l2,
.t-r1,
.t-r2 {
  width: calc(var(--u) * 11);
  height: calc(var(--u) * 6);
  top: calc(var(--u) * 13);
}

.t-l2 {
  left: calc(var(--u) * 3);
}

.t-l1 {
  left: calc(var(--u) * 15.5);
}

.t-r2 {
  right: calc(var(--u) * 3);
}

.t-r1 {
  right: calc(var(--u) * 15.5);
}

.t-l3,
.t-r3,
.t-ps {
  width: calc(var(--u) * 6.5);
  height: calc(var(--u) * 5);
  bottom: calc(var(--u) * 1.5);
  font-size: calc(var(--u) * 1.9);
}

.t-l3 {
  left: calc(50% - var(--u) * 11.5);
}

.t-r3 {
  right: calc(50% - var(--u) * 11.5);
}

.t-ps {
  left: calc(50% - var(--u) * 3.25);
  border-radius: 50%;
  height: calc(var(--u) * 6.5);
}

.t-create,
.t-options,
.t-pad {
  height: calc(var(--u) * 4.6);
  top: calc(var(--u) * 13.5);
  font-size: calc(var(--u) * 1.7);
  padding: 0 calc(var(--u) * 1.4);
}

.t-create {
  left: calc(50% - var(--u) * 19);
  width: calc(var(--u) * 9);
}

.t-pad {
  left: calc(50% - var(--u) * 7);
  width: calc(var(--u) * 14);
}

.t-options {
  left: calc(50% + var(--u) * 10);
  width: calc(var(--u) * 9);
}

/* Held upright, like a handheld: the picture and what is shown on it at the top, the
   controller below it, every part where a thumb reaches it and nothing on top of another */
@media (orientation: portrait) {
  .stage.touch-on {
    --pic-bottom: calc(env(safe-area-inset-top, 0px) + min(56.25vw, 42vh));
    /* The controller's unit, for the way into the menu too (which is not inside it) */
    --pu: min(1.6vw, 0.78vh);
  }

  .stage.touch-on #screen,
  .stage.touch-on .hud {
    top: env(safe-area-inset-top, 0px);
    bottom: auto;
    height: min(56.25vw, 42vh);
  }

  .stage.touch-on .touch {
    --u: var(--pu);
  }

  .stage.touch-on .t-l1,
  .stage.touch-on .t-l2,
  .stage.touch-on .t-r1,
  .stage.touch-on .t-r2 {
    top: calc(var(--pic-bottom) + var(--u) * 3);
  }

  .stage.touch-on .t-create,
  .stage.touch-on .t-pad,
  .stage.touch-on .t-options {
    top: calc(var(--pic-bottom) + var(--u) * 11.5);
  }

  /* In the gap between L1 and R1 */
  .stage.touch-on .t-ps {
    top: calc(var(--pic-bottom) + var(--u) * 3);
    bottom: auto;
  }

  .stage.touch-on .t-dpad {
    left: calc(var(--u) * 4);
    bottom: calc(var(--u) * 34);
    width: calc(var(--u) * 17);
    height: calc(var(--u) * 17);
  }

  .stage.touch-on .t-face {
    right: calc(var(--u) * 3);
    bottom: calc(var(--u) * 32);
    width: calc(var(--u) * 21);
    height: calc(var(--u) * 21);
  }

  .stage.touch-on .t-stick {
    bottom: calc(var(--u) * 5);
    width: calc(var(--u) * 21);
    height: calc(var(--u) * 21);
  }

  .stage.touch-on .t-stick-l {
    left: calc(var(--u) * 4);
  }

  .stage.touch-on .t-stick-r {
    right: calc(var(--u) * 4);
  }

  .stage.touch-on .t-l3 {
    left: calc(var(--u) * 21);
    bottom: calc(var(--u) * 26.5);
  }

  .stage.touch-on .t-r3 {
    right: calc(var(--u) * 21);
    bottom: calc(var(--u) * 26.5);
  }

  /* The way into the menu, in the free band between the buttons and the sticks */
  .stage.touch-on .menu-handle {
    top: calc(var(--pic-bottom) + var(--pu) * 21);
    bottom: auto;
  }
}

/* Sideways the display covers the whole screen: the shoulder buttons stay below the
   first players' names in the top left */
@media (orientation: landscape) {
  .stage.touch-on .t-l1,
  .stage.touch-on .t-l2,
  .stage.touch-on .t-r1,
  .stage.touch-on .t-r2 {
    top: max(calc(var(--u) * 16), 116px);
  }

  .stage.touch-on .t-create,
  .stage.touch-on .t-pad,
  .stage.touch-on .t-options {
    top: max(calc(var(--u) * 16.5), calc(116px + var(--u) * 0.5));
  }

  /* Above the way into the menu at the bottom */
  .stage.touch-on .t-l3,
  .stage.touch-on .t-r3,
  .stage.touch-on .t-ps {
    bottom: calc(var(--u) * 9);
  }
}

/* ---------------------------------------------------------------- dialogs */

.dialog {
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 22px 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--popup);
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
}

.dialog::backdrop {
  background: rgba(4, 3, 10, 0.72);
}

.dialog h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.dialog > p {
  margin-top: 10px;
  font-size: 14px;
}

/* ---------------------------------------------------------------- the app's settings pages, as windows of this page */

/*
 * A window that is one of the app's settings pages (gui/src/qml/controls: SettingsPage,
 * SettingsGroup, SettingsRow, Toggle, Segmented, ValueSlider, PillButton): the same sizes and
 * colours, so that it reads like the app. What is in it scrolls; js/setparts.js builds it.
 */
.dialog.settings {
  width: min(880px, calc(100vw - 32px));
  padding: 24px 26px 20px;
  background: var(--ground);
}

.dialog.settings[open] {
  display: flex;
  flex-direction: column;
}

.dialog.settings > h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.dialog.settings > p {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-soft);
}

.set-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 16px -12px 0;
  padding: 2px 12px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dialog.settings > .row.end {
  flex: none;
  margin-top: 14px;
}

.set-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--heading-soft);
}

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

.set-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.set-group.off,
.set-try.off,
.set-keys.off {
  opacity: 0.5;
}

/* One setting: what it is on the left, its control on the right, or under the text where it is narrow */
.set-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 12px 18px;
}

.set-row + .set-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.set-row.sub {
  padding-left: 34px;
}

.set-row.off {
  opacity: 0.5;
}

label.set-row {
  cursor: pointer;
}

.set-text {
  flex: 1 1 var(--text-min, 240px);
  min-width: min(var(--text-min, 240px), 100%);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.set-text b {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.set-text small {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-dim);
}

.set-controls {
  flex: none;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

/* An on/off switch: purple when on */
input.switch {
  flex: none;
  position: relative;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: 13px;
  background: #3a3458;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.12s;
}

input.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cfcbe6;
  transition: transform 0.12s ease-out, background-color 0.12s;
}

input.switch:checked {
  background: var(--button);
}

input.switch:checked::before {
  transform: translateX(18px);
  background: #ffffff;
}

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

input.switch:disabled {
  opacity: 0.45;
  cursor: default;
}

/* A few choices side by side */
.set-seg {
  display: inline-flex;
  gap: 2px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
}

.set-seg button {
  min-height: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #d9d5f2;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.set-seg button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

.set-seg button.chosen,
.set-seg button.chosen:hover:not(:disabled) {
  background: var(--button);
  color: #ffffff;
  font-weight: 800;
}

.set-seg button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

/* A value on a line: the part behind the handle in the brand's colours, the number beside it */
.set-slider {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 32px;
  max-width: 100%;
}

.set-slider.off {
  opacity: 0.5;
}

.set-slider input {
  flex: 1 1 auto;
  min-width: 0;
  height: 26px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.set-slider input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-from) 0, var(--brand-to) var(--at, 0%), rgba(255, 255, 255, 0.14) var(--at, 0%));
}

.set-slider input::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-from) 0, var(--brand-to) var(--at, 0%), rgba(255, 255, 255, 0.14) var(--at, 0%));
}

.set-slider input::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 3px solid var(--brand-from);
  border-radius: 50%;
  background: #ffffff;
  -webkit-appearance: none;
  appearance: none;
}

.set-slider input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid var(--brand-from);
  border-radius: 50%;
  background: #ffffff;
}

.set-slider input:active::-webkit-slider-thumb {
  border-width: 5px;
}

.set-slider input:active::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border-width: 5px;
}

.set-slider input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.set-slider output {
  flex: none;
  text-align: right;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

/* A rounded button: "primary" starts something, "ghost" is everything else */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 22px;
  background: var(--button);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.pill.primary,
.pill.primary:hover:not(:disabled) {
  background: var(--button);
}

.pill.small {
  min-height: 0;
  height: 34px;
  padding: 0 13px;
  border-radius: 17px;
  font-size: 13px;
}

.pill.ghost,
.pill.ghost:hover:not(:disabled) {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
}

.pill:hover {
  box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.07);
}

.pill:active {
  box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.14);
}

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

.pill:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: default;
}

.set-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-dim);
}

/* Voice & webcam: the devices in use, the microphone's level, the tip, the webcam's picture */
.set-devices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 18px 12px;
}

.set-device {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 14px;
  color: #e7e4fa;
}

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

.set-device span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-devices + .set-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* The level, 0 to 100, and the mark from which the others hear you */
.set-meter {
  position: relative;
  flex: none;
  width: 132px;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
}

.set-meter-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  max-width: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #8c52ff, #b48cff);
  transition: width 0.06s linear;
}

.set-meter-fill.heard {
  background: linear-gradient(90deg, #8c52ff, #4fe0b0);
}

.set-meter-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  border-radius: 1px;
  background: #e7e4fa;
  opacity: 0.8;
}

/* A tip at the foot of the card: the card's colour with a bluish tint */
.set-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 16px 12px;
  border-radius: 0 0 17px 17px;
  background: #1d1b3c;
  font-size: 13px;
  line-height: 1.2;
  color: #c9c5e6;
}

.set-tip .micon {
  flex: none;
  margin-top: 1px;
  color: var(--heading-soft);
}

/* 16:9 like the picture that is sent, rounded like the webcam tiles in a session */
.set-preview {
  padding: 0 18px 18px;
}

.set-preview-frame {
  display: grid;
  place-items: center;
  width: min(100%, 320px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #0d0b1f;
  font-size: 13px;
  color: var(--text-dim);
}

.set-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The bar at the top of Keyboard & mouse: the two switches and the layouts */
.set-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.set-bar-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  cursor: pointer;
}

.set-bar-switch b {
  font-size: 14px;
  font-weight: 800;
  color: #e7e4fa;
}

.set-bar-line {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.set-bar-gap {
  flex: 1 1 auto;
}

.set-bar-layouts {
  position: relative;
}

.set-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 250px;
  max-width: calc(100vw - 64px);
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--popup);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.set-menu button {
  justify-content: flex-start;
  min-height: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.set-menu button:hover:not(:disabled),
.set-menu button:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}

/* Acceleration, drawn */
.set-curve {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  max-width: 100%;
}

.curve {
  display: block;
  max-width: 100%;
  height: auto;
  overflow: visible;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.curve-plot {
  fill: var(--field);
  stroke: var(--line);
}

.curve-grid {
  stroke: rgba(255, 255, 255, 0.05);
}

.curve-even {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1.5;
  stroke-dasharray: 4.5 6;
}

.curve-line {
  fill: none;
  stroke: #b08cff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.curve-word {
  fill: var(--text-dim);
  font-size: 11px;
}

.curve-point {
  outline: none;
  cursor: ns-resize;
}

.curve-dot {
  fill: #ffffff;
  stroke: var(--brand-from);
  stroke-width: 3;
}

.curve-point.held .curve-dot {
  r: 6.5px;
  stroke-width: 5;
}

.curve-ring {
  fill: none;
}

.curve-point:focus-visible .curve-ring {
  stroke: var(--focus);
  stroke-width: 2;
}

.curve-hit {
  fill: transparent;
}

/* Try it here: the controller as the keys and the mouse move it */
.set-try {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px 22px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.set-try.on {
  padding: 13px 17px;
  border: 2px solid var(--brand-from);
}

.set-try-pad {
  justify-self: center;
  opacity: 0.55;
}

.set-try.on .set-try-pad {
  opacity: 1;
}

.set-try-words {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.set-try-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text-soft);
}

.set-try.on .set-try-text {
  color: var(--text);
}

/* The inputs, one card per part of the controller */
.set-keys {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.set-keycard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.set-keyline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.set-keyname {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.set-caps {
  flex: none;
  display: flex;
  gap: 6px;
}

.cap-wrap {
  position: relative;
  display: inline-flex;
}

/* A key: a darker edge, thicker at the bottom */
.cap {
  min-width: 44px;
  min-height: 0;
  height: 30px;
  padding: 0 9px 2px;
  border: 1px solid #39325e;
  border-bottom-width: 3px;
  border-radius: 8px;
  background: #221d3e;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.set-caps .cap:hover:not(:disabled) {
  background: #2a2449;
}

.set-caps .cap:active:not(:disabled) {
  background: #1a1632;
}

/* The one that adds is only an outline */
.set-caps .cap.add {
  min-width: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 15px;
}

.set-caps .cap.add:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
}

/* Waiting for the new one */
.set-caps .cap.waiting,
.set-caps .cap.waiting:hover:not(:disabled) {
  padding: 0 9px;
  border: 1px solid var(--wait);
  background: rgba(245, 185, 66, 0.14);
  color: #fde4a8;
  animation: cap-wait 1.4s ease-in-out infinite;
}

@keyframes cap-wait {
  50% {
    opacity: 0.6;
  }
}

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

/* Takes the input away: a small cross on the key's corner, while the pointer is on the key */
.cap-x {
  position: absolute;
  top: -7px;
  right: -7px;
  display: none;
  width: 16px;
  min-height: 0;
  height: 16px;
  padding: 0;
  border: 1px solid var(--card);
  border-radius: 50%;
  background: #4a4370;
  cursor: pointer;
}

.cap-wrap:hover .cap-x {
  display: block;
}

.cap-wrap .cap-x:hover:not(:disabled) {
  background: var(--bad);
}

.cap-x::before,
.cap-x::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 1.6px;
  border-radius: 1px;
  background: #ffffff;
  transform: translate(-50%, -50%) rotate(45deg);
}

.cap-x::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* A question in front of everything, as the app asks it */
.dialog.ask-card {
  width: min(508px, calc(100vw - 32px));
  padding: 22px 24px;
  border-radius: 20px;
}

.dialog.ask-card::backdrop {
  background: rgba(5, 5, 20, 0.62);
}

.dialog.ask-card h2 {
  font-size: 18px;
  font-weight: 800;
}

.dialog.ask-card p {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text-soft);
  white-space: pre-line;
}

.ask-card-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 700px) {
  .set-keys {
    grid-template-columns: minmax(0, 1fr);
  }

  .set-try {
    grid-template-columns: minmax(0, 1fr);
  }

  .set-bar-line,
  .set-bar-gap {
    display: none;
  }

  .set-curve {
    align-items: flex-start;
  }

  .dialog.settings {
    padding: 18px 16px 16px;
  }
}

/* A key, as in the app's "While playing" row */
kbd {
  flex: none;
  min-width: 34px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: #221d3e;
  color: var(--text);
  font: 700 12px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  text-align: center;
}

@media (max-width: 639px) {
  .dialog {
    padding: 18px 16px;
  }
}
