:root {
  color-scheme: light;
  --bg: #f7fbf8;
  --surface: #ffffff;
  --surface-soft: #eff8f2;
  --ink: #1d2721;
  --muted: #617064;
  --line: #cddbd0;
  --green: #1f8a55;
  --green-dark: #12613b;
  --blue: #246cbf;
  --yellow: #f2c94c;
  --shadow: 0 18px 45px rgba(27, 48, 35, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
input {
  font: inherit;
}

.site-header {
  align-items: center;
  background: rgba(247, 251, 248, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: 16px clamp(16px, 4vw, 56px);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 1.05rem;
  font-weight: 800;
  gap: 10px;
  white-space: nowrap;
}

.brand-mark {
  align-items: center;
  background: var(--green);
  border-radius: 8px;
  color: #ffffff;
  display: inline-flex;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.nav-links {
  align-items: center;
  display: flex;
  gap: clamp(12px, 2.5vw, 28px);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--green-dark);
}

main {
  overflow: hidden;
}

.generator-section {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(330px, 1.15fr);
  gap: clamp(22px, 4vw, 48px);
  padding: clamp(32px, 6vw, 76px) clamp(16px, 4vw, 56px) 28px;
}

.generator-copy {
  align-self: start;
  max-width: 620px;
}

.eyebrow {
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  margin: 0 0 12px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 1.01;
  margin-bottom: 20px;
  max-width: 720px;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  line-height: 1.1;
  margin-bottom: 14px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
  padding: clamp(16px, 3vw, 26px);
}

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

.app-switch {
  border: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}

.app-switch legend {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.app-switch label {
  cursor: pointer;
  min-width: 0;
}

.app-switch input {
  position: absolute;
  opacity: 0;
}

.app-switch span {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  font-weight: 800;
  justify-content: center;
  min-height: 48px;
  padding: 12px;
  text-align: center;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.app-switch input:checked + span {
  background: var(--surface-soft);
  border-color: var(--green);
  color: var(--green-dark);
}

.field-label {
  color: var(--ink);
  font-weight: 800;
}

textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 160px;
  padding: 14px 16px;
  resize: vertical;
  width: 100%;
}

textarea:focus,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(31, 138, 85, 0.2);
  outline-offset: 2px;
}

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

.primary-button,
.secondary-button,
.copy-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  min-height: 44px;
  padding: 12px 18px;
}

.primary-button {
  background: var(--green);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary-button,
.copy-button {
  background: #e8f0ec;
  color: var(--ink);
}

.secondary-button:hover,
.copy-button:hover {
  background: #d8e7de;
}

.result-panel {
  background: #15241b;
  border-radius: 8px;
  color: #eaf7ee;
  min-width: 0;
  padding: 16px;
}

.result-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.result-heading span {
  color: #c8f0d5;
  font-weight: 900;
}

.copy-button {
  min-height: 38px;
  padding: 8px 14px;
}

pre {
  background: #0b1510;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin: 0;
  overflow-x: auto;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

code {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.result-note {
  color: #a8cdb4;
  font-size: 0.9rem;
  margin: 12px 0 0;
}

.result-details {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.result-details li {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #d9f0e1;
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 10px 12px;
}

.result-details strong {
  color: #ffffff;
}

.copy-helper {
  position: fixed;
  top: -999px;
}

.sheet-visual {
  border-radius: 8px;
  grid-column: 1 / -1;
  margin: 6px 0 0;
  max-height: 260px;
  overflow: hidden;
}

.sheet-visual img {
  display: block;
  height: 100%;
  max-height: 260px;
  object-fit: cover;
  width: 100%;
}

.ad-band,
.content-grid {
  display: grid;
  gap: clamp(18px, 4vw, 42px);
  grid-template-columns: minmax(0, 0.68fr) minmax(0, 1fr);
  padding: clamp(34px, 6vw, 72px) clamp(16px, 4vw, 56px);
}

.ad-band {
  align-items: center;
  background: #ffffff;
  border-block: 1px solid var(--line);
}

.ad-slot {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(31, 138, 85, 0.08), rgba(36, 108, 191, 0.08)),
    #f8faf9;
  border: 1px dashed #9ab4a1;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 120px;
  padding: 18px;
  text-align: center;
}

.adsbygoogle {
  display: block;
  min-height: 120px;
  width: 100%;
}

.tip-list,
.faq-list {
  display: grid;
  gap: 14px;
}

.tip-list article,
details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.tip-list p,
details p {
  margin-bottom: 0;
}

summary {
  cursor: pointer;
  font-weight: 900;
}

details p {
  padding-top: 10px;
}

.code-text {
  background: #e9f1ec;
  border-radius: 6px;
  color: var(--green-dark);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  padding: 2px 6px;
}

.site-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
  padding: 22px clamp(16px, 4vw, 56px);
}

.site-footer span:first-child {
  color: var(--ink);
  font-weight: 900;
}

@media (max-width: 840px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .nav-links {
    justify-content: space-between;
    width: 100%;
  }

  .generator-section,
  .ad-band,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .generator-section {
    padding-top: 28px;
  }

  .sheet-visual {
    max-height: 210px;
  }

  .sheet-visual img {
    max-height: 210px;
  }
}

@media (max-width: 520px) {
  .nav-links {
    font-size: 0.86rem;
    gap: 8px;
  }

  .app-switch {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .primary-button,
  .secondary-button {
    justify-content: center;
  }

  .result-heading {
    align-items: stretch;
    flex-direction: column;
  }

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