:root {
  --bg: #eef2f6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #4b5563;
  --line: #d4dbe5;
  --primary: #0f766e;
  --danger: #be123c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Manrope, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 0% 0%, #dff4f0 0%, transparent 28%), var(--bg);
}

.shell {
  width: min(860px, 92vw);
  margin: 24px auto 48px;
  display: grid;
  gap: 14px;
}

.top h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

.top p {
  margin: 6px 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(3, 8, 19, 0.06);
  display: grid;
  gap: 12px;
}

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

.input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  min-width: 220px;
  flex: 1;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #e5e7eb;
  color: #111827;
}

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

.btn.danger {
  background: var(--danger);
  color: white;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.scanner {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.scanner video {
  width: 100%;
  max-width: 380px;
  border-radius: 10px;
  background: #000;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.scanner-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scanner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 800;
}

.pill.idle {
  background: #e5e7eb;
  color: #374151;
}

.pill.connecting {
  background: #fde68a;
  color: #92400e;
}

.pill.connected {
  background: #bbf7d0;
  color: #14532d;
}

.pill.disconnected,
.pill.failed {
  background: #fecaca;
  color: #7f1d1d;
}

.share {
  display: grid;
  gap: 10px;
}

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

.qr {
  width: fit-content;
  min-width: 180px;
  min-height: 180px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
}

.qr canvas {
  display: block;
}

.qr img {
  display: block;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 12px;
  min-height: 110px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: #fafbfc;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: #e8fbf7;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

progress {
  width: 100%;
  height: 14px;
}

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

.lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lists h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
}

.list li {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.download-link {
  border: 0;
  border-radius: 8px;
  background: #cffafe;
  color: #0f766e;
  font: inherit;
  font-weight: 700;
  padding: 6px 8px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .lists {
    grid-template-columns: 1fr;
  }
}
