:root {
  --ink: #102a43;
  --muted: #627d98;
  --line: #d9e2ec;
  --surface: rgba(255,255,255,.92);
  --primary: #087f8c;
  --primary-dark: #05636d;
  --accent: #f5a623;
  --ok: #177245;
  --warn: #d98b0b;
  --bad: #b42318;
  --soft: #f3f7f8;
  --shadow: 0 24px 70px rgba(16,42,67,.14);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  padding: 20px 16px 28px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(8,127,140,.17), transparent 30rem),
    radial-gradient(circle at 90% 90%, rgba(245,166,35,.16), transparent 28rem),
    #f3f7f8;
}

.home-button {
  position: fixed;
  z-index: 10;
  top: 20px;
  left: 20px;
  display: inline-flex;
  min-height: 42px;
  padding: 0 15px;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 12px;
  background: var(--primary);
  box-shadow: 0 10px 25px rgba(8,127,140,.22);
  color: #fff;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.home-button:hover { transform: translateY(-1px); background: var(--primary-dark); box-shadow: 0 13px 28px rgba(8,127,140,.28); }
.home-button:focus-visible { outline: 3px solid rgba(245,166,35,.65); outline-offset: 3px; }
.home-button svg { flex: 0 0 auto; }

.container { width: min(100%, 1100px); margin: 0 auto; padding: 0; }
.header { padding: 0; text-align: left; }
.header::before {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  content: "CONVERTITORE IMMAGINI";
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .14em;
}
h1 { margin: 0; font-size: clamp(2rem, 4.5vw, 3.15rem); line-height: 1.02; letter-spacing: -.045em; }
p { margin: 0; }
#appSubtitle { max-width: 760px; margin-top: 7px; line-height: 1.45; }
.small { font-size: .78rem; }
.muted { color: var(--muted); }

.btn {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #e8eff2;
  color: var(--ink);
  font: inherit;
  font-size: .84rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); background: #dce8ec; }
.btn:active { transform: translateY(0); }
.btn.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }

.container { padding-top: 62px; }
.privacy-notice { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); font-size: .78rem; line-height: 1.6; }
.card { margin-top: 14px; padding: 22px; border: 1px solid rgba(255,255,255,.86); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(12px); min-width: 0; }
button,input,select { font: inherit; }
button,a,input,select,summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: default; opacity: .5; transform: none; }
.drop-zone { width: 100%; min-height: 145px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 22px; background: #f3f9f9; border: 1.5px dashed #9bc9cd; border-radius: 15px; color: var(--primary); cursor: pointer; transition: .15s; }
.drop-zone:hover,.drop-zone.over { background: #e6f3f3; border-color: var(--primary); }
.drop-zone strong { font-size: 1rem; }.drop-zone span { font-size: .78rem; color: var(--muted); }
.help { font-size: .75rem; color: var(--muted); line-height: 1.55; margin-top: 8px; }
.file-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 14px; font-size: .8rem; }
#file-name { overflow-wrap: anywhere; font-weight: 750; }.file-info .text-button { margin-left: auto; }
.workspace { display: grid; grid-template-columns: 350px minmax(0,1fr); gap: 14px; align-items: start; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }fieldset:disabled { opacity: .5; }
h2 { margin: 0; font-size: .9rem; letter-spacing: -.01em; }.section-title { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }.section-title>span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #e6f3f3; color: var(--primary); font-size: .65rem; font-weight: 850; }
.segmented { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); background: #f0f5f7; border-radius: 11px; margin-bottom: 14px; }.segmented button { width: 50%; border: 0; padding: 9px; border-radius: 8px; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 800; cursor: pointer; }.segmented .active { background: var(--primary); color: white; }
.dimension-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.dimension-grid label { font-size: .78rem; font-weight: 750; }.dimension-grid label>span { float: right; font-size: .7rem; color: var(--muted); }
input[type=number],select { width: 100%; min-height: 44px; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 11px; color: var(--ink); background: white; }input[type=number] { margin-top: 7px; }select { font-size: .8rem; }
.checkbox { display: flex; gap: 7px; align-items: center; margin-top: 12px; font-size: .8rem; cursor: pointer; }input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.resize-summary { display: flex; flex-direction: column; align-items: start; gap: 5px; margin-top: 12px; font-size: .75rem; color: var(--muted); }
.text-button { border: 0; padding: 5px 0; background: transparent; color: var(--primary); font-size: .75rem; font-weight: 750; cursor: pointer; }.text-button:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }.range-label { display: flex; justify-content: space-between; margin-top: 14px; font-size: .78rem; }.range-label output { color: var(--primary); font-weight: 750; }input[type=range] { width: 100%; accent-color: var(--primary); margin: 10px 0; }
.color-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .78rem; margin-top: 12px; }input[type=color] { width: 40px; height: 32px; padding: 2px; background: white; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.wide { width: 100%; font-size: .78rem; }.color-removal { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }.color-removal summary { font-size: .75rem; font-weight: 750; cursor: pointer; }.restore { display: block; margin-top: 10px; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }.pill { display: inline-block; border-radius: 30px; background: #e8eff2; padding: 5px 9px; font-size: .65rem; font-weight: 750; white-space: nowrap; }
.preview-stage { min-height: 360px; height: 440px; padding: 20px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; }.checkerboard { background-color: #fff; background-image: conic-gradient(#e8edf1 25%,transparent 0 50%,#e8edf1 0 75%,transparent 0); background-size: 20px 20px; }
#empty-preview { background: #ffffffeb; padding: 12px 18px; border-radius: 9px; color: var(--muted); font-size: .8rem; text-align: center; }#preview { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 5px 25px #102a4320; }
.output-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 20px; border-top: 1px solid var(--line); margin-top: 18px; }.output-bar>div { flex: 1 1 170px; min-width: 0; }#output-name { display: block; font-size: .83rem; overflow-wrap: anywhere; }.download { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
#status { font-size: .78rem; color: var(--primary); margin-top: 14px; line-height: 1.6; }#error { padding: 12px; margin-top: 14px; border: 1px solid #efc6c3; border-radius: 10px; background: #fff3f2; color: var(--bad); font-size: .8rem; line-height: 1.5; }progress { display: block; width: 100%; height: 7px; margin-top: 16px; accent-color: var(--primary); }
footer { color: var(--muted); font-size: .7rem; line-height: 1.7; padding: 16px 4px; }footer a { color: var(--primary); }.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }[hidden] { display: none !important; }
@media(max-width:860px) { .workspace { grid-template-columns: 1fr; }.card { padding: 18px; }.preview-stage { height: 380px; min-height: 240px; } }
@media(max-width:520px) { body { padding: 72px 12px 24px; }.container { padding-top: 0; }.home-button { position: absolute; top: 14px; left: 12px; min-height: 40px; }h1 { font-size: 2.15rem; }.card { padding: 16px; border-radius: 19px; }.privacy-notice { font-size: .73rem; }.preview-stage { height: 300px; }.drop-zone span { font-size: .7rem; }.output-bar .btn { width: 100%; }.file-info .text-button { margin-left: 0; } }
