* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  color: #1a1a1a;
  background: #f6f4ef;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.35;
}

main {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

h1, .hint, .label, .buyer { margin: 0; text-align: center; }

h1 { font-size: 1.75rem; line-height: 1.2; }

.hint, .label { margin-top: 8px; color: #333; }

.buyer {
  margin-top: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  word-break: break-word;
}

.check {
  margin: 24px 0 8px;
  text-align: center;
  font-size: 3rem;
  color: #0f6b45;
}

.field { display: flex; flex-direction: column; margin-top: 16px; }

.field-label { margin-bottom: 6px; font-weight: 700; }

input[name="login"],
input[name="code"] {
  min-height: 52px;
  padding: 0 14px;
  border: 2px solid #1a1a1a;
  border-radius: 14px;
  background: #fff;
  color: #1a1a1a;
  font: inherit;
}

#reader {
  position: relative;
  width: 100%;
  min-height: 240px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 16px;
  background: #171717;
}

#reader:empty::before {
  content: "КАМЕРА";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d5d5d5;
  font-weight: 700;
  letter-spacing: 0.12em;
}

#reader video { width: 100%; }

#sale-form { display: none; }
#sale-form.open { display: block; }
#camera-block[hidden] { display: none; }

.qty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.qty button, .qty input {
  height: 64px;
  border: 2px solid #1a1a1a;
  border-radius: 14px;
  background: #fff;
  color: #1a1a1a;
}

.qty button { width: 64px; padding: 0; font-size: 32px; line-height: 1; }
.qty input {
  width: 96px;
  padding: 0 8px;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
}

.message {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  color: #8f1d18;
  background: #fde8e6;
  white-space: pre-line;
}

.message[hidden] { display: none; }

.actions {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

button, .link-button {
  min-height: 44px;
  font: inherit;
  touch-action: manipulation;
}

button:focus-visible, input:focus-visible, .link-button:focus-visible {
  outline: 3px solid #0f6b45;
  outline-offset: 2px;
}

.primary, .link-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: #0f6b45;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.primary:disabled { opacity: 0.55; }

.ghost {
  width: 100%;
  border: 0;
  background: transparent;
  color: #0f6b45;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
