/* QR Code Tools. Uses Public Tools' --pt-* variables, so it follows the site's light and dark mode and accent. */
.qrm { --qr-r: var(--pt-radius, .75rem); --qr-surface: var(--color-surface, #fff); display: grid; gap: 1rem; margin: 0 0 2.5rem; }
.qrm [hidden] { display: none !important; }

/* Type switch */
.qrm-types { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.qrm-type { position: relative; cursor: pointer; }
.qrm-type input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.qrm-type span { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: .45rem .85rem; border: 1px solid var(--pt-line); border-radius: 999px; background: var(--qr-surface); color: var(--pt-text); font-size: .9rem; font-weight: 600; }
.qrm-type span svg { width: 1rem; height: 1rem; flex: none; }
.qrm-type:hover span { border-color: var(--pt-line-strong); }
.qrm-type input:checked + span { border-color: var(--pt-accent); background: var(--pt-accent-soft); color: var(--pt-accent-strong, var(--pt-accent)); }
.qrm-type input:focus-visible + span { outline: 2px solid var(--pt-accent); outline-offset: 2px; }
@media (max-width: 35rem) {
    .qrm-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
    .qrm-type span { width: 100%; justify-content: center; padding: .4rem .3rem; border-radius: .6rem; font-size: .8125rem; }
}

/* Layout: content, then preview, then design (on wide screens the preview sits on the right) */
.qrm-grid { display: grid; gap: 1rem; align-items: start; grid-template-areas: "in" "out" "design"; }
.qrm-in { grid-area: in; min-width: 0; }
.qrm-out { grid-area: out; min-width: 0; }
.qrm-designwrap { grid-area: design; min-width: 0; }
@media (min-width: 56rem) {
    .qrm-grid { grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem); grid-template-rows: auto 1fr; grid-template-areas: "in out" "design out"; }
    .qrm-out { position: sticky; top: 5rem; }
}
.qrm-panel { border: 1px solid var(--pt-line); border-radius: var(--qr-r); background: var(--qr-surface); }
.qrm-content { padding: 1.1rem; }
.qrm-form { margin: 0; padding: 0; border: 0; min-width: 0; }
.qrm-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.qrm-fields > .qrm-wide { grid-column: 1 / -1; }
@media (max-width: 35rem) { .qrm-fields { grid-template-columns: minmax(0, 1fr); } }
.qrm-textarea { min-height: 0; }
.qrm-or { margin: 0; font-size: .8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); }
.qrm-seg { margin: 0; }
.qrm-seg legend { margin-bottom: .35rem; }

/* Design panel */
.qrm-panel__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .75rem; padding: .95rem 1.1rem; cursor: pointer; list-style: none; }
.qrm-panel__head::-webkit-details-marker { display: none; }
.qrm-panel__head::after { content: ""; margin-left: auto; align-self: center; width: .55rem; height: .55rem; border-right: 2px solid var(--pt-muted); border-bottom: 2px solid var(--pt-muted); transform: rotate(45deg); transition: transform .15s; }
details[open] > .qrm-panel__head::after { transform: rotate(-135deg); }
.qrm-panel__title { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; color: var(--pt-ink); }
.qrm-panel__title svg { width: 1.1rem; height: 1.1rem; }
.qrm-panel__sub { font-size: .8125rem; color: var(--pt-muted); }
.qrm-panel__body { display: grid; gap: 1.1rem; padding: 0 1.1rem 1.1rem; }
.qrm-colours { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.25rem; }
.qrm-colour { display: grid; gap: .35rem; }
.qrm-colour.is-off { opacity: .45; }
.qrm-colour input[type="color"] { width: 4.5rem; height: 2.6rem; padding: .2rem; border: 1px solid var(--pt-line-strong); border-radius: .55rem; background: var(--qr-surface); cursor: pointer; }
.qrm-transparent { min-height: 2.6rem; }
.qrm-shapes-note { margin: -.6rem 0 0; }
.qrm-shapes-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 30rem) { .qrm-shapes-row { grid-template-columns: minmax(0, 1fr); } }
.qrm-shapes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.qrm-shapes legend { grid-column: 1 / -1; margin-bottom: .35rem; }
.qrm-shape { position: relative; display: grid; justify-items: center; gap: .3rem; padding: .5rem .25rem; border: 1px solid var(--pt-line); border-radius: .6rem; cursor: pointer; font-size: .75rem; font-weight: 600; color: var(--pt-text); text-align: center; }
.qrm-shape input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.qrm-shape:has(input:checked) { border-color: var(--pt-accent); box-shadow: 0 0 0 1px var(--pt-accent); background: var(--pt-accent-soft); }
.qrm-shape:has(input:focus-visible) { outline: 2px solid var(--pt-accent); outline-offset: 2px; }
.qrm-shape__pic { width: 1.9rem; height: 1.9rem; color: var(--pt-ink); }
/* Little pictures of each shape, drawn with gradients in the text colour */
.qrm-shape__pic--modules-square { background: conic-gradient(currentColor 25%, transparent 0 50%, currentColor 0 75%, transparent 0) 0 0 / 50% 50%; }
.qrm-shape__pic--modules-rounded { background: radial-gradient(circle at 25% 25%, currentColor 22%, transparent 23%), radial-gradient(circle at 75% 75%, currentColor 22%, transparent 23%), linear-gradient(currentColor, currentColor) 0 0 / 50% 50% no-repeat; border-radius: .35rem; }
.qrm-shape__pic--modules-dots { background: radial-gradient(circle, currentColor 40%, transparent 42%) 0 0 / 50% 50%; }
.qrm-shape__pic--corners-square { border: .3rem solid currentColor; box-shadow: inset 0 0 0 .2rem var(--qr-surface), inset 0 0 0 1rem currentColor; }
.qrm-shape__pic--corners-rounded { border: .3rem solid currentColor; border-radius: .55rem; box-shadow: inset 0 0 0 .2rem var(--qr-surface), inset 0 0 0 1rem currentColor; }
.qrm-shape__pic--corners-dot { border: .3rem solid currentColor; border-radius: 50%; box-shadow: inset 0 0 0 .2rem var(--qr-surface), inset 0 0 0 1rem currentColor; }
.qrm-logo { display: grid; gap: .5rem; }
.qrm-logo__opts { display: grid; gap: .5rem; }
.qrm-row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 30rem) { .qrm-row2 { grid-template-columns: minmax(0, 1fr); } }
.qrm input[type="range"] { width: 100%; accent-color: var(--pt-accent); min-height: 2rem; }
.qrm output { font-weight: 700; color: var(--pt-ink); }

/* Preview */
.qrm-card { display: grid; gap: .75rem; padding: 1.1rem; border: 1px solid var(--pt-line); border-radius: var(--qr-r); background: var(--qr-surface); }
.qrm-empty { margin: 0; padding: 3rem 1rem; text-align: center; color: var(--pt-muted); border: 2px dashed var(--pt-line); border-radius: calc(var(--qr-r) - .2rem); font-size: .9375rem; }
.qrm-empty.is-error { color: var(--pt-error); border-color: currentColor; border-style: solid; background: var(--pt-error-soft); }
.qrm-result { display: grid; gap: .75rem; }
.qrm-canvas { display: grid; place-items: center; padding: .75rem; border-radius: calc(var(--qr-r) - .2rem);
    background: #fff repeating-conic-gradient(#eef1f5 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.qrm-canvas canvas { display: block; max-width: 100%; height: auto; }
.qrm-note { margin: 0; font-size: .875rem; color: var(--pt-text); overflow-wrap: anywhere; }
.qrm-check { margin: 0; font-size: .8125rem; line-height: 1.4; color: var(--pt-muted); min-height: 2.8em; }
.qrm-check.is-ok { color: var(--pt-ok); }
.qrm-check.is-bad { color: var(--pt-error); font-weight: 600; }
.qrm-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.qrm-actions svg { width: 1rem; height: 1rem; }
.qrm-more { position: relative; }
.qrm-more > summary { list-style: none; }
.qrm-more > summary::-webkit-details-marker { display: none; }
.qrm-menu { position: absolute; z-index: 20; right: 0; top: calc(100% + .35rem); min-width: 13rem; display: grid; gap: .15rem; padding: .4rem; border: 1px solid var(--pt-line); border-radius: var(--qr-r); background: var(--qr-surface); box-shadow: 0 10px 30px rgb(0 0 0 / .14); }
.qrm-menu .pt-btn { justify-content: flex-start; }
.qrm-warn { display: grid; gap: .4rem; }
.qrm-warn p { margin: 0; }

/* Bulk */
.qrb { grid-template-columns: minmax(0, 1fr); }
.qrb-input { display: grid; gap: .9rem; padding: 1.1rem; }
.qrb-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.qrb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .75rem; }
.qrb-item { margin: 0; display: grid; gap: .35rem; padding: .5rem; border: 1px solid var(--pt-line); border-radius: .6rem; background: #fff; }
.qrb-item canvas { width: 100%; height: auto; display: block; }
.qrb-item figcaption { font-size: .75rem; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrb-item__err { aspect-ratio: 1; display: grid; place-items: center; color: #b91c1c; font-weight: 700; font-size: .8rem; background: #fef2f2; border-radius: .4rem; }
.qrb-more { grid-column: 1 / -1; margin: 0; }
.qrb-errors ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.qrb-errors__title { margin: 0; font-weight: 700; }

/* Scanner */
.qrs { display: grid; gap: 1rem; margin: 0 0 2.5rem; }
.qrs [hidden] { display: none !important; }
.qrs-zone { display: grid; justify-items: center; gap: .35rem; padding: 2rem 1.25rem; text-align: center; border: 2px dashed var(--pt-line-strong); border-radius: var(--pt-radius, .75rem); background: var(--pt-soft); transition: border-color .15s, background .15s; }
.qrs-zone.is-over { border-color: var(--pt-accent); background: var(--pt-accent-soft); }
.qrs-zone__icon { display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 1rem; background: var(--pt-accent-soft); color: var(--pt-accent); }
.qrs-zone__icon svg { width: 2rem; height: 2rem; }
.qrs-zone__title { margin: .25rem 0 0; font-size: 1.0625rem; font-weight: 700; color: var(--pt-ink); }
.qrs-zone__actions { justify-content: center; }
.qrs-zone .pt-btn svg { width: 1rem; height: 1rem; }
.qrs-cam { display: grid; gap: .75rem; justify-items: center; }
.qrs-cam__view { position: relative; width: min(100%, 32rem); border-radius: var(--pt-radius, .75rem); overflow: hidden; background: #000; }
.qrs-cam__view video { display: block; width: 100%; height: auto; }
.qrs-cam__frame { position: absolute; inset: 15%; border: 3px solid rgb(255 255 255 / .85); border-radius: 1rem; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .25); }
.qrs-out { display: grid; gap: 1rem; }
.qrs-card { display: grid; gap: .85rem; padding: 1.1rem; border: 1px solid var(--pt-line); border-radius: var(--pt-radius, .75rem); background: var(--color-surface, #fff); }
.qrs-card:first-child { border-color: var(--pt-accent); box-shadow: 0 0 0 1px var(--pt-accent); }
.qrs-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.qrs-card__title { margin: 0; font-size: 1.0625rem; font-weight: 700; color: var(--pt-ink); overflow-wrap: anywhere; flex: 1 1 12rem; }
.qrs-card__src { font-size: .8125rem; color: var(--pt-muted); }
.qrs-rows { display: grid; grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr); margin: 0; border: 1px solid var(--pt-line); border-radius: var(--pt-radius-sm, .5rem); overflow: hidden; }
.qrs-rows dt, .qrs-rows dd { margin: 0; padding: .55rem .8rem; border-top: 1px solid var(--pt-line); }
.qrs-rows dt:first-of-type, .qrs-rows dt:first-of-type + dd { border-top: 0; }
.qrs-rows dt { font-size: .8125rem; font-weight: 600; color: var(--pt-muted); background: var(--pt-soft); }
.qrs-rows dd { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem .75rem; color: var(--pt-ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.qrs-rows dd > :first-child { min-width: 0; flex: 1 1 10rem; }
@media (max-width: 30rem) { .qrs-rows { grid-template-columns: minmax(0, 1fr); } .qrs-rows dd { border-top: 0; padding-top: 0; } }
.qrs-warn { margin: 0; }
.qrs-raw summary { cursor: pointer; font-size: .875rem; font-weight: 600; color: var(--pt-muted); }
.qrs-raw pre { margin: .5rem 0 0; padding: .75rem; max-height: 16rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--pt-soft); border-radius: .5rem; color: var(--pt-ink); }

@media (max-width: 40rem) {
    .qrm .pt-btn, .qrs .pt-btn { min-height: 2.75rem; }
    .qrm-type span { min-height: 2.75rem; }
}
