:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d8f3ee;
  --signal: #f97316;
  --danger: #b42318;
  --shadow: 0 22px 60px rgba(28, 38, 63, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--wash);
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("img/page_background.png");
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  filter: saturate(1.55) contrast(1.12);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(244, 247, 251, 0.18));
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 32px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.hero-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 360px);
  gap: 24px 34px;
  align-items: end;
  margin-bottom: 26px;
}

.brand-logo {
  display: inline-flex;
  grid-column: 1 / -1;
  align-items: center;
  width: min(560px, 100%);
}

.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.intro {
  display: grid;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  max-width: 820px;
  font-size: clamp(2.15rem, 4.2vw, 4.15rem);
  line-height: 1;
}

h2 {
  font-size: 1.25rem;
}

.lead {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin-top: 4px;
}

.primary-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--ink);
  color: #ffffff;
  padding: 11px 18px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.primary-link:hover,
.primary-link:focus-visible {
  background: var(--accent);
  outline: none;
  transform: translateY(-1px);
}

.hero-note {
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-weight: 800;
}

.hero-points {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hero-points li {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 850;
  line-height: 1.25;
  padding: 10px 12px;
  box-shadow: 0 14px 34px rgba(28, 38, 63, 0.08);
}

.hero-points li::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--signal);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.16);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(340px, 1fr);
  gap: 20px;
  align-items: start;
}

.generator-panel,
.preview-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.generator-panel {
  display: grid;
  gap: 22px;
  padding: 22px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.mode-button {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 0.92rem;
  font-weight: 750;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.mode-button:hover,
.mode-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.mode-button.is-active {
  border-color: var(--accent);
  color: #063f3b;
  background: var(--accent-soft);
}

.fields {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  padding: 10px 12px;
  outline: none;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.field select:disabled {
  color: var(--muted);
  background: #eef3f7;
}

.field.compact {
  grid-template-columns: 1fr 52px;
  align-items: center;
  gap: 10px;
}

.field.compact span {
  min-width: 0;
}

.field.compact input[type="color"] {
  min-height: 44px;
  padding: 3px;
}

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

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

.range-field {
  grid-column: 1 / -1;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.range-field span {
  grid-column: 1 / -1;
}

.range-field input {
  padding: 0;
  accent-color: var(--accent);
}

.range-field output {
  min-width: 34px;
  color: var(--accent-strong);
  font-weight: 850;
  text-align: right;
}

.logo-upload,
.logo-size-field,
.logo-preview-row {
  grid-column: 1 / -1;
}

.logo-upload input[type="file"] {
  padding: 9px 12px;
}

.logo-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(216, 243, 238, 0.35);
}

.logo-preview-row[hidden] {
  display: none;
}

#logoPreview {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  object-fit: contain;
  padding: 6px;
}

.secondary-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  padding: 0 14px;
  font-weight: 850;
  transition: border-color 160ms ease, color 160ms ease;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  outline: none;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-weight: 800;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.preview-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
  position: sticky;
  top: 24px;
}

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

.status {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 12px;
  color: #063f3b;
  background: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.status.is-error {
  color: var(--danger);
  background: #fee4e2;
}

.qr-stage {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(249, 115, 22, 0.07)),
    #fff;
  padding: 18px;
  overflow: visible;
}

#qrCanvas {
  width: min(100%, 340px);
  aspect-ratio: 1 / 1;
  height: auto;
  display: block;
  border: 1px solid rgba(23, 32, 51, 0.08);
  background: #fff;
  image-rendering: pixelated;
}

.empty-state {
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

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

.download-button {
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--ink);
  font-weight: 850;
  transition: background-color 160ms ease, transform 160ms ease;
}

.download-button:hover,
.download-button:focus-visible {
  background: var(--accent-strong);
  outline: none;
}

.download-button:active,
.mode-button:active {
  transform: translateY(1px);
}

.download-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 24px;
  margin-right: 6px;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 950;
}

.meta-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.meta-list div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.meta-list dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.meta-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 700;
}

.site-footer {
  width: min(1180px, 100%);
  margin: 26px auto 0;
  padding: 18px 0 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

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

.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration: underline;
  outline: none;
}

@media (max-width: 920px) {
  .app-shell {
    padding: 18px;
  }

  .hero-header {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .brand-logo {
    width: min(520px, 100%);
  }

  .hero-points {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .hero-header {
    gap: 16px;
    margin-bottom: 18px;
  }

  .brand-logo {
    width: 100%;
  }

  h1 {
    font-size: 2.2rem;
  }

  .hero-actions,
  .primary-link {
    width: 100%;
  }

  .hero-points {
    grid-template-columns: 1fr;
  }

  .generator-panel,
  .preview-panel {
    padding: 16px;
  }

  .segmented,
  .settings-grid,
  .inline-fields,
  .download-row {
    grid-template-columns: 1fr;
  }

  .qr-stage {
    padding: 14px;
  }

  .preview-head {
    align-items: stretch;
    flex-direction: column;
  }

  .status {
    align-self: flex-start;
  }
}
