:root {
  color-scheme: light;
  --bg: #eef1f5;
  --card: #ffffff;
  --ink: #0b1220;
  --muted: #657083;
  --line: #d5dbe4;
  --primary: #0b1220;
  --primary-contrast: #ffffff;
  --success: #126331;
  --success-bg: #dcfce7;
  --danger: #a01818;
  --warning: #8a5200;
  --warning-bg: #fff4d6;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.shell { width: min(1320px, calc(100% - 30px)); margin: 0 auto; padding: 28px 0 46px; }
.hero { display: flex; gap: 24px; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; }
h1 { margin: 0; font-size: clamp(2.25rem, 5vw, 4rem); letter-spacing: -.055em; }
.subtitle { margin: 10px 0 0; color: var(--muted); max-width: 790px; line-height: 1.5; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.privacy-badge, .version-badge { border-radius: 999px; padding: 8px 12px; white-space: nowrap; font-size: .82rem; font-weight: 800; }
.privacy-badge { border: 1px solid #86efac; color: var(--success); background: var(--success-bg); }
.version-badge { border: 1px solid #bfdbfe; color: #174ea6; background: #eaf2ff; }

.tabs { display: inline-flex; background: #dfe4eb; padding: 5px; border-radius: 14px; margin-bottom: 18px; }
.tab { border: 0; background: transparent; padding: 10px 19px; border-radius: 10px; color: #4e596a; font-weight: 800; }
.tab.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 7px rgba(0,0,0,.09); }
.panel { display: none; }
.panel.active { display: block; }
.grid { display: grid; gap: 18px; }
.sender-grid { grid-template-columns: minmax(360px, .82fr) minmax(540px, 1.18fr); }
.receiver-grid { grid-template-columns: minmax(350px, .78fr) minmax(520px, 1.22fr); }
.card { background: var(--card); border: 1px solid rgba(11,18,32,.08); border-radius: var(--radius); padding: 23px; box-shadow: 0 18px 52px rgba(11,18,32,.07); }
h2 { margin: 0 0 14px; font-size: 1.16rem; }
.muted { color: var(--muted); line-height: 1.48; }
.hint { margin: -5px 0 17px; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.section-divider { height: 1px; background: #e7eaf0; margin: 21px 0; }

.file-picker { display: flex; min-height: 104px; border: 2px dashed var(--line); border-radius: 17px; align-items: center; justify-content: center; flex-direction: column; gap: 5px; font-weight: 800; background: #f8fafc; margin-bottom: 11px; text-align: center; padding: 18px; }
.file-picker:hover { border-color: #9aa4b2; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-picker small, .check-row small { color: var(--muted); font-weight: 500; line-height: 1.35; }
.file-list { display: grid; gap: 7px; margin-top: 11px; }
.file-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 9px 11px; border-radius: 11px; background: #f6f8fb; font-size: .84rem; }
.file-item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.file-list.compact .file-item:nth-child(n+7) { display: none; }
.more-files { color: var(--muted); font-size: .82rem; margin-top: 6px; }

.check-row { display: flex; gap: 11px; align-items: flex-start; padding: 13px; background: #f7f9fc; border: 1px solid #e4e8ef; border-radius: 13px; }
.check-row input { margin-top: 3px; width: 18px; height: 18px; }
.check-row span { display: grid; gap: 3px; }
.settings { margin: 15px 0; }
.two-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings label, .profile-label { display: grid; gap: 8px; font-size: .88rem; font-weight: 800; }
.profile-label { margin: 17px 0 10px; }
select { width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 11px; padding: 11px; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }
button { border: 1px solid var(--line); color: var(--ink); background: #fff; border-radius: 11px; padding: 10px 14px; font-weight: 800; }
button.primary { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }
button.secondary { background: #f9fafb; }
button.small { padding: 8px 11px; font-size: .84rem; }

.progress-wrap { margin-top: 20px; }
.progress-track { height: 10px; background: #e4e8ee; border-radius: 999px; overflow: hidden; }
.progress-bar { width: 0; height: 100%; background: var(--primary); transition: width .13s linear; }
.status { margin-top: 9px; color: var(--muted); font-size: .91rem; line-height: 1.42; }
.status.error { color: var(--danger); }
.status.success { color: var(--success); }
.status.warning { color: var(--warning); }

.stats { display: grid; gap: 9px; margin: 20px 0 0; }
.stats div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 9px; border-bottom: 1px solid #e7eaf0; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; font-weight: 800; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.compact-stats { font-size: .86rem; }

.qr-card { min-width: 0; display: flex; flex-direction: column; }
.qr-header { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; }
.qr-header h2 { margin-bottom: 4px; }
.qr-header p { margin: 0; }
.qr-stage { position: relative; min-height: 650px; display: grid; place-items: center; background: #fff; border-radius: 17px; overflow: hidden; }
.qr-canvas { position: absolute; display: block; max-width: 100%; height: auto; image-rendering: pixelated; opacity: 0; visibility: hidden; }
.qr-canvas.active { opacity: 1; visibility: visible; }
.frame-info { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 11px; }
.sender-cycle { margin-top: 10px; }
.qr-stage:fullscreen { background: #fff; padding: 1.2vh; }
.qr-stage:fullscreen .qr-canvas { max-width: 97vw; max-height: 97vh; }

.camera-stage { position: relative; min-height: 660px; background: #030712; border-radius: 17px; overflow: hidden; display: grid; place-items: center; }
#cameraVideo { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.camera-placeholder { color: #d1d5db; z-index: 1; }
.scan-guide { position: absolute; width: min(82%, 540px); aspect-ratio: 1; border: 3px solid rgba(255,255,255,.95); border-radius: 23px; z-index: 2; box-shadow: 0 0 0 9999px rgba(0,0,0,.18); pointer-events: none; display: grid; place-items: center; }
.scan-guide span { color: rgba(255,255,255,.35); font-size: 1.1rem; letter-spacing: .2em; font-weight: 900; }
.camera-tip { margin: 12px 0 0; color: var(--muted); text-align: center; font-size: .9rem; }

.complete-box { margin-top: 18px; background: var(--success-bg); color: var(--success); padding: 16px; border-radius: 15px; }
.complete-box > p { margin: 6px 0 12px; }
.received-files { display: grid; gap: 8px; margin-top: 13px; }
.received-file { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; background: rgba(255,255,255,.72); padding: 10px; border-radius: 11px; }
.received-file-info { min-width: 0; }
.received-file-info strong { display: block; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.received-file-info small { color: var(--muted); }
.received-file button { padding: 8px 10px; font-size: .8rem; }
.hidden { display: none !important; }
footer { color: var(--muted); font-size: .82rem; text-align: center; margin-top: 20px; }

@media (max-width: 980px) {
  .sender-grid, .receiver-grid { grid-template-columns: 1fr; }
  .qr-stage { min-height: 560px; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 18px, 620px); padding-top: 17px; }
  .hero { display: block; }
  .badges { justify-content: flex-start; margin-top: 14px; }
  .card { padding: 16px; border-radius: 18px; }
  .two-settings { grid-template-columns: 1fr; }
  .qr-stage { min-height: 350px; }
  .camera-stage { min-height: 61vh; }
  .qr-header { align-items: center; }
  .receiver-controls { order: 2; }
  .camera-card { order: 1; }
}
