/* GraphicPG per Android · stile (stessi colori e caratteri del sito: tappetino da taglio verde, accento verde vinile).
   Telefono: visore sopra, opzioni sotto. Tablet e orizzontale: due colonne (pannello a lato + visore grande). */
@font-face { font-family: "Bricolage Grotesque"; src: url(../fonts/bricolage.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(../fonts/instrument.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --mat: #123227; --mat-deep: #0c241b; --mat-2: #17402f; --mat-3: #1d4c39;
  --mat-line: rgba(200, 232, 212, .085); --mat-line-2: rgba(200, 232, 212, .17);
  --paper: #eef1e8; --sage: #a9c1b2; --dim: #7f9a8a;
  --vinyl: #1f8a5a; --vinyl-2: #2fa572; --on-vinyl: #effaf3; --ink: #111216;
  --r: 16px; --r-sm: 10px;
  --head: "Bricolage Grotesque", system-ui, sans-serif;
  --sans: "Instrument Sans", system-ui, Roboto, sans-serif;
  --panel-w: 372px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--mat-deep); color: var(--paper); font: 400 15px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* ---------- barra in alto */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 8px 14px; background: var(--mat-deep); border-bottom: 1px solid var(--mat-line-2); min-height: 54px; }
.brand { display: flex; align-items: center; gap: 9px; font: 700 19px/1 var(--head); letter-spacing: -.02em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand.big { font-size: 26px; margin-bottom: 14px; } .brand.big img { width: 44px; height: 44px; border-radius: 11px; }
.bar-r { display: flex; align-items: center; gap: 8px; }
.ibtn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--mat-line-2); background: var(--mat-2); cursor: pointer; font-weight: 600; font-size: 14px; }
.ibtn.round { width: 40px; padding: 0; justify-content: center; }
.ibtn.sm { min-height: 34px; } .ibtn.round.sm { width: 34px; }
.ibtn:active { background: var(--mat-3); }

/* ---------- impaginazione */
.layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage { position: relative; flex: 0 0 41%; min-height: 0; overflow: hidden;
  background-color: var(--mat);
  background-image: linear-gradient(var(--mat-line-2) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line-2) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px; background-position: -1px -1px; }
.app.noimg .stage { flex-basis: 100%; }
.app.noimg .panel { display: none; }
.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--mat-deep); border-top: 1px solid var(--mat-line-2); }

/* tablet in verticale: visore più alto, opzioni su due colonne */
@media (min-width: 600px) and (orientation: portrait) {
  .stage { flex-basis: 56%; }
  .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
  .opts .card { margin: 0 !important; }
  .opts .card.wide { grid-column: 1 / -1; }
}
/* orizzontale (telefono girato) e tablet larghi: due colonne, pannello a sinistra */
@media (orientation: landscape) and (min-width: 560px), (min-width: 900px) {
  .layout { flex-direction: row; }
  .panel { order: -1; flex: 0 0 var(--panel-w); border-top: 0; border-right: 1px solid var(--mat-line-2); }
  .stage { flex: 1 1 auto; }
  .opts { display: block; }
  .opts .card { margin-bottom: 12px !important; }
}
@media (orientation: landscape) and (max-height: 500px) {
  :root { --panel-w: 330px; }
  .bar { min-height: 46px; padding-top: 4px; padding-bottom: 4px; }
  .modes button { padding: 6px 4px; font-size: 11.5px; } .modes svg { width: 18px; height: 18px; }
}
@media (min-width: 1100px) { :root { --panel-w: 400px; } }

/* ---------- visore */
.viewer { position: absolute; inset: 0; touch-action: none; }
.vcanvas { width: 100%; height: 100%; display: block; touch-action: none; }
.vtools { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; align-items: center; justify-content: space-between; pointer-events: none; }
.swatch i { width: 18px; height: 18px; border-radius: 5px; box-shadow: 0 0 0 1.5px var(--sage); background: repeating-conic-gradient(#d9dcd5 0 25%, #f4f5f1 0 50%) 0 0 / 9px 9px; }
.swatch[data-bg=white] i { background: #fff; } .swatch[data-bg=black] i { background: #000; }
.vtools .ibtn { background: rgba(8, 12, 10, .62); border-color: rgba(255, 255, 255, .2); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.vtools > * { pointer-events: auto; }
.vtools-r { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.vhint { position: absolute; left: 0; right: 0; top: 44px; margin: 0 auto; width: max-content; max-width: calc(100% - 24px); text-align: center; font-size: 12px; color: rgba(255, 255, 255, .9); background: rgba(8, 12, 10, .62); padding: 5px 10px; border-radius: 8px; pointer-events: none; transition: opacity .6s; }
.vhint.fade { opacity: 0; }

.empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; }
.empty-in { max-width: 420px; }
.empty-mark { width: 76px; height: 76px; border-radius: 18px; margin: 0 auto 18px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.empty h1 { font: 700 clamp(26px, 6vw, 38px)/1.05 var(--head); letter-spacing: -.025em; margin: 0 0 10px; }
.empty p { color: var(--sage); margin: 0 0 22px; }
.pick-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- pulsanti */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 999px; border: 0; font: 600 16px/1 var(--sans); cursor: pointer; white-space: nowrap; transition: transform .12s, background-color .15s, opacity .15s; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .38; pointer-events: none; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-vinyl { background: var(--vinyl); color: var(--on-vinyl); } .btn-vinyl:active { background: var(--vinyl-2); }
.btn-paper { background: var(--paper); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--mat-line-2); }
.btn.icon-only { width: 50px; padding: 0; }
.btn.grow { flex: 1; min-width: 0; }
.btn span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- modalità */
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px 12px 4px; }
.modes button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 58px; padding: 8px 4px; border-radius: 14px; border: 0; background: transparent; color: var(--dim); font-size: 12.5px; font-weight: 600; cursor: pointer; line-height: 1.1; text-align: center; }
.modes button[aria-selected="true"] { background: var(--mat-2); color: var(--paper); box-shadow: inset 0 0 0 1px var(--mat-line-2); }
.modes button[aria-selected="true"] svg { color: var(--vinyl); }
.modes svg { width: 22px; height: 22px; }

/* ---------- opzioni */
.opts { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 16px 16px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.card { background: var(--mat); border: 1px solid var(--mat-line-2); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.card h3 { margin: 0 0 9px; font: 600 14px/1.2 var(--sans); color: var(--paper); }
.hint { font-size: 12.5px; color: var(--dim); margin: 8px 0 0; line-height: 1.35; }
.seg { display: flex; background: var(--mat-deep); border-radius: 999px; padding: 3px; gap: 2px; box-shadow: inset 0 0 0 1px var(--mat-line-2); }
.seg button { flex: 1; min-height: 36px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--sage); font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.seg button:disabled { opacity: .35; }
/* confronto sul visore: controllo a segmenti come sul sito, l'indicatore scorre sotto il modo scelto (--ix/--iw da app.js) */
.seg-sm { position: relative; isolation: isolate; border-radius: 11px; gap: 0; background: rgba(8, 12, 10, .62); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .2), 0 6px 18px rgba(0, 0, 0, .3); }
.seg-sm::before { content: ""; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 0; width: var(--iw, 0); border-radius: 8px; transform: translateX(var(--ix, 0)); background: rgba(238, 241, 232, .18); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .16); transition: transform .3s cubic-bezier(.2, .7, .1, 1), width .3s cubic-bezier(.2, .7, .1, 1); }
.seg-sm button { min-height: 32px; font-size: 12.5px; padding: 0 11px; flex: none; border-radius: 8px; color: rgba(238, 241, 232, .7); transition: color .2s; }
.seg-sm button[aria-pressed="true"] { background: transparent; color: #fff; }
/* con un'immagine aperta il fondo è scuro e neutro (niente griglia chiara attorno alla foto) */
.app:not(.noimg) .stage { background: #0a0f0c; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.row + .row { border-top: 1px solid var(--mat-line); }
.row label { flex: 1; }
.sw { position: relative; width: 46px; height: 28px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sw i { position: absolute; inset: 0; border-radius: 999px; background: var(--mat-deep); box-shadow: inset 0 0 0 1.5px var(--mat-line-2); transition: background .15s; pointer-events: none; }
.sw i::after { content: ""; position: absolute; left: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--sage); transition: transform .15s, background .15s; }
.sw input:checked + i { background: var(--vinyl); box-shadow: none; }
.sw input:checked + i::after { transform: translateX(18px); background: var(--on-vinyl); }
.slider { display: flex; align-items: center; gap: 12px; }
.slider input { flex: 1; }
.slider output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; color: var(--paper); font-weight: 600; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 30px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--vinyl) var(--p, 50%), var(--mat-line-2) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -10px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 6px rgba(0,0,0,.4); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--mat-2); box-shadow: inset 0 0 0 1px var(--mat-line-2); font-size: 20px; font-weight: 600; cursor: pointer; }
.stepper b { min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; }
.num { width: 110px; min-height: 38px; border-radius: 10px; border: 1px solid var(--mat-line-2); background: var(--mat-deep); color: var(--paper); padding: 0 10px; font: 600 15px var(--sans); }
.target { margin: 10px 2px 0; color: var(--paper); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips button { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 0; background: var(--mat-deep); box-shadow: inset 0 0 0 1px var(--mat-line-2); color: var(--sage); font-weight: 600; font-size: 13px; }
.chips button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: none; }

/* ---------- azioni */
.actions { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--mat-line-2); background: var(--mat-deep); }
.act-row { display: flex; gap: 8px; }
.result { margin: 0 0 8px; font-size: 13px; color: var(--sage); font-variant-numeric: tabular-nums; text-align: center; }
.result b { color: var(--paper); }

/* ---------- lavoro in corso */
.busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(12, 36, 27, .55); backdrop-filter: blur(2px); padding: 20px; }
.busy-card { width: min(360px, 100%); background: var(--mat-deep); border: 1px solid var(--mat-line-2); border-radius: var(--r); padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.busy-t { font-weight: 600; margin-bottom: 12px; }
.pbar { height: 6px; border-radius: 6px; background: var(--mat-2); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--vinyl); border-radius: 6px; transition: width .25s; }
.pbar.indet i { width: 35% !important; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.busy-r { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--sage); font-variant-numeric: tabular-nums; }

/* ---------- avvisi e schede */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--paper); color: var(--ink); padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); z-index: 50; text-align: center; }
.sheet { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0,0,0,.5); padding: 16px; }
.sheet-card { width: min(460px, 100%); max-height: 90vh; overflow: auto; background: var(--mat-deep); border: 1px solid var(--mat-line-2); border-radius: 20px; padding: 22px; }
.sheet-card p { margin: 0 0 12px; } .dim { color: var(--sage); } .small { font-size: 12.5px; }
.sheet-card .btn { width: 100%; margin-top: 8px; }
.lic-card h2 { font: 700 24px/1.1 var(--head); margin: 0 0 6px; }
.lic-item { border-top: 1px solid var(--mat-line-2); padding: 10px 0; }
.lic-item b { display: block; } .lic-item .dim { font-size: 13px; }
.lic-item .links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.lic-item a { color: var(--vinyl-2); font-size: 13.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.hint.warn { color: var(--vinyl-2); }
.lic-url { display: block; font-size: 12px; word-break: break-all; }
.lic-note { font-size: 12.5px; color: var(--sage); margin: 6px 0 0; }
.lic-text { white-space: pre; font: 9.5px/1.4 ui-monospace, monospace; background: #081a13; border-radius: 10px; padding: 10px; max-height: 45vh; overflow: auto; user-select: text; }
/* Ingrandisci: modello in 2 colonne, regolazioni, anteprima live */
.seg.seg-col { display: grid; grid-template-columns: 1fr 1fr; border-radius: 16px; }
.seg.seg-col button { border-radius: 13px; white-space: normal; line-height: 1.15; padding: 6px 8px; font-size: 13px; }
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.card-h h3 { margin: 0; }
.card .reset { border: 0; background: none; color: var(--vinyl-2); font: 600 12.5px var(--sans); padding: 6px 2px; cursor: pointer; }
.card .reset:disabled { color: var(--dim); opacity: .6; }
.adj { padding: 6px 0 4px; border-top: 1px solid var(--mat-line); }
.adj:first-of-type { border-top: 0; }
.adj-h { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.adj .hint { margin-top: 2px; }
.live-card .row { min-height: 34px; }
.live-card #live-msg:empty { display: none; }

/* ---------- Coda (più immagini insieme, Pro) */
.empty .multi { margin-top: 12px; }
.pro-note { font-size: 12.5px; color: var(--vinyl-2); margin: 8px 0 0; }
.queue { margin: 0 12px 6px; background: var(--mat); border: 1px solid var(--mat-line-2); border-radius: var(--r); padding: 10px 12px; flex: none; }
.q-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.q-head b { font: 700 10.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--paper); }
.q-head #q-count { color: var(--dim); font-variant-numeric: tabular-nums; }
.q-sp { flex: 1; }
.q-link { border: 0; background: none; color: var(--vinyl-2); font: 600 13px var(--sans); padding: 6px 2px; cursor: pointer; }
.q-link.dim { color: var(--dim); }
.q-list { max-height: min(132px, 17vh); overflow-y: auto; margin: 6px -4px 0; overscroll-behavior: contain; }
.q-item { display: flex; align-items: center; gap: 10px; padding: 3px 4px; border-radius: 10px; cursor: pointer; }
.q-item.sel { background: var(--mat-2); box-shadow: inset 0 0 0 1px var(--vinyl); }
.q-item img, .q-item .ph { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; flex: none; background: var(--mat-deep); }
.q-txt { flex: 1; min-width: 0; }
.q-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-st { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-st i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); margin-right: 5px; vertical-align: 1px; }
.q-st.running i { background: var(--vinyl-2); } .q-st.done i { background: #6fd39a; } .q-st.failed i { background: #ff6b6b; } .q-st.failed { color: #ff9b9b; }
.q-mini { height: 3px; border-radius: 3px; background: var(--mat-deep); margin-top: 4px; overflow: hidden; } .q-mini i { display: block; height: 100%; background: var(--vinyl-2); }
.q-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--dim); font-size: 18px; cursor: pointer; flex: none; }
.q-x:disabled { opacity: .25; }
.q-foot { margin-top: 8px; }
.q-foot .pbar { margin-bottom: 6px; }
.q-line { margin: 0 0 6px; font-size: 12px; line-height: 1.3; color: var(--sage); font-variant-numeric: tabular-nums; }
.q-line:empty { display: none; }
.q-head b { cursor: pointer; } .q-head .chev { color: var(--dim); font-size: 11px; cursor: pointer; }
.queue.min .q-list, .queue.min .q-line, .queue.min .pro-note { display: none; }
.queue.min .q-foot { margin-top: 6px; }
/* coda + opzioni scorrono insieme: i pulsanti in basso restano sempre visibili */
.pscroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pscroll .opts { flex: none; min-height: auto; overflow: visible; }

/* ---------- 1.0.1: flusso semplice (immagine → modalità → un pulsante → risultato), il resto nelle avanzate */
.main { padding-top: 4px; }
.field { padding: 10px 0 2px; }
.field + .field { border-top: 1px solid var(--mat-line); margin-top: 8px; }
.flabel { font: 600 13.5px/1.2 var(--sans); color: var(--sage); margin: 0 0 8px 2px; }
.field .hint { margin: 8px 2px 0; }
.seg-lg { padding: 4px; }
.seg-lg button { min-height: 48px; font-size: 15px; padding: 0 6px; }
.adv { margin-top: 8px; border-top: 1px solid var(--mat-line-2); }
.adv-h { display: flex; width: 100%; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 2px; border: 0; background: none; color: var(--paper); font: 600 15px var(--sans); cursor: pointer; }
.adv-h svg { color: var(--sage); transition: transform .2s; }
.adv.open .adv-h svg { transform: rotate(180deg); }
.adv-b:empty { display: none; }
.adv-b { padding-top: 2px; }
.adv-b .card h3 { font-size: 13.5px; }
/* pulsanti in basso: uno solo principale alla volta */
.btn-run { flex: 1; min-width: 0; background: var(--vinyl); color: var(--on-vinyl); } .btn-run:active { background: var(--vinyl-2); }
.btn-save { display: none; background: var(--paper); color: var(--ink); }
.actions.has-res .btn-save { display: inline-flex; }
.actions:not(.has-res) #btn-share { display: none; }
.actions.fresh .btn-run { flex: 0 0 auto; background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--mat-line-2); padding: 0 16px; }
.actions.fresh .btn-save { flex: 1; min-width: 0; background: var(--vinyl); color: var(--on-vinyl); }
.actions.fresh .btn-run svg { display: none; }
.app.working .modes, .app.working .opts { opacity: .45; pointer-events: none; }
.busy-r #busy-pc { font-size: 13.5px; }
.ibtn { min-height: 48px; } .ibtn.round { width: 48px; }
.empty .btn.sm.multi { min-height: 48px; padding: 0 18px; }
/* tablet e orizzontale: il visore ha già lo spazio, le opzioni restano in colonna */
@media (min-width: 600px) and (orientation: portrait) {
  .opts .main, .opts .adv { grid-column: 1 / -1; }
  .adv-b { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
  .adv-b .card { margin: 0 !important; } .adv-b .card.wide { grid-column: 1 / -1; }
}
@media (orientation: landscape) and (min-width: 560px), (min-width: 900px) {
  .adv-b { display: block; }
  .adv-b .card { margin-bottom: 12px !important; }
}

/* ---------- licenza: schermata del codice (copre l'app finché la licenza non è valida) */
body.gated .app { visibility: hidden; }
.gate { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; background: var(--mat-deep);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.gate input { user-select: text; -webkit-user-select: text; }
.g-art { position: relative; flex: none; padding: 26px 22px 22px; border-bottom: 1px solid var(--mat-line-2);
  background-color: var(--mat);
  background-image: linear-gradient(var(--mat-line-2) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line-2) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px), linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px; background-position: -1px -1px; }
.g-brand { display: flex; align-items: center; gap: 12px; font: 700 28px/1 var(--head); letter-spacing: -.025em; }
.g-brand img { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.g-tag { margin: 12px 0 0; color: var(--sage); max-width: 34ch; }
.g-ver { margin: 8px 0 0; color: var(--dim); font-size: 12px; }
.g-test { color: #f4c07a; font-weight: 700; }
.g-main { flex: 1 0 auto; display: flex; justify-content: center; padding: 22px 18px 28px; }
.g-col { position: relative; width: 100%; max-width: 480px; }
.g-x { position: absolute; top: -6px; right: 0; }
.g-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 18px; border-radius: 14px; background: rgba(244, 192, 122, .1); border: 1px solid rgba(244, 192, 122, .35); color: #f6dcb4; font-size: 14px; }
.g-banner svg { color: #f4c07a; margin-top: 1px; }
.g-banner.small { margin: 4px 0 12px; font-size: 13px; }
.g-form h1 { font: 700 clamp(26px, 7vw, 34px)/1.05 var(--head); letter-spacing: -.025em; margin: 0 0 8px; padding-right: 54px; }
.g-lead { color: var(--sage); margin: 0 0 18px; }
.g-lab { display: block; font: 700 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--sage); margin: 0 0 8px; }
.g-field { width: 100%; min-height: 58px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--mat-line-2); background: var(--mat-2); color: var(--paper);
  font: 600 17px/1 var(--sans); outline: none; transition: border-color .15s, background-color .15s; }
.g-field.code { font: 600 clamp(16px, 4.6vw, 20px)/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; text-transform: uppercase; }
.g-field::placeholder { color: var(--dim); opacity: .7; letter-spacing: .04em; }
.g-field:focus { border-color: var(--vinyl-2); background: var(--mat-3); }
.g-field[aria-invalid] { border-color: #e8907c; }
.g-err { color: #ffb4a3; font-size: 14px; margin: 10px 0 0; }
.g-go { width: 100%; margin-top: 14px; min-height: 54px; font-size: 17px; }
.g-spin { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: gspin .8s linear infinite; }
.busy .g-spin { display: inline-block; }
@keyframes gspin { to { transform: rotate(360deg); } }
.g-help { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.g-link { border: 0; background: none; padding: 6px 0; color: var(--vinyl-2); font: 600 14.5px var(--sans); text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; }
.g-note { display: flex; gap: 8px; align-items: flex-start; color: var(--dim); font-size: 13px; }
.g-note svg { width: 16px; height: 16px; margin-top: 1px; }
.g-devs { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--mat); border: 1px solid var(--mat-line-2); font-size: 14px; }
.g-devs p { margin: 0 0 8px; } .g-devs .g-small { color: var(--sage); font-size: 13px; margin: 8px 0 0; }
.g-devs ul { list-style: none; margin: 0; padding: 0; }
.g-devs li { display: flex; flex-direction: column; padding: 7px 0; border-top: 1px solid var(--mat-line-2); }
.g-devs li span { color: var(--sage); font-size: 12.5px; }
.g-alt { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--mat-line-2); }
.g-alt h2 { font: 700 13px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--sage); margin: 0 0 12px; }
.g-opts { display: grid; gap: 10px; }
.g-opt { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--mat-line-2); background: var(--mat); color: var(--paper); cursor: pointer; font: inherit; }
.g-opt:active { background: var(--mat-2); }
.g-opt.trial { border-color: rgba(47, 165, 114, .55); background: linear-gradient(180deg, rgba(31, 138, 90, .18), rgba(31, 138, 90, .06)); }
.g-opt:disabled { opacity: .55; cursor: default; }
.g-oi { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--mat-2); color: var(--vinyl-2); }
.g-oi svg { width: 24px; height: 24px; stroke-width: 1.8; }
.g-ot { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.g-ot b { font-size: 16px; } .g-ot span { color: var(--sage); font-size: 13.5px; line-height: 1.35; }
.g-out { color: var(--dim); } .g-out svg { width: 18px; height: 18px; }
.g-back { margin: -6px 0 10px; text-decoration: none; }
.g-back svg { width: 16px; height: 16px; }
/* tablet e orizzontale: marchio a sinistra, codice a destra (come Groma) */
@media (min-width: 700px) {
  .g-opts { grid-template-columns: 1fr 1fr; } .g-opts.one { grid-template-columns: 1fr; }
}
@media (orientation: landscape) and (min-width: 700px), (min-width: 900px) {
  .gate { flex-direction: row; overflow: hidden; }
  .g-art { flex: 0 0 40%; max-width: 520px; border-bottom: 0; border-right: 1px solid var(--mat-line-2); display: flex; flex-direction: column; justify-content: center; padding: 40px; }
  .g-brand { font-size: 40px; } .g-brand img { width: 68px; height: 68px; border-radius: 16px; }
  .g-tag { font-size: 17px; }
  .g-ver { position: absolute; left: 40px; bottom: 28px; }
  .g-main { overflow-y: auto; align-items: flex-start; padding: 48px 40px; }
  .g-col { margin: auto 0; max-width: 540px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .g-art { padding: 20px; } .g-brand { font-size: 26px; } .g-brand img { width: 44px; height: 44px; }
  .g-main { padding: 20px 24px; }
}

/* ---------- licenza: pulsante in alto e pannello */
.lic-chip.trial { width: auto; padding: 0 14px; gap: 7px; font-size: 13.5px; color: var(--on-vinyl); background: var(--vinyl); border-color: transparent; }
.lic-chip.trial svg { width: 18px; height: 18px; }
.lic-chip.warn { box-shadow: 0 0 0 2px #f4c07a; }
.a-card { width: min(480px, 100%); }
.a-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.a-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--mat-2); color: var(--vinyl-2); flex: none; }
.a-k { margin: 0 !important; font: 700 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--sage); }
.a-head h2 { margin: 4px 0 0; font: 700 26px/1.05 var(--head); letter-spacing: -.02em; }
.a-sub { color: var(--paper); }
.a-rows { margin: 4px 0 12px; border-top: 1px solid var(--mat-line-2); }
.a-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--mat-line-2); font-size: 14px; }
.a-rows dt { color: var(--sage); } .a-rows dd { margin: 0; text-align: right; font-weight: 600; word-break: break-word; }
.a-actions { margin-top: 10px; }
.a-actions .btn svg { width: 16px; height: 16px; }
.a-mail { margin: 10px 0 2px !important; }
.a-confirm { margin-top: 8px; padding: 12px 14px; border-radius: 14px; background: rgba(232, 144, 124, .08); border: 1px solid rgba(232, 144, 124, .35); }
.a-confirm p { font-size: 14px; }
.a-confirm .act-row { display: flex; gap: 8px; } .a-confirm .btn { margin-top: 0; }
.btn-danger { background: #c9563f; color: #fff6f2; } .btn-danger:active { background: #b44a35; }
.btn-danger.busy .t { opacity: .7; }
/* telefono stretto con un'immagine aperta: 4 pulsanti in alto (Cambia, Più immagini, Licenza, Info) → solo icone, senza nome */
@media (max-width: 440px) {
  .app:not(.noimg) .brand span { display: none; }
  .bar #btn-change { width: 48px; padding: 0; justify-content: center; } .bar #btn-change span { display: none; }
  .bar-r { gap: 6px; }
}

/* Telefono e tablet: il vetro sfocato (backdrop-filter) sopra il visore va ricalcolato a ogni fotogramma mentre
   l'immagine si muove ed è la causa principale degli scatti nella WebView. Stesso aspetto con un fondo pieno. */
.vtools .ibtn, .seg-sm { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(8, 12, 10, .8); }
.busy { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(12, 36, 27, .72); }
