.scan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(230px, 1fr);
  gap: 17px;
}

.scan-intro { margin-bottom: 3px; }
#offline-status { margin-top: 0; font-size: 13px; }
.scan-preview { padding: 15px; }
.viewfinder {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  min-height: 195px;
  border: 1px solid #356297;
  border-radius: 11px;
  background: radial-gradient(ellipse at 50% 53%, #0c3866, #031026 70%);
}

.viewfinder video { position: absolute; width: 100%; height: 100%; object-fit: contain; }
.frame {
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  width: min(48%, 255px);
  aspect-ratio: 1;
  border-radius: 18px;
  background: #295b9c18;
  color: #a2d7ff;
  pointer-events: none;
  text-align: center;
}

.frame-corner {
  position: absolute;
  width: 19%;
  height: 19%;
  border: 2px solid #c4f4ff;
  filter: drop-shadow(0 0 5px #1595ef);
}
.frame-corner:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 16px 0 0; }
.frame-corner:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 16px 0 0; }
.frame-corner:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 16px; }
.frame-corner:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 16px; }

.frame-code {
  position: relative;
  font-size: clamp(44px, 6vw, 88px);
  color: #72b8ff;
  line-height: .9;
}
.frame small { max-width: 17ch; font-size: clamp(8px, 1vw, 12px); color: #d4e5ff; }
.frame::after {
  position: absolute;
  top: 53%;
  left: -17%;
  right: -17%;
  height: 2px;
  box-shadow: 0 0 8px 3px #0a7bf6;
  background: linear-gradient(90deg, transparent, #3bd4fd 48%, transparent);
  content: "";
}

.viewfinder:has(video:not([hidden])) .frame-code,
.viewfinder:has(video:not([hidden])) .frame small { visibility: hidden; }

.scan-controls > .button, .scan-controls > button { flex: 1 1 150px; }
.scan-guide {
  background:
    radial-gradient(ellipse at top right, #0a6ae5b0, transparent 48%),
    var(--panel);
}
.scan-guide ol { display: grid; gap: 0; margin: 6px 0 16px; padding: 0; list-style: none; counter-reset: guide; }
.scan-guide li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 54px;
  padding: 9px 0;
  border-bottom: 1px solid #365787;
  font-size: 14px;
  counter-increment: guide;
}
.scan-guide li::before {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid #3e8ce7;
  border-radius: 7px;
  background: #12498c;
  color: white;
  content: counter(guide);
}
.scan-guide .button { width: 100%; }

#result-card { border-left: 4px solid #62a9ff; }
#result-card[data-outcome="valid"] { border-left-color: #50dda0; }
#result-card[data-outcome="invalid"], #result-card[data-outcome="malformed"],
#result-card[data-outcome="unreadable"] { border-left-color: #f47d6e; }
#result-card[data-outcome="unknown_key"], #result-card[data-outcome="unavailable"] { border-left-color: #edb850; }

@media (max-width: 925px) {
  .scan-layout { grid-template-columns: 1fr; }
}
