:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c1e21;
  --muted: #5f6670;
  --border: #d9dde3;
  --accent: #2f6fdf;
  --accent-text: #ffffff;
  --error: #c62828;
  --ok: #2e7d32;
  --warn: #b26a00;
  --radius: 10px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1f2226;
    --text: #e8eaed;
    --muted: #9aa0a8;
    --border: #353a40;
    --accent: #6a9cf5;
    --accent-text: #0d1117;
    --error: #ef6b6b;
    --ok: #6cc472;
    --warn: #e0a64a;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

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

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}


.lede {
  margin: 0 0 20px;
  color: var(--muted);
}

/* Items shared from another app, waiting for a session (home page). */
.share-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -8px 0 16px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
}

.share-pending > .icon {
  flex: none;
  color: var(--accent);
}

.share-pending p {
  flex: 1;
  min-width: 0;
  margin: 0;
}

label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

/* The start/join form's field names line up with the text inside their boxes (the boxes'
   12px padding plus 1px border), about a character in from the box edge. */
#home-form label {
  padding-left: 13px;
}

/* A note after a field's name, styled like the hint text below the field. */
.label-note {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: normal;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.9rem;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

/* Icon buttons show only their icon; the label is a tooltip (title) and stays readable by
   screen readers. A button with .show-label shows its text too, for short-lived states like
   "Copied" or "Confirm?". */
button:has(.icon) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  min-height: 36px;
  padding: 8px;
}

button:has(.icon):not(.show-label) .btn-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

button.show-label {
  padding: 8px 12px;
}

.icon {
  flex: none;
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* Start/Join, with this device's name (labelled above its box) beside it, wrapping below only
   on the narrowest phones. The button lines up with the box, not the label. */
.home-actions {
  align-items: flex-end;
}

/* Same height as the device name box beside it (inputs have 10px vertical padding). */
#home-submit {
  padding-block: 10px;
}

.device-name {
  flex: 1 1 8rem;
  min-width: 0;
}

.error {
  min-height: 1.5em;
  margin: 12px 0 0;
  color: var(--error);
}

.session-bar {
  position: -webkit-sticky; /* Safari before iOS 13 */
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.08);
}

.session-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px;
}

.session-title {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.session-title .label {
  display: inline;
  flex: none;
}

.session-title #session-words {
  overflow: hidden;
  text-overflow: ellipsis;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

#session-words {
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.status {
  color: var(--muted);
  font-size: 0.85rem;
}

.status.offline,
.status.detached {
  flex: none;
  padding: 2px 8px;
  border: 1px solid var(--warn);
  border-radius: 999px;
  color: var(--warn);
  font-size: 0.8rem;
  white-space: nowrap;
}

.session-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 640px) {
  .session-body {
    grid-template-columns: 1fr;
  }
}

.device-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.device-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.9rem;
}

.device-list li::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.device-list li[data-state='connected']::before,
.device-list li[data-state='self']::before {
  background: var(--ok);
}

.device-list li[data-state='failed']::before,
.device-list li[data-state='disconnected']::before {
  background: var(--error);
}

.device-state {
  color: var(--muted);
}

.board {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.items {
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item-text {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  font: 0.9rem/1.45 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.empty {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.narrow {
  max-width: 440px;
  margin: 4vh auto 0;
}

/* The home card's title, with the language menu at the right of the same line. */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.home-header h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.logo {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

.language-menu {
  position: relative;
}

#language-button {
  gap: 4px;
  padding: 6px 8px;
}

#language-button .icon {
  width: 0.9em;
  height: 0.9em;
  color: var(--muted);
}

/* Flags: 3:2, with a faint edge so white stripes show on a white background. */
.flag {
  flex: none;
  width: 24px;
  height: 16px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.15);
}

/* Opens leftwards from the button's right edge (an id, to beat .combo-list further down). */
#language-list {
  left: auto;
  right: 0;
  min-width: max-content;
}

#language-list:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: 10px;
  background: var(--bg);
}

.mode-switch button {
  border: none;
  background: transparent;
  color: var(--muted);
}

.mode-switch button[aria-selected='true'] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.15);
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  min-width: 0;
}

.input-row button {
  flex: none;
  font-size: 1.1rem;
}

.hint {
  min-height: 1.4em;
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

input.pin {
  /* Four monospace digits, plus the letter spacing after each, plus padding and border. */
  width: calc(4ch + 4 * 0.3em + 24px + 2px + 2px);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
}

.credentials {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

/* The words box is never narrower than the widest suggestion ("mummy mumbo gummy" is
   ~215px; 14rem leaves room for fonts that run wider). When the row can't also fit the
   PIN, the PIN wraps onto its own line. On very narrow screens the field takes the whole
   row instead of overflowing. */
.field-words {
  --words-min: 14rem;
  --regenerate-width: 44px;
  flex: 1 1 calc(var(--words-min) + 8px + var(--regenerate-width));
  min-width: min(100%, calc(var(--words-min) + 8px + var(--regenerate-width)));
}

#regenerate,
#forget-key {
  width: var(--regenerate-width);
  padding: 0;
}

/* The words box with an arrow inside its right edge that opens a list of reusable keys. */
.combo {
  position: relative;
  flex: 1;
  min-width: 0;
}

.combo input {
  padding-right: 40px;
}

.combo-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  min-height: 0;
  border: none;
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: var(--muted);
}

.combo-toggle:hover {
  color: var(--text);
}

.combo-toggle .icon {
  transition: transform 120ms ease-out;
}

.combo input[aria-expanded='true'] ~ .combo-toggle .icon {
  transform: rotate(180deg);
}

/* While a key is chosen, a key icon sits inside the box's left edge. */
.combo-key-icon {
  display: none;
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--accent);
  pointer-events: none;
}

.combo.has-key .combo-key-icon {
  display: block;
}

.combo.has-key input {
  padding-left: calc(12px + 1.1em + 8px);
  font-weight: 600;
}

.combo-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(320px, 50vh);
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}

.combo-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.combo-option:hover,
.combo-option.active {
  background: var(--bg);
}

.combo-option[aria-selected='true'] {
  font-weight: 600;
}

.combo-option .icon {
  color: var(--muted);
}

.combo-tag {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.combo-code {
  color: var(--muted);
  font: 0.8rem var(--mono);
}

/* The last option: create a key. Separated from the keys above it, if any. */
.combo-create {
  color: var(--accent);
}

.combo-option + .combo-create {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 6px 6px;
}

.combo-create .icon {
  color: inherit;
}

.field-pin {
  flex: none;
}

/* The words and PIN hints stay separate elements (each field's aria-describedby points at
   its own) but read as one paragraph: shown inline, with the markup's whitespace between
   them giving the space. */
.hints {
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

.hints .hint {
  display: inline;
  margin: 0;
}

/* Chinese doesn't put a space after "。", so drop the space that joins the two hints. */
.hints:lang(zh) {
  font-size: 0;
}

.hints:lang(zh) .hint {
  font-size: 0.85rem;
}

.join-requests {
  display: grid;
  gap: 8px;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 10px;
}

.join-requests:empty {
  display: none;
}

.join-request {
  border-color: var(--accent);
  border-width: 2px;
}

.join-request p {
  margin: 0;
}

/* The terms line, with the donation link (when set up) on its own line below. */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.site-footer a,
.hint a {
  color: inherit;
}

/* No donation page set up yet. */
.donate:has(a[href=""]) {
  display: none;
}

label.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: normal;
}

label.checkbox input {
  width: auto;
  margin-top: 0.3em;
}

.saved {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.saved-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saved-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.saved-list li > div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.saved-list .hint {
  display: block;
  margin: 0;
}

/* The Persistent checkbox with its info button beside it. */
.persist-setting {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
}

.info-button:hover {
  color: var(--text);
}

.status.detached {
  border-color: var(--accent);
  color: var(--accent);
}

/* ShareRTC's relay in use: its share of the allowance (warning colour near the end). */
.status.relay {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.status.relay.warn {
  border-color: var(--warn);
  color: var(--warn);
}

.session-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.board-tabs {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 0;
}

/* Video tab: the broadcast (or "Nobody is sharing video") above its controls. The stage is
   always dark, like a screen, in both colour schemes. It has the shape of the video being
   watched, or else of this device's screen, following rotation (--screen-ratio, set by
   main.js), but never taller than most of the window. */
.video-stage {
  position: relative;
  display: grid;
  place-items: center;
  /* Watching someone else: the shape of their video (--video-ratio, set by main.js). */
  aspect-ratio: var(--video-ratio, var(--screen-ratio, 16 / 9));
  max-height: 75vh;
  max-height: 75dvh;
  /* Narrower than the card when the height limit applies (a tall screen): keep it centred. */
  margin-inline: auto;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
}

/* Positioned to fill the stage, so a video of any shape (e.g. a portrait camera) fits
   inside it whole, rather than growing the grid row and being cut off. */
.video-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Your own camera shows mirrored, as people expect; viewers see it the right way round. */
.video-stage video.mirrored {
  transform: scaleX(-1);
}

.video-empty {
  margin: 0;
  padding: 16px;
  color: #c8ccd2;
  text-align: center;
}

.video-muted {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  padding: 6px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.6);
  color: #ffffff;
}

/* Full screen: the stage (video, badges and buttons) fills the screen. */
.video-stage:fullscreen {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.video-overlay-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: rgb(0 0 0 / 0.55);
  color: #ffffff;
}

.video-overlay-button:hover {
  background: rgb(0 0 0 / 0.75);
}

.video-sound {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
}

.video-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 12px;
}

.video-caption {
  margin: 0;
  color: var(--muted);
}

.video-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.board-tabs button.has-new::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.text-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.drawing {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.drawing-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.swatches,
.pen-widths,
.drawing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drawing-actions {
  margin-left: auto;
}

.swatch {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
}

.swatch[aria-checked='true'] {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.pen-width {
  display: grid;
  place-items: center;
  width: 40px;
  height: 32px;
  padding: 0;
}

.pen-width span {
  display: block;
  width: 20px;
  border-radius: 999px;
  background: var(--text);
}

.pen-width[aria-checked='true'] {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.drawing-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  cursor: crosshair;
  touch-action: none;
}

.compose-hint {
  align-self: center;
  margin: 0;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.file-preview {
  flex: none;
  width: 96px;
  height: 72px;
  border: 1px solid var(--border);
  border-radius: 6px;
  object-fit: cover;
  background: #ffffff;
}

.file-info {
  display: grid;
  min-width: 0;
}

.file-name {
  overflow-wrap: anywhere;
}

.file-size {
  color: var(--muted);
  font-size: 0.85rem;
}

.file-progress {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--border);
}

.file-progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.15s;
}

.file-status {
  flex: 1;
  text-align: right;
}

.file-actions {
  display: flex;
  gap: 6px;
}

.file-item .item-meta {
  flex-wrap: wrap;
}

body.dragging #session-view .board {
  outline: 3px dashed var(--accent);
  outline-offset: 6px;
  border-radius: var(--radius);
}

.image-frame {
  display: grid;
  place-items: center;
  min-height: 80px;
  border-radius: 6px;
  background: var(--bg);
}

.item-image {
  display: block;
  max-width: 100%;
  max-height: 480px;
  border-radius: 6px;
}

.image-status {
  padding: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.image-status:empty {
  display: none;
}

.item-actions {
  display: flex;
  gap: 6px;
}

button.delete {
  color: var(--muted);
}

button.danger {
  border-color: var(--error);
  background: var(--error);
  color: #ffffff;
}

/* In-page confirm/alert (dialog.js). Padding sits on the inner form so a click on the
   <dialog> element itself means the backdrop was clicked. */
#app-dialog,
#idle-dialog,
#camera-dialog,
#settings-dialog,
#key-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);
}

#app-dialog::backdrop,
#idle-dialog::backdrop,
#camera-dialog::backdrop,
#settings-dialog::backdrop,
#key-dialog::backdrop,
#terms-dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}

/* The terms: the text scrolls, while the title, checkbox and button stay in view. */
#terms-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);
}

#terms-dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 34px);
  padding: 20px;
}

#terms-dialog h2 {
  font-size: 1.25rem;
}

.terms-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -20px;
  padding: 0 20px;
  border-block: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.5;
}

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

.terms-body h3 {
  margin: 16px 0 4px;
  font-size: 0.95rem;
}

.terms-body p,
.terms-body ul {
  margin: 0 0 8px;
}

.terms-body ul {
  padding-left: 20px;
}

.terms-body a {
  color: var(--accent);
}

.terms-updated {
  margin-top: 12px !important;
  color: var(--muted);
}

.terms-agree {
  margin: 16px 0 0;
  font-weight: 600;
}

#app-dialog form,
#idle-dialog form,
#camera-dialog form,
#settings-dialog form,
#key-dialog form {
  padding: 20px;
}

#key-dialog h2 {
  font-size: 1.25rem;
}

#key-dialog .field {
  margin-top: 12px;
}

#key-new {
  flex: none;
}

/* A reusable key offered in the conversation. */
.key-badge {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font-size: 1.2rem;
}

.key-tag {
  overflow-wrap: anywhere;
}

.key-note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Take photo on desktops (camera.js): the preview keeps the camera's shape. */
#camera-dialog {
  width: min(720px, calc(100vw - 32px));
}

.camera-frame {
  display: flex;
  justify-content: center;
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
  background: #000000;
}

#camera-preview {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 180px);
  min-height: 120px;
}

#camera-preview.mirrored {
  transform: scaleX(-1);
}

#camera-status:empty {
  display: none;
}

#camera-status {
  margin: 8px 0 0;
}

#camera-dialog .dialog-actions {
  margin-top: 16px;
}

#camera-switch {
  min-width: 0;
  margin-right: auto;
}

#settings-dialog {
  width: min(480px, calc(100vw - 32px));
  overflow-y: auto;
}

#settings-dialog h2 {
  font-size: 1.25rem;
}

.settings-section {
  margin-top: 16px;
}

.settings-section h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.settings-section .field {
  margin-top: 10px;
}

.settings-help,
.settings-status {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-status.good {
  color: var(--ok);
}

.settings-status.bad {
  color: var(--error);
}

.session-tools {
  display: inline-flex;
  gap: 8px;
}

.connection-help {
  margin-bottom: 16px;
  border-color: var(--error);
}

.connection-help.warning {
  border-color: var(--border);
}

.connection-help p,
.connection-help ul {
  margin: 0 0 8px;
}

.connection-help-title {
  font-weight: 600;
}

.connection-help ul {
  padding-left: 20px;
}

.dialog-message {
  margin: 0;
  overflow-wrap: anywhere;
}

/* A prompt's text box (dialog.js). */
.dialog-input {
  margin-top: 12px;
}

.dialog-error {
  margin: 6px 0 0;
}

.dialog-error:empty {
  display: none;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.dialog-actions button {
  min-width: 88px;
}

@media (prefers-reduced-motion: no-preference) {
  #app-dialog[open] {
    animation: dialog-in 120ms ease-out;
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}

button.delete.confirming {
  border-color: var(--error);
  background: var(--error);
  color: #ffffff;
}
