:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --line: #374151;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --danger: #dc2626;
  --danger-2: #b91c1c;
  --ok: #16a34a;
  --warn: #d97706;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  width: min(980px, calc(100% - 32px));
  margin: 24px auto;
}

.container.narrow {
  width: min(480px, calc(100% - 32px));
}

.card,
.topbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.topbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
}

input,
textarea,
button,
a.btn {
  font: inherit;
}

input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-2);
}

.btn.btn-secondary {
  background: #475569;
}

.btn.btn-secondary:hover {
  background: #334155;
}

.btn.btn-danger {
  background: var(--danger);
}

.btn.btn-danger:hover {
  background: var(--danger-2);
}

.badge {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.92rem;
}

.msg {
  min-height: 22px;
}

.muted {
  color: var(--muted);
}

.result-panel {
  min-height: 80px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.result-ok {
  border-color: rgba(22, 163, 74, 0.45);
}

.result-warn {
  border-color: rgba(217, 119, 6, 0.45);
}

.result-bad {
  border-color: rgba(220, 38, 38, 0.45);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.result-table th,
.result-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.result-table th {
  width: 170px;
  color: var(--muted);
  font-weight: 600;
}

.result-table td {
  word-break: break-word;
}

.result-table tr:last-child th,
.result-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 680px) {
  .topbar {
    flex-direction: column;
  }

  .result-table th {
    width: 120px;
  }
}

@media (max-width: 680px) {
  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .result-row {
    grid-template-columns: 115px minmax(0, 1fr);
  }
}

.reader-box {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  min-height: 280px;
  padding: 8px;
}

#reader {
  max-width: 100%;
  margin: 0 auto;
}

#reader video {
  width: 100% !important;
  height: auto !important;
  border-radius: 8px;
  object-fit: cover;
}

#reader__scan_region {
  display: flex;
  justify-content: center;
}