/* TRW Free QR Code Generator. Every selector is scoped to .trw-qr. */
.trw-qr {
	--q-ink: #17302a; --q-muted: #50655e; --q-green: #0b7a52; --q-green-deep: #075a3c; --q-gold: #f2b52c;
	--q-wash: #edf5f0; --q-line: #cddcd4; --q-paper: #fff; --q-danger: #a8231b; --q-warn-bg: #fff5d9;
	--q-font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
	font-family: var(--q-font); color: var(--q-ink); font-size: 16px; line-height: 1.5;
	max-width: 1180px; margin: 0 auto 2.5em; text-align: left;
}
.trw-qr *, .trw-qr *::before, .trw-qr *::after { box-sizing: border-box; }
.trw-qr [hidden] { display: none !important; }
.trw-qr p { margin: 0; }
.trw-qr svg { flex: none; }
.trw-qr .trw-qr-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; border: 0; }

/* Header */
.trw-qr .trw-qr-head { margin-bottom: 16px; }
.trw-qr .trw-qr-title { font-family: var(--q-font); font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; color: var(--q-ink); margin: 0 0 6px; padding: 0; }
.trw-qr .trw-qr-lede { color: var(--q-muted); font-size: 1.05rem; margin-bottom: 12px; }
.trw-qr .trw-qr-privacy { display: inline-flex; align-items: center; gap: 8px; background: var(--q-wash); color: var(--q-green-deep); border-radius: 999px; padding: 7px 14px 7px 12px; font-weight: 700; font-size: 0.92rem; line-height: 1.35; }
.trw-qr .trw-qr-alert { background: var(--q-warn-bg); padding: 12px 16px; border-radius: 10px; margin: 10px 0; }

/* Tabs */
.trw-qr .trw-qr-tabs { display: flex; gap: 6px; margin: 0 0 14px; border-bottom: 2px solid var(--q-line); }
.trw-qr button.trw-qr-tab {
	margin: 0 0 -2px; padding: 12px 18px; min-height: 48px; background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0;
	color: var(--q-muted); font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: 0;
}
.trw-qr button.trw-qr-tab:hover { background: var(--q-wash); color: var(--q-ink); }
.trw-qr button.trw-qr-tab.is-active { color: var(--q-green-deep); border-bottom-color: var(--q-green); }

/* Layout: mobile = type/fields, preview, design, download. Desktop = form left, sticky preview right. */
.trw-qr .trw-qr-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.trw-qr .trw-qr-main { order: 1; display: grid; gap: 14px; min-width: 0; }
.trw-qr .trw-qr-side { display: contents; }
.trw-qr .trw-qr-preview-card { order: 2; }
.trw-qr .trw-qr-design { order: 3; min-width: 0; }
.trw-qr .trw-qr-download-card { order: 4; }
@media (min-width: 900px) {
	.trw-qr .trw-qr-grid { grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "main side" "design side"; align-items: start; gap: 16px 24px; }
	.trw-qr .trw-qr-main { grid-area: main; }
	.trw-qr .trw-qr-design { grid-area: design; }
	.trw-qr .trw-qr-side { display: grid; gap: 14px; grid-area: side; position: sticky; top: 20px; }
	.trw-qr .trw-qr-preview-card, .trw-qr .trw-qr-download-card { order: 0; }
}

.trw-qr .trw-qr-card { background: var(--q-paper); border: 1px solid var(--q-line); border-radius: 16px; padding: 16px; }
@media (min-width: 700px) { .trw-qr .trw-qr-card { padding: 18px 20px; } }
.trw-qr .trw-qr-h { font-family: var(--q-font); font-size: 1.12rem; line-height: 1.3; font-weight: 800; color: var(--q-ink); margin: 0 0 12px; padding: 0; letter-spacing: 0; }
.trw-qr .trw-qr-h--sub { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--q-line); }

/* Type picker */
.trw-qr .trw-qr-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.trw-qr .trw-qr-type { position: relative; margin: 0; cursor: pointer; }
.trw-qr .trw-qr-type input, .trw-qr .trw-qr-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.trw-qr .trw-qr-type > span {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 72px; padding: 8px 6px;
	border: 2px solid var(--q-line); border-radius: 12px; background: var(--q-paper); color: var(--q-ink); text-align: center;
	transition: border-color .15s ease, background-color .15s ease;
}
.trw-qr .trw-qr-type b { font-size: 0.88rem; font-weight: 700; line-height: 1.2; }
.trw-qr .trw-qr-type:hover > span { border-color: #9dbdae; }
.trw-qr .trw-qr-type input:checked + span { border-color: var(--q-green); background: var(--q-wash); color: var(--q-green-deep); }
.trw-qr .trw-qr-type input:focus-visible + span, .trw-qr .trw-qr-chips input:focus-visible + span { outline: 3px solid var(--q-gold); outline-offset: 2px; }

/* Fields */
.trw-qr fieldset.trw-qr-fields { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 12px 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .trw-qr fieldset.trw-qr-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .trw-qr .trw-qr-field.is-wide, .trw-qr .trw-qr-sub { grid-column: 1 / -1; } }
.trw-qr .trw-qr-sub { display: contents; }
.trw-qr .trw-qr-sub[hidden] { display: none !important; }
.trw-qr .trw-qr-field { min-width: 0; }
.trw-qr .trw-qr-label { display: block; margin: 0 0 6px; font-weight: 700; font-size: 0.95rem; color: var(--q-ink); }
.trw-qr input.trw-qr-input, .trw-qr select.trw-qr-input, .trw-qr textarea.trw-qr-input {
	display: block; width: 100%; min-height: 48px; margin: 0; padding: 10px 12px; border: 2px solid var(--q-line); border-radius: 12px;
	background: #fff; color: var(--q-ink); font: inherit; font-size: 16px; line-height: 1.4; box-shadow: none;
}
.trw-qr textarea.trw-qr-input { min-height: 104px; resize: vertical; }
.trw-qr .trw-qr-input:focus { border-color: var(--q-green); outline: none; box-shadow: 0 0 0 3px rgba(11,122,82,.15); }
.trw-qr .trw-qr-input[aria-invalid="true"] { border-color: var(--q-danger); }
.trw-qr .trw-qr-help { color: var(--q-muted); font-size: 0.86rem; margin-top: 6px; }
.trw-qr .trw-qr-error { color: var(--q-danger); font-size: 0.9rem; font-weight: 600; margin-top: 6px; }
.trw-qr .trw-qr-counter:empty { display: none; }
.trw-qr label.trw-qr-check { display: flex; align-items: center; gap: 10px; margin: 0; min-height: 40px; font-weight: 600; cursor: pointer; }
.trw-qr label.trw-qr-check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--q-green); }

/* Chips */
.trw-qr .trw-qr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.trw-qr .trw-qr-chips label { position: relative; margin: 0; cursor: pointer; }
.trw-qr .trw-qr-chips span {
	display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 2px solid var(--q-line); border-radius: 12px;
	font-weight: 700; font-size: 0.92rem; background: #fff; color: var(--q-ink);
}
.trw-qr .trw-qr-chips input:checked + span { border-color: var(--q-green); background: var(--q-wash); color: var(--q-green-deep); }
.trw-qr .trw-qr-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; }

/* Design */
.trw-qr .trw-qr-design { display: grid; gap: 14px; }
.trw-qr .trw-qr-design .trw-qr-h { margin-bottom: 0; }
.trw-qr .trw-qr-colors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.trw-qr input.trw-qr-color { display: block; width: 100%; height: 48px; padding: 3px; margin: 0; border: 2px solid var(--q-line); border-radius: 12px; background: #fff; cursor: pointer; }
.trw-qr .trw-qr-range { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; }
.trw-qr .trw-qr-range .trw-qr-label { margin: 0; }
.trw-qr .trw-qr-range output { font-weight: 800; color: var(--q-green-deep); font-variant-numeric: tabular-nums; }
.trw-qr .trw-qr-range .trw-qr-help { grid-column: 1 / -1; }
.trw-qr input[type="range"] { grid-column: 1 / -1; width: 100%; height: 32px; margin: 4px 0 0; padding: 0; background: transparent; border: 0; box-shadow: none; -webkit-appearance: none; appearance: none; accent-color: var(--q-green); }
.trw-qr input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: #dbe7e0; }
.trw-qr input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--q-green); border: 4px solid #fff; box-shadow: 0 0 0 1px var(--q-green-deep); }
.trw-qr input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: #dbe7e0; }
.trw-qr input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--q-green); border: 4px solid #fff; box-shadow: 0 0 0 1px var(--q-green-deep); }
.trw-qr .trw-qr-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.trw-qr .trw-qr-logo { display: grid; gap: 12px; position: relative; }
.trw-qr .trw-qr-logo-on { display: flex; align-items: center; gap: 14px; }
.trw-qr .trw-qr-logo-on img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--q-line); border-radius: 10px; background: repeating-conic-gradient(#eef3f0 0 25%, #fff 0 50%) 0 0 / 12px 12px; margin: 0; }

/* Buttons */
.trw-qr .trw-qr-btn, .trw-qr button.trw-qr-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; margin: 0; width: auto;
	border: 2px solid transparent; border-radius: 12px; font-family: var(--q-font); font-size: 1rem; font-weight: 700; line-height: 1.2;
	text-transform: none; letter-spacing: 0; text-decoration: none; text-shadow: none; box-shadow: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.trw-qr button.trw-qr-btn--primary { background: var(--q-green); color: #fff; }
.trw-qr button.trw-qr-btn--primary:hover { background: var(--q-green-deep); color: #fff; }
.trw-qr button.trw-qr-btn--secondary { background: #fff; color: var(--q-green-deep); border-color: var(--q-green); }
.trw-qr button.trw-qr-btn--secondary:hover { background: var(--q-wash); color: var(--q-green-deep); }
.trw-qr button.trw-qr-btn--ghost { background: transparent; color: var(--q-muted); border-color: var(--q-line); }
.trw-qr button.trw-qr-btn--ghost:hover { background: var(--q-wash); color: var(--q-ink); }
.trw-qr button.trw-qr-btn:disabled { opacity: .45; cursor: not-allowed; }
.trw-qr button:focus-visible, .trw-qr a:focus-visible, .trw-qr input:focus-visible, .trw-qr select:focus-visible, .trw-qr summary:focus-visible { outline: 3px solid var(--q-gold); outline-offset: 2px; }
.trw-qr button.trw-qr-link { background: none; border: 0; padding: 6px 2px; margin: 0; min-height: 0; box-shadow: none; text-transform: none; color: var(--q-green-deep); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Preview */
.trw-qr .trw-qr-preview { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; width: 100%; max-width: 340px; margin: 0 auto; border-radius: 12px; background: #f4f8f6; overflow: hidden; }
.trw-qr .trw-qr-placeholder { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; color: var(--q-muted); text-align: center; font-weight: 600; }
.trw-qr .trw-qr-svg { width: 100%; height: 100%; }
.trw-qr .trw-qr-svg svg { display: block; width: 100%; height: 100%; }
.trw-qr .trw-qr-svg.is-transparent { background: repeating-conic-gradient(#e3eae6 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.trw-qr ul.trw-qr-warnings { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.trw-qr ul.trw-qr-warnings:empty { display: none; }
.trw-qr ul.trw-qr-warnings li { margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 0.9rem; line-height: 1.4; }
.trw-qr ul.trw-qr-warnings li.is-danger { background: #fde8e6; color: #7a1712; font-weight: 600; }
.trw-qr ul.trw-qr-warnings li.is-warn { background: var(--q-warn-bg); color: #5a4300; }
.trw-qr ul.trw-qr-warnings li.is-info { background: var(--q-wash); color: var(--q-green-deep); }
.trw-qr .trw-qr-inside { margin-top: 12px; }
.trw-qr .trw-qr-inside summary { cursor: pointer; font-weight: 700; color: var(--q-green-deep); }
.trw-qr .trw-qr-inside pre, .trw-qr pre.trw-qr-decoded {
	margin: 8px 0 6px; padding: 10px 12px; max-height: 180px; overflow: auto; background: #f4f8f6; border: 1px solid var(--q-line); border-radius: 10px;
	font: 0.85rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; color: var(--q-ink);
}
.trw-qr .trw-qr-static { margin-top: 12px; font-size: 0.86rem; color: var(--q-muted); }
.trw-qr .trw-qr-dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.trw-qr .trw-qr-dl .trw-qr-btn { padding-left: 6px; padding-right: 6px; }
.trw-qr .trw-qr-download-card { display: grid; gap: 4px; }
.trw-qr .trw-qr-download-card [data-role="reset"] { margin-top: 12px; justify-self: end; }

/* Scanner */
.trw-qr .trw-qr-scanner .trw-qr-card { max-width: 720px; }
.trw-qr .trw-qr-scan-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.trw-qr .trw-qr-scan-actions .trw-qr-btn { flex: 1 1 200px; }
.trw-qr .trw-qr-cam { position: relative; margin-top: 14px; border-radius: 14px; overflow: hidden; background: #0f1d19; aspect-ratio: 3 / 4; max-height: 70vh; }
@media (min-width: 700px) { .trw-qr .trw-qr-cam { aspect-ratio: 4 / 3; } }
.trw-qr .trw-qr-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.trw-qr .trw-qr-cam-frame { position: absolute; left: 50%; top: 50%; width: 62%; aspect-ratio: 1 / 1; transform: translate(-50%, -50%); border: 3px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.28); pointer-events: none; }
.trw-qr button.trw-qr-cam-stop { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: rgba(255,255,255,.95); color: var(--q-ink); border-color: transparent; }
.trw-qr .trw-qr-scan-msg { margin-top: 12px; font-weight: 600; }
.trw-qr .trw-qr-scan-msg:empty { display: none; }
.trw-qr .trw-qr-scan-msg.is-error { background: #fde8e6; color: #7a1712; padding: 10px 14px; border-radius: 10px; }
.trw-qr .trw-qr-scan-msg.is-ok { color: var(--q-green-deep); }
.trw-qr .trw-qr-result { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--q-line); }
.trw-qr .trw-qr-kind { font-weight: 800; color: var(--q-green-deep); }
.trw-qr dl.trw-qr-parsed { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0; font-size: 0.95rem; }
.trw-qr dl.trw-qr-parsed dt { font-weight: 700; color: var(--q-muted); }
.trw-qr dl.trw-qr-parsed dd { margin: 0; word-break: break-word; }
.trw-qr .trw-qr-result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.trw-qr .trw-qr-warn-box { margin-top: 12px; padding: 10px 12px; background: var(--q-warn-bg); color: #5a4300; border-radius: 10px; font-size: 0.9rem; }

/* Content */
.trw-qr .trw-qr-content { margin-top: 48px; max-width: 760px; }
.trw-qr .trw-qr-content section { margin-bottom: 34px; }
.trw-qr .trw-qr-content h2 { font-family: var(--q-font); font-size: clamp(1.3rem, 1.1rem + 1vw, 1.65rem); line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; color: var(--q-ink); margin: 0 0 12px; }
.trw-qr .trw-qr-content p { margin: 0 0 12px; font-size: 1.02rem; line-height: 1.65; }
.trw-qr .trw-qr-content ol { margin: 0 0 12px; padding-left: 1.4em; }
.trw-qr .trw-qr-content ol li { margin: 0 0 8px; line-height: 1.6; }
.trw-qr .trw-qr-faq details { border-bottom: 1px solid var(--q-line); }
.trw-qr .trw-qr-faq details:first-of-type { border-top: 1px solid var(--q-line); }
.trw-qr .trw-qr-faq summary { cursor: pointer; list-style: none; padding: 14px 32px 14px 0; position: relative; font-weight: 700; font-size: 1.02rem; line-height: 1.4; }
.trw-qr .trw-qr-faq summary::-webkit-details-marker { display: none; }
.trw-qr .trw-qr-faq summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 10px; height: 10px; margin-top: -7px; border-right: 2.5px solid var(--q-green); border-bottom: 2.5px solid var(--q-green); transform: rotate(45deg); transition: transform .15s ease; }
.trw-qr .trw-qr-faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.trw-qr .trw-qr-faq details p { padding: 0 0 14px; margin: 0; color: #2e4740; }
.trw-qr .trw-qr-more ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 620px) { .trw-qr .trw-qr-more ul { grid-template-columns: 1fr 1fr; } }
.trw-qr .trw-qr-more li { margin: 0; padding: 16px 18px; border: 1px solid var(--q-line); border-left: 5px solid var(--q-gold); border-radius: 10px; }
.trw-qr .trw-qr-more a { font-weight: 800; color: var(--q-green-deep); text-decoration: underline; text-underline-offset: 3px; font-size: 1.05rem; }
.trw-qr .trw-qr-more p { margin: 6px 0 0; font-size: 0.95rem; color: var(--q-muted); line-height: 1.5; }

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