:root,
[data-theme="light"] {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
  --radius: 20px;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #1f2937;
  --border: #374151;
  --text: #f9fafb;
  --muted: #9ca3af;
  --primary: #2dd4bf;
  --primary-hover: #14b8a6;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 10;
}

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

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 28px 0 16px;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.logo {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.logo svg {
  width: 28px;
  height: 28px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.brand-subtitle,
.section-copy {
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 2.4vw, 2.5rem);
}

h2 {
  font-size: 1.1rem;
}

.theme-toggle {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  padding: 16px 0 32px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.section-heading {
  margin-bottom: 20px;
  display: grid;
  gap: 6px;
}

.controls {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-grid {
  display: grid;
  gap: 16px;
}

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

label {
  font-weight: 600;
}

input[type="url"],
input[type="text"],
select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
}

input[type="color"] {
  width: 100%;
  min-height: 48px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.help {
  font-size: 0.9rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 8px;
}

.btn {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-secondary,
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.preview-panel {
  display: grid;
  gap: 18px;
}

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

.print-card {
  background: white;
  color: #111827;
  border-radius: 20px;
  padding: 24px;
  border: 1px dashed #d1d5db;
}

.qr-stage {
  min-height: 320px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border-radius: 18px;
  padding: 16px;
}

.qrcode {
  display: grid;
  place-items: center;
}

.qrcode img,
.qrcode canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.qr-caption {
  margin-top: 18px;
  text-align: center;
  font-weight: 600;
  font-size: 1.1rem;
  word-break: break-word;
}

.notes {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer {
  padding: 0 0 32px;
  color: var(--muted);
}

.no-print {
  display: block;
}

.print-mount {
  display: none;
}

:focus-visible {
  outline: 3px solid rgba(45, 212, 191, 0.4);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .two-up {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
  }
}

@media print {
  body {
    background: white;
    margin: 0;
    padding: 0;
  }

  .site-header,
  .controls-panel,
  .preview-meta,
  .notes,
  .site-footer,
  .print-card {
    display: none !important;
  }

  .layout,
  .preview-panel {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  .panel {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .print-mount {
    display: flex !important;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 12mm;
  }

  .print-mount img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 24mm);
    object-fit: contain;
  }

  @page {
    margin: 0;
  }
}
