/* Spiaggia del Giorno — stile app (Aegean, mobile-first) */
:root {
  --paper: #EAF0EF; --card: #FFFFFF; --card-2: #F4F7F6;
  --ink: #12242B; --ink-soft: #4C5F66; --ink-faint: #86969B;
  --accent: #0E6E8C; --accent-deep: #094F66; --sun: #C86C4E;
  --line: #DCE4E2; --line-soft: #E8EEEC;
  --good: #2C8A6E; --warn: #C98A2E; --bad: #C6543F;
  --shadow: 20 40 46;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #081419; --card: #10242C; --card-2: #0C1D24;
    --ink: #E6EEEC; --ink-soft: #A7B8BC; --ink-faint: #6E838A;
    --accent: #57BCDC; --accent-deep: #8AD4EC; --sun: #E0906F;
    --line: #21393F; --line-soft: #182C32;
    --good: #4FC49F; --warn: #E0B25E; --bad: #E88068;
    --shadow: 0 0 0;
  }
}
:root[data-theme="light"] {
  --paper: #EAF0EF; --card: #FFFFFF; --card-2: #F4F7F6; --ink: #12242B; --ink-soft: #4C5F66;
  --ink-faint: #86969B; --accent: #0E6E8C; --accent-deep: #094F66; --sun: #C86C4E;
  --line: #DCE4E2; --line-soft: #E8EEEC; --good: #2C8A6E; --warn: #C98A2E; --bad: #C6543F; --shadow: 20 40 46;
}
:root[data-theme="dark"] {
  --paper: #081419; --card: #10242C; --card-2: #0C1D24; --ink: #E6EEEC; --ink-soft: #A7B8BC;
  --ink-faint: #6E838A; --accent: #57BCDC; --accent-deep: #8AD4EC; --sun: #E0906F;
  --line: #21393F; --line-soft: #182C32; --good: #4FC49F; --warn: #E0B25E; --bad: #E88068; --shadow: 0 0 0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(66px + env(safe-area-inset-bottom));
}
h1, h2, h3 { text-wrap: balance; line-height: 1.2; margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---- App bar ---- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.appbar-in { max-width: 620px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-ic { display: grid; place-items: center; color: var(--accent); }
.brand-ic svg { width: 24px; height: 24px; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { font-size: 12.5px; color: var(--accent); font-weight: 600; text-transform: capitalize; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 19px; line-height: 1;
  display: grid; place-items: center;
}
.icon-btn.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .icon-btn.spin { animation: none; } }

/* ---- Layout ---- */
.view { max-width: 620px; margin: 0 auto; padding: 18px 18px 24px; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin: 26px 2px 12px; }
.section-title:first-child { margin-top: 6px; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.stack { display: grid; gap: 12px; }

/* ---- Cards ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 1px 3px rgb(var(--shadow) / 0.05); }
.card.pad { padding: 16px 18px; }

/* ---- Hero (spiaggia del giorno) ---- */
.hero { overflow: hidden; }
.hero-photo { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(160deg, var(--accent-deep), var(--accent)); overflow: hidden; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-photo .ph-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.hero-photo .ph-fallback svg { width: 66px; height: 66px; color: rgba(255, 255, 255, 0.82); }
.hero-photo .grad { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.55)); }
.hero-badge {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: rgba(0,0,0,.42); color: #fff; backdrop-filter: blur(4px);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 6px 11px; border-radius: 999px;
}
.hero-cap { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 2; color: #fff; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hero-cap h2 { font-size: 26px; font-weight: 800; text-shadow: 0 1px 12px rgba(0,0,0,.4); }
.hero-cap .isle { font-size: 13px; opacity: .92; font-weight: 600; }
.hero-body { padding: 15px 18px 18px; }

/* ---- Score badge ---- */
.score { --c: var(--good); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 62px; height: 62px; border-radius: 16px; background: color-mix(in srgb, var(--c) 15%, var(--card)); border: 1.5px solid color-mix(in srgb, var(--c) 45%, transparent); color: var(--c); }
.score b { font-size: 23px; font-weight: 800; line-height: 1; }
.score small { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; opacity: .8; margin-top: 2px; }
.score.lg { min-width: 74px; height: 74px; }
.score.lg b { font-size: 28px; }
.score.sm { min-width: 46px; height: 46px; border-radius: 12px; }
.score.sm b { font-size: 17px; }

/* ---- Weather chips ---- */
.wx-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wx { display: inline-flex; align-items: center; gap: 7px; background: var(--card-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 7px 11px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.wx svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--accent); }
.wx .v { color: var(--ink); }
.wx .sym { font-size: 11px; font-weight: 800; }
.sym-ok { color: var(--good); }
.sym-est { color: var(--warn); }

.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.note::before { content: "!"; flex: 0 0 auto; width: 17px; height: 17px; border-radius: 50%; background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); font-weight: 800; font-size: 11px; display: grid; place-items: center; margin-top: 1px; }

/* ---- List rows (classifica) ---- */
.row { display: grid; grid-template-columns: 18px 50px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; overflow: hidden; }
.row + .row { border-top: 1px solid var(--line-soft); }
.row .rank { text-align: center; font-weight: 800; color: var(--ink-faint); font-size: 13px; }
.row .thumb { width: 50px; height: 50px; border-radius: 12px; background: linear-gradient(160deg, var(--accent-deep), var(--accent)); display: grid; place-items: center; overflow: hidden; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .thumb .fb { width: 23px; height: 23px; color: rgba(255, 255, 255, 0.92); }
.row .meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .nm-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.row .nm { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sb { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .wx-mini { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .wx-mini svg { width: 13px; height: 13px; flex: 0 0 auto; }
.row .score { flex: 0 0 auto; }
.vbadge { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--good); background: color-mix(in srgb, var(--good) 15%, transparent); border-radius: 6px; padding: 2px 6px; }
.vbadge svg { width: 11px; height: 11px; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; }
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- Param bars + accordion (scheda) ---- */
.params { display: grid; gap: 0; }
.pitem { border-top: 1px solid var(--line-soft); }
.pitem:first-child { border-top: none; }
.prow { display: grid; grid-template-columns: 1fr 88px 42px; align-items: center; gap: 10px; padding: 11px 0; width: 100%; background: none; border: none; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.prow .pl { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.prow .chev { width: 15px; height: 15px; color: var(--ink-faint); transition: transform .18s ease; flex: 0 0 auto; }
.prow[aria-expanded="true"] .chev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .prow .chev { transition: none; } }
.prow .pd { font-size: 11.5px; color: var(--ink-faint); font-weight: 500; margin-top: 2px; }
.prow .track { height: 8px; border-radius: 5px; background: var(--line-soft); overflow: hidden; }
.prow .track i { display: block; height: 100%; border-radius: 5px; background: var(--c, var(--accent)); }
.prow .pv { text-align: right; font-weight: 800; font-size: 14px; white-space: nowrap; }
.pdetail { padding: 0 0 13px; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.pdetail p { margin: 0 0 8px; }
.pdetail .facts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pdetail .fact { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--ink); }
.pdetail .fact span { color: var(--ink-soft); font-weight: 500; }
.pdetail .src { font-size: 11.5px; color: var(--ink-faint); }
.grouplabel { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 18px 0 4px; }

/* ---- Buttons ---- */
.ic { width: 16px; height: 16px; flex: 0 0 auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 13px 18px; border-radius: 13px; border: none; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.chip-btn svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 2px; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn-sm { padding: 8px 14px; border-radius: 10px; border: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; }
.btn-ghost { background: transparent; border: none; color: var(--ink-soft); font-size: 15px; padding: 6px 8px; }
.link { color: var(--accent); font-weight: 700; font-size: 14px; }

/* ---- Sliders (pesi) ---- */
.slider { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 9px 0; }
.slider + .slider { border-top: 1px solid var(--line-soft); }
.slider label { font-size: 14px; font-weight: 600; }
.slider .val { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); font-size: 14px; }
.slider input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }

/* ---- Compare ---- */
.cmp-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-pick button { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600; }
.cmp-pick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.cmp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cmp-table { border-collapse: collapse; width: 100%; min-width: 340px; font-size: 13.5px; }
.cmp-table th, .cmp-table td { padding: 9px 8px; text-align: center; border-bottom: 1px solid var(--line-soft); }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; color: var(--ink-soft); font-weight: 600; position: sticky; left: 0; background: var(--card); }
.cmp-table thead th { font-size: 13px; }
.cmp-table .win { color: var(--good); font-weight: 800; }
.cmp-verdict { margin-top: 14px; }

/* ---- Install banner ---- */
.install-banner { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--accent); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.install-banner[hidden] { display: none; }
.install-banner .ib-txt { display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.install-banner .ib-txt b { font-size: 14px; }
.install-banner .ib-txt span { opacity: .92; }
.install-banner .ib-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.install-banner .btn-sm { background: #fff; color: var(--accent-deep); }
.install-banner .btn-ghost { color: #fff; }

/* ---- Tab bar ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tab { flex: 1 1 0; max-width: 130px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border-radius: 12px; font-size: 10.5px; font-weight: 600; color: var(--ink-faint); }
.tab .ti { display: grid; place-items: center; height: 24px; }
.tab .ti svg { width: 23px; height: 23px; }
.tab.active { color: var(--accent); }

/* ---- States ---- */
.loading, .empty { text-align: center; padding: 48px 16px; color: var(--ink-soft); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); margin: 0 auto 14px; animation: spin 1s linear infinite; }
.skeleton { background: linear-gradient(90deg, var(--line-soft), var(--card-2), var(--line-soft)); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .spinner, .skeleton { animation: none; } }

/* ---- Sera / feedback ---- */
.mini-lbl { font-size: 12px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.sera-cta { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sera-cta .sera-ic { color: var(--accent); display: grid; place-items: center; }
.sera-cta .sera-ic svg { width: 24px; height: 24px; }
.sera-cta .sera-tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sera-cta .sera-tx b { font-size: 15px; }
.sera-cta .sera-tx span { font-size: 13px; color: var(--ink-soft); }
.sera-cta .sera-ch { color: var(--ink-faint); }
.sera-cta .sera-ch svg { width: 18px; height: 18px; }

/* ---- Spese ---- */
.totrow { display: flex; justify-content: space-between; gap: 8px; text-align: center; }
.totrow > div { flex: 1 1 0; }
.t-lbl { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.t-val { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 4px; }
.exp-form { display: flex; gap: 10px; }
.exp-form input { flex: 1 1 auto; min-width: 0; padding: 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 16px; }
.exp-form .btn span { white-space: nowrap; }
.exp-link { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); margin-top: 11px; }
.exp-link input { width: 18px; height: 18px; accent-color: var(--accent); }
.row.exp { grid-template-columns: minmax(0, 1fr) auto auto; }
.exp-amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.exp-del { background: none; border: none; color: var(--ink-faint); padding: 6px; display: grid; place-items: center; }
.exp-del svg { width: 18px; height: 18px; }

.legend-line { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); }
.legend-line b { color: var(--ink); }
.foot { text-align: center; font-size: 12px; color: var(--ink-faint); margin-top: 22px; }
