:root {
  --bg: #fbfbfa;
  --fg: #16161a;
  --muted: #6b6b76;
  --line: #e2e2dd;
  --card: #ffffff;
  --accent: #1a1a1f;
  --accent-fg: #ffffff;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --fg: #e9e9ec;
    --muted: #9a9aa4;
    --line: #2b2b31;
    --card: #1b1b1f;
    --accent: #e9e9ec;
    --accent-fg: #131316;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.head h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.75rem 0 1rem;
}

.tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.tab:hover { color: var(--fg); }

.tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.cols {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
  align-items: start;
}

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

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
}

label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.9rem 0 0.3rem;
}

.pane > label:first-child { margin-top: 0; }

input[type="text"], input[type="tel"], input[type="email"], input[type="url"], textarea, select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

textarea { resize: vertical; }

input:focus, textarea:focus, select:focus {
  border-color: var(--muted);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: end;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  color: var(--fg);
}

.check input { width: auto; margin: 0; }

.opts {
  margin-top: 1.25rem;
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
}

.opts summary {
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
}

.opts[open] summary { margin-bottom: 0.25rem; }

input[type="range"] {
  width: 100%;
  accent-color: var(--fg);
}

.out {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 1rem;
}

@media (max-width: 720px) {
  .out { position: static; }
}

/* The QR canvas carries its own quiet zone, so this needs only enough
   padding to keep the code off the rounded corners. */
.qr-frame {
  background: #fff;
  border-radius: 8px;
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

#qr {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  display: block;
}

#qr[hidden] { display: none; }

.empty {
  margin: 0;
  color: #8a8a94;
  font-size: 0.85rem;
  text-align: center;
}

.meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.1em;
}

.actions {
  display: flex;
  gap: 0.4rem;
}

button {
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}

/* Only the action row divides its space; tabs size to their labels. */
.actions button { flex: 1; }
.actions button.ghost { flex: 0 0 auto; }

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--fg);
}

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

.foot {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.foot a { color: inherit; }
