/* QR tab and badge style editor. Every canvas also gets its display size inline from JavaScript, so a missing or
   stale copy of this file cannot make a badge spill over the screen. Phones first; wider rules start at 760 px. */

.qr-tab { min-width: 0; }
.qr-tab canvas { max-width: 100%; }
@media (max-width: 759.98px) { .qr-tab > .lead { font-size: var(--fs-s); line-height: 1.4; } }

/* Top actions: a tidy 2 x 2 block on phones, one row on desktop */
.qr-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qr-actions .btn { min-width: 0; min-height: 42px; padding: 0 0.6em; white-space: nowrap; }
.qr-actions .btn > svg { flex: none; }
@media (min-width: 760px) {
  .qr-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
  .qr-actions .btn { min-height: 44px; padding: 0 1.1em; font-size: var(--fs-s); }
}

/* Phones: two columns of badge thumbnails, a tap opens the badge */
.qr-thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.thumb { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 8px; min-width: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.thumb:active { transform: scale(0.98); }
.thumb:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.thumb-pic { background: var(--paper-2); border-radius: 10px; overflow: hidden; }
/* The label sits under the picture: on top of it, it covered a corner of the code. */
.thumb-pic { order: 0; }
.thumb-tag { order: 1; align-self: flex-start; font-size: 0.6875rem; }
.thumb-title { order: 2; }
.thumb-title { font-size: 0.8125rem; font-weight: 650; line-height: 1.25; min-height: 2.5em; overflow-wrap: anywhere; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* The badge sheet */
.qr-sheet { display: grid; gap: 0.8rem; min-width: 0; }
.qr-sheet-tag { margin: 0; }
.qr-png { display: flex; gap: 0.5rem; }
.qr-png .btn { flex: 1 1 0; min-width: 0; }

/* Desktop cards */
.qr-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1000px) { .qr-grid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.qr-item { display: flex; flex-direction: column; gap: 0.7rem; padding: 1rem; min-width: 0; }
.qr-item h3 { font-size: 1rem; overflow-wrap: anywhere; }
.qr-canvas { background: var(--paper-2); border-radius: var(--radius); padding: 0.6rem; }
.shortlink { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.shortlink code { font-family: var(--mono); font-size: var(--fs-xs); background: var(--paper-2); padding: 0.45em 0.6em; border-radius: 6px; overflow-wrap: anywhere; flex: 1 1 10rem; min-width: 0; }
.code-box { font-family: var(--mono); font-size: var(--fs-xs); background: var(--ink); color: var(--paper); padding: 0.9rem 1rem; border-radius: var(--radius); overflow-wrap: anywhere; white-space: pre-wrap; margin: 0.6rem 0; }

/* Style editor */
.qs-grid { display: grid; gap: 1.5rem; }
.qs-main, .qs-side { min-width: 0; }
@media (min-width: 900px) { .qs-grid { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; } .qs-side { position: sticky; top: 140px; } }
.qs-group { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.qs-group legend { padding: 0; margin-bottom: 4px; font-size: 0.78rem; font-weight: 700; color: var(--ink-2); }

/* Preview switch: "Badge" / "Auf der Folie" and the three slide sizes */
.qs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1.5px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg-b { min-height: 36px; padding: 0 0.7em; border: 0; background: transparent; color: var(--ink-2); font: 650 0.8125rem/1 var(--font); cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.seg-b + .seg-b { border-left: 1.5px solid var(--line-2); }
.seg-b.is-on { background: var(--ink); color: var(--paper); }
.qs-hint { width: 100%; margin: 0.1rem 0 0; }
.qs-bar .switch-row { width: 100%; margin: 0; min-height: 40px; padding: 0.2rem 0; }

/* Tiles: one row per group; on phones it scrolls sideways */
.tile-row { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 4px 1.2rem 14px 4px; margin: -4px -1.2rem -14px -4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tile-row::-webkit-scrollbar { display: none; }
.tile-row > * { flex: 0 0 72px; scroll-snap-align: start; }
@media (min-width: 760px) {
  .tile-row { flex-wrap: wrap; overflow: visible; margin: 0; padding: 4px 4px 14px; }
  .tile-row > * { flex-basis: 88px; }
}
.tile, .swatch { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; min-width: 0; padding: 6px 4px 12px; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 12px; color: var(--ink); cursor: pointer; font: inherit; -webkit-tap-highlight-color: transparent; }
.tile.is-active, .swatch.is-active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--mark); }
.tile:active, .swatch:active { transform: scale(0.96); }
.tile-svg { display: block; height: 44px; width: auto; max-width: 100%; }
.tile-label { font-size: 0.72rem; font-weight: 650; color: var(--ink-2); text-align: center; line-height: 1.15; overflow-wrap: normal; word-break: keep-all; }
.swatch-dot { width: 36px; height: 36px; margin: 4px 0; border-radius: 50%; border: 2px solid; display: inline-flex; align-items: center; justify-content: center; }
.swatch-dot > span { width: 14px; height: 14px; border-radius: 4px; display: block; }
.tile-logo { width: 36px; height: 36px; margin: 4px 0; display: inline-flex; align-items: center; justify-content: center; }
.tile-logo svg { width: 32px; height: 32px; }
.tile-initials { font-weight: 850; font-size: 1rem; letter-spacing: -0.02em; background: #fff; border: 1.5px solid var(--line-2); border-radius: 10px; }
.tile-none { color: var(--ink-3); border: 1.5px dashed var(--line-2); border-radius: 10px; }
@media (min-width: 760px) { .tile-svg { height: 56px; } .tile-label { font-size: 0.75rem; } }

/* Caption field with counter and a calm warning */
.qs-cap { position: relative; }
.qs-cap .input { padding-right: 3.6rem; }
.qs-count { position: absolute; right: 0.85rem; top: 50%; transform: translateY(-50%); font-size: 0.75rem; font-weight: 650; color: var(--ink-3); pointer-events: none; font-variant-numeric: tabular-nums; }
.qs-count.is-near { color: var(--ink); }
.qs-group .hint { margin: 0.3rem 0 0.4rem; }
.qs-warn { margin: 0 0 0.5rem; padding: 0.5rem 0.7rem; border-radius: 10px; background: var(--mark-soft); border: 1.5px solid var(--mark); font-size: 0.8125rem; line-height: 1.35; }
.qs-initials { margin: 0.6rem 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { min-height: 36px; padding: 0 0.85rem; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--card); font: 650 var(--fs-xs)/1 var(--font); color: var(--ink); cursor: pointer; transition: transform 0.14s var(--ease), background-color 0.15s; -webkit-tap-highlight-color: transparent; }
.chip:active { transform: scale(0.96); }
.chip.is-active { background: var(--mark); border-color: var(--ink); }
.qs-controls .switch-row { margin-bottom: 0; min-height: 44px; padding: 0.25rem 0; }

/* Previews */
.qs-preview { line-height: 0; min-width: 0; }
.qs-big { background: var(--paper-2); padding: 0.7rem; border-radius: var(--radius); }
.qs-slide { background: var(--paper-2); padding: 0.5rem; border-radius: var(--radius); }
.qs-pin { position: sticky; top: 0; z-index: 3; background: var(--paper); padding: 2px 1.2rem 6px; margin: 0 -1.2rem 8px; border-bottom: 1px solid var(--line); }
.qs-pin .qs-bar { flex-wrap: nowrap; margin-bottom: 6px; }
.qs-pin .seg-b { padding: 0 0.6em; font-size: 0.78rem; }
.qs-pinned { display: block; }
.qs-main > p.hint { margin-bottom: 0.9rem; }

/* Premium locks: the option stays visible with a small tag and a lock */
.tile, .swatch { position: relative; }
.tile.is-locked, .swatch.is-locked { background: var(--paper-2); }
.tile.is-locked > :not(.tile-lock):not(.tile-prem), .swatch.is-locked > :not(.tile-lock):not(.tile-prem) { opacity: 0.55; }
.tile-lock { position: absolute; top: 4px; right: 4px; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--paper); }
.tile-lock svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile-prem { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); line-height: 0; white-space: nowrap; }
.tile .tile-prem .ptag, .swatch .tile-prem .ptag { font-size: 0.56rem; line-height: 1.2; padding: 2px 5px; gap: 0; }
.tile .tile-prem .ptag svg, .swatch .tile-prem .ptag svg { display: none; }
.btn.is-locked { gap: 0.4em; }
.qs-logo-help { margin-top: 0.6rem; }
.qs-logo-help a { color: var(--ink); font-weight: 700; }
.tile-own img { display: block; }
