:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5e675e;
  --paper: #fff9ea;
  --panel: rgba(255, 252, 241, 0.88);
  --panel-strong: #fffcf1;
  --line: rgba(23, 32, 27, 0.14);
  --moss: #1f5c42;
  --moss-2: #174633;
  --sun: #f5b642;
  --clay: #d45f3d;
  --sky: #8ac6d1;
  --cream: #fff3cf;
  --danger: #a33525;
  --shadow: 0 24px 80px rgba(38, 48, 32, 0.16);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 12% 10%, rgba(245, 182, 66, 0.42), transparent 28rem),
    radial-gradient(circle at 86% 8%, rgba(138, 198, 209, 0.48), transparent 25rem),
    linear-gradient(135deg, #fff7df 0%, #f8ebc5 48%, #e6f0d9 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(31, 92, 66, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 92, 66, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

body::after {
  position: fixed;
  right: -9rem;
  bottom: -13rem;
  z-index: -1;
  width: 32rem;
  height: 32rem;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(45deg, transparent 46%, rgba(31, 92, 66, 0.14) 47% 53%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, rgba(212, 95, 61, 0.16) 47% 53%, transparent 54%),
    var(--cream);
  border-radius: 50%;
  filter: blur(0.2px);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

code {
  padding: 0.05rem 0.32rem;
  color: var(--moss-2);
  background: rgba(31, 92, 66, 0.09);
  border-radius: 999px;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.hero {
  position: relative;
  padding: 22px;
  margin-bottom: 22px;
  overflow: hidden;
  background: rgba(255, 252, 241, 0.58);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.hero::after {
  position: absolute;
  right: 2rem;
  bottom: -7.4rem;
  width: 18rem;
  height: 18rem;
  content: "";
  background:
    linear-gradient(90deg, var(--ink) 12px, transparent 12px) 0 0 / 42px 42px,
    linear-gradient(var(--ink) 12px, transparent 12px) 0 0 / 42px 42px,
    linear-gradient(90deg, transparent 15px, var(--paper) 15px 27px, transparent 27px) 0 0 / 42px 42px,
    linear-gradient(transparent 15px, var(--paper) 15px 27px, transparent 27px) 0 0 / 42px 42px;
  border: 14px solid var(--ink);
  border-radius: 44px;
  opacity: 0.06;
  transform: rotate(-10deg);
}

.topbar,
.hero-grid,
.workspace,
.panel-heading,
.button-row,
.download-grid,
.field-grid,
.preset-row,
.meter-row,
.batch-intro,
.scanner-grid,
.status-stack {
  display: grid;
  gap: 16px;
}

.topbar {
  position: relative;
  z-index: 1;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  width: fit-content;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  background: var(--ink);
  border-radius: 10px;
  box-shadow: inset 10px 0 0 var(--sun), inset 0 10px 0 var(--sky);
}

.brand-mark::after {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 8px;
  height: 8px;
  content: "";
  background: var(--paper);
  border-radius: 3px;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.trust-strip span,
.promise-pill,
.status-badge,
.soft-warning,
.mini-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.42rem 0.68rem;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  border-radius: 999px;
}

.trust-strip span {
  color: var(--moss-2);
  background: rgba(31, 92, 66, 0.1);
}

.hero-grid {
  position: relative;
  z-index: 1;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: end;
  margin-top: 42px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--clay);
  font-size: 0.77rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 0.98;
}

h1 {
  max-width: 1000px;
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 7.8rem);
  font-weight: 900;
  letter-spacing: -0.085em;
}

h2 {
  margin-bottom: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.7rem);
  letter-spacing: -0.045em;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.hero-copy {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.22rem);
  line-height: 1.72;
}

.promise-card {
  position: relative;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 243, 207, 0.74)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 16px 42px rgba(23, 32, 27, 0.12);
}

.promise-card p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.promise-pill {
  color: var(--ink);
  background: var(--sun);
}

.workspace {
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.creator-panel,
.preview-panel {
  padding: clamp(18px, 3vw, 28px);
}

.preview-panel {
  position: sticky;
  top: 18px;
}

.panel-heading {
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-bottom: 22px;
}

.form-stack {
  position: relative;
}

.qr-form {
  display: none;
  animation: rise 240ms ease both;
}

.qr-form.active {
  display: grid;
  gap: 16px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.toggle-card span {
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.84rem 0.98rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 32, 27, 0.16);
  border-radius: 16px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  background: #fffef8;
  border-color: rgba(31, 92, 66, 0.7);
  box-shadow: 0 0 0 4px rgba(31, 92, 66, 0.12);
}

input[type="range"] {
  min-height: auto;
  padding: 0;
  accent-color: var(--moss);
  background: transparent;
  border: 0;
  border-radius: 0;
}

input[type="color"] {
  min-height: 56px;
  padding: 6px;
}

input[type="file"] {
  padding: 0.78rem;
}

.field-grid.two,
.control-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.control-grid {
  margin-top: 18px;
}

.helper,
.meter-row,
.status-line,
.muted,
.batch-intro p,
.scanner-grid p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.helper {
  margin: -4px 0 0;
}

.meter-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.toggle-card {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 0.72rem 0.86rem;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(23, 32, 27, 0.14);
  border-radius: 16px;
}

.toggle-card.small {
  min-height: 42px;
}

.toggle-card input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--moss);
}

.segmented {
  display: flex;
  gap: 8px;
  padding: 6px;
  overflow-x: auto;
  background: rgba(31, 92, 66, 0.08);
  border-radius: 18px;
}

.segment {
  flex: 1 0 max-content;
  padding: 0.72rem 0.9rem;
  color: var(--moss-2);
  font-weight: 900;
  background: transparent;
  border: 0;
  border-radius: 13px;
}

.segment.active {
  color: white;
  background: var(--moss);
  box-shadow: 0 10px 24px rgba(31, 92, 66, 0.22);
}

.accordion {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

details {
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 22px;
}

summary {
  padding: 17px 0;
  font-weight: 900;
  list-style-position: outside;
  cursor: pointer;
}

details[open] {
  padding-bottom: 18px;
}

.preset-row {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.preset-row button {
  padding: 0.48rem 0.58rem;
  color: var(--moss-2);
  font-size: 0.78rem;
  font-weight: 900;
  background: rgba(31, 92, 66, 0.08);
  border: 1px solid rgba(31, 92, 66, 0.12);
  border-radius: 999px;
}

.button-row {
  grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
  align-items: center;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 46px;
  padding: 0.8rem 1rem;
  font-weight: 900;
  border-radius: 999px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  color: white;
  background: var(--moss);
  border: 1px solid var(--moss-2);
  box-shadow: 0 16px 28px rgba(31, 92, 66, 0.24);
}

.primary-button.alt {
  color: var(--ink);
  background: var(--sun);
  border-color: rgba(23, 32, 27, 0.18);
  box-shadow: 0 16px 28px rgba(245, 182, 66, 0.24);
}

.secondary-button,
.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(23, 32, 27, 0.16);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.34);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.preset-row button:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.preset-row button:active {
  transform: translateY(0);
}

.soft-warning {
  color: var(--danger);
  background: rgba(212, 95, 61, 0.14);
}

.hidden {
  display: none !important;
}

.qr-stage {
  position: relative;
  display: grid;
  min-height: 420px;
  place-items: center;
  padding: clamp(18px, 3vw, 30px);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.42) 52%, transparent 53%),
    linear-gradient(135deg, rgba(31, 92, 66, 0.12), rgba(245, 182, 66, 0.16));
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 30px;
}

.qr-stage::before,
.qr-stage::after {
  position: absolute;
  width: 160px;
  height: 160px;
  content: "";
  border: 24px solid rgba(23, 32, 27, 0.08);
  border-radius: 44px;
}

.qr-stage::before {
  top: -52px;
  left: -44px;
}

.qr-stage::after {
  right: -58px;
  bottom: -54px;
}

.qr-preview {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  max-width: 100%;
  padding: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 26px;
  box-shadow: 0 22px 54px rgba(23, 32, 27, 0.14);
}

.qr-preview canvas,
.qr-preview svg {
  display: block;
  max-width: min(100%, 360px);
  height: auto !important;
  border-radius: 12px;
}

.preview-placeholder {
  position: absolute;
  z-index: 2;
  max-width: 240px;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.5;
  text-align: center;
}

.destination-card {
  padding: 18px;
  margin: 18px 0;
  overflow-wrap: anywhere;
  background: rgba(23, 32, 27, 0.06);
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 22px;
}

.destination-card strong {
  display: block;
  margin: 8px 0;
  font-size: 1.12rem;
}

.destination-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.mini-label {
  color: var(--moss-2);
  background: rgba(31, 92, 66, 0.1);
}

.status-stack {
  gap: 8px;
  margin-bottom: 18px;
}

.status-line {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 16px;
}

.status-line.ok {
  color: var(--moss-2);
  background: rgba(31, 92, 66, 0.1);
}

.status-line.warn {
  color: var(--danger);
  background: rgba(212, 95, 61, 0.12);
}

.status-badge.waiting {
  color: var(--muted);
  background: rgba(23, 32, 27, 0.08);
}

.status-badge.good {
  color: white;
  background: var(--moss);
}

.status-badge.bad {
  color: white;
  background: var(--danger);
}

.download-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.download-grid button {
  width: 100%;
}

.batch-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  max-height: 460px;
  overflow: auto;
}

.batch-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  overflow-wrap: anywhere;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: 18px;
}

.batch-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: white;
  border-radius: 12px;
}

.batch-card span {
  color: var(--muted);
  font-size: 0.76rem;
}

.video-shell {
  display: grid;
  min-height: 240px;
  overflow: hidden;
  place-items: center;
  background: #101611;
  border-radius: 22px;
}

#scannerVideo {
  width: 100%;
  max-height: 420px;
  background: #101611;
}

.scan-output {
  display: grid;
  gap: 10px;
  padding: 16px;
  overflow-wrap: anywhere;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 18px;
}

.scan-output strong {
  display: block;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  color: white;
  font-weight: 900;
  pointer-events: none;
  background: var(--ink);
  border-radius: 999px;
  box-shadow: 0 18px 42px rgba(23, 32, 27, 0.28);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .hero-grid,
  .workspace {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: relative;
    top: auto;
  }

  .promise-card {
    max-width: 620px;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 18px, 1480px);
    padding-top: 9px;
  }

  .hero,
  .panel {
    border-radius: 24px;
  }

  .topbar,
  .panel-heading,
  .field-grid.two,
  .control-grid,
  .download-grid,
  .meter-row,
  .batch-intro,
  .scanner-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 18px;
  }

  .trust-strip {
    justify-content: flex-start;
  }

  h1 {
    font-size: clamp(2.8rem, 17vw, 5rem);
  }

  .qr-stage {
    min-height: 330px;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .button-row button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .hero,
  .creator-panel,
  .download-grid,
  .status-stack,
  .destination-card {
    display: none;
  }

  .workspace,
  .preview-panel {
    display: block;
    box-shadow: none;
  }

  .preview-panel {
    border: 0;
  }
}
