/* The QR code generator (qr-code-generator and its Hindi twin). The colours are the page's (--bg, --bg-2, --border, --accent ...). */
/* the words that say something happened: the green, the amber and the red of the dark page are too pale to read on a white page, so the light page has darker ones (4.5 : 1 or more) */
:root { --qm-ok: var(--accent); --qm-warn: #ffb454; --qm-err: #ff8a8a; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --qm-ok: #0b7a4b; --qm-warn: #a85a00; --qm-err: #b3261e; } }
:root[data-theme="light"] { --qm-ok: #0b7a4b; --qm-warn: #a85a00; --qm-err: #b3261e; }

.qm { margin-top: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-2); scroll-margin-top: 72px; }
@media (min-width: 700px) { .qm { padding: 22px; } }
@media (max-width: 480px) { .qm { margin-inline: -8px; padding: 10px 8px; } }
.qm [hidden] { display: none !important; }
.qm-nojs { color: var(--text-2); }
.qm button, .qm input, .qm select, .qm textarea { font-family: inherit; }
.qm-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.qm-title { margin-bottom: 8px; font-size: 15px; font-weight: 700; }

/* the kinds: round buttons that wrap (a radio button each, so the keyboard and a screen reader work as they should) */
.qm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.qm-chip { position: relative; -webkit-tap-highlight-color: transparent; }
.qm-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.qm-chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 22px; background: var(--bg); font-size: 14px; font-weight: 600; }
.qm-chip input:checked + span { border-color: var(--accent); background: var(--accent-lo); color: var(--qm-ok); }
.qm-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the boxes on the left (below on a phone) and the picture on the right */
.qm-grid { display: grid; gap: 18px; margin-top: 16px; }
@media (min-width: 900px) { .qm-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 360px); align-items: start; } .qm-out { position: sticky; top: 84px; } }
.qm-form, .qm-out { min-width: 0; }

.qm-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.qm-intl { grid-template-columns: 104px minmax(0, 1fr); }
.qm-row { grid-column: 1 / -1; display: grid; gap: 6px; min-width: 0; align-content: start; }
.qm-row.fit { grid-column: auto; }
.qm-row > label, .qm-color > label { font-size: 14px; font-weight: 600; }
.qm input[type="text"], .qm textarea, .qm select { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.4; }
.qm textarea { resize: vertical; line-height: 1.5; }
.qm input:focus, .qm textarea:focus, .qm select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.qm input::placeholder, .qm textarea::placeholder { color: var(--text-2); opacity: .8; }
.qm [aria-invalid="true"] { border-color: var(--qm-err); }
.qm-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 600; cursor: pointer; }
.qm-check input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--accent); }
.qm-help { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.qm-err { font-size: 13px; line-height: 1.5; font-weight: 600; color: var(--qm-err); }

/* colours, size, error correction: closed until wanted */
.qm-more { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--border); }
.qm-more summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none; font-size: 15px; font-weight: 700; }
.qm-more summary::-webkit-details-marker { display: none; }
.qm-more summary::after { content: '+'; margin-left: auto; padding-left: 12px; color: var(--qm-ok); font-size: 20px; line-height: 1; }
.qm-more[open] summary::after { content: '−'; }
.qm-opts { display: grid; gap: 14px; padding: 4px 0 6px; }
.qm-colors { display: flex; flex-wrap: wrap; gap: 16px; }
.qm-color { display: grid; gap: 6px; }
.qm-color input[type="color"] { width: 64px; height: 44px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; }
.qm-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.qm-swatch { position: relative; -webkit-tap-highlight-color: transparent; width: 44px; height: 44px; padding: 0; border: 2px solid var(--border); border-radius: 50%; background: var(--sw-bg); cursor: pointer; }
.qm-swatch i { position: absolute; inset: 9px; border-radius: 50%; background: var(--sw-fg); }
.qm-swatch:hover { border-color: var(--accent); }
.qm-swatch:focus-visible, .qm .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the picture: a square that is always there, so that nothing below it moves when the code comes and goes */
.qm-stage { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1 / 1; margin: 0 auto; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.qm-canvas { display: block; width: 100%; height: 100%; }
.qm-stage[data-state="empty"] .qm-canvas { visibility: hidden; }
.qm-empty { position: absolute; inset: 0; display: none; place-content: center; gap: 6px; padding: 16px; border: 2px dashed var(--border); border-radius: 12px; text-align: center; color: var(--text-2); }
.qm-stage[data-state="empty"] .qm-empty { display: grid; }
.qm-empty strong { color: var(--text); font-size: 15px; }
.qm-empty span { font-size: 14px; }

.qm-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.qm .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: transparent; }
.qm .btn-primary { background: var(--accent); border: 0; color: #08080E; }
.qm .btn-ghost { border: 1px solid var(--border); color: var(--text); }
.qm .btn-ghost:hover { border-color: var(--accent); color: var(--qm-ok); }
.qm-locate { justify-self: start; }

/* what happened, what to look at */
.qm-status { min-height: 1.4em; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--qm-ok); text-align: center; }
.qm-status[data-status="loc"] { margin-top: 4px; text-align: left; }
.qm-status.warn { color: var(--qm-warn); }
.qm-hints { list-style: none; display: grid; gap: 8px; margin-top: 10px; }
.qm-hints li { padding-left: 12px; border-left: 3px solid var(--border); font-size: 14px; line-height: 1.5; color: var(--text-2); }
.qm-hints li.warn { color: var(--qm-warn); border-left-color: var(--qm-warn); font-weight: 600; }
.qm-holds { margin-top: 12px; font-size: 13px; color: var(--text-2); }
.qm-holds code { display: block; max-height: 9em; margin-top: 4px; padding: 8px 10px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
html[lang="hi"] .qm-title { font-size: 16px; }
