:root {
  --primary: #4285f4;
  --text: #333333;
  --text-secondary: #757575;
  --bg: #ffffff;
  --bg-secondary: #f2f2f2;
  --border: #e0e0e0;
  --sheet-bg: #ffffff;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

body.dark-theme {
  --primary: #8ab4f8;
  --text: #eeeeee;
  --text-secondary: #9aa0a6;
  --bg: #000000;
  --bg-secondary: #262628;
  --border: #3c4043;
  --sheet-bg: #141414;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  body.auto-theme {
    --primary: #8ab4f8;
    --text: #eeeeee;
    --text-secondary: #9aa0a6;
    --bg: #000000;
    --bg-secondary: #262628;
    --border: #3c4043;
    --sheet-bg: #141414;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "Manrope", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 0;
  z-index: 2;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.header-actions {
  display: flex;
  gap: 2px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.icon-button:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

#center {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.radar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  display: block;
}

.radar-field {
  position: absolute;
  left: 50%;
  top: 42%;
  translate: -50% -50%;
  width: min(70vw, 70vh, 540px);
  aspect-ratio: 1 / 1;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
}

.empty-hint {
  position: absolute;
  left: 50%;
  top: 42%;
  translate: -50% -50%;
  z-index: 1;
  width: min(78vw, 360px);
  padding: 8px;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#center.has-peers .empty-hint {
  opacity: 0;
  visibility: hidden;
}

#primaryGradient .start-color {
  stop-color: color-mix(in srgb, var(--primary) 80%, white);
}

#primaryGradient .stop-color {
  stop-color: var(--primary);
}

.empty-hint-title {
  margin: 0 0 5px;
  font-size: 22px;
  font-weight: 400;
  line-height: 32px;
  letter-spacing: -0.012em;
  color: var(--primary);
}

.empty-hint-sub {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--text-secondary);
}

@media (max-width: 480px) {
  .empty-hint-title {
    font-size: 18px;
    line-height: 26px;
  }
  .empty-hint-sub {
    font-size: 12px;
    line-height: 18px;
  }
}

.peers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.peer {
  position: absolute;
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  user-select: none;
  -webkit-user-select: none;
}

.peer-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  position: relative;
  background: linear-gradient(160deg, #5b9cff 0%, #3b82f6 55%, #2f6fe0 100%);
  box-shadow:
    0 2px 8px rgba(47, 111, 224, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.15s ease;
}

.peer-icon[class*="tone-"] {
  background: linear-gradient(160deg, #5b9cff 0%, #3b82f6 55%, #2f6fe0 100%);
  color: #fff;
  box-shadow:
    0 2px 8px rgba(47, 111, 224, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.peer:hover .peer-icon,
.peer:focus-visible .peer-icon {
  transform: scale(1.08);
}

.peer.busy .peer-icon { opacity: 0.65; }

.peer-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.avatar-glyph {
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  user-select: none;
}

.peer-icon .avatar-glyph {
  font-size: 22px;
}

.chat-peer-avatar .avatar-glyph {
  font-size: 18px;
}

.chat-row-avatar .avatar-glyph {
  font-size: 15px;
}

.peer-unread {
  position: absolute;
  top: -4px;
  right: -6px;
  z-index: 2;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(185, 28, 28, 0.35);
  pointer-events: none;
}

.peer-progress {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #fff;
  opacity: 0;
  animation: spin 0.85s linear infinite;
}

.peer.busy .peer-progress { opacity: 1; }

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

.peer-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 88px;
}

.peer-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  max-width: 88px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.peer-device,
.self-device {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  max-width: 88px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  opacity: 0.85;
}

.self-device {
  max-width: none;
  margin: 0;
}

.status-dock {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 20px 20px;
  text-align: center;
}

.footer-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: -10px 0 2px;
  color: var(--primary);
}

.known-as {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
}

.known-as-label {
  color: var(--text);
}

.name-chip {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
}

.name-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.discovery-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  font-size: 13px;
}

.discovery-label {
  color: var(--text-secondary);
}

.discovery-badge {
  border: 0;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
}

.discovery-badge:hover {
  background: color-mix(in srgb, var(--primary) 24%, transparent);
}

.room-line {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

dialog.sheet {
  border: 0;
  border-radius: 16px;
  padding: 22px;
  width: min(380px, calc(100vw - 32px));
  background: var(--sheet-bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog.chat-dialog {
  border: 0;
  padding: 0;
  width: min(420px, calc(100vw - 24px));
  height: min(640px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  border-radius: 16px;
  overflow: hidden;
  background: #ededed;
  color: var(--text);
  box-shadow: var(--shadow);
  flex-direction: column;
}

dialog.chat-dialog[open] {
  display: flex;
}

body.dark-theme dialog.chat-dialog {
  background: #111111;
}

dialog.chat-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.chat-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f7f7f7;
  border-bottom: 1px solid var(--border);
}

body.dark-theme .chat-header {
  background: #1c1c1e;
}

.chat-back,
.chat-attach {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chat-back:hover,
.chat-attach:hover {
  background: var(--bg-secondary);
}

.chat-back svg,
.chat-attach svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.chat-peer-name {
  margin: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-empty {
  margin: auto;
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
}

.chat-row.mine {
  flex-direction: row-reverse;
}

.chat-row-avatar {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, #5b9cff 0%, #3b82f6 55%, #2f6fe0 100%);
  flex: 0 0 auto;
  margin-top: 0;
}

.chat-row.mine .chat-row-avatar {
  background: linear-gradient(160deg, #7dd87d 0%, #2aae67 100%);
}

.chat-row-avatar svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.chat-bubble {
  max-width: min(72%, 260px);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  background: #fff;
  color: #111;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

body.dark-theme .chat-bubble {
  background: #2c2c2e;
  color: #f2f2f7;
}

.chat-row.mine .chat-bubble {
  background: #95ec69;
  color: #111;
}

body.dark-theme .chat-row.mine .chat-bubble {
  background: #3eb575;
  color: #fff;
}

.chat-bubble.file {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.chat-bubble.offer,
.chat-bubble.file-rich {
  max-width: min(82%, 280px);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-offer-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

body.dark-theme .chat-offer-title {
  color: #f2f2f7;
}

.chat-offer-previews {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-img-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  max-width: 168px;
}

.chat-img-download {
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}

.chat-img-download:focus-visible {
  outline: 2px solid #07c160;
  outline-offset: 2px;
}

.chat-img-download:disabled {
  opacity: 0.7;
  cursor: default;
}

.chat-img-block .chat-offer-img,
.chat-img-block .chat-file-img {
  width: 140px;
}

.chat-img-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 0 0 auto;
}

.chat-img-action .chat-file-save {
  background: transparent;
  color: #07c160;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
}

.chat-img-block .chat-file-dl-progress {
  margin-top: 0;
}

.chat-offer-img,
.chat-file-img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #ddd;
}

.chat-offer-files,
.chat-file-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-offer-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.chat-offer-file-main,
.chat-file-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  min-width: 0;
  flex: 1;
}

.chat-offer-file .name,
.chat-file-meta .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.chat-offer-file .size,
.chat-file-meta .size {
  color: var(--text-secondary);
  flex: 0 0 auto;
}

.chat-offer-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.chat-offer-actions-send {
  align-items: center;
  justify-content: space-between;
}

.chat-offer-actions-send .chat-offer-waiting {
  flex: 1;
  text-align: left;
  font-size: 12px;
}

.chat-offer-actions-send .chat-offer-btn {
  flex: 0 0 auto;
}

.chat-offer-btn,
.chat-file-save {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  cursor: pointer;
}

.chat-file-save:disabled {
  opacity: 0.55;
  cursor: default;
}

.chat-file-dl-progress {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.chat-offer-btn {
  flex: 1;
  background: #f2f2f2;
  color: #333;
}

.chat-offer-btn.primary {
  background: #07c160;
  color: #fff;
}

.chat-offer-status {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding-top: 2px;
}

.chat-offer-interrupted {
  color: #dc2626;
}

.chat-offer-waiting {
  color: var(--text-secondary);
}

.chat-bubble.connect {
  min-width: 160px;
}

.chat-connect-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.chat-offer-transfer-progress {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.chat-file-card {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
  padding: 8px;
}

body.dark-theme .chat-file-card {
  background: rgba(255, 255, 255, 0.06);
}

.chat-file-fallback {
  height: 72px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
}

.chat-file-fallback svg {
  fill: currentColor;
}

.chat-file-save {
  align-self: flex-start;
  background: transparent;
  color: #07c160;
  padding: 4px 0;
}

.chat-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: #f7f7f7;
  border-top: 1px solid var(--border);
}

body.dark-theme .chat-composer {
  background: #1c1c1e;
}

.chat-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 0 12px;
  outline: none;
}

body.dark-theme .chat-input {
  background: #2c2c2e;
}

.chat-send {
  border: 0;
  border-radius: 8px;
  background: #07c160;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  height: 40px;
  padding: 0 16px;
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-send:hover {
  filter: brightness(1.05);
}

dialog.sheet.sheet-closable {
  position: relative;
  padding-top: 28px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #e5e5ea;
  color: #636366;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.dialog-close svg {
  width: 14px;
  height: 14px;
}

.dialog-close:hover {
  background: #d1d1d6;
  color: #1c1c1e;
}

.dialog-close:active {
  transform: scale(0.94);
}

body.dark-theme .dialog-close {
  background: #3a3a3c;
  color: #c7c7cc;
}

body.dark-theme .dialog-close:hover {
  background: #48484a;
  color: #f2f2f7;
}

dialog.sheet::backdrop {
  background: rgba(0, 0, 0, 0.28);
}

dialog.sheet h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}

dialog.sheet p {
  margin: 0 0 14px;
  line-height: 1.45;
  color: var(--text-secondary);
  font-size: 14px;
}

.from span {
  color: var(--text);
  font-weight: 600;
}

.preview-stage {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 0 0 14px;
  max-height: 220px;
  overflow: auto;
}

.preview-card {
  width: min(100%, 220px);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.preview-card img,
.preview-card video {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #111;
}

body.light-theme .preview-card img,
body.light-theme .preview-card video {
  background: #f0f0f0;
}

.room-panel {
  display: flex;
  flex-direction: column;
}

.room-panel[hidden] {
  display: none !important;
}

.room-panel-inside {
  align-items: stretch;
  gap: 4px;
  padding-top: 8px;
}

.room-panel-inside .room-code-display {
  margin-bottom: 8px;
}

.room-panel-inside .room-status {
  text-align: center;
  margin: 0 0 18px !important;
}

.room-panel-inside .room-actions-bottom {
  justify-content: center;
}

.room-panel-inside .room-actions-bottom .btn {
  min-width: 140px;
}

.room-entered {
  margin: 0 0 14px !important;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: center;
  font-size: 14px !important;
  font-weight: 600;
  color: #0b57d0;
  background: rgba(66, 133, 244, 0.12);
}

body.dark-theme .room-entered {
  color: #8ab4f8;
  background: rgba(138, 180, 248, 0.14);
}

.room-kicker {
  margin: 0 0 4px !important;
  font-size: 13px !important;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--text-secondary);
}

.room-code-display {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 0;
  margin: 0 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  user-select: all;
}

.room-divider {
  height: 1px;
  margin: 16px 0 12px;
  background: var(--border);
  border: 0;
}

.room-or {
  margin: 0 0 10px !important;
  text-align: center;
  font-size: 12px !important;
  color: var(--text-secondary);
}

.room-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.room-qr {
  width: 168px;
  height: 168px;
  border-radius: 0;
  background: #fff;
  padding: 0;
  box-sizing: border-box;
  border: 0;
  box-shadow: none;
}

.room-qr-hint {
  margin: 0 !important;
  font-size: 12px !important;
  color: var(--text-secondary);
}


.room-actions-top {
  margin: 0 0 8px;
}

.room-status {
  margin: 0 0 18px !important;
  text-align: center;
  font-size: 14px !important;
}

.room-actions {
  margin-top: 4px;
}

.room-actions-bottom {
  margin-top: 16px;
}

.preview-fallback {
  width: min(100%, 220px);
  min-height: 120px;
  border-radius: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  color: var(--text-secondary);
  text-align: center;
}

.preview-fallback .ext {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}

.preview-fallback .label {
  font-size: 12px;
  word-break: break-all;
}

.preview-card.preview-text {
  width: min(100%, 100%);
  max-width: 100%;
  text-align: left;
}

.preview-text-head {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-secondary) 80%, var(--primary) 8%);
}

.preview-text-body {
  margin: 0;
  padding: 12px;
  max-height: 180px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  max-height: 180px;
  overflow: auto;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-secondary);
  font-size: 13px;
}

.file-item .thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #ddd;
  flex-shrink: 0;
}

.file-item .meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-item .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.file-item .size {
  color: var(--text-secondary);
  font-size: 12px;
}

.btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--bg-secondary);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

textarea,
input,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  margin-bottom: 14px;
  resize: vertical;
}

.otp-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 16px;
}

.otp-digit {
  width: 48px;
  height: 56px;
  margin: 0;
  padding: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  caret-color: var(--primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.otp-digit:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.2);
  background: var(--bg);
}

.hint { font-size: 13px; }

.done-tip {
  margin: 0 0 12px !important;
  font-size: 13px !important;
  line-height: 1.45;
  color: var(--text-secondary);
}

.progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--bg-secondary);
  overflow: hidden;
  margin: 8px 0 10px;
}

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

#progress-percent {
  text-align: center;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(50, 50, 50, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  z-index: 50;
  max-width: calc(100vw - 32px);
}

@media (max-width: 420px) {
  .otp-row { gap: 7px; }
  .otp-digit {
    width: 42px;
    height: 50px;
    font-size: 20px;
  }

  .peer {
    width: 78px;
  }

  .peer-icon {
    width: 46px;
    height: 46px;
  }

  .peer-icon svg {
    width: 22px;
    height: 22px;
  }
}
