:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --border: #e2e4e9;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --hint-bg: #fffbeb;
  --hint-text: #92400e;
  --hint-border: #fcd34d;
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-alt: #1c1f26;
    --text: #e6e7eb;
    --text-muted: #9aa0ab;
    --border: #2b2f38;
    --accent: #60a5fa;
    --accent-text: #0b1220;
    --hint-bg: #2a2210;
    --hint-text: #fcd34d;
    --hint-border: #78350f;
  }
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --border: #e2e4e9;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --hint-bg: #fffbeb;
  --hint-text: #92400e;
  --hint-border: #fcd34d;
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --bg-alt: #1c1f26;
  --text: #e6e7eb;
  --text-muted: #9aa0ab;
  --border: #2b2f38;
  --accent: #60a5fa;
  --accent-text: #0b1220;
  --hint-bg: #2a2210;
  --hint-text: #fcd34d;
  --hint-border: #78350f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  background: var(--bg-alt);
}
.ad-slot--top { height: 90px; margin: 0 auto; max-width: 728px; }
.ad-slot--inline { height: 90px; margin: 24px auto; max-width: 728px; }
.ad-slot::before { content: "Ad placeholder"; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.site-header h1 { font-size: 1.25rem; margin: 0; }
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
}

.tool {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 24px;
  min-height: 60vh;
}
@media (max-width: 768px) {
  .tool { grid-template-columns: 1fr; }
}

.pane {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--bg-alt);
  gap: 12px;
}

.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.type-tab {
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.type-tab:hover { border-color: var(--accent); }
.type-tab.is-active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}
.field label { color: var(--text-muted); }
.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.field textarea { min-height: 80px; resize: vertical; }

.qr-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.control select {
  font-size: 0.85rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.qr-canvas-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 220px;
}
.qr-canvas-wrapper canvas { max-width: 100%; height: auto; }

.validation-hint {
  padding: 8px 10px;
  font-size: 0.8rem;
  background: var(--hint-bg);
  color: var(--hint-text);
  border: 1px solid var(--hint-border);
  border-radius: 6px;
}

.download-btn {
  align-self: flex-start;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
.download-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.site-footer {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.75rem;
}
