:root {
  --ink: #18212f;
  --muted: #5f6f7b;
  --line: #dce5e0;
  --paper: #fbfbf6;
  --soft: #eef4ef;
  --green: #285f4f;
  --green-dark: #173e35;
  --coral: #d65d45;
  --blue: #213d63;
  --white: #ffffff;
  --shadow: 0 20px 50px rgba(25, 38, 47, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.public-shell,
.admin-shell,
.legal-page {
  min-height: 100vh;
}

.hero {
  position: relative;
  display: grid;
  min-height: 84vh;
  align-items: end;
  overflow: hidden;
  color: var(--white);
  background: var(--green-dark);
}

.hero__media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(16, 43, 38, 0.88), rgba(16, 43, 38, 0.45) 48%, rgba(16, 43, 38, 0.1)),
    var(--green-dark);
  background-position: center;
  background-size: cover;
}

.hero__media::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, rgba(16, 43, 38, 0.88), rgba(16, 43, 38, 0.52) 48%, rgba(16, 43, 38, 0.2));
}

.hero__media iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 177.7778vh;
  min-width: 100%;
  height: 100%;
  min-height: 56.25vw;
  border: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 120px 0 88px;
}

.language-switch {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.language-switch__button {
  min-width: 42px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.84);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
}

.language-switch__button.is-active {
  color: var(--green-dark);
  background: var(--white);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #ffb29d;
}

h1,
h2 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: 0;
}

h1 {
  max-width: 900px;
  font-size: clamp(2.5rem, 7vw, 5.7rem);
}

h2 {
  font-size: clamp(1.7rem, 4vw, 3rem);
}

p {
  line-height: 1.65;
}

.hero__content p:not(.eyebrow) {
  max-width: 670px;
  margin: 22px 0 28px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.12rem;
}

.hero__cta,
.primary-button,
.secondary-button,
.share-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.hero__cta,
.primary-button {
  padding: 0 22px;
  color: var(--white);
  background: var(--coral);
}

.secondary-button,
.share-button {
  padding: 0 16px;
  color: var(--green-dark);
  background: var(--soft);
}

.danger-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--white);
  background: #9f2d25;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.content-band {
  padding: 70px 20px;
}

.content-band--muted {
  background: var(--soft);
}

.layout {
  display: grid;
  width: min(1180px, 100%);
  grid-template-columns: 0.85fr 1.15fr;
  gap: 28px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel--intro {
  padding: 34px;
}

.panel--intro p {
  color: var(--muted);
}

.reward {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding: 18px;
  border-left: 5px solid var(--coral);
  background: #fff5f0;
}

.reward span,
.stat-card span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reward strong {
  color: var(--blue);
  font-size: 1.7rem;
}

.reward img {
  width: min(145px, 34vw);
  height: auto;
  flex: 0 0 auto;
}

.form-card {
  padding: 30px;
}

.form-header p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--green-dark);
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%),
    linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 12px) 20px;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus {
  border-color: var(--green);
  outline: 3px solid rgba(40, 95, 79, 0.16);
}

.form-divider {
  height: 1px;
  margin: 30px 0;
  background: var(--line);
}

.form-card .primary-button {
  width: 100%;
  margin-top: 26px;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.how-it-works {
  margin-top: 24px;
  padding: 22px;
  border: 1px solid #f4c7ba;
  border-radius: 8px;
  background: #fff5f0;
}

.how-it-works ol {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-it-works li {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  align-items: start;
}

.how-it-works strong {
  color: var(--coral);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.how-it-works span,
.lead-copy p {
  color: var(--muted);
  line-height: 1.55;
}

.duplicate-referral {
  display: grid;
  gap: 16px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: var(--soft);
}

.duplicate-referral strong {
  display: block;
  color: var(--green-dark);
  font-size: 1.1rem;
}

.duplicate-referral p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
}

.duplicate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gallery-band {
  overflow: hidden;
  width: 100%;
  margin-top: 34px;
  padding: 34px 0 0;
  border-top: 1px solid var(--line);
}

.gallery-intro {
  width: min(780px, 100%);
  margin: 0 auto 24px;
  padding: 0 20px;
}

.gallery-intro h2 {
  max-width: 720px;
}

.gallery-intro p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
}

.gallery-rail {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}

.gallery-track {
  display: flex;
  width: max-content;
  gap: 16px;
  padding: 0 20px 12px;
  animation: gallery-scroll 46s linear infinite;
  will-change: transform;
}

.gallery-track:hover {
  animation-play-state: paused;
}

.gallery-card {
  width: clamp(260px, 34vw, 430px);
  aspect-ratio: 5 / 3;
  flex: 0 0 auto;
  overflow: hidden;
  margin: 0;
  border-radius: 8px;
  background: var(--soft);
  box-shadow: var(--shadow);
}

.gallery-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes gallery-scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(calc(-50% - 8px));
  }
}

.result-shell {
  display: grid;
  width: min(980px, 100%);
  grid-template-columns: 1fr 260px;
  gap: 28px;
  margin: 0 auto;
  align-items: center;
}

.saved-shell {
  width: min(980px, 100%);
  margin: 0 auto;
}

.saved-header {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.saved-list {
  display: grid;
  gap: 12px;
}

.saved-code-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.saved-code-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 1.15rem;
}

.saved-code-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.saved-code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.link-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 18px 0;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.qr-wrap {
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.qr-wrap img {
  width: 220px;
  height: 220px;
}

.compact-form {
  width: min(780px, 100%);
  margin: 0 auto;
}

.consent {
  grid-template-columns: auto 1fr;
  margin-top: 22px;
  color: var(--ink);
  font-weight: 600;
}

.consent input {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
}

.consent span {
  color: var(--muted);
  line-height: 1.5;
}

.consent a {
  color: var(--green);
  font-weight: 800;
}

.thank-you {
  margin-top: 18px;
  padding: 16px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--white);
  font-weight: 700;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: calc(100vw - 40px);
  padding: 14px 16px;
  border-radius: 8px;
  color: var(--white);
  background: var(--green-dark);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.site-footer {
  padding: 54px 20px;
  color: var(--white);
  background: var(--green-dark);
}

.footer-grid {
  display: grid;
  width: min(1180px, 100%);
  grid-template-columns: 1fr auto;
  gap: 34px;
  margin: 0 auto;
  align-items: center;
}

.site-footer .eyebrow {
  color: #ffb29d;
}

.site-footer address {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.82);
  font-style: normal;
}

.site-footer address span {
  margin-top: 8px;
  color: #ffb29d;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.site-footer address a,
.site-footer address strong {
  color: var(--white);
}

.footer-copy {
  display: grid;
  max-width: 760px;
  gap: 14px;
}

.footer-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1rem;
  line-height: 1.7;
}

.speedwell-box {
  display: grid;
  gap: 12px;
  justify-items: start;
  min-width: 260px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--green-dark);
  text-decoration: none;
}

.speedwell-box span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.speedwell-box img {
  width: min(220px, 56vw);
  height: auto;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -18px;
  left: var(--x);
  width: 9px;
  height: 16px;
  border-radius: 2px;
  opacity: 0.95;
  animation: confetti-fall var(--duration) ease-in var(--delay) forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -20px, 0) rotate(0deg);
  }

  100% {
    transform: translate3d(calc((50vw - var(--x)) * 0.18), 110vh, 0) rotate(var(--rotate));
  }
}

.admin-login-shell,
.admin-shell {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0;
}

.admin-login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.admin-login-card {
  width: min(460px, 100%);
  padding: 30px;
}

.admin-login-card h1 {
  color: var(--green-dark);
  font-size: clamp(2rem, 6vw, 3.5rem);
}

.admin-login-card p:not(.eyebrow) {
  color: var(--muted);
}

.admin-login-card .primary-button {
  width: 100%;
  margin-top: 22px;
}

.login-error {
  margin: 14px 0 0;
  color: var(--coral);
  font-weight: 800;
}

.admin-header,
.table-toolbar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.admin-header h1 {
  color: var(--green-dark);
  font-size: clamp(2rem, 5vw, 4.4rem);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 34px 0;
}

.stat-card {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.stat-card strong {
  color: var(--blue);
  font-size: 2.4rem;
}

.admin-table-section {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.table-toolbar {
  margin-bottom: 18px;
}

.table-toolbar h2 {
  font-size: 1.6rem;
}

.table-toolbar input {
  max-width: 390px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  margin: 0 6px 6px 0;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.code-date-entry {
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
}

.code-date-entry:last-child {
  margin-bottom: 0;
}

.code-date-entry span {
  color: var(--muted);
  font-size: 0.82rem;
}

.visits-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.visit-details-row td {
  background: var(--soft);
}

.visit-details-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.visit-details-panel ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.visit-details-panel li {
  color: var(--ink);
}

.visit-details-panel li span {
  display: block;
  color: var(--muted);
}

.visit-details-panel em,
.visit-details-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.lead-entry {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.lead-entry:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.empty-state {
  padding: 26px 12px;
  color: var(--muted);
  text-align: center;
}

.legal-page {
  width: min(820px, calc(100% - 40px));
  margin: 0 auto;
  padding: 70px 0;
}

.legal-page--wide {
  width: min(980px, calc(100% - 40px));
}

.legal-page h1 {
  color: var(--green-dark);
  font-size: clamp(2rem, 6vw, 4.2rem);
}

.legal-page h2 {
  color: var(--green-dark);
  font-size: clamp(1.55rem, 4vw, 2.6rem);
}

.legal-page h3 {
  margin: 26px 0 10px;
  color: var(--green-dark);
  font-size: 1.05rem;
}

.legal-page p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.05rem;
}

.legal-page li {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 26px 0 34px;
}

.legal-nav a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--green-dark);
  background: var(--soft);
  font-weight: 800;
  text-decoration: none;
}

.legal-notice,
.legal-contact {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .layout,
  .result-shell,
  .stats-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 78vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-rail {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .gallery-track {
    animation: none;
    scroll-snap-type: x proximity;
  }

  .gallery-card {
    scroll-snap-align: start;
  }
}

@media (max-width: 620px) {
  .field-grid,
  .link-box {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .table-toolbar,
  .saved-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-actions {
    justify-content: stretch;
  }

  .saved-code-card {
    grid-template-columns: 1fr;
  }

  .saved-code-actions {
    justify-content: stretch;
  }

  .reward {
    align-items: flex-start;
    flex-direction: column;
  }

  .content-band {
    padding: 46px 16px;
  }

  .panel--intro,
  .form-card,
  .admin-table-section {
    padding: 22px;
  }
}
