:root {
  --page: #f5f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #5f6b7a;
  --line: #d9e0e8;
  --line-strong: #c3ccd8;
  --accent: #0f766e;
  --accent-dark: #0b4f4a;
  --danger: #b42318;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 22px 55px rgba(17, 24, 39, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0, var(--page) 380px),
    var(--page);
}

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

a {
  color: inherit;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
  border-bottom: 1px solid rgba(217, 224, 232, 0.72);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
}

.brand img {
  display: block;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav a {
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.top-nav a:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.tool-hero,
.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.tool-hero {
  display: grid;
  gap: 34px;
  padding: 58px 0 42px;
}

.intro {
  max-width: 820px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 920px;
  margin-bottom: 18px;
  font-size: 4.25rem;
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  letter-spacing: 0;
}

.intro-copy {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.72;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.trust-row span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: #425066;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0 12px;
  white-space: nowrap;
}

.generator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.86fr);
  gap: 22px;
  align-items: start;
}

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

.controls {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.panel-heading,
.preview-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2,
.preview h2 {
  margin-bottom: 0;
  font-size: 1.34rem;
  line-height: 1.25;
}

.field,
.color-field {
  display: grid;
  gap: 8px;
}

.field span,
.color-field span {
  color: #334155;
  font-size: 0.86rem;
  font-weight: 800;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  min-height: 172px;
  padding: 16px;
  resize: vertical;
  line-height: 1.55;
}

textarea::placeholder {
  color: #98a2b3;
}

select {
  min-height: 48px;
  padding: 0 14px;
  cursor: pointer;
}

textarea:focus,
select:focus,
input[type="color"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.control-row,
.swatches,
.actions,
.preview-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.color-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

input[type="color"] {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

button {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 850;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.24);
}

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

.secondary {
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: #243044;
}

.secondary:hover:not(:disabled) {
  border-color: #9aa7b7;
  background: var(--surface-soft);
}

.status {
  min-height: 22px;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.status.error {
  color: var(--danger);
}

.preview {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.preview-top {
  margin-bottom: 0;
}

.qr-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    #f9fbfc;
  background-size: 22px 22px;
  overflow: hidden;
}

.qr-stage::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(195, 204, 216, 0.65);
  border-radius: 8px;
  pointer-events: none;
}

canvas {
  position: relative;
  z-index: 1;
  width: min(84%, 560px);
  height: min(84%, 560px);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 18px 34px rgba(17, 24, 39, 0.14);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease;
}

canvas.ready {
  opacity: 1;
  transform: scale(1);
}

.empty-state {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-weight: 750;
}

.empty-state span {
  display: block;
  width: 86px;
  height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--ink) 12px, transparent 12px) 0 0 / 28px 28px,
    linear-gradient(var(--ink) 12px, transparent 12px) 0 0 / 28px 28px,
    #ffffff;
  opacity: 0.18;
}

.empty-state p {
  margin-bottom: 0;
}

.empty-state.hidden {
  display: none;
}

.seo-content {
  display: grid;
  gap: 24px;
  padding: 28px 0 0;
  scroll-margin-top: 92px;
}

.seo-content h2 {
  max-width: 780px;
  margin-bottom: 14px;
  font-size: 2.35rem;
  line-height: 1.12;
}

.seo-content p {
  max-width: 840px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

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

.content-columns article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.content-columns h3 {
  margin-bottom: 10px;
  font-size: 1.04rem;
  line-height: 1.3;
}

.content-columns p {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  scroll-margin-top: 92px;
}

.site-footer p {
  max-width: 720px;
  margin-bottom: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
}

.site-footer a {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 920px) {
  h1 {
    font-size: 3.1rem;
  }

  .generator-grid,
  .content-columns,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .site-footer nav {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .site-header,
  .tool-hero,
  .site-footer {
    width: min(100% - 22px, 1180px);
  }

  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tool-hero {
    padding: 34px 0 32px;
  }

  h1 {
    font-size: 2.42rem;
    line-height: 1.04;
  }

  .intro-copy {
    font-size: 1rem;
  }

  .controls,
  .preview {
    padding: 18px;
  }

  .panel-heading,
  .preview-top {
    flex-direction: column;
  }

  .control-row,
  .swatches,
  .actions,
  .preview-actions {
    grid-template-columns: 1fr;
  }

  .seo-content h2 {
    font-size: 1.82rem;
  }
}
