.qr-shell,
.qr-explainer,
.qr-related {
  color: #111;
}

.qr-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.qr-back-link:hover,
.qr-back-link:focus-visible {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.qr-shell form {
  display: grid;
  gap: 1.5rem;
}

.qr-card {
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #fff;
  padding: clamp(1rem, 3vw, 1.75rem);
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.05);
}

.qr-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.qr-card-heading > div {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.qr-card-heading h2,
.qr-explainer h2,
.qr-related h2 {
  font-family: var(--font-headline, "Inter", sans-serif);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.qr-card-heading p {
  color: #6b7280;
  font-size: 0.82rem;
}

.qr-step {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 999px;
  background: #ffd700;
  font-weight: 900;
}

.qr-type-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.qr-type-button {
  min-height: 4.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.8rem;
  background: #fff;
  color: #4b5563;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 800;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.qr-type-button:hover,
.qr-type-button:focus-visible {
  border-color: #111;
  color: #111;
  transform: translateY(-1px);
}

.qr-type-button.is-active {
  border-color: #ffd700;
  background: #fff9d6;
  color: #111;
  box-shadow: inset 0 0 0 1px #ffd700;
}

.qr-fields,
.qr-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
  border-radius: 0.85rem;
  background: #f8f9fa;
}

.qr-fields.hidden {
  display: none;
}

.qr-options-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  background: transparent;
}

.qr-field {
  display: block;
  min-width: 0;
}

.qr-field > span,
.qr-logo-box h3 {
  display: block;
  margin-bottom: 0.42rem;
  color: #374151;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qr-field em,
.qr-logo-box h3 span {
  color: #9ca3af;
  font-style: normal;
  font-weight: 600;
  text-transform: none;
}

.qr-field input:not([type="color"]),
.qr-field textarea,
.qr-field select {
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid #d1d5db;
  border-radius: 0.65rem;
  background: #fff;
  padding: 0.7rem 0.8rem;
  color: #111;
  font-size: 0.9rem;
}

.qr-field textarea {
  resize: vertical;
}

.qr-field input:focus,
.qr-field textarea:focus,
.qr-field select:focus {
  border-color: #c9a900;
  outline: 3px solid rgba(255, 215, 0, 0.25);
}

.qr-field [aria-invalid="true"] {
  border-color: #b91c1c;
  outline-color: rgba(185, 28, 28, 0.18);
}

.qr-field-wide {
  grid-column: 1 / -1;
}

.qr-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.85rem;
  align-self: end;
  font-size: 0.88rem;
  font-weight: 700;
}

.qr-field-error {
  display: block;
  margin-top: 0.35rem;
  color: #b91c1c;
  font-size: 0.76rem;
  font-weight: 700;
}

.qr-field-error.hidden {
  display: none;
}

.qr-color-field input {
  width: 100%;
  height: 2.85rem;
  border: 1px solid #d1d5db;
  border-radius: 0.65rem;
  background: #fff;
  padding: 0.3rem;
}

.qr-logo-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem 1.25rem;
  margin-top: 1.25rem;
  border: 1px dashed #d1d5db;
  border-radius: 0.85rem;
  background: #f8f9fa;
  padding: 1rem;
}

.qr-logo-box h3 {
  margin-bottom: 0.2rem;
  color: #111;
}

.qr-logo-box p {
  color: #6b7280;
  font-size: 0.78rem;
}

.qr-logo-box > #qr-logo-meta {
  grid-column: 1 / -1;
}

.qr-logo-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#qr-logo {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.qr-file-button,
.qr-secondary-button,
.qr-generate-button {
  min-height: 2.75rem;
  border-radius: 0.65rem;
  padding: 0.7rem 1rem;
  font-family: var(--font-headline, "Inter", sans-serif);
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}

.qr-file-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #111;
  color: #fff;
}

.qr-secondary-button {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111;
}

.qr-secondary-button.hidden {
  display: none;
}

.qr-status {
  margin-top: 1rem;
  border-radius: 0.65rem;
  padding: 0.75rem 0.9rem;
  background: #f3f4f6;
  color: #374151;
  font-size: 0.84rem;
  font-weight: 700;
}

.qr-status.hidden {
  display: none;
}

.qr-status.is-error {
  background: #fef2f2;
  color: #991b1b;
}

.qr-status.is-success {
  background: #ecfdf5;
  color: #065f46;
}

.qr-generate-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 3.4rem;
  margin-top: 1rem;
  border: 0;
  background: #ffd700;
  color: #111;
  font-size: 1rem;
}

.qr-generate-button:hover,
.qr-generate-button:focus-visible {
  background: #e9c500;
}

.qr-local-note,
.qr-result-privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
  color: #6b7280;
  font-size: 0.76rem;
  text-align: center;
}

.qr-result-details {
  width: min(100%, 42rem);
  margin: 1.25rem auto 0;
}

.qr-result-actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.75rem;
  width: min(100%, 42rem);
  margin: 1.35rem auto 0;
}

.qr-result-actions .tool-flow-download,
.qr-result-actions .tool-flow-back {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}

.qr-result-details.hidden {
  display: none;
}

.qr-result-preview {
  display: grid;
  width: min(100%, 31rem);
  margin: 0 auto;
  place-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #f8f9fa;
  padding: clamp(0.8rem, 3vw, 1.5rem);
}

.qr-result-canvas {
  display: block;
  width: 100%;
  max-width: 28rem;
  height: auto;
  image-rendering: pixelated;
}

.qr-result-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
  text-align: left;
}

.qr-result-summary > div {
  border-radius: 0.7rem;
  background: #f3f4f6;
  padding: 0.75rem;
}

.qr-result-summary dt {
  color: #6b7280;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.qr-result-summary dd {
  margin-top: 0.2rem;
  color: #111;
  font-size: 0.82rem;
  font-weight: 800;
}

.qr-explainer,
.qr-related {
  margin-top: 2rem;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  background: #fff;
  padding: clamp(1.1rem, 3vw, 1.75rem);
}

.qr-explainer ol {
  margin: 1rem 0;
  padding-left: 1.25rem;
  color: #4b5563;
  list-style: decimal;
}

.qr-explainer li + li {
  margin-top: 0.45rem;
}

.qr-explainer p {
  color: #4b5563;
  line-height: 1.7;
}

.qr-related > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.qr-related a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.85rem;
}

.qr-related a:hover,
.qr-related a:focus-visible {
  border-color: #ffd700;
  background: #fffdf0;
}

.qr-related strong,
.qr-related small {
  display: block;
}

.qr-related small {
  margin-top: 0.15rem;
  color: #6b7280;
  font-size: 0.72rem;
}

@media (max-width: 800px) {
  .qr-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-related > div { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .qr-card-heading { align-items: flex-start; flex-direction: column; }
  .qr-fields, .qr-options-grid { grid-template-columns: 1fr; }
  .qr-field-wide { grid-column: auto; }
  .qr-logo-box { grid-template-columns: 1fr; }
  .qr-logo-box > #qr-logo-meta { grid-column: auto; }
  .qr-logo-actions { align-items: stretch; flex-direction: column; }
  .qr-result-summary { grid-template-columns: 1fr; }
  .qr-result-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .qr-type-button { transition: none; }
}
