﻿* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
}
h1, h2, .brand { font-family: var(--font-head); font-weight: var(--head-weight); }
h1, .album-meta h2 { text-transform: var(--head-transform); letter-spacing: var(--head-spacing); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
h2:first-child { margin-top: 0; }
small, .muted { color: var(--muted); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 640px; padding-top: 32px; padding-bottom: 48px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: calc(100vh - 140px); }

/* ---------- barra superiore */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 1.05rem; margin-right: auto; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav .linklike { color: var(--text); padding: 7px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav .linklike:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-form { margin: 0; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.nav-toggle, .nav-burger { display: none; }

@media (max-width: 720px) {
  .nav-burger { display: block; width: 40px; height: 40px; cursor: pointer; position: relative; }
  .nav-burger span, .nav-burger span::before, .nav-burger span::after {
    position: absolute; left: 10px; width: 20px; height: 2px; background: var(--text); content: ""; border-radius: 2px;
  }
  .nav-burger span { top: 19px; }
  .nav-burger span::before { top: -6px; left: 0; }
  .nav-burger span::after { top: 6px; left: 0; }
  .nav {
    display: none; position: absolute; top: 58px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px 12px;
  }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav a, .nav .linklike { padding: 10px 12px; text-align: left; width: 100%; }
}

.footer { color: var(--muted); font-size: .85rem; padding-bottom: 24px; text-align: center; }

/* ---------- elementi comuni */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { margin: 0; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--btn-radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--error-soft); }
.btn.small { padding: 5px 11px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.muted-card { background: transparent; box-shadow: none; }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.flash-error { background: var(--error-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash-info { background: var(--info-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }

.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-weight: 600; vertical-align: 1px; }
.badge-public { background: var(--success-soft); color: var(--success); }
.badge-users { background: var(--info-soft); color: var(--accent); }
.badge-private { background: var(--surface-2); color: var(--muted); }

.empty { text-align: center; padding: 64px 16px; color: var(--muted); }
.empty h1, .empty h2 { color: var(--text); }

/* ---------- moduli */
.form label { display: block; margin-bottom: 14px; font-weight: 550; }
.form label small { font-weight: 400; }
.form input[type=text], .form input:not([type]), .form input[type=password], .form input[type=number], .form textarea, .form select,
.uploader select, .select-bar select {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.form input:focus, .form textarea:focus, .form select:focus, .uploader select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.form fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px 4px; margin: 0 0 16px; }
.form legend { font-weight: 650; padding: 0 6px; }
.form label.radio, .form label.check { display: flex; align-items: baseline; gap: 8px; font-weight: 400; margin-bottom: 10px; cursor: pointer; }
.form label.radio strong { font-weight: 600; }
.radio-row { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .two-cols { grid-template-columns: 1fr; } }
.narrow-form { max-width: 520px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone h2 { color: var(--danger); }
.login-card { max-width: 400px; margin: 40px auto; }
.login-card h1 { margin-bottom: 16px; }
textarea.code { width: 100%; font: 13px/1.4 ui-monospace, Consolas, monospace; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }

.install-title { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 4px 0; }
.checks .ok { color: var(--success); }
.checks .bad { color: var(--danger); font-weight: 600; }
.checks .warn { color: var(--muted); }
.plain { margin: 0; padding-left: 18px; }

/* ---------- album */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.album-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.album-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16, 24, 40, .12); }
.album-cover { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-empty { display: block; width: 100%; height: 100%;
  background: radial-gradient(circle at 70% 35%, color-mix(in srgb, var(--muted) 30%, transparent) 0 9%, transparent 10%),
              linear-gradient(160deg, transparent 55%, color-mix(in srgb, var(--muted) 22%, transparent) 56%); }
.album-meta { padding: 12px 14px 14px; }
.album-meta h2 { font-size: 1rem; margin: 0 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-meta p { margin: 0; font-size: .86rem; color: var(--muted); }
.album-desc { margin: -6px 0 20px; max-width: 760px; color: var(--muted); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--tile-gap); }
@media (max-width: 520px) { .media-grid { grid-template-columns: repeat(3, 1fr); gap: min(var(--tile-gap), 6px); } }
.tile { margin: 0; position: relative; aspect-ratio: 1; background: var(--surface-2); border-radius: var(--tile-radius); overflow: hidden;
  border: var(--tile-border); box-shadow: var(--tile-shadow); }
.tile-link { display: block; width: 100%; height: 100%; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.tile-link:hover img { transform: scale(1.04); }
.tile .play { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; background: rgba(0, 0, 0, .5); }
.tile .play::after { content: ""; position: absolute; left: 18px; top: 14px; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff; }
.tile .duration { position: absolute; right: 6px; bottom: 6px; font-size: .75rem; color: #fff; background: rgba(0, 0, 0, .6); padding: 1px 6px; border-radius: 4px; }
.tile .cover-flag { position: absolute; left: 6px; bottom: 4px; color: #ffd24a; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
.tile-check { display: none; position: absolute; top: 6px; left: 6px; background: rgba(255, 255, 255, .9); border-radius: 6px; padding: 3px 5px; line-height: 1; }
.tile-check input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.select-mode .tile-check { display: block; }
.select-mode .tile-link img { transform: none; }
.tile:has(input:checked) { outline: 3px solid var(--accent); outline-offset: -3px; }

.select-bar { display: none; position: sticky; top: 66px; z-index: 10; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 12px; margin-bottom: 12px; }
.select-mode .select-bar { display: flex; }
.select-bar select { width: auto; margin: 0; padding: 5px 8px; max-width: 200px; }
.select-hint { font-size: .85rem; }
@media (max-width: 720px) { .select-hint { display: none; } }
.select-mode .tile-link { cursor: pointer; }
.select-mode .tile:not(:has(input:checked)) img { opacity: .75; }

/* ---------- modifica elemento */
.edit-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 16px; align-items: start; }
@media (max-width: 800px) { .edit-layout { grid-template-columns: 1fr; } }
.preview img, .preview video { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: #000; border-radius: 6px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; margin: 14px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- tabella utenti */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: .6; }
.table .right { text-align: right; }

.table .nowrap, .nowrap { white-space: nowrap; }
.table .ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- statistiche */
.stats-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 14px; padding-bottom: 6px; }
.stats-filter label { flex: 1 1 160px; }
.stats-filter input[type=date] {
  display: block; width: 100%; margin-top: 5px; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color-scheme: light dark;
}
.stats-filter .btn { margin-bottom: 14px; }
.stats-quick { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; margin-bottom: 8px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; display: flex; flex-direction: column; }
.stat-num { font-size: 1.7rem; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .88rem; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.chart-head h2 { margin: 0 0 12px; }
.chart-legend { display: flex; gap: 14px; font-size: .85rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw-view, .seg-view { background: var(--accent); }
.sw-dl, .seg-dl { background: var(--success); }
.chart { display: flex; align-items: stretch; gap: 2px; height: 180px; border-bottom: 1px solid var(--border); }
.chart-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 3px 3px 0 0; }
a.chart-col:hover { background: var(--surface-2); text-decoration: none; }
.seg { display: block; width: 100%; }
.seg-view { border-radius: 3px 3px 0 0; }
.chart-axis { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.chart-note { font-size: .82rem; margin: 6px 0 0; }
.section-title { margin: 24px 0 10px; }
.stats-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 860px) { .stats-cols { grid-template-columns: 1fr; } }
.who-list { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.who { display: inline-block; background: var(--accent-soft); color: var(--text); border-radius: 99px; padding: 1px 10px; font-size: .86rem; }
.who small { color: var(--muted); }
.pad { padding: 16px 20px; margin: 0; }
.pager { justify-content: center; margin-bottom: 16px; }
.stats-clean { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 14px; }
.stats-clean h2 { flex-basis: 100%; }
.stats-clean label { flex: 1 1 260px; }
.stats-clean .btn { margin-bottom: 14px; }

/* ---------- caricamento */
.uploader label.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-weight: 600; margin-bottom: 16px; }
.uploader label.inline select { width: auto; min-width: 220px; max-width: 100%; margin: 0; }
.small-link { font-weight: 400; font-size: .9rem; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 36px 16px;
  border: 2px dashed var(--border); border-radius: var(--radius); cursor: pointer; background: var(--bg); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone strong { font-size: 1.05rem; }
.dz-icon { width: 44px; height: 44px; margin-bottom: 6px; border-radius: 50%; background: var(--accent); position: relative; }
.dz-icon::before { content: ""; position: absolute; left: 50%; top: 12px; margin-left: -8px; border-style: solid; border-width: 0 8px 9px; border-color: transparent transparent var(--accent-text); }
.dz-icon::after { content: ""; position: absolute; left: 50%; top: 20px; margin-left: -3px; width: 6px; height: 12px; background: var(--accent-text); }
.resize-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 14px; margin-bottom: 16px;
  background: var(--surface-2); border-radius: 8px; }
.resize-opts label { display: flex; align-items: center; gap: 8px; margin: 0; }
.resize-opts label.check { cursor: pointer; }
.resize-opts input[type=checkbox] { width: 17px; height: 17px; margin: 0; }
.resize-opts select { padding: 5px 8px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.resize-opts select:disabled { opacity: .5; }
.resize-opts small { flex-basis: 100%; }
.dz-btn { margin: 6px 0 4px; pointer-events: none; }
.up-list { list-style: none; padding: 0; margin: 16px 0 0; max-height: 50vh; overflow-y: auto; }
.up-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.up-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-list .status { color: var(--muted); text-align: right; white-space: nowrap; }
.up-list .bar { grid-column: 1 / -1; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.up-list .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-list li.ok .status { color: var(--success); }
.up-list li.ok .bar span { background: var(--success); }
.up-list li.err .status { color: var(--danger); white-space: normal; }
.up-list li.dup .status { color: var(--muted); }
.up-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }

/* ---------- link di condivisione */
.share-list { list-style: none; padding: 0; margin: 0 0 16px; }
.share-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.share-list li.share-off { opacity: .6; }
.share-main { flex: 1 1 320px; min-width: 0; }
.share-url { display: block; width: 100%; margin-top: 6px; padding: 6px 9px; font: 13px/1.4 ui-monospace, Consolas, monospace;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.share-actions form { margin: 0; }
.share-new { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 14px; }
.share-new label { flex: 1 1 200px; }
.share-new .btn { margin-bottom: 14px; }

/* ---------- filigrana di sfondo (prima pagina e album) */
/* il disegno è una maschera: prende il colore del testo del tema, molto trasparente */
body.has-watermark::before, .wm-preview::before {
  content: ""; pointer-events: none;
  background-color: var(--text); opacity: var(--wm-opacity, .06);
  -webkit-mask-image: var(--wm-image); mask-image: var(--wm-image);
  -webkit-mask-repeat: repeat; mask-repeat: repeat;
  -webkit-mask-size: var(--wm-size, 460px) auto; mask-size: var(--wm-size, 460px) auto;
}
body.has-watermark::before { position: fixed; inset: 0; z-index: -1; }
body.has-watermark .topbar, body.has-watermark .album-card { position: relative; }
.wm-preview { position: relative; height: 150px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); overflow: hidden; margin: 4px 0 16px; }
.wm-preview::before { position: absolute; inset: 0; }
.wm-preview span { position: absolute; left: 12px; bottom: 8px; font-size: .8rem; color: var(--muted); }

/* ---------- scelta del tema (impostazioni) */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.form label.theme-option { display: flex; flex-direction: column; gap: 3px; margin: 0; cursor: pointer; font-weight: 400; }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card { display: block; border-radius: 10px; overflow: hidden; border: 2px solid var(--border);
  background: var(--bg); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.theme-option:hover .theme-card { border-color: var(--muted); }
.theme-option input:checked + .theme-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-option input:focus-visible + .theme-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-name { font-weight: 650; margin-top: 6px; }
.theme-desc { font-size: .85rem; color: var(--muted); }
.tc-bar { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tc-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); }
.tc-line { width: 46px; height: 5px; border-radius: 3px; background: var(--text); opacity: .7; }
.tc-btn { margin-left: auto; width: 26px; height: 9px; border-radius: var(--btn-radius); background: var(--accent); }
.tc-body { display: block; padding: 8px 10px 10px; }
.tc-title { display: block; font: var(--head-weight) 13px/1.3 var(--font-head); text-transform: var(--head-transform);
  letter-spacing: var(--head-spacing); margin-bottom: 6px; }
.tc-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: min(var(--tile-gap), 5px); }
.tc-tile { aspect-ratio: 1; border-radius: min(var(--tile-radius), 8px); box-shadow: var(--tile-shadow);
  border: var(--tile-border); border-width: min(2px, 6px); }
.tc-tile.t1 { background: linear-gradient(160deg, #8ec5e8, #3f7fb3); }
.tc-tile.t2 { background: linear-gradient(160deg, #f3c27a, #c46a3c); }
.tc-tile.t3 { background: linear-gradient(160deg, #9fd39a, #3f8a4f); }
.tc-tile.t4 { background: linear-gradient(160deg, #d9a6c9, #8a4c7a); }
.tc-tile.t5 { background: linear-gradient(160deg, #c9ced6, #6d7684); }
.tc-tile.t6 { background: linear-gradient(160deg, #f5e08a, #c9a02c); }

/* ---------- scelta del tema da parte dei visitatori */
.footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 20px; }
.theme-pick { display: inline-flex; align-items: center; gap: 6px; }
.theme-pick select { font: inherit; font-size: .85rem; padding: 3px 6px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; }

/* ---------- visualizzatore a schermo intero */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8, 9, 11, .96); display: none; color: #fff;
  opacity: 0; transition: opacity .25s ease; }
.lightbox.open { display: block; }
.lightbox.visible { opacity: 1; }
.lightbox[data-transition="none"] { transition: none; }

/* transizioni tra le foto: l'elemento nuovo entra mentre il vecchio esce */
.lb-media { position: absolute; inset: 0; margin: auto; max-width: calc(100% - 24px); max-height: calc(100% - 24px);
  object-fit: contain; user-select: none; }
.lb-media.enter { opacity: 0; }
.lb-media.leave { opacity: 0; pointer-events: none; }
.lb-media.enter, .lb-media.leave { transition: opacity .4s ease, transform .45s cubic-bezier(.2, .7, .2, 1); }
[data-transition="slide"] .lb-media.enter { transform: translateX(calc(var(--dir, 0) * 80px)); }
[data-transition="slide"] .lb-media.leave { transform: translateX(calc(var(--dir, 0) * -80px)); }
[data-transition="zoom"] .lb-media.enter { transform: scale(.88); }
[data-transition="zoom"] .lb-media.leave { transform: scale(1.08); }
.lightbox .lb-media.enter.enter-active { opacity: 1; transform: none; }
.lightbox.playing .lb-play { background: rgba(255, 255, 255, .25); }
/* presentazione a schermo intero: sfondo nero, foto a tutto schermo, comandi a scomparsa */
.lightbox.is-fullscreen { background: #000; }
.lightbox.is-fullscreen.playing .lb-stage { inset: 0; padding: 0; }
.lightbox.is-fullscreen.playing .lb-media { max-width: 100%; max-height: 100%; }
.lightbox.is-fullscreen.playing .lb-bar,
.lightbox.is-fullscreen.playing .lb-nav { opacity: 0; transition: opacity .3s; pointer-events: none; }
.lightbox.is-fullscreen.playing.show-ui .lb-bar,
.lightbox.is-fullscreen.playing.show-ui .lb-nav { opacity: 1; pointer-events: auto; }
.lightbox.is-fullscreen.playing:not(.show-ui) { cursor: none; }
.lb-fs { font-size: 1.05rem; line-height: 1; }
.footer .version { margin-left: 6px; font-size: .78rem; opacity: .7; font-variant-numeric: tabular-nums; }
.lb-del:hover { background: rgba(239, 80, 80, .45); }

/* comparsa morbida delle miniature */
img.fade-in { opacity: 0; transition: opacity .45s ease, transform .25s; }
img.fade-in.loaded { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  /* solo dissolvenze, nessun movimento */
  .lb-media.enter, .lb-media.leave { transform: none !important; }
  .tile-link:hover img, .album-card:hover { transform: none; }
}
body.lb-open { overflow: hidden; }
.lb-stage { position: absolute; inset: 0 0 56px; display: flex; align-items: center; justify-content: center; padding: 12px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.lb-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: rgba(0, 0, 0, .5); }
.lb-caption { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-count { color: #aab; font-size: .88rem; }
.lb-btn { color: #fff; background: rgba(255, 255, 255, .1); border: 0; border-radius: 8px; padding: 7px 12px; font: inherit; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, .2); text-decoration: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 80px; border: 0; background: rgba(255, 255, 255, .08); color: #fff; font-size: 2.4rem; line-height: 1; cursor: pointer; border-radius: 8px; }
.lb-nav:hover { background: rgba(255, 255, 255, .18); }
.lb-prev { left: 10px; }
.lb-next { right: 10px; }
@media (max-width: 600px) {
  .lb-nav { width: 40px; height: 64px; font-size: 2rem; background: rgba(255, 255, 255, .05); }
  .lb-count { display: none; }
}
