:root {
  color-scheme: light;
  --page: #f2f4f6;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --text: #18212b;
  --muted: #66727e;
  --line: #d9dee4;
  --line-strong: #c4ccd4;
  --blue: #2268d7;
  --blue-hover: #1959bc;
  --green: #13795b;
  --green-soft: #edf8f3;
  --amber: #9a6200;
  --red: #b4232d;
  --shadow: 0 8px 24px rgba(24, 33, 43, 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.button,
.file-action {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 650;
}

button:hover,
.file-action:hover {
  border-color: #aab5c0;
  background: #fafbfc;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.file-action:focus-visible {
  outline: 3px solid rgba(34, 104, 215, 0.2);
  outline-offset: 2px;
}

button.primary,
.send-button,
.file-action.primary-action {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

button.primary:hover,
.send-button:hover,
.file-action.primary-action:hover {
  border-color: var(--blue-hover);
  background: var(--blue-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.app-header {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #18212b;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.app-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.language-control {
  flex: 0 0 auto;
}

.language-control select {
  width: 148px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 32px 0 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.device-menu {
  min-width: 0;
  max-width: min(48%, 280px);
  height: 40px;
  min-height: 40px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(24, 33, 43, 0.04);
}

.device-menu > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: #24a67a;
  box-shadow: 0 0 0 3px #e6f6f0;
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.receiver-card,
.send-card,
.inbox-panel,
.modal-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.receiver-card {
  padding: 18px;
  display: grid;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.send-card,
.inbox-panel {
  padding: 20px;
}

.inbox-panel {
  margin-top: 14px;
}

.app-footer {
  padding: 22px 0 0;
  text-align: center;
  font-size: 13px;
}

.app-footer a {
  color: var(--muted);
}

.section-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h2,
.content-heading h3 {
  margin: 0;
  overflow-wrap: anywhere;
  letter-spacing: 0;
}

.section-heading h2 {
  font-size: 19px;
  line-height: 1.3;
}

.content-heading h3 {
  font-size: 16px;
}

.section-kicker {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}

.inbox-kicker {
  color: var(--amber);
}

.live-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}

.receive-code-wrap {
  min-width: 0;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.qr-code {
  width: min(250px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.qr-code svg {
  width: 100%;
  height: 100%;
  display: block;
}

.code-stack {
  width: min(250px, 100%);
  min-width: 0;
  display: grid;
  gap: 6px;
}

.code-stack small,
.field-label,
.input-block > span,
.file-picker > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.code-stack p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.device-code {
  width: 100%;
  min-width: 0;
  padding: 10px 8px;
  border-radius: 8px;
  background: #18212b;
  text-align: center;
  font-size: 40px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
  color: #fff;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}

.target-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 9px;
  margin-top: 16px;
}

.code-entry {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input[type="text"],
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
}

input[type="text"] {
  height: 44px;
  padding: 0 12px;
  font-variant-numeric: tabular-nums;
}

textarea {
  min-height: 128px;
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--blue);
  background: #fff;
}

.selected-target {
  min-width: 0;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #cde4d9;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.favorites-block {
  margin-top: 13px;
}

.device-list {
  min-width: 0;
  min-height: 34px;
  margin-top: 7px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.device-list .muted {
  margin: 5px 0 0;
  font-size: 13px;
}

.device-button {
  min-height: 34px;
  padding: 0 11px;
  background: var(--surface-soft);
  font-size: 13px;
}

.form-divider {
  height: 1px;
  margin: 16px 0;
  background: var(--line);
}

.content-heading {
  margin-bottom: 12px;
}

.input-block {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.file-picker {
  min-width: 0;
  margin-top: 11px;
  border: 1px dashed #aeb8c2;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  display: grid;
  gap: 9px;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}

.clipboard-fallback {
  position: fixed;
  top: 0;
  left: -9999px;
}

.file-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.file-action {
  min-width: 0;
  text-align: center;
}

.file-picker strong {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.local-transfer-note {
  min-width: 0;
  margin-top: 12px;
  padding: 10px 11px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid #d6e8df;
  border-radius: 7px;
  background: #f4faf7;
}

.privacy-check {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dff2e9;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.local-transfer-note p {
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 2px;
  line-height: 1.4;
}

.local-transfer-note strong {
  color: #175d48;
  font-size: 13px;
}

.local-transfer-note p span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.send-footer {
  min-width: 0;
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  align-items: end;
  gap: 14px;
}

.send-feedback {
  min-width: 0;
}

.send-button {
  width: 100%;
  height: 50px;
  font-size: 15px;
  font-weight: 800;
}

.status {
  min-width: 0;
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.receiver-card > .status {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--green);
}

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

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

.status.danger {
  color: var(--red);
}

progress {
  width: 100%;
  height: 7px;
  margin-top: 7px;
  accent-color: var(--blue);
}

.received-list {
  min-width: 0;
  display: grid;
  gap: 9px;
  margin-top: 13px;
}

.received-list > .muted {
  margin: 0;
  padding: 16px 0 4px;
}

.received-item {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: var(--surface-soft);
}

.received-item > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.text-box {
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: var(--surface-soft);
}

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

.ghost-button {
  background: transparent;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(24, 33, 43, 0.58);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal[hidden] {
  display: none;
}

.modal-panel {
  width: min(500px, 100%);
  padding: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

#scan-video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
  background: #101820;
}

#scan-video[hidden] {
  display: none;
}

.scan-fallback {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.info-shell {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.info-brand {
  color: var(--text);
  text-decoration: none;
}

.info-brand > span:last-child {
  display: grid;
  gap: 2px;
}

.info-brand strong {
  font-size: 18px;
}

.info-brand small {
  color: var(--muted);
}

.info-content {
  width: min(760px, 100%);
  margin: 0 auto;
  padding-top: 42px;
}

.info-intro {
  padding-bottom: 28px;
}

.info-content h1,
.info-content h2,
.info-content h3 {
  margin-top: 0;
  letter-spacing: 0;
}

.info-content h1 {
  margin-bottom: 12px;
  font-size: 34px;
  line-height: 1.2;
}

.info-content h2 {
  margin-bottom: 16px;
  font-size: 22px;
}

.info-content h3 {
  margin-bottom: 7px;
  font-size: 16px;
}

.info-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.info-intro p {
  max-width: 680px;
  font-size: 17px;
}

.info-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.info-columns > div {
  min-width: 0;
  padding-top: 14px;
  border-top: 2px solid var(--blue);
}

.info-section {
  margin-top: 36px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.info-section > h3 {
  margin-top: 22px;
}

.info-section details {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.info-section details:last-child {
  border-bottom: 1px solid var(--line);
}

.info-section summary {
  cursor: pointer;
  font-weight: 700;
}

.info-section details p {
  padding-top: 9px;
}

.info-back {
  margin-top: 32px;
}

[dir="rtl"] .local-transfer-note,
[dir="rtl"] .brand-lockup {
  text-align: right;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1080px);
    padding: 12px 0 28px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 11px;
  }

  .brand-lockup {
    gap: 9px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .app-header h1 {
    font-size: 19px;
  }

  .app-header p {
    display: none;
  }

  .device-menu {
    flex: 1 1 0;
    max-width: none;
    height: 38px;
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .header-actions {
    width: 100%;
    justify-content: stretch;
    gap: 6px;
  }

  .language-control {
    flex: 1 1 0;
  }

  .language-control select {
    width: 100%;
    height: 38px;
    padding-left: 7px;
    font-size: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .receiver-card {
    position: static;
    padding: 14px;
    gap: 12px;
  }

  .send-card,
  .inbox-panel {
    padding: 15px;
  }

  .inbox-panel {
    margin-top: 10px;
  }

  .section-heading h2 {
    font-size: 17px;
  }

  .receive-code-wrap {
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: center;
    justify-items: stretch;
    gap: 12px;
  }

  .qr-code {
    width: 110px;
  }

  .code-stack {
    width: 100%;
  }

  .code-stack small {
    text-align: left;
  }

  [dir="rtl"] .code-stack small {
    text-align: right;
  }

  .device-code {
    font-size: 36px;
    padding: 11px 6px;
  }

  .target-strip {
    grid-template-columns: 1fr;
    margin-top: 13px;
  }

  #scan-code {
    height: 48px;
  }

  textarea {
    min-height: 104px;
  }

  .send-footer {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .send-button {
    grid-row: 1;
  }

  .info-shell {
    width: min(100% - 20px, 900px);
    padding: 12px 0 36px;
  }

  .info-header {
    gap: 10px;
  }

  .info-content {
    padding-top: 30px;
  }

  .info-content h1 {
    font-size: 28px;
  }

  .info-columns {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

@media (max-width: 370px) {
  .app-shell {
    width: min(100% - 14px, 1080px);
  }

  .brand-mark {
    display: none;
  }

  .app-header {
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    display: grid;
  }

  .language-control select,
  .device-menu {
    width: 100%;
    max-width: none;
  }

  .receive-code-wrap {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 9px;
  }

  .qr-code {
    width: 96px;
  }

  .device-code {
    font-size: 31px;
  }

  .file-actions,
  .scan-fallback {
    grid-template-columns: 1fr;
  }
}
