:root {
  color-scheme: light;
  --background: 48 30% 96%;
  --foreground: 30 8% 10%;
  --card: 45 25% 93%;
  --secondary: 45 22% 90%;
  --muted-foreground: 40 6% 39%;
  --accent: 217 84% 46%;
  --accent-foreground: 0 0% 98%;
  --destructive: 4 70% 47%;
  --ok: 145 55% 32%;
  --border: 45 18% 85%;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: 30 8% 8%;
    --foreground: 45 25% 90%;
    --card: 30 7% 11%;
    --secondary: 30 6% 15%;
    --muted-foreground: 40 8% 62%;
    --accent: 217 90% 62%;
    --accent-foreground: 30 8% 8%;
    --destructive: 4 75% 62%;
    --ok: 145 50% 55%;
    --border: 30 6% 20%;
  }
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0 !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: 400 15.5px/1.55 var(--font-mono);
  transition: background-color 0.3s, color 0.3s;
}
a { color: hsl(var(--accent)); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 1.25rem; }
@media (min-width: 640px) { .container { padding-inline: 2rem; } }
@media (min-width: 1024px) { .container { padding-inline: 3.5rem; } }

kbd {
  font: 500 11px var(--font-mono);
  border: 1px solid hsl(var(--border));
  padding: 0 4px;
  margin-left: 4px;
  color: hsl(var(--muted-foreground));
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.1rem; border-bottom: 1px solid hsl(var(--border)); }
.brand { font-weight: 700; color: hsl(var(--foreground)); font-size: 16px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.glyph { color: hsl(var(--accent)); font-weight: 400; }
.tabs { display: flex; }
.tabs button { border-right-width: 0; }
.tabs button:last-child { border-right-width: 1px; }
.tabs button[aria-selected="true"] { background: hsl(var(--foreground)); color: hsl(var(--background)); }
.tabs button[aria-selected="true"] kbd { color: inherit; border-color: currentColor; }

.intro { padding-block: 2.5rem 1.75rem; }
.hero {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.6vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 0.75rem;
}
.caret::after { content: "▋"; color: hsl(var(--accent)); animation: blink 1s step-end infinite; margin-left: 0.08em; font-weight: 400; }
@keyframes blink { 50% { opacity: 0; } }
.sub { margin: 0; color: hsl(var(--muted-foreground)); font-size: 13.5px; }

.grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; padding-bottom: 3rem; }
@media (min-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); align-items: start; }
  .grid.scan { grid-template-columns: 1fr 1fr; }
  .preview { position: sticky; top: 1.25rem; }
}
.controls { display: grid; gap: 1.25rem; min-width: 0; }

.card { border: 1px solid hsl(var(--border)); background: hsl(var(--card)); padding: 1.4rem; transition: background-color 0.3s, border-color 0.3s; }
@media (min-width: 640px) { .card { padding: 1.6rem 1.75rem; } }
.section-heading { font-family: var(--font-display); font-size: clamp(1.2rem, 2vw, 1.45rem); letter-spacing: -0.01em; font-weight: 700; margin: 0 0 1rem; }
.section-heading::before { content: "■ "; color: hsl(var(--accent)); font-weight: 400; }

button, .btnlike {
  font: 500 13px var(--font-mono);
  color: hsl(var(--foreground));
  background: transparent;
  border: 1px solid hsl(var(--border));
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
button:hover, .btnlike:hover { border-color: hsl(var(--foreground)); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .btnlike:focus-within {
  outline: 1px solid hsl(var(--accent));
  outline-offset: 1px;
}
button.ghost { border-color: transparent; color: hsl(var(--muted-foreground)); padding-inline: 0.4rem; }
button.ghost:hover { color: hsl(var(--foreground)); }

.seg { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 1.1rem; }
.seg button { margin: 0 -1px -1px 0; }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border-color: hsl(var(--foreground));
  position: relative;
}
.seg.small { margin: 0; }
.seg.small button { padding: 0.35rem 0.7rem; font-size: 12.5px; }
.seg.small.looks { margin-bottom: 1.1rem; }

.fields { display: grid; gap: 0.85rem; }
.fields.two { grid-template-columns: 1fr; }
@media (min-width: 560px) { .fields.two { grid-template-columns: 1fr 1fr; } }
.fields[hidden] { display: none; }
label { display: grid; gap: 0.35rem; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
label output { color: hsl(var(--foreground)); }
input, select, textarea {
  font: 400 14px var(--font-mono);
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  padding: 0.55rem 0.65rem;
  width: 100%;
  min-width: 0;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: hsl(var(--muted-foreground) / 0.7); }
label.check { display: flex; align-items: center; gap: 0.5rem; align-self: end; padding-bottom: 0.55rem; color: hsl(var(--foreground)); }
label.check input { width: auto; accent-color: hsl(var(--accent)); }
input[type="range"] { padding: 0; accent-color: hsl(var(--accent)); background: transparent; border: 0; height: 2.1rem; }
.color { display: grid; grid-template-columns: 2.4rem 1fr; }
.color input[type="color"] { padding: 2px; height: 100%; min-height: 2.35rem; border-right: 0; cursor: pointer; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding-block: 0.55rem; border-top: 1px solid hsl(var(--border)); }
.row:first-of-type { margin-top: 1rem; }
.row + .fields { margin-top: 0.75rem; border-top: 1px solid hsl(var(--border)); padding-top: 0.9rem; }
.lbl { font-size: 12.5px; color: hsl(var(--muted-foreground)); }

.payload {
  margin: 1.1rem 0 0;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--secondary));
  padding: 0.6rem 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 7.5rem;
  overflow: auto;
}
.payload::before { content: "› "; color: hsl(var(--accent)); }

.logo-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end; margin-top: 0.9rem; border-top: 1px solid hsl(var(--border)); padding-top: 0.9rem; }
.logo-row > label:last-child { flex: 1 1 12rem; }
label.file input[type="file"] { font-size: 12.5px; padding: 0.4rem; }
.btnlike { position: relative; overflow: hidden; }
.btnlike input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.note { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin: 0.75rem 0 0; }
.note.warn { color: hsl(var(--destructive)); }

.stage { display: grid; gap: 0.85rem; }
.qr {
  aspect-ratio: 1;
  width: 100%;
  display: grid;
  place-items: center;
  background-color: hsl(var(--secondary));
}
.qr svg { width: 100%; height: 100%; display: block; }
.qr .err { font-size: 13px; color: hsl(var(--destructive)); padding: 1.5rem; text-align: center; background: hsl(var(--card)); }
.meta { margin: 0; font-size: 12px; color: hsl(var(--muted-foreground)); }
.check-line { margin: 0; font-size: 12px; min-height: 1.2em; color: hsl(var(--muted-foreground)); }
.check-line.ok { color: hsl(var(--ok)); }
.check-line.bad { color: hsl(var(--destructive)); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.actions button { flex: 1 1 auto; justify-content: center; }
.actions.left button, .actions.left .btnlike { flex: 0 0 auto; }
.actions #dlPng { background: hsl(var(--foreground)); color: hsl(var(--background)); border-color: hsl(var(--foreground)); }
.actions #dlPng kbd { color: inherit; border-color: currentColor; }
.toast { margin: 0; min-height: 1.2em; font-size: 12px; color: hsl(var(--accent)); }

.drop {
  margin-top: 1rem;
  border: 1px dashed hsl(var(--border));
  padding: 2.25rem 1rem;
  text-align: center;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
  transition: border-color 0.15s, color 0.15s;
}
.drop.over { border-color: hsl(var(--accent)); color: hsl(var(--foreground)); }
video { width: 100%; margin-top: 1rem; background: #000; display: block; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.results li { border: 1px solid hsl(var(--border)); background: hsl(var(--background)); padding: 0.75rem; display: grid; gap: 0.5rem; }
.results li.empty { color: hsl(var(--muted-foreground)); font-size: 13px; border-style: dashed; background: transparent; }
.results .val { font-size: 13.5px; white-space: pre-wrap; word-break: break-all; }
.results .meta-line { font-size: 11px; color: hsl(var(--muted-foreground)); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.results .meta-line button { padding: 0.2rem 0.5rem; font-size: 11.5px; }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding-block: 1.25rem 2rem; border-top: 1px solid hsl(var(--border)); font-size: 12px; color: hsl(var(--muted-foreground)); }
.foot kbd { margin-left: 0; margin-right: 2px; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
