:root {
  color-scheme: light;
  --bg: #efe9df;
  --ink: #383c42;
  --navy: #0f243c;
  --teal: #13b8b5;
  --green: #44b755;
  --code: #687487;
  --panel: #ebe2d3;
  --panel-wrap: #ffffff;
  --button-light: #aeb8c4;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

button {
  border: 0;
  font: inherit;
}

.labelcheck {
  width: min(100%, 720px);
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(238px, 1fr) auto auto auto auto;
  padding: max(18px, env(safe-area-inset-top)) 31px max(12px, env(safe-area-inset-bottom));
  background: var(--bg);
  overflow: hidden;
}

.brandbar {
  position: relative;
  min-height: 176px;
}

.brandguard-logo {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(168px, 34vw, 212px);
  height: auto;
  display: block;
}

.customer-logo-wrap {
  position: absolute;
  top: 16px;
  left: 56%;
  width: clamp(156px, 31vw, 205px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
}

.customer-logo {
  width: 82%;
  height: auto;
  display: block;
}

.live-dot {
  position: absolute;
  right: -3px;
  top: 78px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 11px rgba(68, 183, 85, 0.2);
}

.scanner-card {
  position: relative;
  width: 100%;
  min-height: 238px;
  height: 100%;
  overflow: hidden;
  border-radius: 34px;
  background: #a8662d;
}

.camera,
.placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera {
  object-fit: cover;
  opacity: 0;
  transition: opacity 160ms ease;
}

.camera.is-active {
  opacity: 1;
}

.placeholder {
  background:
    radial-gradient(circle at 4% 7%, rgba(255, 255, 255, 0.86) 0 14%, rgba(255, 255, 255, 0.48) 16%, transparent 33%),
    radial-gradient(circle at 66% 78%, rgba(47, 15, 4, 0.88) 0 34%, transparent 72%),
    linear-gradient(138deg, #f3a64e 0%, #a75f25 38%, #4b1304 100%);
  filter: blur(7px);
  transform: scale(1.04);
}

.placeholder.is-hidden {
  opacity: 0;
}

.scan-frame {
  position: absolute;
  inset: 31px;
  pointer-events: none;
}

.scan-frame span {
  position: absolute;
  width: 66px;
  height: 66px;
  border-color: var(--navy);
}

.scan-frame span:nth-child(1) {
  top: 0;
  left: 0;
  border-top: 8px solid;
  border-left: 8px solid;
  border-top-left-radius: 14px;
}

.scan-frame span:nth-child(2) {
  top: 0;
  right: 0;
  border-top: 8px solid;
  border-right: 8px solid;
  border-top-right-radius: 14px;
}

.scan-frame span:nth-child(3) {
  right: 0;
  bottom: 0;
  border-right: 8px solid;
  border-bottom: 8px solid;
  border-bottom-right-radius: 14px;
}

.scan-frame span:nth-child(4) {
  bottom: 0;
  left: 0;
  border-bottom: 8px solid;
  border-left: 8px solid;
  border-bottom-left-radius: 14px;
}

.scan-frame i {
  position: absolute;
  left: 17px;
  right: 17px;
  top: 3px;
  height: 7px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 10px rgba(19, 184, 181, 0.36);
}

.is-scanning .scan-frame i {
  animation: scanline 1.7s ease-in-out infinite;
}

.result-pill {
  display: block;
  width: 82%;
  min-height: 66px;
  margin: 17px auto 0;
  padding: 11px 24px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--code);
  color: #fff;
  font-size: clamp(33px, 7.2vw, 48px);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-pill.is-error {
  background: #9d4141;
}

.status {
  min-height: 28px;
  margin: 8px 0 9px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
  text-align: center;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin: 0;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel-wrap);
}

.status-grid div {
  min-height: 103px;
  min-width: 0;
  padding: 13px 13px 11px;
  border-radius: 10px;
  background: var(--panel);
}

.status-grid dt {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.05;
  text-transform: uppercase;
}

.status-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 0.88fr 0.88fr;
  gap: 12px;
  margin-top: 16px;
}

.actions button {
  min-width: 0;
  min-height: 62px;
  border-radius: 10px;
  background: var(--button-light);
  color: #fff;
  font-size: clamp(22px, 5.2vw, 30px);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.actions .stop-action {
  background: var(--ink);
}

.actions button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

@keyframes scanline {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(calc(100% + 170px));
  }
}

@media (max-width: 520px) {
  .labelcheck {
    padding-left: 18px;
    padding-right: 18px;
    grid-template-rows: auto minmax(220px, 1fr) auto auto auto auto;
  }

  .brandbar {
    min-height: 146px;
  }

  .brandguard-logo {
    width: 136px;
  }

  .customer-logo-wrap {
    top: 10px;
    left: 66%;
    width: 142px;
  }

  .live-dot {
    top: 67px;
    right: 0;
    width: 25px;
    height: 25px;
    box-shadow: 0 0 0 9px rgba(68, 183, 85, 0.2);
  }

  .scan-frame {
    inset: 26px;
  }

  .result-pill {
    width: 82%;
    min-height: 52px;
    margin-top: 13px;
    padding: 8px 18px;
  }

  .status {
    margin-bottom: 7px;
    font-size: 16px;
  }

  .status-grid {
    gap: 9px;
    padding: 8px;
  }

  .status-grid div {
    min-height: 91px;
    padding: 10px 9px;
  }

  .status-grid dt {
    font-size: 14px;
  }

  .status-grid dd {
    font-size: 17px;
  }

  .actions {
    gap: 10px;
    margin-top: 14px;
  }

  .actions button {
    min-height: 56px;
    border-radius: 9px;
  }
}

@media (max-height: 720px) {
  .labelcheck {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    grid-template-rows: auto minmax(185px, 1fr) auto auto auto auto;
  }

  .brandbar {
    min-height: 120px;
  }

  .brandguard-logo {
    width: 118px;
  }

  .customer-logo-wrap {
    top: 4px;
    left: 66%;
    width: 122px;
  }

  .live-dot {
    top: 55px;
    width: 21px;
    height: 21px;
  }

  .scanner-card {
    border-radius: 28px;
  }

  .scan-frame {
    inset: 23px;
  }

  .result-pill {
    min-height: 44px;
    margin-top: 9px;
    font-size: clamp(27px, 6.8vw, 38px);
  }

  .status {
    min-height: 22px;
    margin-top: 5px;
    margin-bottom: 6px;
    font-size: 14px;
  }

  .status-grid div {
    min-height: 75px;
  }

  .status-grid dt {
    margin-bottom: 5px;
    font-size: 12px;
  }

  .status-grid dd {
    font-size: 14px;
  }

  .actions {
    margin-top: 10px;
  }

  .actions button {
    min-height: 48px;
    font-size: clamp(18px, 4.8vw, 24px);
  }
}
