.x402-lacey {
  --x402-navy: #1d344d;
  --x402-navy-dark: #12263a;
  --x402-blue: #2f6e9f;
  --x402-teal: #2d7776;
  --x402-orange: #d77a20;
  --x402-gold: #d8a11c;
  --x402-ink: #1e252b;
  --x402-muted: #65717c;
  --x402-line: #cbd3da;
  --x402-panel: #ffffff;
  --x402-soft: #f4f7f9;
}

.x402-lacey,
.x402-lacey * { box-sizing: border-box; }

.x402-lacey {
  display: block;
  float: none;
  width: 100%;
  min-width: 0;
  max-width: 1360px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  container: x402-lacey-tool / inline-size;
  color: var(--x402-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.x402-lacey__title {
  margin: 0 0 10px;
  color: var(--x402-navy-dark);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.15;
}

.x402-lacey__intro {
  margin: 0 0 18px;
  max-width: 850px;
  color: var(--x402-muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.x402-lacey__notice {
  margin-bottom: 24px;
  padding: 13px 16px;
  border-left: 4px solid var(--x402-orange);
  border-radius: 8px;
  background: #fff8f0;
  color: #4f4338;
  line-height: 1.5;
}

.x402-lacey__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.x402-lacey__editor,
.x402-lacey__preview-panel {
  border: 1px solid var(--x402-line);
  border-radius: 18px;
  background: var(--x402-panel);
  box-shadow: 0 12px 30px rgba(22, 40, 57, .08);
}

.x402-lacey__editor { padding: 24px; container: x402-lacey-editor / inline-size; min-width: 0; }
.x402-lacey__preview-panel { padding: 18px; min-width: 0; }

.x402-lacey__editor-heading,
.x402-lacey__preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.x402-lacey__editor-heading h3,
.x402-lacey__preview-heading h3 {
  margin: 0 0 3px;
  color: var(--x402-navy-dark);
  font-size: 1.25rem;
}

.x402-lacey__editor-heading p,
.x402-lacey__preview-heading p,
.x402-lacey__preview-heading span,
.x402-lacey__row-help {
  margin: 0;
  color: var(--x402-muted);
  font-size: .9rem;
}

.x402-lacey__counter {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid #b8d2d1;
  border-radius: 999px;
  background: #edf7f7;
  color: var(--x402-teal);
  font-size: .82rem;
  font-weight: 700;
}

.x402-lacey__species-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: end;
  padding: 14px 0;
  border-top: 1px solid #e2e7eb;
}

.x402-lacey__species-row:first-child { border-top: 0; padding-top: 4px; }

.x402-lacey__field { display: block; margin: 0; min-width: 0; }
.x402-lacey__field--scientific { grid-column: 1 / 3; }
.x402-lacey__remove { grid-column: 3; grid-row: 1; }

.x402-lacey__field span {
  display: block;
  margin-bottom: 5px;
  color: var(--x402-navy-dark);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.x402-lacey__field input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid #bfc8cf;
  border-radius: 8px;
  background: #fff;
  color: var(--x402-ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
}

.x402-lacey__field input:focus {
  outline: 3px solid rgba(47, 110, 159, .15);
  border-color: var(--x402-blue);
}

.x402-lacey__remove {
  width: 36px;
  height: 44px;
  min-width: 0;
  margin: 0;
  padding: 0;
  text-align: center;
  border: 1px solid #d9c2c2;
  border-radius: 8px;
  background: #fff7f7;
  color: #8f3838;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.x402-lacey__row-controls,
.x402-lacey__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.x402-lacey__row-controls { margin-top: 8px; }
.x402-lacey__row-help { margin-top: 9px; }
.x402-lacey__actions { margin-top: 22px; padding-top: 20px; border-top: 1px solid #e0e5e9; }

.x402-lacey__button {
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 10px 16px;
  line-height: 1.4;
  white-space: normal;
  text-transform: none;
  letter-spacing: normal;
  border-radius: 9px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.x402-lacey__button--primary {
  background: var(--x402-navy-dark);
  color: #fff;
}

.x402-lacey__button--secondary {
  border-color: var(--x402-blue);
  background: #fff;
  color: var(--x402-navy-dark);
}

.x402-lacey__button--ghost {
  border-color: #d8dee3;
  background: #f7f9fa;
  color: var(--x402-muted);
}

.x402-lacey__button:disabled,
.x402-lacey__remove:disabled { opacity: .45; cursor: not-allowed; }


.x402-lacey__print-note {
  margin: 12px 0 0;
  color: var(--x402-muted);
  font-size: .86rem;
  line-height: 1.45;
}

.x402-lacey__message {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #e1b8b8;
  border-radius: 8px;
  background: #fff3f3;
  color: #7b2c2c;
  font-size: .92rem;
}

.x402-lacey__preview-panel { position: static; }

.x402-lacey__label {
  position: relative;
  aspect-ratio: 4 / 6;
  width: min(100%, 384px);
  container: x402-lacey-label / inline-size;
  margin: 0 auto;
  overflow: hidden;
  border: 5px solid var(--x402-navy-dark);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(25, 39, 52, .13);
}

.x402-lacey__label::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 85% 7%, rgba(45,119,118,.06) 0 1px, transparent 2px) 0 0 / 12px 12px,
    linear-gradient(135deg, rgba(216,161,28,.035), transparent 38%);
}

.x402-lacey__label-top {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 108px;
  padding: 15px 16px 13px;
  color: #fff;
  background: var(--x402-navy-dark);
  border-bottom: 4px solid var(--x402-orange);
}

.x402-lacey__wildlife {
  font-size: clamp(1.55rem, 4vw, 2.2rem);
  font-weight: 900;
  line-height: .95;
  letter-spacing: .035em;
}

.x402-lacey__live {
  margin-top: 7px;
  font-size: clamp(.82rem, 2vw, 1.02rem);
  font-weight: 800;
  letter-spacing: .045em;
}

.x402-lacey__emblem {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.2));
}

.x402-lacey__status {
  position: relative;
  z-index: 1;
  padding: 8px 14px;
  text-align: center;
  color: var(--x402-teal);
  background: #edf7f7;
  border-bottom: 1px solid #c7dddd;
  font-size: .98rem;
  font-weight: 900;
  letter-spacing: .13em;
}

.x402-lacey__table-wrap {
  position: relative;
  z-index: 1;
  padding: 12px 12px 0;
}

.x402-lacey__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.x402-lacey__table th {
  padding: 8px 7px;
  background: var(--x402-soft);
  color: var(--x402-navy-dark);
  border: 1px solid #bcc6cd;
  font-size: .72rem;
  line-height: 1.1;
  text-align: left;
  letter-spacing: .025em;
}

.x402-lacey__table th:first-child { width: 13%; text-align: center; }
.x402-lacey__table th:nth-child(2) { width: 39%; }
.x402-lacey__table th:nth-child(3) { width: 48%; }

.x402-lacey__table td {
  height: 44px;
  padding: 6px 7px;
  border: 1px solid #c8d0d6;
  vertical-align: middle;
  font-size: .78rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.x402-lacey__table td:first-child {
  text-align: center;
  font-weight: 850;
  color: var(--x402-navy-dark);
}

.x402-lacey__table td:nth-child(3) { font-style: italic; }
.x402-lacey__table td.is-empty { color: #9aa4ac; }

.x402-lacey__footer {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  background: var(--x402-navy-dark);
  color: rgba(255,255,255,.9);
  font-size: .56rem;
  letter-spacing: .035em;
  text-transform: uppercase;
}

/* Only the tool breaks out of a narrow theme column. The page header,
   shipping form, navigation and other blocks are not widened or repositioned. */
.x402-lacey-host {
  display: flow-root;
  float: none;
  clear: both;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 0 !important;
  border: 0;
  overflow: visible;
}
.x402-lacey-host > .x402-lacey {
  width: var(--x402-lacey-screen-width, 100%) !important;
  max-width: none !important;
  margin-left: var(--x402-lacey-screen-offset, 0px) !important;
  margin-right: 0 !important;
  padding: 0 !important;
  float: none !important;
}
.x402-lacey__actions .x402-lacey__button { flex: 1 1 230px; }
.x402-lacey__button:focus-visible,
.x402-lacey__remove:focus-visible {
  outline: 3px solid var(--x402-blue);
  outline-offset: 3px;
}
.x402-lacey__message[hidden] { display: none !important; }
.x402-lacey__table { margin: 0; }
.x402-lacey__emblem { flex: 0 0 auto; margin: 0; padding: 0; border: 0; }

/* Component width, not monitor width, controls the internal layout.
   Contained shortcodes in intentional columns therefore remain usable. */
@container x402-lacey-tool (min-width: 900px) {
  .x402-lacey__layout { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
  .x402-lacey__preview-panel { position: sticky; top: 24px; }
}
@container x402-lacey-tool (min-width: 1100px) {
  .x402-lacey__layout { grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; }
}
@container x402-lacey-editor (min-width: 600px) {
  .x402-lacey__species-row {
    grid-template-columns: 74px minmax(0, 1fr) minmax(0, 1.25fr) 36px;
    gap: 12px;
  }
  .x402-lacey__field--scientific { grid-column: auto; }
  .x402-lacey__remove { grid-column: auto; grid-row: auto; }
}
@container x402-lacey-tool (max-width: 600px) {
  .x402-lacey__editor { padding: 16px; }
  .x402-lacey__preview-panel { padding: 14px; }
  .x402-lacey__layout { gap: 20px; }
  .x402-lacey__actions .x402-lacey__button { flex-basis: 100%; }
}

/* Scale the on-screen preview as a complete 4 x 6 label. Fixed desktop
   row heights otherwise cut off the lower rows on a small phone screen.
   The independent physical print stylesheet is unchanged. */
@supports (font-size: 1cqw) {
  .x402-lacey__label-top { min-height: 0; height: 27cqw; padding: 4cqw; gap: 2.5cqw; border-bottom-width: 1cqw; }
  .x402-lacey__wildlife { font-size: 9cqw; }
  .x402-lacey__live { font-size: 3.8cqw; margin-top: 2cqw; letter-spacing: .025em; }
  .x402-lacey__emblem { width: 14cqw; height: 14cqw; }
  .x402-lacey__status { font-size: 4cqw; padding: 1.6cqw 3cqw; line-height: 1.35; }
  .x402-lacey__table-wrap { padding: 3cqw 3cqw 0; }
  .x402-lacey__table th { font-size: 2.7cqw; padding: 1.8cqw 1.2cqw; letter-spacing: .015em; }
  .x402-lacey__table td { font-size: 3cqw; height: 10.5cqw; padding: 1.3cqw 1.2cqw; }
  .x402-lacey__footer { font-size: 1.6cqw; padding: 2cqw; gap: 1cqw; line-height: 1.3; }
}

/* Retain a usable single-column fallback in older browsers without
   container-query support; enhancement never creates horizontal scrolling. */
@supports not (container-type: inline-size) {
  .x402-lacey__label { min-height: 590px; }
}
