@charset "UTF-8";
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
}

/* Font, palette e forme dal progetto locale Novel Academy. */
:root {
  color-scheme: light;
  --ink: #222;
  --blue: #0683ff;
  --link: #006dcc;
  --muted: #666970;
  --border: #e2e3e6;
  --soft: #f5f5f7;
  --radius: 28px;
  font-family: "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.65; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; transition: background .18s, border-color .18s, box-shadow .18s; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
input[type=radio]:focus-visible + span, .switch-row input:focus-visible + .switch {
  outline: 3px solid var(--blue); outline-offset: 4px;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 9px; font-size: 13px; font-weight: 600; }
label { font-size: 13px; font-weight: 500; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap; }

.site-header {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  width: min(1300px, calc(100% - 80px)); min-height: 72px; padding: 10px 32px;
  color: #f5f5f7; background: #222226; border: 1px solid #ffffff30; border-radius: 999px;
  box-shadow: 0 12px 36px #00000026, inset 0 1px 0 #ffffff35, inset 0 -1px 0 #ffffff0d;
}
@supports (backdrop-filter: blur(24px)) {
  .site-header { background: linear-gradient(135deg, #ffffff12, #ffffff03 48%, #ffffff08), rgba(20,20,24,.86); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%); }
}
.brand { display: flex; flex: 0 0 88px; }
.brand img { display: block; width: 88px; height: auto; }
.header-caption { font-size: 14px; letter-spacing: -.025em; color: #e8e8ed; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: transparent; border: 0; font-size: 12px; padding: 8px 0; }
.text-button:hover { color: var(--link); }
.site-header .text-button { color: #e8e8ed; padding: 8px 14px; min-height: 44px; font-size: 14px; border-radius: 999px; }
.site-header .text-button:hover { color: #fff; background: #ffffff14; }
.help-icon { border: 1px solid currentColor; border-radius: 50%; width: 18px; height: 18px; line-height: 17px; font-size: 11px; }
main { width: min(1300px, calc(100% - 80px)); margin: auto; padding-top: 104px; }
.intro { padding: 64px 0 44px; text-align: center; }
.eyebrow { font-size: 16px; font-weight: 600; letter-spacing: -.035em; margin-bottom: 20px; }
h1 { font-size: clamp(36px, 4.6vw, 64px); font-weight: 600; line-height: 1.07; letter-spacing: -.06em; text-wrap: balance; }
h1 span { color: #777981; }
.intro p { color: var(--muted); margin: 22px auto 0; font-size: 17px; line-height: 1.65; text-wrap: balance; }
.privacy-badge { display: inline-flex; gap: 8px; align-items: center; margin-top: 24px; font-size: 12px; color: var(--muted); }
.privacy-badge svg { width: 19px; height: 19px; color: var(--link); }
.privacy-badge span { display: flex; align-items: center; gap: 9px; }
.privacy-badge small { font-size: 12px; font-weight: 400; }

.workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start; }
.controls { background: rgba(34, 34, 34, 0.05); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.control-section { padding: 24px; border-bottom: 1px solid var(--border); }
h2 { font-size: 15px; letter-spacing: -.025em; font-weight: 600; }
.control-section h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.step { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--link); background: #eaf4ff; width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.drop-zone { width: 100%; border: 1px dashed #b7c7d8; border-radius: 18px; background: #f8fafc; display: flex; align-items: center; flex-direction: column; padding: 20px 10px; gap: 3px; }
.drop-zone:hover, .drop-zone.dragging { background: #eaf4ff; border-color: var(--blue); }
.upload-icon { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-bottom: 7px; border: 1px solid #c9dff5; background: #eaf4ff; border-radius: 10px; font-size: 25px; line-height: 1; color: var(--link); }
.upload-icon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; }
.upload-icon path { animation: upload-arrow 2.8s ease-in-out infinite; }
@keyframes upload-arrow {
  0%, 20%, 60%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .upload-icon path { animation: none; }
}
.drop-zone strong { font-size: 14px; font-weight: 600; }
.drop-zone > span:not(.upload-icon) { font-size: 12px; color: var(--muted); }
.drop-zone small { font-size: 11px; color: var(--muted); margin-top: 7px; }
.demo-button { font-size: 11px; padding: 13px 0 0; width: 100%; background: transparent; border: 0; text-align: left; color: var(--link); }
.demo-button span { float: right; }
.demo-button:hover { text-decoration: underline; }
.file-info { display: flex; align-items: center; gap: 9px; background: var(--soft); padding: 12px; margin-top: 12px; border-radius: 12px; min-width: 0; }
.file-info > div { min-width: 0; flex: 1; }
.file-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.file-info small { display: block; font-size: 11px; color: var(--muted); }
.file-thumb { font-size: 22px; }
.icon-button { border: 0; background: transparent; font-size: 24px; font-weight: 400; line-height: 1; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; }
.icon-button:hover { background: #e8e8ed; }
.dimensions-row { display: grid; grid-template-columns: 1fr 22px 1fr; gap: 8px; align-items: end; }
.dimensions-row label { min-width: 0; }
.unit-input { border: 1px solid #d8dade; border-radius: 11px; display: flex; align-items: center; background: #fff; margin-top: 7px; }
.unit-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px #0683ff20; }
.unit-input input { width: 100%; min-width: 0; padding: 10px 0 10px 12px; border: 0; background: transparent; color: var(--ink); font-size: 16px; font-weight: 500; outline: none; appearance: textfield; -moz-appearance: textfield; }
.unit-input input::-webkit-inner-spin-button { appearance: none; }
.unit-input span { font-size: 12px; font-weight: 400; color: var(--muted); padding: 0 10px 0 4px; }
.swap-button { height: 44px; font-size: 21px; background: none; border: 0; color: var(--muted); padding: 0; }
.swap-button:hover { color: var(--link); }
.presets { display: flex; gap: 6px; margin: 10px 0 22px; }
.presets button { font-size: 10px; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 6px; flex: 1; white-space: nowrap; color: var(--muted); }
.presets button:hover, .presets .selected { background: #eaf4ff; border-color: #b8d9ff; color: var(--link); }
.segmented { display: flex; background: var(--soft); border-radius: 12px; padding: 4px; gap: 3px; }
.segmented label { flex: 1; position: relative; }
.segmented input, .swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { padding: 8px 5px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; cursor: pointer; border: 1px solid transparent; border-radius: 9px; color: var(--muted); }
.segmented svg { width: 15px; height: 15px; }
.segmented input:checked + span { background: #fff; border-color: var(--border); color: var(--ink); box-shadow: 0 2px 5px #00000008; }
.hint { font-size: 11px; color: var(--muted); line-height: 1.6; margin-top: 9px; }
.crop-control { margin-top: 16px; }
.crop-control > label { display: flex; justify-content: space-between; font-size: 12px; }
.crop-control small { font-size: 11px; color: var(--muted); }
.inline-button { font-size: 12px; border: 0; background: transparent; padding: 0; color: var(--link); text-decoration: underline; }
.grid-size-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid-size-row .unit-input { width: 96px; margin: 0; }
.grid-size-row input { padding: 8px 0 8px 12px; }
.style-row { display: flex; gap: 15px; justify-content: space-between; align-items: center; margin: 20px 0; }
.color-field legend { font-size: 12px; margin-bottom: 11px; }
.swatches { display: flex; gap: 10px; }
.swatches label { position: relative; cursor: pointer; }
.swatch { height: 26px; width: 26px; display: block; border-radius: 50%; border: 1px solid #d8dade; position: relative; }
.swatch.white { background: #fff; }
.swatch.black { background: #202724; }
.swatch.terra { background: #b34d34; }
.swatches input:checked + .swatch { outline: 2px solid var(--blue); outline-offset: 3px; }
.swatches input:checked + .swatch:after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 13px; }
.swatches input:checked + .white:after { color: var(--link); }
.weight-label { display: block; font-size: 12px; }
.weight-label select { margin-top: 7px; width: 111px; }
select { border: 1px solid #d8dade; border-radius: 10px; background-color: #fff; padding: 8px; color: var(--ink); font-size: 12px; max-width: 100%; cursor: pointer; }
.range-label { display: flex; justify-content: space-between; font-size: 12px; }
.range-label output { font-size: 12px; color: var(--muted); font-weight: 400; }
input[type=range] { width: 100%; height: 20px; margin: 10px 0 4px; accent-color: var(--blue); cursor: pointer; }
.switch-row { display: flex; position: relative; align-items: center; gap: 12px; margin-top: 18px; font-size: 13px; cursor: pointer; }
.switch-row > span:first-child { flex: 1; }
.switch-row small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); margin-top: 3px; }
.switch-row input { position: absolute; right: 0; opacity: 0; width: 38px; height: 26px; cursor: pointer; }
.switch { width: 36px; height: 22px; border-radius: 999px; background: #d8dade; transition: background .15s; pointer-events: none; }
.switch:after { content: ''; display: block; background: #fff; width: 16px; height: 16px; border-radius: 50%; margin: 3px; transition: transform .15s; }
.switch-row input:checked + .switch { background: var(--blue); }
.switch-row input:checked + .switch:after { transform: translateX(14px); }
.check-row { display: flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 18px; cursor: pointer; }
.check-row input { margin: 0; accent-color: var(--blue); width: 15px; height: 15px; }
.reset-row { padding: 12px 24px; background: #fafafa; }
.reset-row .text-button { font-size: 11px; color: var(--muted); }
.reset-row .text-button:hover { color: var(--link); }

.preview-panel { min-width: 0; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 66px; padding: 12px 22px; background: #fff; border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.preview-title { display: flex; gap: 9px; align-items: center; }
.preview-title h2 { font-size: 14px; }
.status-dot { width: 6px; height: 6px; background: var(--blue); border-radius: 50%; }
.demo-tag { font-size: 9px; font-weight: 500; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 3px 8px; }
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 999px; background: var(--soft); padding: 3px; gap: 2px; }
.view-toggle button { font-size: 11px; background: none; border: 0; border-radius: 999px; color: var(--muted); padding: 6px 12px; }
.view-toggle .active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px #00000014; }
.preview-stage { position: relative; display: flex; align-items: center; justify-content: center; height: 690px; min-height: 300px; overflow: hidden; background: #eeeff2; border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); padding: 42px 44px 34px; }
.canvas-wrap { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.canvas-frame { position: relative; box-shadow: 0 5px 12px #00000014, 0 22px 42px #00000010; line-height: 0; background: #fff; max-width: 100%; max-height: 100%; }
canvas { display: block; width: 100%; height: 100%; }
.dimension-top, .dimension-side { position: absolute; z-index: 1; font-size: 11px; color: var(--muted); white-space: nowrap; }
.dimension-top { top: 0; left: 50%; transform: translate(-50%, -25px); }
.dimension-top:before, .dimension-top:after { content: '—'; padding: 0 10px; color: #a1a1a6; }
.dimension-side { left: 100%; top: 50%; transform: translate(15px,-50%); writing-mode: vertical-rl; }
.loading { position: absolute; inset: 0; background: #eeeff2ee; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 18px; }
.empty-state { text-align: center; max-width: 320px; }
.empty-state > span { font-size: 50px; color: #a1a1a6; }
.empty-state h3 { font-size: 24px; line-height: 1.2; letter-spacing: -.04em; font-weight: 600; margin: 12px 0; }
.empty-state p { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.preview-caption { display: flex; justify-content: space-between; gap: 8px; padding: 14px 4px 20px; font-size: 11px; color: var(--muted); }
.live-indicator { font-size: 10px; white-space: nowrap; }
.live-indicator span { display: inline-block; width: 5px; height: 5px; background: var(--blue); border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.notice { padding: 14px 16px; margin-bottom: 14px; border: 1px solid #c9dff5; background: #eaf4ff; border-radius: 14px; color: #193b69; font-size: 12px; line-height: 1.6; }
.notice.error { color: #933f32; background: #fff0ed; border-color: #e5c5ba; }
.export-panel { display: grid; grid-template-columns: 1fr auto; gap: 20px 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; align-items: center; }
.export-description h2 { font-size: 23px; line-height: 1.15; font-weight: 600; letter-spacing: -.04em; }
.export-description p { font-size: 12px; color: var(--muted); margin-top: 9px; max-width: 255px; }
.export-controls { display: flex; gap: 10px; align-items: end; }
.export-controls > label { font-size: 11px; color: var(--muted); font-weight: 400; }
.export-controls select { display: block; margin-top: 5px; padding: 11px 8px; font-size: 11px; max-width: 145px; }
.primary-button { display: inline-flex; gap: 9px; align-items: center; justify-content: center; background: var(--blue); color: #fff; border: 1px solid transparent; border-radius: 999px; padding: 12px 20px; font-size: 13px; font-weight: 500; white-space: nowrap; min-height: 44px; }
.primary-button:hover { background: #0073e6; }
.primary-button svg { width: 17px; height: 17px; }
.export-size { grid-column: 1 / -1; text-align: right; font-size: 10px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; }
.atelier-tip { display: flex; align-items: flex-start; gap: 13px; margin: 24px 4px 0; max-width: 600px; }
.tip-symbol { font-size: 26px; color: var(--link); line-height: 1.3; }
.atelier-tip p { font-size: 12px; color: var(--muted); line-height: 1.65; }
.atelier-tip strong { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
footer { display: flex; justify-content: space-between; gap: 16px; padding: 28px 0; margin-top: 44px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.footer-divider { margin: 0 12px; color: #a1a1a6; }
dialog { padding: 36px; border: 1px solid var(--border); border-radius: var(--radius); max-width: 560px; width: calc(100% - 32px); max-height: 85vh; overflow: auto; background: #fff; color: var(--ink); box-shadow: 0 20px 100px #00000026; }
dialog::backdrop { background: #14141899; backdrop-filter: blur(6px); }
.dialog-close { position: absolute; right: 14px; top: 13px; }
dialog .eyebrow { font-size: 12px; margin-right: 15px; }
dialog h2 { font-size: 32px; line-height: 1.1; letter-spacing: -.05em; font-weight: 600; margin: 12px 0 26px; }
dialog ol { padding-left: 21px; font-size: 14px; }
dialog li { padding-left: 5px; margin-bottom: 20px; }
dialog li p { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.7; }
.dialog-note { font-size: 12px; line-height: 1.7; color: #193b69; background: #eaf4ff; padding: 16px; border-radius: 14px; margin: 20px 0; }
dialog .primary-button { width: 100%; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50; background: #222226; color: #fff; border: 1px solid #ffffff30; border-radius: 18px; padding: 14px 22px; box-shadow: 0 8px 28px #00000026; font-size: 13px; width: max-content; max-width: calc(100% - 32px); }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 320px minmax(0,1fr); gap: 22px; }
  .control-section { padding: 22px; }
  .export-panel { grid-template-columns: 1fr; }
  .export-description p { max-width: none; }
  .export-controls { justify-content: space-between; }
  .export-size { text-align: left; }
  .preview-stage { height: 650px; }
}
@media (max-width: 900px) {
  main { width: calc(100% - 40px); }
  .site-header { width: calc(100% - 40px); padding-inline: 24px; }
  .workspace { grid-template-columns: 300px minmax(0,1fr); gap: 18px; }
  .control-section { padding: 20px; }
  .preview-toolbar { padding: 12px 14px; }
  .preview-title { gap: 7px; }
  .demo-tag { font-size: 8px; padding-inline: 5px; }
  .view-toggle button { padding-inline: 8px; }
  .preview-stage { height: 520px; padding: 40px 34px 30px; }
  .preview-caption { flex-direction: column; }
  .live-indicator { display: none; }
  .export-panel { padding: 22px; }
  .export-controls { flex-wrap: wrap; }
  .export-controls > label, .export-controls .primary-button { width: 100%; }
  .export-controls select { width: 100%; max-width: none; }
}
@media (max-width: 700px) {
  main { width: calc(100% - 32px); padding-top: 96px; }
  .site-header { top: 12px; width: calc(100% - 24px); min-height: 68px; padding: 10px 20px; gap: 10px; }
  .header-caption { display: none; }
  .site-header .text-button { font-size: 12px; padding-inline: 10px; }
  .intro { padding: 40px 6px 32px; }
  .eyebrow { font-size: 14px; margin-bottom: 18px; }
  h1 { font-size: clamp(32px, 7.7vw, 48px); }
  .intro p { font-size: 15px; margin-top: 20px; max-width: 360px; }
  .privacy-badge { margin-top: 20px; font-size: 11px; text-align: left; }
  .privacy-badge span { display: block; }
  .privacy-badge small { display: block; font-size: 11px; }
  .workspace { display: flex; flex-direction: column; gap: 24px; }
  .controls, .preview-panel { width: 100%; }
  .control-section { padding: 24px; }
  .drop-zone { padding: 20px 12px; }
  .dimensions-row { grid-template-columns: 1fr 28px 1fr; }
  .presets button { font-size: 11px; }
  .preview-toolbar { padding: 14px 18px; }
  .view-toggle button { padding-inline: 12px; }
  .demo-tag { font-size: 9px; padding-inline: 6px; }
  .preview-stage { height: 500px; padding: 40px 34px 30px; }
  .export-description h2 { font-size: 25px; }
  .export-controls { flex-wrap: nowrap; align-items: end; }
  .export-controls > label { min-width: 0; flex: 1; }
  .export-controls .primary-button { width: auto; font-size: 12px; padding-inline: 16px; }
  .export-controls select { font-size: 10px; }
  .export-size { line-height: 1.7; }
  footer { flex-direction: column; gap: 8px; margin-top: 32px; padding: 24px 4px; font-size: 10px; }
  dialog { padding: 32px 24px; }
}
@media (max-width: 360px) {
  .control-section { padding: 20px; }
  .export-controls { flex-wrap: wrap; }
  .export-controls .primary-button { width: 100%; }
  .preview-toolbar { padding-inline: 12px; }
  .preview-title { gap: 5px; }
  .view-toggle button { padding-inline: 8px; }
  .preview-stage { height: 440px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media (prefers-reduced-transparency: reduce) { .site-header { background: #222226; backdrop-filter: none; -webkit-backdrop-filter: none; } }

/* Percorso a passaggi, progettato per l'uso dal telefono. */
body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
main { max-width: 1000px; }
.intro { padding: 34px 0 24px; }
.intro .eyebrow { font-size: 13px; margin-bottom: 16px; }
h1 { font-size: clamp(32px, 3.6vw, 46px); }
#wizard-heading:focus { outline: none; }
.intro p { font-size: 15px; margin-top: 16px; }
.privacy-badge { margin-top: 16px; }
body:not([data-wizard-step="1"]) .intro .eyebrow,
body:not([data-wizard-step="1"]) .privacy-badge { display: none; }
.wizard-progress { max-width: 460px; margin: 0 auto 28px; }
.wizard-progress ol { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); list-style: none; padding: 0; margin: 0; }
.wizard-progress li { position: relative; }
.wizard-progress li:not(:last-child)::after { content: ''; position: absolute; top: 16px; left: calc(50% + 23px); right: calc(-50% + 23px); height: 1px; background: #d8dade; }
.wizard-progress li:has(.completed)::after { background: #83bdff; }
.wizard-progress button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; width: 100%; border: 0; padding: 0 3px; background: none; color: var(--muted); font-size: 11px; }
.wizard-progress button:disabled { opacity: 1; color: #767981; cursor: default; }
.progress-icon { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #d8dade; border-radius: 50%; background: var(--soft); font-size: 12px; font-weight: 500; }
.wizard-progress button[aria-current="step"] { color: var(--link); font-weight: 600; }
.wizard-progress [aria-current="step"] .progress-icon { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 0 0 4px #0683ff12; }
.wizard-progress .completed .progress-icon { color: var(--link); background: #eaf4ff; border-color: #b8d9ff; }
.workspace { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 24px; }
.control-section { border-bottom: 0; padding: 26px; }
.control-section h2 { font-size: 17px; line-height: 1.3; }
.control-section h2 .step { display: none; }
.drop-zone { min-height: 180px; }
.unit-input input, select { font-size: 16px; }
select { min-height: 44px; }
.segmented span { min-height: 44px; }
.presets button { min-height: 38px; }
.demo-button { min-height: 44px; padding-block: 12px 0; }
.swatch { height: 30px; width: 30px; }
.swatches { gap: 14px; }
.switch { width: 42px; height: 26px; }
.switch:after { width: 20px; height: 20px; }
.switch-row input { width: 44px; height: 44px; }
.switch-row input:checked + .switch:after { transform: translateX(16px); }
.switch-row, .check-row { min-height: 44px; }
.advanced-options { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 6px; font-size: 12px; color: var(--muted); }
.advanced-options summary { min-height: 44px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; }
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options summary:after { content: '+'; font-size: 20px; }
.advanced-options[open] summary:after { content: '−'; }
.advanced-options > div { padding-top: 8px; }
.reset-row { border-top: 1px solid var(--border); }
.reset-row .text-button { min-height: 32px; }
body:not([data-wizard-step="5"]) .preview-stage { height: 380px; }
body:not([data-wizard-step="5"]) .preview-caption { display: none; }
body[data-wizard-step="1"] .dimension-top,
body[data-wizard-step="1"] .dimension-side,
body[data-wizard-step="1"] .view-toggle,
body[data-wizard-step="2"] .view-toggle { display: none; }
body[data-wizard-step="1"] .preview-stage { padding: 24px; }
.preview-toolbar { min-height: 58px; }
.preview-toolbar .view-toggle button { min-height: 34px; }
body[data-wizard-step="5"] .workspace { display: block; max-width: 640px; margin-inline: auto; }
body[data-wizard-step="5"] .preview-stage { height: 440px; }
body[data-wizard-step="5"] .export-panel { grid-template-columns: 1fr; padding: 20px; gap: 12px; border-radius: 22px; }
.export-description { display: none; }
.export-controls, .export-controls > label { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 18px; font-size: 13px; color: var(--ink); }
.export-controls select { max-width: none; width: auto; margin: 0; font-size: 13px; }
.export-size { text-align: left; font-size: 11px; }
.wizard-navigation { position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; background: #ffffffed; border-top: 1px solid var(--border); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding-bottom: env(safe-area-inset-bottom); }
.wizard-navigation-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; max-width: 1000px; margin: auto; padding: 14px 28px; }
.back-button { display: inline-flex; align-items: center; gap: 8px; justify-self: start; grid-column: 1; min-height: 48px; padding: 8px 4px; font-size: 14px; background: none; border: 0; color: var(--muted); }
.back-button:hover { color: var(--link); }
.wizard-counter { grid-column: 2; color: var(--muted); font-size: 12px; }
.wizard-navigation .primary-button { grid-column: 3; justify-self: end; min-height: 48px; min-width: 140px; font-size: 14px; gap: 12px; }
.wizard-navigation button:disabled { cursor: default; }
body[data-wizard-step="1"] .wizard-counter { grid-column: 1; justify-self: start; }
#error { max-width: 640px; margin: 0 auto 18px; }
footer { font-size: 10px; margin-top: 26px; padding: 22px 0; }
.toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (max-width: 700px) {
  main { padding-top: 92px; }
  .intro { padding: 22px 4px 20px; }
  .intro .eyebrow { font-size: 12px; margin-bottom: 12px; }
  h1 { font-size: clamp(30px, 8vw, 36px); }
  .intro p { font-size: 13px; line-height: 1.55; margin-top: 12px; max-width: 300px; }
  .privacy-badge { margin-top: 12px; }
  .privacy-badge span { display: flex; flex-wrap: wrap; gap: 0 7px; }
  .privacy-badge, .privacy-badge small { font-size: 10px; }
  .wizard-progress { margin-bottom: 22px; max-width: 400px; }
  .wizard-progress button { font-size: 11px; }
  .workspace { display: flex; gap: 18px; }
  .controls { border-radius: 22px; }
  .control-section { padding: 22px; }
  .control-section h2 { font-size: 17px; margin-bottom: 16px; }
  .drop-zone { min-height: 148px; padding: 18px 12px; }
  .drop-zone strong { font-size: 16px; }
  .unit-input input { font-size: 18px; min-height: 48px; }
  .preview-toolbar { padding: 10px 18px; border-radius: 22px 22px 0 0; min-height: 52px; }
  .preview-title h2 { font-size: 12px; }
  .preview-stage { border-radius: 0 0 22px 22px; }
  body:not([data-wizard-step="5"]) .preview-stage { height: 240px; min-height: 200px; padding: 32px 32px 24px; }
  body[data-wizard-step="1"] .preview-stage { height: 210px; padding: 16px; }
  body[data-wizard-step="5"] .preview-stage { height: clamp(300px, 45dvh, 440px); }
  body[data-wizard-step="5"] .preview-panel { width: 100%; }
  .preview-caption { font-size: 10px; padding-bottom: 16px; }
  .style-row { margin: 16px 0; }
  .weight-label select { font-size: 16px; }
  .grid-size-row .unit-input { width: 106px; }
  .switch-row { margin-top: 12px; }
  .advanced-options { margin-top: 12px; }
  .reset-row { padding: 8px 22px; }
  .dimension-top, .dimension-side { font-size: 10px; }
  .dimension-top { transform: translate(-50%,-22px); }
  .export-controls > label { font-size: 13px; }
  .export-controls select { font-size: 16px; width: 190px; max-width: 68%; padding-inline: 8px; }
  .export-size { font-size: 10px; }
  .atelier-tip { margin-top: 20px; }
  .atelier-tip p { font-size: 11px; }
  .wizard-navigation-inner { padding: 12px 18px; gap: 8px; }
  .wizard-navigation .primary-button { min-width: 132px; padding-inline: 18px; }
  .wizard-counter { font-size: 11px; }
  .back-button { font-size: 13px; }
  footer { text-align: center; align-items: center; margin-top: 20px; font-size: 9px; gap: 4px; }
  footer > span:first-child { display: none; }
}
@media (max-width: 360px) {
  .control-section { padding: 18px; }
  .wizard-navigation-inner { padding-inline: 14px; }
  .wizard-navigation .primary-button { min-width: 118px; padding-inline: 14px; font-size: 13px; }
}

/* L'istruzione è il titolo del passaggio. */
body[data-wizard-step="1"] .preview-panel { display: none; }
body[data-wizard-step="1"] main {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 96px - env(safe-area-inset-bottom));
}
body[data-wizard-step="1"] .wizard-progress { width: 100%; }
body[data-wizard-step="1"] .workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
}
body[data-wizard-step="1"] .controls,
body[data-wizard-step="1"] .upload-section {
  display: flex;
  flex-direction: column;
  flex: 1;
}
body[data-wizard-step="1"] .drop-zone {
  flex: 1;
  min-height: 220px;
  justify-content: center;
  gap: 8px;
  background: #eaf4ff;
  border-color: var(--blue);
}
body[data-wizard-step="1"] .upload-icon { width: 42px; height: 42px; font-size: 30px; margin-bottom: 10px; }
body[data-wizard-step="1"].has-uploaded-image .controls,
body[data-wizard-step="1"].has-uploaded-image .upload-section { flex: 0 0 auto; }
body[data-wizard-step="1"].has-uploaded-image .file-info { margin-top: 0; }
.intro { padding: 30px 0 24px; }
#wizard-heading { max-width: 650px; margin-inline: auto; font-size: clamp(26px, 3vw, 34px); line-height: 1.2; letter-spacing: -.04em; }
@media (max-width: 700px) {
  .intro { padding: 24px 6px 22px; }
  #wizard-heading { font-size: 26px; line-height: 1.2; }
}

/* Formato e inquadratura sono due passaggi distinti. */
body[data-wizard-step="2"] .preview-panel { display: none; }
body[data-wizard-step="2"] .workspace { display: block; max-width: 460px; margin-inline: auto; }
.presets-title { font-size: 13px; font-weight: 500; margin-top: 24px; }
body[data-wizard-step="2"] .presets { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 0; }
body[data-wizard-step="2"] .presets button { min-height: 48px; font-size: 14px; border-radius: 12px; }
body[data-wizard-step="3"] .view-toggle { display: none; }
body[data-wizard-step="3"] .preview-stage { height: 440px; }
.fit-section legend { display: none; }
.fit-section .segmented span { min-height: 50px; font-size: 14px; }
.fit-section .hint { font-size: 12px; margin-top: 12px; }
.can-drag canvas { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.is-dragging canvas { cursor: grabbing; }
.canvas-frame:has(canvas:focus-visible) { outline: 3px solid var(--blue); outline-offset: 5px; }
#crop-control { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 14px 4px 4px; }
#crop-direction { max-width: 340px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.center-crop-button { min-height: 44px; flex-shrink: 0; padding: 8px 12px; border: 1px solid var(--border); background: #fff; border-radius: 999px; color: var(--link); font-size: 12px; }
.center-crop-button:hover { background: #eaf4ff; }
.center-crop-button:disabled { cursor: default; }
.wizard-progress { max-width: 520px; width: 100%; }
@media (max-width: 700px) {
  .wizard-progress { max-width: 440px; }
  .wizard-progress button { font-size: 10px; }
  body[data-wizard-step="3"] .workspace { gap: 16px; }
  body[data-wizard-step="3"] .fit-section { padding: 20px; }
  body[data-wizard-step="3"] .fit-section h2 { display: none; }
  body[data-wizard-step="3"] .preview-stage { height: clamp(280px, 42dvh, 440px); }
  #crop-control { align-items: flex-start; gap: 10px; }
  #crop-direction { font-size: 11px; }
  .center-crop-button { font-size: 11px; padding-inline: 10px; }
}

/* Passaggi neutri e comando di scambio ben visibile. */
.wizard-progress button[aria-current="step"] { color: #3e4046; }
.wizard-progress [aria-current="step"] .progress-icon { color: #fff; background: #62656d; border-color: #62656d; box-shadow: 0 0 0 4px #62656d14; }
.wizard-progress .completed .progress-icon { color: #55585f; background: #e8e9ec; border-color: #caced4; }
.wizard-progress li:has(.completed)::after { background: #b6b9c1; }
.wizard-progress button:focus-visible { outline-color: #62656d; }
.dimensions-row { grid-template-columns: minmax(0,1fr) 46px minmax(0,1fr); gap: 10px; }
.swap-button { display: grid; place-items: center; width: 46px; height: 50px; margin-bottom: 0; color: #3e4046; background: #eceef1; border: 1px solid #caced4; border-radius: 12px; box-shadow: 0 2px 4px #00000006; }
.swap-button svg { width: 24px; height: 24px; stroke-width: 1.8; }
.swap-button:hover { color: #222; background: #dfe2e7; border-color: #b4b8c1; }
.swap-button:active { background: #d3d7de; }

/* Editor diretto: il riquadro evidenziato è l'area che verrà esportata. */
body[data-wizard-step="3"] .workspace { display: block; max-width: 640px; margin-inline: auto; }
body[data-wizard-step="3"] .preview-stage { padding: 0; height: 460px; background: #43464c; }
body[data-wizard-step="3"] .canvas-frame { box-shadow: none; background: transparent; }
body[data-wizard-step="3"] .dimension-top,
body[data-wizard-step="3"] .dimension-side { display: none; }
body[data-wizard-step="3"] .canvas-frame:has(canvas:focus-visible) { outline-offset: -4px; }
.crop-format { color: var(--muted); font-size: 12px; white-space: nowrap; }
#crop-control { display: grid; grid-template-columns: 1fr auto; gap: 14px 12px; padding: 18px 4px 4px; align-items: center; }
#crop-direction { grid-column: 1 / -1; max-width: none; }
.zoom-controls { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; }
.zoom-controls input[type=range] { flex: 1; width: 0; margin: 0; height: 44px; }
.zoom-button { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--ink); font-size: 25px; line-height: 1; }
.zoom-button:hover { background: #eaf4ff; border-color: #b8d9ff; }
.zoom-button:disabled { cursor: default; }
#zoom-value { flex: 0 0 45px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#center-crop { grid-column: 2; }
@media (max-width: 700px) {
  body[data-wizard-step="3"] .preview-stage { height: clamp(300px, 44dvh, 460px); }
  .crop-format { font-size: 11px; }
  .zoom-controls { gap: 10px; }
  #crop-direction { font-size: 12px; }
}
@media (max-width: 700px) {
  body[data-wizard-step="3"] .preview-stage { height: clamp(240px, 34dvh, 400px); }
}

/* Griglia automatica, con opzioni visibili solo in modalità personalizzata. */
.default-grid-toggle { margin: 0; align-items: flex-start; gap: 18px; }
.default-grid-toggle strong { display: block; font-size: 16px; line-height: 1.3; font-weight: 600; letter-spacing: -.025em; }
.default-grid-toggle small { font-size: 12px; line-height: 1.6; margin-top: 9px; max-width: 280px; }
.default-grid-toggle .switch { margin-top: 2px; flex-shrink: 0; }
.default-grid-toggle input { top: -7px; }
.default-grid-summary { margin-top: 18px; padding: 12px 14px; border: 1px solid var(--border); background: var(--soft); border-radius: 12px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.custom-grid-options { border-top: 1px solid var(--border); margin-top: 22px; padding-top: 20px; }
.custom-grid-options > legend { float: left; width: 100%; font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.custom-grid-options > legend + * { clear: both; }
@media (max-width: 700px) {
  .default-grid-toggle strong { font-size: 16px; }
  .default-grid-toggle small { font-size: 12px; }
}

/* Le misure dell'opera hanno una card dedicata. */
.dimensions-card { padding: 18px; border: 1px solid #c9dff5; border-radius: 18px; background: #eaf4ff; }
.dimensions-card label { color: #193b69; font-weight: 600; }
.dimensions-card .unit-input { background: #fff; border-color: #bfcee0; }
@media (max-width: 700px) {
  .dimensions-card { padding: 14px; }
  .dimensions-card .dimensions-row { gap: 8px; }
}
.default-grid-toggle { align-items: center; min-height: 32px; }
.default-grid-toggle .switch { margin-top: 0; }
.default-grid-toggle input { top: -6px; }

/* Più spazio al riferimento con griglia. */
body[data-wizard-step="4"] .preview-stage,
body[data-wizard-step="5"] .preview-stage { height: 650px; }
@media (max-width: 700px) {
  body[data-wizard-step="4"] .preview-stage,
  body[data-wizard-step="5"] .preview-stage { height: clamp(360px, 55dvh, 620px); padding: 32px 32px 24px; }
}
@media (max-width: 700px) {
  .control-section { padding: 10px 22px; }
}
@media (max-width: 700px) {
  body[data-wizard-step="1"] .upload-section { padding: 10px; }
}

/* L'inquadratura si regola direttamente sulla foto. */
body[data-wizard-step="3"] .preview-toolbar { background: transparent; border: 0; border-radius: 0; min-height: 24px; padding: 0 4px 8px; justify-content: center; }
body[data-wizard-step="3"] .preview-title { display: none; }
body[data-wizard-step="3"] .preview-stage { height: 600px; background: transparent; border: 0; border-radius: 0; }
#crop-control { display: flex; justify-content: flex-end; padding: 10px 4px 0; }
@media (max-width: 700px) {
  body[data-wizard-step="3"] .preview-stage { height: clamp(360px, 56dvh, 600px); }
}

/* La progressione abbraccia le icone dei passaggi raggiunti. */
.wizard-progress { position: relative; }
.wizard-progress ol { position: relative; z-index: 1; }
.wizard-progress li::after { display: none; }
.progress-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.wizard-progress-bar { position: absolute; z-index: 0; top: -4px; left: calc(10% - 21px); width: 42px; height: 42px; margin: 0; border: 1px solid #caced4; border-radius: 999px; background: #e8e9ec; overflow: hidden; pointer-events: none; transition: width .65s cubic-bezier(.22, 1, .36, 1); }
.wizard-progress-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 15%, rgba(98, 101, 109, .09) 50%, transparent 85%); transform: translateX(-100%); animation: progress-flow 6s ease-in-out infinite; }
@keyframes progress-flow {
  0%, 12% { transform: translateX(-100%); }
  65%, 100% { transform: translateX(100%); }
}
body[data-wizard-step="5"] .wizard-progress-bar::after { animation: none; opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .wizard-progress-bar::after { animation: none; }
}
.wizard-progress .completed .progress-icon { background: transparent; border-color: transparent; }
.wizard-progress [aria-current="step"] .progress-icon { box-shadow: none; }

/* Misure utili per riportare la griglia centrata sul foglio. */
#crop-format { text-align: center; margin: 0 0 10px; }
.grid-margins { margin: 0 4px 16px; padding-left: 12px; border-left: 2px solid var(--blue); font-size: 12px; line-height: 1.6; }
.grid-margins strong { display: block; font-size: 13px; font-weight: 600; }
.grid-margins p { margin: 4px 0 0; color: var(--muted); }
body[data-wizard-step="4"] .preview-stage,
body[data-wizard-step="5"] .preview-stage { background: transparent; border: 0; border-radius: 0; }

.margin-toggle-row { margin: 16px 0 0; padding-top: 16px; border-top: 1px solid #a7c9ee; }
.margin-toggle-row strong { font-size: 16px; font-weight: 600; }
.grid-summary { text-align: center; margin: 8px 4px 14px; font-size: 12px; color: var(--muted); }
.grid-margins { margin: 16px 4px 0; padding: 18px; border: 1px solid #a8cefa; border-radius: 18px; background: #eaf4ff; }
.grid-margins h3 { margin: 0 0 6px; color: #193b69; font-size: 15px; font-weight: 600; }
.grid-margins strong { color: var(--muted); font-size: 12px; font-weight: 400; }
.grid-margins p { margin-top: 10px; color: #193b69; font-size: 16px; font-weight: 600; line-height: 1.5; }

/* Ogni passaggio occupa lo spazio disponibile della vista. */
body { height: 100dvh; display: flex; flex-direction: column; padding-bottom: 0; }
.site-header { position: relative; top: auto; left: auto; transform: none; flex: 0 0 auto; width: min(1000px, calc(100% - 28px)); min-height: 54px; margin: 8px auto 6px; padding: 5px 20px; }
.brand { flex-basis: 64px; }
.brand img { width: 64px; }
.site-header .text-button { font-size: 12px; min-height: 40px; padding: 6px 8px; }
.header-caption { font-size: 12px; }
@media (min-width: 701px) {
  .site-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .site-header .brand { justify-self: start; }
  .site-header .header-caption { justify-self: center; }
  .site-header .text-button { justify-self: end; }
}
body[data-wizard-step] main { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; padding-top: 0; width: min(560px, calc(100% - 28px)); margin: 0 auto; }
body[data-wizard-step] .intro { padding: 8px 0 10px; flex: 0 0 auto; }
body[data-wizard-step] #wizard-heading { font-size: 23px; line-height: 1.15; }
.privacy-badge { margin-top: 6px; }
body[data-wizard-step] .wizard-progress { flex: 0 0 auto; margin: 4px auto 12px; }
body[data-wizard-step] .workspace { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; width: 100%; max-width: 560px; margin: 0 auto; gap: 8px; align-items: stretch; }
body[data-wizard-step] .controls { flex: 0 0 auto; }
body[data-wizard-step] .preview-panel { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; width: 100%; }
body[data-wizard-step="1"] .preview-panel,
body[data-wizard-step="2"] .preview-panel { display: none; }
body[data-wizard-step] .preview-stage { flex: 1 1 0; min-height: 0; height: auto; padding: 25px 40px 25px; overflow: visible; }
body[data-wizard-step="3"] .preview-stage { padding: 0; }
body[data-wizard-step] .preview-caption, footer { display: none; }
.wizard-navigation { position: static; flex: 0 0 auto; margin-top: 8px; }
.wizard-navigation-inner { max-width: 600px; padding: 8px 16px; }
.wizard-navigation .primary-button, .wizard-navigation .back-button { min-height: 44px; }
body[data-wizard-step] .grid-summary { flex: 0 0 auto; margin: 4px 0; font-size: 11px; }
#crop-format { font-size: 11px; margin-bottom: 0; flex-shrink: 0; }
#crop-control { flex: 0 0 auto; padding: 3px 0; }
.center-crop-button { min-height: 34px; padding: 4px 10px; }
body[data-wizard-step="1"] .controls,
body[data-wizard-step="1"] .upload-section { flex: 1 1 0; min-height: 0; }
body[data-wizard-step="1"] .drop-zone { min-height: 0; }
body[data-wizard-step="1"].has-uploaded-image .controls,
body[data-wizard-step="1"].has-uploaded-image .upload-section { flex: 0 0 auto; }

/* Formato: miniatura e campi, senza titolo o sfondo della card. */
body[data-wizard-step="2"] .controls { background: transparent; border: 0; overflow: visible; }
body[data-wizard-step="2"] .control-section { padding: 0; }
.format-thumbnail { height: 112px; display: flex; justify-content: center; align-items: center; margin: 40px 0 36px; }
#format-preview { flex-shrink: 0; box-shadow: 3px 5px 12px #20395424; border-radius: 2px; }
body[data-wizard-step="2"] .dimensions-card { padding: 14px 18px; background: rgba(34, 34, 34, .05); border: 0; border-radius: 20px; }
body[data-wizard-step="2"] .dimensions-card .unit-input { background: rgba(34, 34, 34, .1); border-color: #a9aaad; }
body[data-wizard-step="2"] .dimensions-card label { font-size: 12px; color: #505050; }
body[data-wizard-step="2"] .dimensions-card input { font-weight: 650; }
body[data-wizard-step="2"] .unit-input input { min-height: 46px; font-size: 19px; }
body[data-wizard-step="2"] .swap-button { height: 46px; }
body[data-wizard-step="2"] .presets-title { margin-top: 12px; margin-bottom: 6px; font-size: 12px; }
body[data-wizard-step="2"] .presets { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
body[data-wizard-step="2"] .presets button { min-height: 40px; font-size: 12px; padding: 6px; }

/* Interruttori compatti e quote dei margini direttamente sul foglio. */
body[data-wizard-step="4"] .grid-section { display: grid; grid-template-columns: 1fr 1fr; align-items: center; padding: 6px 12px; gap: 0 10px; }
body[data-wizard-step="4"] .grid-section .switch-row { min-height: 36px; margin: 0; padding: 0; border: 0; gap: 6px; }
body[data-wizard-step="4"] .grid-section .switch-row strong { font-size: 12px; line-height: 1.2; }
body[data-wizard-step="4"] .grid-section .switch { width: 34px; height: 22px; margin: 0; }
body[data-wizard-step="4"] .grid-section .switch:after { width: 16px; height: 16px; }
body[data-wizard-step="4"] .grid-section .switch-row input:checked + .switch:after { transform: translateX(12px); }
body[data-wizard-step="4"] .grid-section .switch-row input { top: -4px; right: -4px; }
body[data-wizard-step="4"] .grid-section:has(#margin-toggle-row[hidden]) { grid-template-columns: 1fr; }
body[data-wizard-step="4"] .custom-grid-options { grid-column: 1 / -1; margin-top: 4px; padding-top: 6px; }
body[data-wizard-step="4"] .custom-grid-options > legend { margin-bottom: 4px; font-size: 12px; }
body[data-wizard-step="4"] .grid-size-row .unit-input { height: 40px; }
body[data-wizard-step="4"] .grid-size-row .unit-input input { min-height: 38px; }
.margin-dimension { position: absolute; color: #ff525c; font-size: 11px; font-weight: 500; white-space: nowrap; line-height: 1.2; pointer-events: none; }
.margin-x { left: 0; top: 50%; height: 0; border-top: 1px solid currentColor; }
.margin-x span { position: absolute; right: calc(100% + 8px); top: 0; transform: translateY(-50%); }
.margin-y { left: calc(100% + 1px); top: 0; width: 0; border-left: 1px solid currentColor; }
.margin-y span { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); }
body[data-wizard-step="4"] .preview-stage,
body[data-wizard-step="5"] .preview-stage { padding-inline: 48px; }
body[data-wizard-step] .dimension-top, body[data-wizard-step] .dimension-side { font-size: 10px; }
body[data-wizard-step] .dimension-top { transform: translate(-50%, -20px); }
body[data-wizard-step] .dimension-side { transform: translate(13px, -50%); }
.download-format { flex: 0 0 auto; text-align: center; color: var(--muted); font-size: 11px; margin: 3px 0; }
body[data-wizard-step="5"] .atelier-tip { flex: 0 0 auto; margin: 6px 0 2px; padding: 8px 12px; border-radius: 12px; background: #eaf4ff; gap: 8px; }
body[data-wizard-step="5"] .atelier-tip p { font-size: 11px; line-height: 1.4; }
body[data-wizard-step="5"] .atelier-tip strong { font-size: 12px; margin-bottom: 2px; }
body[data-wizard-step="5"] .tip-symbol { font-size: 20px; }
#error { flex-shrink: 0; margin-bottom: 8px; }
@media (max-height: 700px) {
  .site-header { min-height: 46px; margin-block: 5px; padding-block: 2px; }
  .brand img { width: 54px; }
  body[data-wizard-step] #wizard-heading { font-size: 21px; }
  body[data-wizard-step] .intro { padding-block: 4px 8px; }
  body[data-wizard-step] .wizard-progress { margin-bottom: 8px; }
  .format-thumbnail { height: 78px; margin-block: 18px; }
  body[data-wizard-step="2"] .presets button { min-height: 34px; }
  .privacy-badge small { display: none; }
}

/* Contenuti leggibili anche senza JavaScript, apribili senza lasciare lo strumento. */
body[data-wizard-step] .intro .tool-description { max-width: 470px; margin: 5px auto 0; font-size: 11px; line-height: 1.4; }
.tool-guide { flex: 0 0 auto; margin-top: 6px; color: var(--muted); font-size: 11px; }
.tool-guide summary { cursor: pointer; text-align: center; padding: 5px 0; }
.tool-guide summary h2 { display: inline; font-size: inherit; font-weight: 500; letter-spacing: normal; }
.tool-guide-content { max-height: min(35dvh, 300px); overflow-y: auto; overscroll-behavior: contain; margin-top: 4px; padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: 14px; color: var(--ink); font-size: 13px; line-height: 1.65; }
.tool-guide-content h3 { margin: 18px 0 5px; font-size: 15px; line-height: 1.3; }
.tool-guide-content p { margin: 7px 0; }
.tool-guide-content ol { padding-left: 20px; }
.tool-guide-content li { margin-block: 7px; }
.tool-guide a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.tool-guide summary:focus-visible, .tool-guide a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
#download-button[aria-disabled="true"] { opacity: .5; cursor: wait; pointer-events: none; }
@media (max-height: 700px) {
  .tool-guide-content { position: fixed; z-index: 50; left: 50%; bottom: 100px; transform: translateX(-50%); width: min(560px, calc(100% - 28px)); max-height: 42dvh; margin: 0; box-shadow: 0 8px 32px #22222226; }
}
