:root {
  --bg: #fff9f1;
  --surface: #fffefb;
  --surface-2: #fff3e1;
  --ink: #1f2329;
  --muted: #545f69;
  --line: #d4c4ac;
  --accent: #d45d2d;
  --accent-2: #1d7d6f;
  --radius: 18px;
  --shadow: 0 10px 35px rgba(37, 25, 12, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Manrope", "Avenir Next", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 12%, #ffe4c0 0%, transparent 30%),
    radial-gradient(circle at 87% 18%, #ffd6a8 0%, transparent 32%),
    linear-gradient(180deg, #fffaf3 0%, #fff1dd 100%);
  min-height: 100vh;
}

.container {
  width: min(1180px, 92%);
  margin: 0 auto;
}

.bg-orb {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(34px);
  opacity: 0.22;
}

.orb-a {
  width: 280px;
  height: 280px;
  background: #f08a52;
  top: 18%;
  left: -60px;
}

.orb-b {
  width: 360px;
  height: 360px;
  background: #2d9f8e;
  bottom: -80px;
  right: -100px;
}

.hero {
  padding: 3.8rem 0 2.4rem;
}

.hero__inner {
  background: linear-gradient(130deg, #fffefb 0%, #ffefda 100%);
  border: 1px solid #f1d2ad;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  animation: fadeUp 450ms ease-out both;
}

.eyebrow {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-size: 0.8rem;
}

h1 {
  margin: 0.35rem 0 0.5rem;
  font-family: "Space Grotesk", "Futura", sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.08;
}

.hero__lead {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.12rem);
}

.access-bar {
  margin-top: 1rem;
  border: 1px dashed #d7bea0;
  border-radius: 12px;
  padding: 0.7rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  background: #fff9ef;
}

.access-bar label {
  font-size: 0.8rem;
  font-weight: 700;
}

.access-bar button {
  border: 1px solid #c5ab87;
  background: #fff4e5;
  border-radius: 10px;
  padding: 0.5rem 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

#accessStatus {
  font-size: 0.85rem;
  font-weight: 700;
  color: #155c50;
}

.controls {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.9rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label,
legend {
  font-size: 0.83rem;
  font-weight: 700;
  color: #41505b;
}

input,
select {
  width: 100%;
  border: 1px solid #ccb89b;
  border-radius: 11px;
  background: #fffefb;
  padding: 0.64rem 0.75rem;
  font: inherit;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #1d7d6f55;
  outline-offset: 1px;
}

.lang-toggle {
  border: 1px solid #ccb89b;
  border-radius: 12px;
  margin: 0;
  padding: 0.45rem;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  background: #fffdf9;
}

.view-toggle {
  border: 1px solid #ccb89b;
  border-radius: 12px;
  margin: 0;
  padding: 0.45rem;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  background: #fffdf9;
}

.lang-toggle,
.control-group {
  min-width: 0;
}

.view-toggle legend {
  padding: 0 0.35rem;
}

.lang-toggle legend {
  padding: 0 0.35rem;
}

.lang-btn {
  border: 1px solid #ccb89b;
  background: #fff8ec;
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  font-weight: 700;
}

.lang-btn.is-active {
  background: #1d7d6f;
  border-color: #1d7d6f;
  color: #fff;
}

.view-btn {
  border: 1px solid #ccb89b;
  background: #fff8ec;
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  font-weight: 700;
}

.view-btn.is-active {
  background: #1f2329;
  border-color: #1f2329;
  color: #fff;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.composer {
  margin-bottom: 1rem;
  border: 1px solid #ecd7b8;
  background: linear-gradient(180deg, #fffefb 0%, #fff4e4 100%);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.composer__head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.composer__head p {
  margin: 0.25rem 0 0;
  color: #5b646f;
  font-size: 0.92rem;
}

.composer-form {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.85rem;
}

.composer-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.composer-grid label {
  display: grid;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.83rem;
  color: #41505b;
}

textarea {
  width: 100%;
  border: 1px solid #ccb89b;
  border-radius: 11px;
  background: #fffefb;
  padding: 0.64rem 0.75rem;
  font: inherit;
  resize: vertical;
}

textarea:focus {
  outline: 3px solid #1d7d6f55;
  outline-offset: 1px;
}

.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.composer-actions button {
  border: 1px solid #cbaf8a;
  background: #fff7ec;
  border-radius: 11px;
  padding: 0.52rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.composer-actions button.accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.composer-actions button#downloadFullBtn {
  background: #eef8f7;
  border-color: #83bfb7;
}

#formFeedback {
  min-height: 1.2rem;
  color: #176356;
  font-size: 0.85rem;
  font-weight: 700;
}

#formFeedback.error {
  color: #8f2222;
}

.import-box {
  border: 1px dashed #d0b99a;
  border-radius: 12px;
  background: #fffaf2;
  padding: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.import-box h3 {
  margin: 0;
}

.import-box p {
  margin: 0;
  color: #5f6872;
  font-size: 0.9rem;
}

.affiliate-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid #ecd7b8;
  box-shadow: var(--shadow);
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
  animation: fadeUp 520ms ease-out both;
}

.preview-shell {
  border: 1px solid #ead5b7;
  border-radius: 12px;
  background: #fffaf2;
  min-height: 130px;
  overflow: hidden;
  margin-bottom: 0.2rem;
}

.preview-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.preview-fallback {
  min-height: 130px;
  display: grid;
  place-items: center;
  color: #756654;
  font-weight: 700;
  font-size: 0.86rem;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.card-head__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

h2 {
  margin: 0;
  font-family: "Space Grotesk", "Futura", sans-serif;
  font-size: 1.24rem;
}

.meta {
  margin: 0.26rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.contact-link {
  text-decoration: none;
  font-weight: 700;
  color: #fff;
  background: var(--accent-2);
  padding: 0.42rem 0.72rem;
  border-radius: 10px;
}

.lang-panel.is-hidden {
  display: none;
}

.content-block {
  border: 1px solid #e5d1b5;
  background: var(--surface-2);
  border-radius: 13px;
  padding: 0.74rem;
}

.affiliation-kit {
  background: #fff7ea;
}

.kit-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.45rem;
  align-items: start;
  padding: 0.22rem 0;
}

@media (max-width: 520px) {
  .kit-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

.kit-label {
  font-weight: 700;
  color: #5a4f3c;
  font-size: 0.83rem;
}

.kit-value {
  color: #27333c;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.kit-link {
  color: #0f6f61;
  text-decoration: underline;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 0.94rem;
  color: #243038;
}

.copy-source {
  margin: 0;
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.84rem;
  background: #fffdf8;
  border: 1px dashed #cfb891;
  border-radius: 10px;
  padding: 0.62rem;
  line-height: 1.4;
  user-select: text;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.card-actions button {
  border: 1px solid #cbaf8a;
  background: #fff7ec;
  border-radius: 11px;
  padding: 0.52rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.card-actions button.accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.card-actions button[data-action="duplicate"] {
  background: #f8fbff;
  border-color: #8ab8dc;
}

.card-actions button[data-action="copy-affiliation-kit"] {
  background: #f4fbf8;
  border-color: #89baad;
}

.cards-grid.is-compact .affiliate-card {
  gap: 0.6rem;
  padding: 0.8rem;
}

.cards-grid.is-compact .lang-panel {
  display: none;
}

.cards-grid.is-compact .card-actions button[data-action="copy-tags"],
.cards-grid.is-compact .card-actions button[data-action="copy-specs"],
.cards-grid.is-compact .card-actions button[data-action="duplicate"] {
  display: none;
}

.copy-feedback {
  min-height: 1.2rem;
  color: #176356;
  font-size: 0.85rem;
  font-weight: 700;
}

.copy-feedback.error {
  color: #8f2222;
}

.results-info {
  margin: 0 0 2.2rem;
  color: #3d4a55;
  font-weight: 700;
}

.empty-state {
  margin: 0 0 0.6rem;
  border: 1px dashed #d3bc9b;
  background: #fffaf1;
  color: #66553f;
  border-radius: 12px;
  padding: 0.8rem;
  font-weight: 700;
}

.is-hidden {
  display: none;
}

body.is-locked .private-only,
body.is-locked .private-control {
  display: none !important;
}

body.is-locked .hero__lead {
  display: none;
}

body.is-locked .eyebrow {
  display: none;
}

body.is-locked .hero__inner {
  padding: 1rem;
}

body.is-locked .hero {
  padding: 1.4rem 0 1rem;
}

body.is-locked .access-bar label {
  display: none;
}

body.is-locked #resultsInfo {
  display: none;
}

body.is-locked #accessStatus {
  display: none;
}

body.is-locked .cards-grid {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

body.is-locked .public-card .card-head {
  margin-bottom: 0.25rem;
}

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

@media (min-width: 720px) {
  .hero__inner {
    padding: 1.8rem;
  }

  .controls {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto auto;
    align-items: end;
  }

  .access-bar {
    grid-template-columns: 1.2fr 2fr auto auto 1fr;
    align-items: center;
  }

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

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

@media (min-width: 1080px) {
  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
