:root {
  --green: #16a637;
  --green-deep: #15803d;
  --green-dark: #14532d;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card-line: #f3f4f6;
  --cream: #fffde3;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --danger: #dc2626;
  --shadow: 0 10px 25px #0000001a, 0 4px 10px #0000000d;
  --sans: Inter, ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background: #fff;
}

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

.promo {
  padding: 12px 16px;
  color: var(--cream);
  background: linear-gradient(135deg, #16a637, #15803d, #14532d);
  text-align: center;
}

.promo p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(135deg, #fffde3, #fef3c7, #fde68a);
  box-shadow: var(--shadow);
}

.nav-inner {
  width: min(1080px, calc(100% - 32px));
  height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-link {
  display: flex;
  align-items: center;
}

.logo-link img {
  height: 48px;
  width: auto;
  display: block;
}

.nav-current {
  color: var(--green);
  font-weight: 700;
  border-bottom: 2px solid var(--green);
  padding-bottom: 4px;
}

.hero {
  background: linear-gradient(to bottom, #fffde3 0%, #fef3c7 46%, #fff 100%);
  padding: 42px 0 72px;
}

.page {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.intro {
  margin-bottom: 28px;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

h1 span {
  color: var(--green);
}

.lede {
  max-width: 64ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.card {
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.form-card,
.preview-card,
.snippet-card {
  padding: 22px;
}

.preview-card {
  position: sticky;
  top: 92px;
  align-self: start;
}

h2 {
  margin-bottom: 16px;
  font-size: 1.35rem;
}

h3 {
  margin: 22px 0 12px;
  font-size: 1rem;
}

.field {
  margin-bottom: 16px;
}

.label,
label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea,
.combo-trigger {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px 14px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.45;
}

input:focus,
textarea:focus,
.combo.is-open .combo-trigger,
.combo-trigger:focus-visible {
  border-color: var(--green);
  box-shadow: 0 0 0 3px #16a6371a;
}

.combo {
  position: relative;
}

.combo-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}

.combo-value {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
}

.combo-value .flag {
  font-size: 1.15rem;
  line-height: 1;
}

.combo-value .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-value .code,
.option-code {
  color: var(--muted);
  font-weight: 600;
}

.chevron {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.combo.is-open .chevron {
  transform: rotate(180deg);
}

.combo-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  overflow: hidden;
  border: 1px solid #f3f4f6;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.15);
}

.combo-panel[hidden] {
  display: none;
}

.combo-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 10px 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
}

.combo-search:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px #16a6371a;
}

.combo-search svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.combo-search input {
  width: auto;
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 11px 0;
  box-shadow: none;
}

.combo-search input:focus {
  box-shadow: none;
}

.combo-status {
  margin: 8px 14px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.combo-list {
  max-height: 240px;
  margin: 6px 0;
  padding: 0 6px;
  overflow: auto;
  list-style: none;
}

.combo-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
}

.combo-option:hover,
.combo-option.is-active {
  background: #f0fdf4;
}

.combo-option.is-selected .option-name {
  color: var(--green);
  font-weight: 700;
}

.option-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.option-name mark {
  padding: 0;
  color: inherit;
  background: #dcfce7;
  font-weight: 700;
}

.combo-custom {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--card-line);
  background: #fff;
  padding: 12px 16px;
  color: var(--green);
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.combo-custom:hover,
.combo-custom.is-active {
  background: #f0fdf4;
}

.phone-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.dial {
  min-width: 72px;
  padding: 12px;
  border-radius: 12px;
  background: #f0fdf4;
  color: var(--green);
  font-weight: 700;
  text-align: center;
}

.hint,
.destination,
.copy-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 600;
}

.generate,
.copy {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.generate {
  width: 100%;
  margin-top: 6px;
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  box-shadow: 0 10px 20px #2563eb33;
}

.generate:hover,
.copy:hover {
  transform: translateY(-1px);
}

.preview-head,
.snippet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.preview-head h2,
.snippet-head h2 {
  margin-bottom: 0;
}

.destination {
  margin: 4px 0 0;
  text-align: right;
}

.browser {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffde3;
}

.browser-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  background: #fef3c7;
}

.browser-bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d6d3d1;
}

.browser-url {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.browser-page {
  position: relative;
  min-height: 560px;
  padding: 28px 22px 84px;
  background: linear-gradient(to bottom, #fffde3, #fff 80%);
}

.fake-kicker,
.fake-title,
.fake-copy,
.fake-button {
  border-radius: 999px;
}

.fake-kicker {
  width: 92px;
  height: 10px;
  margin-bottom: 16px;
  background: #bbf7d0;
}

.fake-title {
  width: 78%;
  height: 18px;
  margin-bottom: 10px;
  background: #e5e7eb;
}

.fake-title.short {
  width: 48%;
}

.fake-copy {
  width: 100%;
  height: 8px;
  margin-top: 10px;
  background: #f3f4f6;
}

.fake-button {
  width: 132px;
  height: 34px;
  margin-top: 22px;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
}

.preview-empty {
  position: absolute;
  right: 18px;
  bottom: 22px;
  max-width: 150px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.check-hint {
  margin-top: 6px;
}

#popup-options[hidden],
.popup-color[hidden],
#logo-thumb[hidden] {
  display: none;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.upload,
.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

#logo-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.color-grid label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.86rem;
}

.color-grid input[type="color"] {
  width: 42px;
  height: 32px;
  padding: 2px;
  border-radius: 8px;
}

.side-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.side-pills label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.side-pills input {
  width: auto;
  accent-color: var(--green);
}

.side-pills label:has(input:checked) {
  border-color: var(--green);
  background: #f0fdf4;
  color: var(--green);
}

.offset-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.snippet-card {
  margin-top: 18px;
}

.snippet-head h2 {
  margin-bottom: 4px;
}

.snippet-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.text-link {
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.copy {
  padding: 10px 16px;
  color: var(--green);
  background: #fff;
  border: 1px solid var(--green);
}

pre {
  margin: 16px 0 0;
  padding: 16px;
  overflow: auto;
  border-radius: 12px;
  color: #fffde3;
  background: var(--green-dark);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre;
}

.copy-status:empty {
  display: none;
}

@media (max-width: 840px) {
  .layout,
  .snippet-head,
  .preview-head {
    display: block;
  }

  .destination {
    margin-top: 6px;
    text-align: left;
  }

  .snippet-actions {
    margin-top: 12px;
  }

  .nav-inner,
  .page {
    width: min(100% - 20px, 1080px);
  }

  .hero {
    padding-top: 28px;
  }

  .preview-card {
    position: static;
  }

  .color-grid,
  .offset-row {
    grid-template-columns: 1fr;
  }
}
