/* Kurier - dunkle Oberflaeche, bewusst ruhig gehalten. */

:root {
  --bg: #12151c;
  --bg-raised: #171b24;
  --surface: #1e2430;
  --surface-strong: #262e3d;
  --line: #2b3444;
  --text: #e6eaf2;
  --text-dim: #93a0b5;
  --text-faint: #6b7789;
  --accent: #4b8dff;
  --accent-deep: #2f6fe0;
  --accent-text: #ffffff;
  --good: #3ecf8e;
  --warn: #e8b23a;
  --bad: #f2676b;
  --radius: 14px;
  --radius-sm: 9px;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------- Kopfzeile */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}

.peer {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 600;
  flex: none;
}

.peer-text {
  min-width: 0;
}

.peer-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.peer-state {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}

.dot[data-status='online'] {
  background: var(--good);
}

.dot[data-status='polling'] {
  background: var(--warn);
}

.dot[data-status='connecting'] {
  background: var(--warn);
  animation: pulse 1.2s ease-in-out infinite;
}

.dot[data-status='error'] {
  background: var(--bad);
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

/* Sitzt der andere auch gerade davor? Der Punkt steht neben dem Namen:
   beim Gegenueber rechts davon, bei einem selbst links. Fehlt er ganz,
   ist nichts bekannt - das ist etwas anderes als "nicht da". */

.live {
  display: inline-block;
  vertical-align: middle;
  width: 8px;
  height: 8px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--good) 28%, transparent);
  flex: none;
}

.live[data-da='nein'] {
  background: transparent;
  border: 1.5px solid var(--text-faint);
  box-shadow: none;
}

.peer-name .live {
  margin-left: 7px;
}

.self .live {
  margin-left: 1px;
  margin-right: 1px;
}

.topbar-actions {
  display: flex;
  gap: 4px;
}

.icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-dim);
}

.icon:hover {
  background: var(--surface);
  color: var(--text);
}

.icon.small {
  width: 28px;
  height: 28px;
}

.icon.small svg {
  width: 16px;
  height: 16px;
}

/* ----------------------------------------------------------------- Suche */

.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}

.searchbar[hidden] {
  display: none;
}

.searchbar-icon {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  flex: none;
}

.searchbar input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.searchbar input::-webkit-search-cancel-button {
  display: none;
}

.searchbar-count {
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- Verlauf */

.thread {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-color: var(--surface-strong) transparent;
}

.thread::-webkit-scrollbar {
  width: 10px;
}

.thread::-webkit-scrollbar-thumb {
  background: var(--surface-strong);
  border-radius: 10px;
  border: 3px solid var(--bg);
}

.daymark {
  align-self: center;
  margin: 14px 0 8px;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: min(78%, 680px);
  margin-top: 9px;
}

.msg.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.msg:not(.mine) {
  align-self: flex-start;
}

/* Folgenachricht derselben Person rueckt enger zusammen. */
.msg.tight {
  margin-top: 2px;
}

.msg-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 4px 3px;
  font-size: 12px;
  color: var(--text-faint);
}

.msg.tight .msg-head {
  display: none;
}

.msg-sender {
  font-weight: 600;
  color: var(--text-dim);
}

.msg-geraet {
  color: var(--text-faint);
}

.msg-geraet::before {
  content: '· ';
}

.bubble {
  position: relative;
  padding: 9px 13px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 0;
}

.msg.mine .bubble {
  background: var(--accent-deep);
  border-color: transparent;
  color: var(--accent-text);
}

.msg:not(.mine) .bubble {
  border-bottom-left-radius: 5px;
}

.msg.mine .bubble {
  border-bottom-right-radius: 5px;
}

/* Lange Texte zeichengenau zeigen, ohne das Fenster zu sprengen. */
.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  font: inherit;
}

.text.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 15;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Anklickbare Adressen im Nachrichtentext. */
.verweis {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}

.verweis:hover {
  text-decoration-thickness: 2px;
}

.msg.mine .verweis {
  /* Auf der blauen Blase traegt Blau nicht - dort genuegt der Unterstrich. */
  color: inherit;
  text-decoration-color: rgba(255, 255, 255, 0.65);
}

.verweis:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.bubble mark {
  background: var(--warn);
  color: #1a1407;
  border-radius: 3px;
  padding: 0 1px;
}

/* Zitat über einer Antwort: schmaler Balken, gedämpft, anklickbar. */
.zitat {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 7px;
  padding: 4px 9px;
  border: none;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: inherit;
}

.zitat:hover {
  background: rgba(255, 255, 255, 0.09);
}

.msg.mine .zitat {
  border-left-color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.18);
}

.msg.mine .zitat:hover {
  background: rgba(0, 0, 0, 0.28);
}

.zitat-wer {
  display: block;
  font-weight: 600;
  color: var(--accent);
}

.msg.mine .zitat-wer {
  color: inherit;
}

/* Ein Zitat bleibt einzeilig - die ganze Nachricht steht ja oben im Verlauf. */
.zitat-text {
  display: block;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Kurzes Aufleuchten, wenn ein Zitat zu seiner Nachricht geführt hat. */
.msg.gezeigt .bubble {
  animation: aufleuchten 1.6s ease-out;
}

@keyframes aufleuchten {
  0%,
  55% {
    box-shadow: 0 0 0 2px var(--accent);
  }
  100% {
    box-shadow: 0 0 0 2px transparent;
  }
}

.bubble-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  font-size: 12.5px;
}

.linkish {
  color: inherit;
  opacity: 0.72;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}

.linkish:hover {
  opacity: 1;
}

/* "Antworten" sitzt am rechten Rand der Blase, abgesetzt vom Rest. */
.linkish.rechts {
  margin-left: auto;
}

.msg-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  margin: 3px 5px 0;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* Die Begründung eines Fehlschlags bekommt eine eigene Zeile. */
.msg-foot .why {
  flex-basis: 100%;
  color: var(--bad);
  overflow-wrap: anywhere;
}

.msg.mine .msg-foot {
  justify-content: flex-end;
}

.msg.mine .msg-foot .why {
  text-align: right;
}

.msg-foot .state[data-state='pending'] {
  color: var(--text-dim);
}

.msg-foot .state[data-state='failed'] {
  color: var(--bad);
}

/* ------------------------------------------------------------ Dateiblase */

.file {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 220px;
}

.file-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.09);
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.file-text {
  min-width: 0;
  flex: 1;
}

.file-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.file-size {
  font-size: 12px;
  opacity: 0.7;
}

.preview {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: zoom-in;
  background: rgba(0, 0, 0, 0.25);
}

.bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  margin-top: 8px;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: currentColor;
  transition: width 0.18s ease-out;
}

.notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--warn);
}

/* Bei aktiver Suche treten Nicht-Treffer zurueck. */
.thread.searching .msg {
  opacity: 0.32;
}

.thread.searching .msg.hit {
  opacity: 1;
}

.msg.current .bubble {
  box-shadow: 0 0 0 2px var(--accent);
}

/* --------------------------------------------------------- Leerer Zustand */

.empty {
  margin: auto;
  text-align: center;
  color: var(--text-faint);
  padding: 24px;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text-dim);
}

.empty-mark svg {
  width: 28px;
  height: 28px;
}

.empty-title {
  margin: 0 0 4px;
  color: var(--text-dim);
  font-weight: 600;
}

.empty-hint {
  margin: 0;
  font-size: 13.5px;
}

.jump {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  z-index: 4;
}

.jump[hidden] {
  display: none;
}

/* ------------------------------------------------------------- Eingabe */

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 14px;
  background: var(--bg-raised);
  border-top: 1px solid var(--line);
}

.composer .icon {
  margin-bottom: 4px;
}

.field {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 11px 5px;
}

.field:focus-within {
  border-color: var(--accent);
}

/* Zeigt über dem Eingabefeld, worauf gerade geantwortet wird. */
.antwort-leiste {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -2px 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  min-width: 0;
}

.antwort-leiste[hidden] {
  display: none;
}

.antwort-marke {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--accent);
}

.antwort-wer {
  flex: none;
  font-weight: 600;
  color: var(--accent);
}

.antwort-text {
  flex: 1;
  min-width: 0;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.antwort-leiste .icon {
  flex: none;
}

.field textarea {
  display: block;
  width: 100%;
  max-height: 40vh;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  resize: none;
  overflow-y: auto;
  padding: 0;
}

.field textarea:focus {
  outline: none;
}

.field textarea::placeholder {
  color: var(--text-faint);
}

.field-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.counter {
  font-variant-numeric: tabular-nums;
}

.counter.loud {
  color: var(--accent);
}

.field-hint {
  margin-left: auto;
  white-space: nowrap;
}

.send {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  flex: none;
}

.send:hover {
  background: var(--accent-deep);
}

.send:disabled {
  background: var(--surface-strong);
  color: var(--text-faint);
  cursor: default;
}

/* --------------------------------------------------------- Drag und Drop */

.dropzone {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(10, 13, 19, 0.82);
  backdrop-filter: blur(2px);
}

.dropzone[hidden] {
  display: none;
}

.dropzone-inner {
  text-align: center;
  padding: 34px 54px;
  border: 2px dashed var(--accent);
  border-radius: 20px;
  background: var(--bg-raised);
  color: var(--text);
}

.dropzone-inner svg {
  width: 34px;
  height: 34px;
  color: var(--accent);
}

.dropzone-inner p {
  margin: 10px 0 2px;
  font-weight: 600;
}

.dropzone-inner span {
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------- Dialoge */

.sheet {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-raised);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.sheet::backdrop {
  background: rgba(8, 10, 15, 0.68);
}

.sheet h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.sheet-hint {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 14px;
  background: var(--surface);
  border-radius: 11px;
}

.tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.tab.active {
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 600;
}

.label {
  display: block;
  margin-bottom: 13px;
  font-size: 13px;
  color: var(--text-dim);
}

.label input,
.label textarea,
.label select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.label textarea {
  resize: vertical;
  font-family: 'Cascadia Mono', Consolas, monospace;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

/* Knopf innerhalb eines Reiters braucht Luft zum nächsten Feld. */
.pane > .ghost {
  margin-bottom: 14px;
}

.label-hint {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-faint);
}

.rows {
  display: grid;
  gap: 2px;
  margin: 4px 0 14px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.row-label {
  font-size: 13.5px;
}

.row-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.row-value {
  font-size: 13.5px;
  color: var(--text-dim);
  text-align: right;
}

.row-value.mono {
  font-family: 'Cascadia Mono', Consolas, monospace;
}

.row-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-faint);
}

.feedback {
  margin: 4px 0 0;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: rgba(242, 103, 107, 0.12);
  border: 1px solid rgba(242, 103, 107, 0.4);
  color: #ffb9bb;
}

.feedback[hidden] {
  display: none;
}

.feedback.ok {
  background: rgba(62, 207, 142, 0.12);
  border-color: rgba(62, 207, 142, 0.4);
  color: #a9eccb;
}

.feedback.busy {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text-dim);
}

.sheet-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.primary,
.ghost {
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}

.primary {
  background: var(--accent);
  color: var(--accent-text);
}

.primary:hover {
  background: var(--accent-deep);
}

.primary:disabled,
.ghost:disabled {
  opacity: 0.5;
  cursor: default;
}

.ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost:hover:not(:disabled) {
  background: var(--surface-strong);
}

.ghost.small {
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 500;
}

/* ---------------------------------------------------------------- Hinweise */

.toasts {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 30;
  pointer-events: none;
}

.toast {
  max-width: min(520px, calc(100vw - 40px));
  padding: 10px 15px;
  border-radius: 11px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: rise 0.18s ease-out;
}

.toast.error {
  background: #3b1f23;
  border-color: #6d3237;
  color: #ffc9cb;
}

.toast.ok {
  background: #16342a;
  border-color: #2b6d53;
  color: #b7eed3;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Schmales Fenster: Blasen duerfen breiter werden, Hinweise weichen. */
@media (max-width: 560px) {
  .msg {
    max-width: 88%;
  }

  .field-hint {
    display: none;
  }
}

/* --------------------------------------------- Einstellungen: Abschnitte */

.sheet-section {
  margin: 22px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.sheet-section:first-of-type {
  margin-top: 6px;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 13px;
  font-size: 13.5px;
  cursor: pointer;
}

.check input {
  margin: 2px 0 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: none;
}

.check .label-hint {
  margin-top: 3px;
}

.slider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.slider input[type='range'] {
  flex: 1;
  accent-color: var(--accent);
}

.slider-value {
  min-width: 48px;
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ------------------------------------------------- Band für Aktualisierungen */

.band {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: linear-gradient(90deg, rgba(75, 141, 255, 0.18), rgba(75, 141, 255, 0.06));
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

.band[hidden] {
  display: none;
}

.band-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex: none;
}

.band-text {
  flex: 1;
  min-width: 0;
}

.band-bar {
  width: 120px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
  flex: none;
}

.band-bar[hidden] {
  display: none;
}

.band-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease-out;
}

.band-action {
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  flex: none;
}

.band-action:hover {
  background: var(--accent-deep);
}

.band-action[hidden] {
  display: none;
}

.band.fehler {
  background: rgba(242, 103, 107, 0.14);
}

.band.fehler .band-icon {
  color: var(--bad);
}

/* Wer man selbst ist. Ohne das zeigt die Kopfzeile nur den Namen des
   Gegenübers - und beide Seiten sehen dasselbe Programm. */

.self {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 4px;
  margin-right: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.self:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.self-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.self strong {
  color: var(--text);
  font-weight: 600;
}

/* Im schmalen Fenster reicht das Kürzel. */
@media (max-width: 560px) {
  .self-name {
    display: none;
  }

  .self {
    padding: 4px;
  }
}

/* Ohne Beschriftung liest sich der grosse Name oben als "das bin ich".
   Er gehoert aber dem Gegenueber - also steht es jetzt dabei. */

.peer-label {
  font-weight: 400;
  color: var(--text-faint);
  font-size: 12.5px;
}

.peer-name strong {
  font-weight: 600;
}

.peer-room {
  color: var(--text-faint);
}

.peer-room::before {
  content: '·';
  margin: 0 5px;
}

@media (max-width: 560px) {
  .peer-room {
    display: none;
  }
}

/* ----------------------------------------------- Web- und Telefonausgabe */

/* Was es nur unter Windows gibt, blendet die Web-Ausgabe aus - und
   umgekehrt. Beide Seiten teilen sich dieselbe index.html. */
body.web .nur-desktop,
body:not(.web) .nur-web {
  display: none;
}

/* Auf dem Telefon wandert die Adressleiste beim Scrollen weg - 100% waere
   dann zu hoch und die Eingabe rutschte unter den Rand. dvh misst, was
   wirklich zu sehen ist; --tastatur zieht ab, was die Bildschirmtastatur
   gerade verdeckt (gesetzt in src/web/entry.mjs). */
body.web {
  height: calc(100dvh - var(--tastatur, 0px));
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body.web .thread {
  /* Sonst wippt beim Scrollen im Verlauf das ganze Fenster mit. */
  overscroll-behavior: contain;
}

/* Randlose Telefone: oben die Uhr, unten der Ziehbalken. */
body.web .topbar {
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right));
}

body.web .composer {
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right));
}

body.web .sheet {
  max-height: calc(100dvh - 48px);
}

/* Mit offener Tastatur bleibt wenig Platz - das Eingabefeld darf dann nicht
   die halbe Hoehe fuer sich beanspruchen. */
body.web .field textarea {
  max-height: 28dvh;
}

/* Beschriftung und Wert nebeneinander brauchen Platz, den ein Telefon nicht
   hat - sonst bricht beides in drei Zeilen um. Untereinander liest es sich
   besser. Gilt auch fuer das Fenster am Anschlag seiner Mindestbreite. */
@media (max-width: 460px) {
  .row {
    grid-template-columns: 1fr;
  }

  .row-side {
    justify-content: flex-start;
  }

  .row-value {
    text-align: left;
  }
}

/* Finger statt Mauszeiger: groessere Ziele, kein Warten auf einen zweiten
   Tipp - und mindestens 16px in den Feldern, darunter zoomt iOS beim
   Hineintippen die ganze Seite heran. */
@media (pointer: coarse) {
  button,
  .linkish {
    touch-action: manipulation;
  }

  .icon {
    width: 42px;
    height: 42px;
  }

  .icon.small {
    width: 34px;
    height: 34px;
  }

  .linkish {
    padding: 7px 0;
  }

  .bubble-tools {
    gap: 20px;
    margin-top: 1px;
  }

  /* Die Auswahl muss so eng sein wie die Regeln, die sie ueberstimmt -
     sonst gewinnt weiter ".field textarea" mit seinem geerbten Mass. */
  .field textarea,
  .label input,
  .label textarea,
  .label select,
  .searchbar input {
    font-size: 16px;
  }

  .msg {
    max-width: 92%;
  }
}
