/* Application components */
.app { display: grid; grid-template-columns: minmax(0, 1fr); height: 100dvh; background: var(--surface); }
    .main-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100dvh; }

    .app-bar { flex: none; height: 64px; display: flex; align-items: center; gap: 4px; padding-inline: 4px; background: var(--surface); color: var(--on-surface); z-index: 10; }
    .brand { position: relative; flex: none; width: 40px; height: 40px; margin-inline: 4px 8px; border-radius: var(--corner-m); background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; }
    .brand .material-symbols-rounded { font-size: 20px; }
    .live-dot { position: absolute; top: -3px; right: -3px; width: 6px; height: 6px; border-radius: 999px; background: var(--error); }
    .app-bar h1 { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--on-surface); }
    .app-bar .actions { flex: none; display: flex; }

    .stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface-container-lowest); }
    #cameraContainer { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
    #viewCanvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: var(--corner-m); background: var(--surface-container-lowest); object-fit: contain; }
    #gridOverlay { position: absolute; inset: 0; border-radius: var(--corner-m); overflow: hidden; pointer-events: none; }
    #gridOverlay .gv, #gridOverlay .gh { position: absolute; background: rgba(255, 255, 255, 0.25); }
    #gridOverlay .gv { top: 0; bottom: 0; width: 1px; }
    #gridOverlay .gh { left: 0; right: 0; height: 1px; }
    #gridOverlay .gv.a { left: 33.333%; }
    #gridOverlay .gv.b { left: 66.666%; }
    #gridOverlay .gh.a { top: 33.333%; }
    #gridOverlay .gh.b { top: 66.666%; }
    #flashOverlay { position: absolute; inset: 0; border-radius: var(--corner-m); background: #ffffff; opacity: 0; pointer-events: none; transition: opacity var(--fx-fast); }
    .timer-overlay { --timer-progress: 0; position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; pointer-events: none; }
    .timer-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 24px; border-radius: var(--corner-xl); background: var(--inverse-surface); color: var(--inverse-on-surface); box-shadow: var(--elev-3); pointer-events: auto; }
    .timer-count { font-size: 4rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35); }
    #hiddenMap { position: absolute; top: -9999px; left: -9999px; width: 200px; height: 200px; }

    #cameraFallback { position: absolute; inset: 0; z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--surface-container-lowest); }
    #cameraFallback > .material-symbols-rounded { font-size: 48px; color: var(--on-surface-variant); margin-bottom: 8px; }
    #cameraFallback p { margin: 0; max-width: 360px; color: var(--on-surface-variant); }
    .fallback-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }

    .float-toolbar { position: absolute; top: 24px; right: 24px; z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border-radius: 999px; background: var(--surface-container); box-shadow: var(--elev-2); }
    .float-toolbar .divider { width: 24px; height: 1px; background: var(--outline-variant); margin-block: 2px; }
    .float-toolbar.orientation-toolbar { top: 24px; right: auto; left: 24px; flex-direction: row; }

    .dock { position: relative; flex: none; height: calc(64px + env(safe-area-inset-bottom, 0px)); padding: 0 16px env(safe-area-inset-bottom, 0px); background: var(--surface-container); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; z-index: 10; }
    .dock-left { justify-self: start; display: flex; align-items: center; gap: 8px; }
    .dock-right { justify-self: end; display: flex; align-items: center; }

    .fab-capture { position: absolute; left: 50%; bottom: calc(100% + 16px); transform: translateX(-50%); width: 96px; height: 96px; border: 0; border-radius: var(--corner-xl); background: var(--primary-container); color: var(--on-primary-container); box-shadow: var(--elev-3); display: grid; place-items: center; transition: box-shadow var(--fx-fast), background-color var(--fx-fast); }
    .fab-capture .material-symbols-rounded { font-size: 32px; }
    .fab-capture:hover { box-shadow: var(--elev-4); background-color: color-mix(in srgb, var(--on-primary-container) 8%, var(--primary-container)); }
    .fab-capture:active { box-shadow: var(--elev-3); background-color: color-mix(in srgb, var(--on-primary-container) 10%, var(--primary-container)); }
    .fab-capture.timer-cancel { background: var(--error); color: var(--on-error); }

    .icon-btn { position: relative; flex: none; width: 48px; height: 48px; border: 0; border-radius: 999px; background: transparent; color: var(--on-surface-variant); display: inline-grid; place-items: center; transition: background-color var(--fx-fast), color var(--fx-fast); }
    .icon-btn .material-symbols-rounded { font-size: 24px; }
    .icon-btn:hover { background-color: var(--state-hover); }
    .icon-btn:focus-visible { background-color: var(--state-focus); }
    .icon-btn:active { background-color: var(--state-pressed); }
    .icon-btn[aria-pressed="true"] { background: transparent; color: var(--primary); }
    .icon-btn[aria-pressed="true"] .material-symbols-rounded { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
    .icon-btn:not([aria-pressed]) .material-symbols-rounded,
    .brand .material-symbols-rounded,
    .btn .material-symbols-rounded,
    .fab-capture .material-symbols-rounded,
    .chip[aria-checked="true"] .material-symbols-rounded,
    .filled-card .card-icon .material-symbols-rounded,
    .switch-handle .material-symbols-rounded,
    .gallery-empty .material-symbols-rounded,
    .thumb-delete .material-symbols-rounded,
    .snackbar .material-symbols-rounded,
    #cameraFallback > .material-symbols-rounded { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
    .icon-btn[aria-pressed="true"]:hover { background-color: color-mix(in srgb, var(--primary) 8%, transparent); }
    .icon-btn.badged { overflow: visible; }

    .badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--error); color: var(--on-error); font-size: 0.6875rem; line-height: 16px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
    .badge[hidden] { display: none; }
    .timer-label { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 0.625rem; line-height: 18px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; box-shadow: var(--elev-1); }
    .timer-label[hidden] { display: none; }

    .side-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; width: 100%; max-width: 640px; margin-inline: auto; max-height: 90dvh; display: flex; flex-direction: column; background: var(--surface-container-low); color: var(--on-surface); border-radius: var(--corner-xl) var(--corner-xl) 0 0; box-shadow: var(--elev-3); transform: translateY(100%); transition: transform 200ms var(--emph-accel); --sheet-bg: var(--surface-container-low); }
    .side-sheet.open { transform: translateY(0); transition: transform 400ms var(--emph-decel); }

    .drag-handle { flex: none; width: 100%; height: 48px; display: grid; place-items: center; background: transparent; touch-action: none; cursor: grab; }
    .drag-handle::before { content: ''; width: 32px; height: 4px; border-radius: 999px; background: var(--on-surface-variant); opacity: 0.4; }
    .sheet-header { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 16px 12px 24px; background: var(--sheet-bg); }
    .sheet-header h2 { flex: 1; min-width: 0; margin: 0; color: var(--on-surface); }
    .sheet-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px; }
    .sheet-actions { flex: none; padding: 16px 24px calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--sheet-bg); }

    .section { padding-block: 16px; }
    .section + .section { border-top: 1px solid var(--outline-variant); }
    .section-title { margin: 0 0 12px; color: var(--on-surface); font-size: 0.875rem; line-height: 1.25rem; font-weight: 700; letter-spacing: 0.007em; }
    .legal-copy { margin: 0; color: var(--on-surface-variant); }
    .legal-copy + .legal-copy { margin-top: 8px; }
    .legal-copy a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
    .legal-copy a:hover { color: var(--primary); opacity: 0.82; }
    .stack { display: flex; flex-direction: column; gap: 12px; }
    .field-row { display: flex; gap: 12px; align-items: flex-start; }
    .field-row > * { min-width: 0; }
    .field-row .grow { flex: 1; }
    .field-row .w-flag { flex: none; width: 84px; }

    .field { position: relative; }
    .field input, .field textarea { display: block; width: 100%; background: transparent; color: var(--on-surface); border: 1px solid var(--outline); border-radius: var(--corner-xs); padding: 20px 16px 8px; font-size: 1rem; line-height: 1.5rem; letter-spacing: 0.031em; transition: border-color var(--fx-fast); caret-color: var(--primary); }
    .field input { height: 56px; }
    .field textarea { min-height: 56px; padding-top: 24px; resize: none; line-height: 1.25rem; }
    .field input:hover, .field textarea:hover { border-color: var(--on-surface); }
    .field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
    .field label { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); padding: 0 4px; color: var(--on-surface-variant); font-size: 1rem; line-height: 1.5rem; letter-spacing: 0.031em; pointer-events: none; transition: top var(--spatial-fast), font-size var(--fx-fast), color var(--fx-fast); background: var(--sheet-bg); }
    .field textarea + label { top: 16px; transform: none; font-size: 0.75rem; line-height: 1rem; letter-spacing: 0.033em; }
    .field input:focus + label, .field input:not(:placeholder-shown) + label { top: 0; transform: translateY(-50%); font-size: 0.75rem; line-height: 1rem; letter-spacing: 0.033em; }
    .field input:focus + label, .field textarea:focus + label { color: var(--primary); }
    .field input::placeholder, .field textarea::placeholder { color: transparent; }
    .field-hint { margin: -4px 4px 0; color: var(--on-surface-variant); }

    .btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 24px; border: 0; border-radius: 999px; font-size: 0.875rem; line-height: 1.25rem; letter-spacing: 0.007em; font-weight: 500; transition: background-color var(--fx-fast), box-shadow var(--fx-fast), border-radius var(--spatial-fast); white-space: nowrap; }
    .btn .material-symbols-rounded { font-size: 20px; }
    .btn.primary { background: var(--primary); color: var(--on-primary); }
    .btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
    .btn.outlined { background: transparent; color: var(--on-surface-variant); border: 1px solid var(--outline); }
    .btn.text { background: transparent; color: var(--primary); padding: 0 12px; }
    .btn.text.error { color: var(--error); }
    .btn.block { width: 100%; }
    .btn.primary:hover { background-color: color-mix(in srgb, var(--on-primary) 8%, var(--primary)); }
    .btn.tonal:hover { background-color: color-mix(in srgb, var(--on-secondary-container) 8%, var(--secondary-container)); }
    .btn.outlined:hover, .btn.text:hover { background-color: var(--state-hover); }
    .btn:active { border-radius: var(--corner-s); }
    .btn:disabled { cursor: default; opacity: 1; background: color-mix(in srgb, var(--on-surface) 12%, transparent); color: color-mix(in srgb, var(--on-surface) 38%, transparent); border-color: transparent; }
    .btn.outlined:disabled { background: transparent; border-color: color-mix(in srgb, var(--on-surface) 12%, transparent); }
    .btn.text:disabled { background: transparent; }

    .chips { display: flex; flex-wrap: wrap; gap: 8px; }
    .chip { height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--outline); border-radius: var(--corner-s); background: transparent; color: var(--on-surface-variant); font-size: 0.875rem; line-height: 1.25rem; letter-spacing: 0.007em; font-weight: 500; transition: background-color var(--fx-fast), color var(--fx-fast), border-radius var(--spatial-fast), border-color var(--fx-fast); }
    .chip .material-symbols-rounded { display: none; font-size: 18px; }
    .chip { position: relative; }
    .chip::before { content: ''; position: absolute; inset: -8px 0; }
    .chip:hover { background-color: var(--state-hover); }
    .chip:active { border-radius: var(--corner-s); }
    .chip[aria-checked="true"] { background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent; border-radius: 999px; }
    .chip[aria-checked="true"] .material-symbols-rounded { display: inline-block; }

    .count-pill { align-self: center; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--secondary-container); color: var(--on-secondary-container); font-size: 0.75rem; line-height: 24px; letter-spacing: 0.0417em; font-weight: 500; text-align: center; font-variant-numeric: tabular-nums; }

    .group-label { display: block; margin: 0 0 8px; color: var(--on-surface-variant); font-size: 0.75rem; line-height: 1rem; letter-spacing: 0.0417em; font-weight: 500; }

    .filled-card { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--corner-m); background: var(--surface-container-highest); color: var(--on-surface); }
    .filled-card .card-icon { flex: none; width: 40px; height: 40px; border-radius: 999px; background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; }
    .filled-card .card-icon .material-symbols-rounded { font-size: 20px; }
    .filled-card .card-text { flex: 1; min-width: 0; }
    .filled-card .card-text p { margin: 0; }
    .filled-card .card-text .muted { color: var(--on-surface-variant); }

    .switch-row { display: flex; align-items: center; gap: 16px; min-height: 48px; cursor: pointer; user-select: none; }
    .switch-row > span:first-child { flex: 1; color: var(--on-surface); }
    .switch-input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
    .switch { position: relative; flex: none; width: 52px; height: 32px; border-radius: 999px; background: var(--surface-container-highest); border: 2px solid var(--outline); transition: background-color var(--fx-default), border-color var(--fx-default); }
    .switch-handle { position: absolute; top: 50%; left: 6px; width: 16px; height: 16px; border-radius: 999px; background: var(--outline); transform: translateY(-50%); display: grid; place-items: center; color: var(--on-primary); transition: left var(--spatial-fast), width var(--spatial-fast), height var(--spatial-fast), background-color var(--fx-default); }
    .switch-handle .material-symbols-rounded { font-size: 16px; opacity: 0; transition: opacity var(--fx-fast); }
    .switch-input:checked + .switch { background: var(--primary); border-color: var(--primary); }
    .switch-input:checked + .switch .switch-handle { left: 18px; width: 24px; height: 24px; background: var(--on-primary); }
    .switch-input:checked + .switch .switch-handle .material-symbols-rounded { opacity: 1; }
    .switch-input:focus-visible + .switch { outline: 2px solid var(--primary); outline-offset: 2px; }
    .switch-row:active .switch-handle { width: 28px; height: 28px; }
    .switch-row:active .switch-input:not(:checked) + .switch .switch-handle { left: 2px; }
    .switch-row:active .switch-input:checked + .switch .switch-handle { left: 18px; }

    .slider-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
    .slider-head .value { color: var(--on-surface-variant); }
    input[type="range"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; }
    input[type="range"]::-webkit-slider-runnable-track { height: 16px; border-radius: 999px; background: linear-gradient(to right, var(--primary) 0 var(--fill, 88%), var(--surface-container-highest) var(--fill, 88%) 100%); }
    input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 44px; margin-top: -14px; border: 0; border-radius: 999px; background: var(--primary); }
    input[type="range"]::-moz-range-track { height: 16px; border-radius: 999px; background: var(--surface-container-highest); }
    input[type="range"]::-moz-range-progress { height: 16px; border-radius: 999px; background: var(--primary); }
    input[type="range"]::-moz-range-thumb { width: 4px; height: 44px; border: 0; border-radius: 999px; background: var(--primary); }
    input[type="range"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 999px; }

    .scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--fx-default); }
    .scrim.visible { opacity: 0.32; pointer-events: auto; }

    .overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background-color: rgba(0, 0, 0, 0.32); }
    .overlay:not(.hidden) { animation: overlay-in var(--fx-default) both; }
    @keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

    .dialog:focus { outline: none; }
    .dialog { width: 100%; min-width: 280px; max-width: 560px; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: var(--corner-xl); background: var(--surface-container-high); color: var(--on-surface); box-shadow: var(--elev-3); }
    .dialog-head { display: flex; align-items: flex-start; gap: 8px; }
    .dialog-head h3 { flex: 1; min-width: 0; margin: 0; }
    .dialog-head .icon-btn { margin-top: -8px; }
    .dialog-head .icon-btn:last-child { margin-right: -8px; }
    .dialog-body { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
    .dialog-text { margin: 0; color: var(--on-surface-variant); }
    .dialog-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
    .dialog-actions .spacer { flex: 1; }
    .dialog-actions.end { justify-content: flex-end; }

    .preview-frame { display: flex; align-items: center; justify-content: center; min-height: 0; border-radius: var(--corner-m); background: var(--surface-container-lowest); padding: 8px; }
    #imgResult { display: block; max-width: 100%; max-height: 56dvh; object-fit: contain; border-radius: var(--corner-s); }

    #galleryGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow-y: auto; min-height: 0; max-height: 52dvh; padding: 2px; }
    @media (min-width: 480px) { #galleryGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
    .thumb { position: relative; aspect-ratio: 4 / 3; border-radius: var(--corner-m); overflow: hidden; background: var(--surface-container); }
    .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
    .thumb-open { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; background: transparent; }
    .thumb-open:focus-visible { outline: 2px solid var(--primary); outline-offset: -4px; }
    .thumb-delete { position: absolute; top: 4px; right: 4px; width: 48px; height: 48px; border-radius: 999px; border: 0; background: var(--surface-container-highest); color: var(--on-surface); display: grid; place-items: center; box-shadow: var(--elev-1); }
    .thumb-delete .material-symbols-rounded { font-size: 20px; }
    .thumb-delete:hover { background: color-mix(in srgb, var(--on-surface) 8%, var(--surface-container-highest)); }

    .gallery-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px 8px; }
    .gallery-empty .material-symbols-rounded { font-size: 48px; color: var(--on-surface-variant); }
    .gallery-empty p { margin: 0; color: var(--on-surface-variant); }

    .snackbar { position: fixed; left: 50%; bottom: calc(64px + 16px + 96px + 16px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); z-index: 80; display: flex; align-items: center; gap: 12px; min-height: 48px; max-width: min(560px, calc(100vw - 32px)); padding: 8px 16px; border-radius: var(--corner-xs); background: var(--inverse-surface); color: var(--inverse-on-surface); box-shadow: var(--elev-3); opacity: 0; pointer-events: none; transition: opacity var(--fx-default), transform var(--spatial-fast); }
    .snackbar.show { opacity: 1; transform: translate(-50%, 0); }
    .snackbar .material-symbols-rounded { font-size: 24px; color: var(--inverse-primary); }
    .snackbar span { min-width: 0; }


    #hiddenQr { display: none; }
    ::-webkit-scrollbar { width: 8px; height: 8px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 999px; }

    @media (min-width: 641px) {
      .side-sheet { max-width: min(640px, calc(100vw - 112px)); max-height: calc(100dvh - 56px); }
    }

    @media (min-width: 840px) {
      .app { grid-template-columns: minmax(0, 1fr) 360px; }
      .app.sheet-closed { grid-template-columns: minmax(0, 1fr); }
      .app.sheet-closed .side-sheet { display: none; }
      .side-sheet { position: static; height: 100dvh; max-height: none; max-width: 400px; margin: 0; border-radius: 0; border-left: 1px solid var(--outline-variant); box-shadow: none; transform: none; background: var(--surface); --sheet-bg: var(--surface); }
      .drag-handle { display: none; }
      .sheet-header { padding-top: 24px; }
      .sheet-actions .btn.block { width: auto; }
      .main-pane { height: 100dvh; }
    }

    @media (max-height: 600px) {
      .dialog { padding: 16px; gap: 12px; }
      #imgResult { max-height: 44dvh; }
    }

    @media (max-height: 520px) {
      .float-toolbar .toolbar-fullscreen { display: none; }
    }


    .leaflet-control-container { display: none !important; }

/* Design chooser */
.design-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.design-option { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 104px; padding: 8px; border: 1px solid var(--outline-variant); border-radius: var(--corner-m); background: var(--surface-container); color: var(--on-surface); text-align: left; transition: background-color var(--fx-fast), border-color var(--fx-fast), box-shadow var(--fx-fast); }
.design-option:hover { background: var(--surface-container-high); }
.design-option[aria-checked="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.design-text { display: flex; flex-direction: column; gap: 2px; padding: 0 20px 4px 4px; }
.design-text .muted { color: var(--on-surface-variant); }
.design-check { position: absolute; top: 8px; right: 8px; font-size: 18px; color: var(--primary); opacity: 0; transition: opacity var(--fx-fast); }
.design-option[aria-checked="true"] .design-check { opacity: 1; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.design-swatch { display: block; height: 44px; border-radius: var(--corner-s); overflow: hidden; }
.design-swatch-m3 { display: grid; grid-template-columns: 1.4fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px; padding: 4px; background: var(--surface-container-highest); }
.design-swatch-m3 span { display: block; border-radius: 5px; }
.design-swatch-m3 span:nth-child(1) { grid-row: span 2; background: var(--primary-container); }
.design-swatch-m3 span:nth-child(2) { background: var(--secondary-container); }
.design-swatch-m3 span:nth-child(3) { background: var(--surface-bright); }
.design-swatch-glass { position: relative; background: radial-gradient(120% 120% at 18% 10%, rgba(160, 200, 255, 0.85), transparent 55%), radial-gradient(120% 120% at 88% 90%, rgba(255, 170, 222, 0.55), transparent 55%), linear-gradient(150deg, #0d1628, #0a1020); }
.design-swatch-glass span { position: absolute; inset: 6px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.45); background: linear-gradient(150deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.06)); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset; }
[data-design="glass"] .design-option { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.22); }
[data-design="glass"] .design-option:hover { background: rgba(255, 255, 255, 0.11); }
[data-design="glass"] .design-option[aria-checked="true"] { border-color: rgba(190, 215, 255, 0.9); box-shadow: inset 0 0 0 1px rgba(190, 215, 255, 0.7), 0 0 18px rgba(120, 170, 255, 0.18); }

/* Stamp template picker */
.template-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.template-option { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--outline-variant); border-radius: var(--corner-m); background: var(--surface-container); color: var(--on-surface); text-align: left; transition: background-color var(--fx-fast), border-color var(--fx-fast), box-shadow var(--fx-fast); }
.template-option:hover { background: var(--surface-container-high); }
.template-option[aria-checked="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.template-name { font-size: 0.875rem; line-height: 1.25rem; letter-spacing: 0.007em; font-weight: 500; }
.template-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--corner-s); background: linear-gradient(160deg, #334155, #0f172a); overflow: hidden; }
.template-thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), transparent 48%); pointer-events: none; }
.tt-card { position: absolute; left: 9%; right: 9%; bottom: 10%; height: 46%; display: flex; align-items: center; gap: 6%; padding: 5%; border-radius: 5px; background: rgba(15, 23, 42, 0.94); border: 1px solid rgba(255, 255, 255, 0.30); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.tt-map { flex: none; width: 19%; aspect-ratio: 1; border-radius: 3px; background: linear-gradient(145deg, #64748b, #1e293b); }
.tt-lines { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.tt-lines i { display: block; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.78); }
.tt-lines i:nth-child(2) { width: 82%; background: rgba(255, 255, 255, 0.52); }
.tt-lines i:nth-child(3) { width: 58%; background: rgba(255, 255, 255, 0.34); }
.tt-qr { flex: none; width: 17%; aspect-ratio: 1; border-radius: 2px; border: 1px solid rgba(255, 255, 255, 0.55); background: repeating-conic-gradient(#0f172a 0 25%, #e2e8f0 0 50%) 0 0 / 7px 7px; }
.template-thumb-postcard .tt-card { height: 58%; }
.tt-banner { position: absolute; inset: 5% 5% auto; height: 42%; border-radius: 3px; background: linear-gradient(135deg, #64748b, #1e293b); }
.template-thumb-postcard .tt-lines { position: absolute; left: 5%; right: 26%; bottom: 8%; }
.template-thumb-postcard .tt-qr { position: absolute; right: 5%; bottom: 8%; }
.tt-card-top { top: 9%; bottom: auto; }
.template-thumb-strip .tt-strip { position: absolute; left: 6%; right: 6%; bottom: 18%; height: 28%; display: flex; align-items: center; gap: 6%; padding: 0 6%; border-radius: 999px; background: rgba(15, 23, 42, 0.94); border: 1px solid rgba(255, 255, 255, 0.32); }
.tt-pin { flex: none; width: 7%; aspect-ratio: 1; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.28); }
.tt-strip i { flex: 1; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.75); }
.tt-strip-badge { flex: none; width: 17%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.30); }
[data-design="glass"] .template-option { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.22); }
[data-design="glass"] .template-option:hover { background: rgba(255, 255, 255, 0.11); }
[data-design="glass"] .template-option[aria-checked="true"] { border-color: rgba(190, 215, 255, 0.9); box-shadow: inset 0 0 0 1px rgba(190, 215, 255, 0.7), 0 0 18px rgba(120, 170, 255, 0.18); }
[data-design="glass"] .template-thumb { border: 1px solid rgba(255, 255, 255, 0.18); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
