:root {
  --icon-size: 20px;
  --icon-button-size: 44px;
  --ink: #212121;
  --muted: #626262;
  --line: #dedede;
  --accent: #242424;
  --wash: #f1f1f1;
  --bg: #fff;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
}
.symbols,
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
svg:not(.symbols) {
  width: var(--icon-size);
  height: var(--icon-size);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select,
summary,
input[type="color"],
input[type="range"] {
  cursor: pointer;
}
button {
  color: inherit;
}
button:disabled {
  cursor: wait;
  opacity: 0.64;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #777;
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
header {
  height: 67px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.nav,
main {
  max-width: 1240px;
  margin: auto;
  padding: 0 46px;
}
.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.reset,
.iconbutton,
.dismiss {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.nav h1 {
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.048em;
  margin: 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--icon-button-size);
  color: inherit;
  text-decoration: none;
}
.url-field { position: relative; }
.reset {
  position: absolute;
  inset-inline-end: 1px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--icon-button-size);
  height: var(--icon-button-size);
  padding: 0;
  border-radius: 10px;
  color: var(--muted);
}
.reset:hover { color: var(--accent); background: var(--wash); }
.reset:focus-visible { outline-offset: -3px; }
#url:placeholder-shown + .reset { display: none; }
.card {
  min-width: 0;
}
.block {
  padding: 22px 0;
}
.block + .block {
  border-top: 1px solid var(--line);
}
h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.55px;
  font-weight: 610;
}
h2 svg {
  color: var(--muted);
}
.block h2 {
  margin-bottom: 15px;
}
input[type="url"],
textarea,
select,
.colorbox {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
input[type="url"],
select {
  height: 42px;
}
input[type="url"] {
  display: block;
  min-height: calc(var(--icon-button-size) + 2px);
  padding-inline-end: calc(var(--icon-button-size) + 6px);
  font-size: 15px;
}
textarea {
  display: block;
  font-size: 15px;
  line-height: 1.5;
  min-height: 73px;
  resize: vertical;
}
.segments {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--wash);
}
.segments button {
  border: 1px solid transparent;
  border-radius: inherit;
  padding: 7px 14px;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
}
.segments button.on {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
  font-weight: 600;
}
.mode {
  margin-bottom: 12px;
}
.generate,
.download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 999px;
  font-weight: 600;
}
.generate {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--accent);
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 14px;
}
.generate:hover {
  background: var(--wash);
}
.drop {
  position: relative;
  min-height: 116px;
  padding: 12px;
  border: 1px dashed #b9b9b9;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  background: #fafafa;
  font-size: 14px;
}
.drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}
.drop:focus-within,
.drop.drag {
  outline: 2px solid var(--accent);
}
.drop svg {
  color: var(--accent);
}
.drop small {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.notice,
.error {
  overflow-wrap: anywhere;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.notice:not(:empty),
.error:not(:empty) {
  display: block;
  margin-top: 7px;
}
.error,
.notice.bad {
  color: #a53143;
}
.fieldlabel,
.slider label {
  font-size: 14px;
  font-weight: 550;
}
.fieldlabel {
  display: block;
  margin-bottom: 7px;
}
.selectwrap {
  position: relative;
}
.selectwrap svg {
  pointer-events: none;
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  transform: translateY(-50%);
}
select {
  appearance: none;
  font-size: 14px;
  padding-inline-end: 35px;
}
.colors {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.colorbox {
  width: auto;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font:
    12px ui-monospace,
    Menlo,
    monospace;
  border-radius: 7px;
  padding: 5px 8px;
}
.colorbox input {
  width: 23px;
  height: 23px;
  border: 0;
  background: transparent;
  padding: 0;
}
.colorbox input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.colorbox input::-webkit-color-swatch {
  border: 0;
  border-radius: 4px;
}
#swatches {
  display: flex;
  gap: 7px;
}
.swatch {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  border: 2px solid white;
  background: var(--swatch);
}
.swatch.on {
  outline: 1px solid var(--swatch);
}
#endRow {
  margin-top: 13px;
}
.slider {
  margin-top: 15px;
}
.sliderline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.slider output {
  font:
    12px ui-monospace,
    Menlo,
    monospace;
  color: var(--muted);
  background: transparent;
  border-radius: 4px;
  padding: 3px 6px;
}
.slider input {
  display: block;
  width: 100%;
  margin: 9px 0 2px;
  appearance: none;
  background: linear-gradient(
    to right,
    var(--accent) 0 var(--pct),
    #e5e5e5 var(--pct) 100%
  );
  height: 4px;
  border-radius: 3px;
}
.slider input::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 2px solid white;
  border-radius: 100%;
  background: var(--accent);
  box-shadow: 0 0 0 1px #888;
}
.slider input::-moz-range-thumb {
  background: var(--accent);
  border: 2px solid white;
  border-radius: 50%;
}
details {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 13px;
}
summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 580;
}
summary::-webkit-details-marker {
  display: none;
}
details[open] > summary svg {
  transform: rotate(180deg);
}
.preview-head,
.preview-foot {
  padding: 0;
}
.preview-head {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.iconbutton {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--icon-button-size);
  height: var(--icon-button-size);
  padding: 0;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 50%;
}
.iconbutton:hover:enabled { background: var(--wash); }
.iconbutton[aria-expanded="true"] { color: white; background: var(--accent); }
.iconbutton[aria-expanded="true"]:hover { background: #424242; }
.canvas {
  display: grid;
  place-items: center;
  aspect-ratio: 1.42;
  background: #f4f4f4;
  border-radius: 12px;
  padding: 28px;
}
.qrframe {
  position: relative;
  width: min(72%, 295px);
  aspect-ratio: 1;
  background: white;
  box-shadow: 0 4px 18px #0000000d;
}
.qrframe img {
  width: 100%;
  height: 100%;
  display: block;
}
.preview-foot {
  padding-top: 14px;
}
.meta {
  min-height: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  gap: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.meta > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}
.meta .ok {
  color: #28715a;
}
.meta .bad {
  color: #9a3048;
}
#dims {
  font-family: ui-monospace, Menlo, monospace;
  white-space: nowrap;
}
.download {
  width: 100%;
  background: var(--accent);
  color: white;
  height: 46px;
  border: none;
  font-size: 15px;
}
.download:hover:enabled {
  background: #424242;
}
.library {
  margin: 21px 0;
}
.library h2 {
  font-size: 15px;
  margin-bottom: 11px;
}
.presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.preset {
  overflow-wrap: anywhere;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 7px 5px 5px;
  font-size: 14px;
  font-weight: 550;
}
.preset img {
  width: 37px;
  height: 37px;
  object-fit: cover;
  border-radius: 5px;
}
.preset.on {
  background: var(--wash);
  border-color: #bcbcbc;
}
.preset:hover {
  background: var(--wash);
}
dialog {
  padding: 26px;
  max-width: min(90vw, 530px);
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
}
dialog::backdrop {
  background: #16161670;
}
.dismiss {
  position: absolute;
  inset-inline-end: 8px;
  top: 8px;
  background: white;
}
dialog img {
  max-width: 100%;
  display: block;
}
dialog h2 {
  margin-inline-end: 20px;
}
dialog li {
  margin: 12px 0;
  line-height: 1.45;
}
dialog[open] {
  box-shadow: 0 10px 50px #00000022;
}
body:has(dialog[open]) {
  overflow: hidden;
}
@media (min-width: 1500px) {
  main,
  .nav {
    max-width: 1320px;
  }
  .canvas {
    aspect-ratio: 1.35;
  }
  .qrframe {
    width: 310px;
  }
}
@media (max-width: 860px) {
  .nav,
  main {
    padding-inline: 22px;
  }
  .block {
    padding: 18px 0;
  }
  .canvas {
    aspect-ratio: 1.13;
  }
  .preset {
    font-size: 13px;
    gap: 5px;
  }
  .preset img {
    width: 28px;
    height: 28px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background-color 0.14s,
      color 0.14s,
      border-color 0.14s;
  }
}
.ad-placement {
  display: grid;
  place-items: center;
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding: 24px 0;
}
.ad-slot {
  width: min(100%, 728px);
  height: 90px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #f7f7f7;
  color: var(--muted);
  font-size: 12px;
}
.text-action {
  background: transparent;
  color: var(--accent);
  border: 0;
  font: inherit;
  padding: 10px 2px;
}
#retryPreview { font-size: 14px; }
main, .nav { max-width: 680px; }
.canvas {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  aspect-ratio: auto;
  height: clamp(228px, 37dvh, 360px);
  padding: clamp(20px, 3.5dvh, 32px) 16px;
}
.qrframe { height: 100%; width: auto; max-width: 100%; }
#emptyPreview { text-align: center; color: var(--muted); font-size: 14px; }
#examplePreview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(78%, 360px);
  max-height: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
#examplePreview img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  object-fit: contain;
  opacity: 0.6;
}
#examplePreview:not([hidden]) + #emptyPreview { display: none; }
.downloads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) var(--icon-button-size);
  align-items: center;
  gap: 8px;
  direction: ltr;
}
[dir="rtl"] .downloads button { direction: rtl; }
.download-format { display: none; }
@media (max-width: 540px) {
  .download-label { display: none; }
  .download-format { display: inline; }
}
.download.secondary { background: white; color: var(--ink); border: 1px solid var(--line); }
.download.secondary:hover:enabled { background: var(--wash); }
#advanced { border-top: 1px solid var(--line); margin-top: 18px; }
#advanced .block { padding: 20px 0 0; }
#removeArt { font-size: 14px; text-decoration: underline; }
@media (max-width: 680px) {
  header { height: 48px; }
  main, .nav { padding-inline: 18px; }
  #linkPanel { padding: 18px 0 14px; }
  #linkPanel h2, .preview-head { margin-bottom: 6px; }
  input[type="url"], select, textarea { font-size: 16px; }
  .segments button, .generate, summary { min-height: 44px; }
  .canvas { width: 100%; height: auto; min-height: 0; aspect-ratio: 1; padding: 16px; }
  #advanced { margin-top: 14px; padding-top: 3px; }
  .preset { flex-direction: column; }
  .ad-slot { width: min(100%, 320px); height: 50px; }
}
body { min-height: 100dvh; display: flex; flex-direction: column; }
header, footer { flex: none; }
main { width: 100%; margin: 0 auto; flex: 1; }
footer {
  display: flex;
  justify-content: flex-end;
  padding: 8px max(20px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) 20px;
  border-top: 1px solid var(--line);
}
#languageFlag, .language-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--icon-size);
  height: var(--icon-size);
  font-size: var(--icon-size);
  line-height: 1;
}
#languageDialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(28px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  background: #fafafa;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.language-sheet { max-width: 660px; margin: clamp(0px, 5vh, 56px) auto 0; }
.language-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.language-heading h2 { margin: 0; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.04em; line-height: 1.2; }
.language-heading h2:focus { outline: none; }
#languageOptions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.language-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  min-height: 67px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  text-align: start;
}
.language-option[data-language="auto"] { grid-column: 1 / -1; margin-bottom: 6px; }
.language-option:hover { background: #f4f4f4; border-color: #b8b8b8; }
.language-option[aria-pressed="true"] { background: #eff4f0; border-color: #789584; }
.language-copy { display: grid; gap: 2px; }
.language-name { font-weight: 600; line-height: 1.35; }
.language-caption { font-size: 13px; color: var(--muted); }
.language-check { display: grid; margin-inline-start: auto; visibility: hidden; color: #355c47; }
.language-option[aria-pressed="true"] .language-check { visibility: visible; }
@media (max-width: 540px) {
  #languageOptions { grid-template-columns: 1fr; gap: 7px; }
  .language-sheet { margin-top: 0; }
  .language-heading { position: sticky; top: 0; z-index: 1; background: #fafafa; padding-block: 8px; margin-bottom: 12px; }
  .language-option { min-height: 54px; padding: 8px 12px; }
}
[dir="rtl"] .slider input { background-image: linear-gradient(to left, var(--accent) 0 var(--pct), #e5e5e5 var(--pct) 100%); }
