:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --paper: #fffdf8;
  --panel: #ffffff;
  --ink: #17251f;
  --muted: #647269;
  --line: #d9ded4;
  --green: #2e7d58;
  --green-dark: #1d5a40;
  --coral: #d96c4a;
  --yellow: #f2c85b;
  --blue: #436da9;
  --mint: #e8f4ed;
  --cream: #fff6df;
  --rose: #fff0e8;
  --shadow: 0 20px 60px rgba(25, 43, 34, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fbfaf5 0%, var(--bg) 42%, #f2f1ea 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 64px);
  background: rgba(251, 250, 245, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand,
.locale-switch,
.topbar nav,
.trust-row,
.hero-actions,
.card-actions,
.action-row,
.toggle-row,
.stats,
footer nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  font-weight: 900;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border: 2px solid var(--green-dark);
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 31%, var(--green-dark) 32%, var(--green-dark) 35%, transparent 36%),
    linear-gradient(transparent 31%, var(--green-dark) 32%, var(--green-dark) 35%, transparent 36%),
    var(--yellow);
}

.topbar nav {
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.locale-switch {
  justify-content: flex-end;
}

.locale-switch a,
.trust-row span,
.card-badges span,
.tag-row span,
.stats span,
.template-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.locale-switch a.is-current {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

main {
  overflow: hidden;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: clamp(26px, 5vw, 64px);
  align-items: center;
  padding: clamp(34px, 7vw, 82px) clamp(18px, 5vw, 76px) 32px;
}

.hero-copy {
  max-width: 920px;
}

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

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

h1 {
  max-width: 880px;
  margin-bottom: 18px;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.72;
}

.button,
button,
.text-link {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.button,
.text-link {
  display: inline-flex;
  align-items: center;
  padding: 11px 14px;
}

button {
  padding: 10px 12px;
}

.primary,
.primary-action,
.wide-action {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.hero-actions,
.trust-row {
  margin-top: 24px;
}

.hero-preview,
.builder-panel,
.chart-sheet,
.template-card,
.related-card,
.faq details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-preview {
  padding: 18px;
}

.mini-toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  margin-bottom: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.mini-sheet,
.template-preview {
  border: 1px solid #d8dfd5;
  border-radius: 8px;
  background: var(--paper);
}

.mini-sheet {
  padding: 16px;
  margin-bottom: 14px;
}

.mini-title {
  height: 18px;
  border-radius: 5px;
  background: var(--green);
  color: #fff;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 900;
}

.mini-grid,
.preview-box-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-top: 14px;
}

.mini-grid span,
.preview-box-grid span {
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-radius: 6px;
  opacity: 0.75;
}

.wide-action {
  width: 100%;
}

.template-library,
.workspace,
.recent-section,
.seo-content,
.related-section,
.faq {
  padding: 48px clamp(18px, 5vw, 76px);
}

.popular-strip,
.search-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 16px;
}

.popular-strip {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 18px 0;
}

.popular-strip h3 {
  margin: 0;
  font-size: 20px;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.popular-grid button {
  display: grid;
  gap: 5px;
  min-height: 76px;
  text-align: left;
}

.popular-grid strong,
.popular-grid span {
  overflow-wrap: anywhere;
}

.popular-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(240px, 380px) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  margin: 14px 0;
}

.control-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 850;
}

.scenario-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scenario-chips button {
  min-height: 38px;
  border-radius: 999px;
  padding-inline: 12px;
}

.scenario-chips button.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.install-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin: 10px clamp(18px, 5vw, 76px) 24px;
  border: 1px solid #bdd2c5;
  border-radius: 8px;
  background: linear-gradient(135deg, #f1fbf5, #fff8e9);
  padding: 18px;
}

.install-banner h2 {
  margin-bottom: 6px;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.1;
}

.install-banner p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.install-actions button {
  white-space: nowrap;
}

.section-heading {
  max-width: 900px;
  margin-bottom: 20px;
}

.section-heading.spread {
  display: flex;
  max-width: none;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin-bottom: 9px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
}

.section-heading p,
.seo-content p,
.faq p {
  color: var(--muted);
  line-height: 1.7;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--ink);
  padding: 12px 13px;
  line-height: 1.4;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(67, 109, 169, 0.28);
  outline-offset: 2px;
}

.template-states {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.state-message,
.input-hint {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

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

.template-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  box-shadow: none;
}

.template-preview {
  min-height: 132px;
  padding: 14px;
  color: var(--green-dark);
}

.theme-cute {
  background: linear-gradient(135deg, #fff7e6, #fff0f4);
  color: var(--coral);
}

.theme-mint {
  background: linear-gradient(135deg, #f2fff6, #e8f4ed);
  color: var(--green);
}

.theme-ink {
  background: linear-gradient(135deg, #f6f7f3, #ffffff);
  color: #1f2a24;
}

.theme-sunrise {
  background: linear-gradient(135deg, #fff7dd, #fff1e8);
  color: var(--coral);
}

.theme-ocean {
  background: linear-gradient(135deg, #edf7ff, #eef4ff);
  color: var(--blue);
}

.theme-lavender {
  background: linear-gradient(135deg, #f7f1ff, #fff5fb);
  color: #7556a7;
}

.preview-title-line,
.preview-row {
  height: 11px;
  border-radius: 8px;
  background: currentColor;
  opacity: 0.8;
  margin-bottom: 9px;
}

.preview-row {
  width: 78%;
  opacity: 0.35;
}

.preview-row.short {
  width: 54%;
}

.template-card h3,
.related-card h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.template-card p,
.related-card p {
  color: var(--muted);
  line-height: 1.58;
}

.template-card dl,
.dialog-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.template-card dl div,
.dialog-facts div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 0;
  font-weight: 750;
}

.card-actions {
  align-items: stretch;
}

.card-actions button {
  flex: 1 1 132px;
}

.quiet {
  color: var(--muted);
}

.empty-state,
.ad-slot {
  border: 1px dashed #bdc8bd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  padding: 22px;
  text-align: center;
}

.ad-slot {
  margin: 6px clamp(18px, 5vw, 76px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.builder-panel {
  display: grid;
  gap: 15px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.panel-header h3 {
  margin-bottom: 4px;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.check-option {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 9px 11px;
}

.check-option input {
  width: auto;
}

.error-state,
.success-state {
  margin: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
}

.error-state {
  background: #fff1ee;
  color: #9a3412;
}

.success-state {
  background: var(--mint);
  color: var(--green-dark);
}

.preview-column {
  min-width: 0;
}

.preview-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.preview-header h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
}

.chart-sheet {
  min-height: 520px;
  padding: clamp(16px, 3vw, 30px);
  box-shadow: var(--shadow);
}

.chart-sunrise {
  --sheet-accent: var(--coral);
  --sheet-soft: var(--rose);
}

.chart-mint {
  --sheet-accent: var(--green);
  --sheet-soft: var(--mint);
}

.chart-ink {
  --sheet-accent: #1f2a24;
  --sheet-soft: #f1f2ef;
}

.chart-cute {
  --sheet-accent: #b35a7c;
  --sheet-soft: #fff0f4;
}

.chart-ocean {
  --sheet-accent: #2f6fa5;
  --sheet-soft: #edf7ff;
}

.chart-lavender {
  --sheet-accent: #7556a7;
  --sheet-soft: #f7f1ff;
}

.sheet-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--sheet-accent);
}

.sheet-label {
  margin: 0 0 6px;
  color: var(--sheet-accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sheet-top h3 {
  margin: 0;
  font-size: clamp(24px, 4vw, 42px);
  letter-spacing: 0;
}

.sheet-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.paper-badge {
  min-width: 78px;
  border-radius: 8px;
  background: var(--sheet-soft);
  color: var(--sheet-accent);
  padding: 10px 12px;
  text-align: center;
  font-weight: 900;
}

.mobile-scroll-note {
  display: none;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.date-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.date-row span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
  overflow-wrap: anywhere;
}

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

.chart-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  table-layout: fixed;
}

.chart-table th,
.chart-table td {
  height: 48px;
  border: 1px solid #cfd7ce;
  padding: 9px;
  text-align: center;
  vertical-align: middle;
}

.chart-table thead th {
  background: var(--sheet-soft);
  color: var(--sheet-accent);
  font-size: 13px;
  font-weight: 900;
}

.chart-table tbody th {
  width: 220px;
  text-align: left;
  font-weight: 850;
}

.chart-table tbody td:nth-child(2) {
  width: 110px;
  color: var(--muted);
  font-weight: 800;
}

.check-box {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--sheet-accent);
  border-radius: 6px;
  background: white;
}

.reward-cell {
  background: linear-gradient(135deg, var(--sheet-soft), white);
}

.sheet-note {
  margin-top: 14px;
  border-left: 4px solid var(--sheet-accent);
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 750;
}

.sheet-extra {
  min-height: 84px;
  margin-top: 12px;
  border: 1px dashed #cfd7ce;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--muted);
}

.sheet-extra strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.signature-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.signature-row span {
  border-top: 2px solid #cfd7ce;
  padding-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.orientation-landscape {
  min-height: 460px;
}

.density-compact .chart-table th,
.density-compact .chart-table td {
  height: 38px;
  padding: 6px;
  font-size: 12px;
}

.density-large .chart-table th,
.density-large .chart-table td {
  height: 58px;
  font-size: 15px;
}

.recent-grid,
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.saved-recent-layout h3 {
  margin-bottom: 10px;
}

.recent-grid button,
.related-card {
  text-align: left;
}

.related-card {
  padding: 18px;
  box-shadow: none;
}

.seo-content {
  background: var(--paper);
}

.seo-content-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  max-width: 1180px;
}

.seo-content h2 {
  font-size: clamp(28px, 4vw, 44px);
  margin-bottom: 12px;
}

.content-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.content-card ul {
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.content-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 1180px;
  margin-top: 22px;
}

.content-module-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.content-module-grid h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.content-module-grid p {
  margin: 0;
}

.faq {
  max-width: 1000px;
}

.faq details {
  padding: 16px 18px;
  margin: 12px 0;
  box-shadow: none;
}

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

footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 24px clamp(18px, 5vw, 76px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-weight: 750;
}

.template-dialog {
  width: min(680px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.template-dialog::backdrop {
  background: rgba(23, 37, 31, 0.35);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

#closeDialog {
  min-width: 42px;
  font-size: 24px;
}

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

@media (max-width: 920px) {
  .hero,
  .install-banner,
  .builder-layout,
  .seo-content-inner,
  .content-module-grid,
  .popular-strip,
  .search-panel,
  .saved-recent-layout {
    grid-template-columns: 1fr;
  }

  .install-actions {
    justify-content: flex-start;
  }

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

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

@media (max-width: 640px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .topbar nav,
  .locale-switch {
    justify-content: flex-start;
  }

  h1 {
    font-size: 38px;
  }

  .hero,
  .install-banner,
  .template-library,
  .workspace,
  .recent-section,
  .seo-content,
  .related-section,
  .faq {
    padding-left: 16px;
    padding-right: 16px;
  }

  .template-grid,
  .recent-grid,
  .related-grid,
  .popular-grid,
  .filters,
  .field-grid {
    grid-template-columns: 1fr;
  }

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

  .section-heading.spread,
  .preview-header,
  .panel-header,
  footer {
    display: block;
  }

  .mobile-scroll-note {
    display: block;
  }

  .chart-sheet {
    padding: 14px;
  }

  .chart-table {
    min-width: 720px;
    font-size: 13px;
  }

  .card-actions button {
    flex-basis: 100%;
  }

  .install-actions button {
    flex: 1 1 150px;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .hero,
  .install-banner,
  .template-library,
  .builder-panel,
  .preview-header,
  .recent-section,
  .seo-content,
  .related-section,
  .faq,
  .ad-slot,
  footer,
  .mobile-scroll-note {
    display: none;
  }

  .workspace {
    padding: 0;
  }

  .builder-layout {
    display: block;
  }

  .chart-sheet {
    width: 100%;
    min-height: auto;
    padding: 12mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .chart-table {
    min-width: 0;
    font-size: 11px;
  }

  .chart-table th,
  .chart-table td {
    height: 34px;
    padding: 4px;
  }

  .check-box {
    width: 17px;
    height: 17px;
    border-radius: 4px;
  }
}
