/* PescaSorprese - Arcade Noir.
   Fondo notturno, una sola luce dorata, superfici pulite. I colori delle rarita restano quelli del
   gioco (li usa anche l'album grafico del bot), solo ricalibrati per il fondo scuro. */

@font-face {
  font-family: Inter;
  src: url("/fonts/InterVariable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Gummy;
  src: url("/assets/fonts/SourGummy-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* Superfici */
  --bg: #0b0a10;
  --bg-soft: #100e17;
  --surface: #16131f;
  --surface-2: #1d1929;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Testo */
  --text: #f5f2f8;
  --text-2: #a8a1b8;
  --text-3: #6e6782;

  /* Accento */
  --gold: #e8c36a;
  --gold-deep: #c69a3d;
  --gold-veil: rgba(232, 195, 106, 0.12);
  --cta-bg: #e8c36a;
  --cta-text: #241a05;

  /* Stati */
  --plus: #49c98a;
  --minus: #f2596e;

  /* Forma e movimento */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
  --t: 160ms cubic-bezier(0.2, 0, 0.2, 1);

  --ui: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: Gummy, var(--ui);
}

/* Rarita: un colore per famiglia, usato come accento e non come fondo. */
.tier-comune { --tier: #93a6bd; --tier-soft: rgba(147, 166, 189, 0.16); }
.tier-halloween { --tier: #ff8c3c; --tier-soft: rgba(255, 140, 60, 0.16); }
.tier-natale { --tier: #ff5a5f; --tier-soft: rgba(255, 90, 95, 0.16); }
.tier-anime { --tier: #2fd4c6; --tier-soft: rgba(47, 212, 198, 0.16); }
.tier-forziere { --tier: #ffc23d; --tier-soft: rgba(255, 194, 61, 0.16); }
.tier-raro { --tier: #5aa9f5; --tier-soft: rgba(90, 169, 245, 0.16); }
.tier-epico { --tier: #b77bf0; --tier-soft: rgba(183, 123, 240, 0.16); }
.tier-leggendario { --tier: #f0b429; --tier-soft: rgba(240, 180, 41, 0.16); }
.tier-staff { --tier: #ff7a7a; --tier-soft: rgba(255, 122, 122, 0.16); }
.tier-maledetto { --tier: #6fbf73; --tier-soft: rgba(111, 191, 115, 0.16); }
.tier-niente { --tier: #7b7489; --tier-soft: rgba(123, 116, 137, 0.16); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 50% -10%, #1a1426 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px calc(88px + env(safe-area-inset-bottom));
}
#content { display: flex; flex-direction: column; flex: 1; }
.view { flex: 1; }

/* --- Insegna --- */

.logo { text-align: center; padding: 2px 0 18px; }
.logo-img {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin: 0 auto;
}
.logo-by {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.demo-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--gold-veil);
  color: var(--gold);
  font-size: 13px;
  text-align: center;
}

/* --- Intestazioni di sezione --- */

.section-title {
  margin: 32px 0 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section-title:first-child { margin-top: 0; }

/* --- Saluto e macchina --- */

.machine {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.machine-image {
  width: 72px;
  height: 94px;
  flex: none;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
}
.machine-copy { min-width: 0; flex: 1; }
.hello {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.hint { margin: 2px 0 12px; font-size: 13px; color: var(--text-2); }

.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  background: var(--cta-bg);
  color: var(--cta-text);
  font-size: 14px;
  font-weight: 600;
  transition: transform var(--t), filter var(--t);
}
.cta:hover { filter: brightness(1.06); }
.cta:active { transform: scale(0.97); }

/* --- Numeri --- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 0 0; }
.stat {
  padding: 12px 10px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}
.stat-icon { display: none; }
.stat strong {
  display: block;
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.album-progress { display: flex; align-items: center; gap: 12px; margin: 14px 0 18px; }

/* Avanzamento dell'album: anello, pezzi, una collezione per pallino. */
.album-ring { text-align: center; padding: 4px 0 8px; }
.ring { position: relative; width: min(50vw, 190px); margin: 0 auto; }
.ring svg { display: block; width: 100%; height: auto; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 10; }
.ring-value {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 900ms cubic-bezier(0.2, 0, 0.2, 1);
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.ring-center strong { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-center span { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.ring-pieces { margin: 14px 0 0; font-size: 14px; color: var(--text-2); }
.ring-pieces b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.ring-dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.ring-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--tier);
  opacity: 0.45;
}
.ring-dot.done { background: var(--tier); opacity: 1; }
.ring-sets { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }

a.tg-link { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
a.tg-link:hover { color: var(--gold); }
.brand-footer a.tg-link { border-bottom-color: var(--line-strong); }
.album-progress span { font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.progress { flex: 1; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width 600ms var(--t);
}

/* --- Selettore dei set --- */

.set-tabs { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 10px; margin-bottom: 16px; }
.set-nav {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.set-nav:hover { background: var(--surface-2); color: var(--text); }
.set-nav:active { transform: scale(0.94); }
.set-current { text-align: center; min-width: 0; }
.set-stars { display: block; font-size: 10px; letter-spacing: 0.22em; color: var(--tier); }
.set-name {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.set-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.set-line { display: block; width: 72%; height: 3px; margin: 8px auto 0; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.set-line i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--tier); transition: width 500ms var(--t); }

/* --- Intestazione del set --- */

.set-header {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--tier-soft), transparent);
  border: 1px solid var(--line);
  text-align: center;
  margin-bottom: 12px;
}
.set-ribbon {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tier);
}
.set-prize-text { margin: 6px 0 0; font-size: 13px; color: var(--text-2); }
/* Descrizione del set (dalla dashboard): al posto del premio, piu' discreta e in corsivo. */
.set-desc { margin: 8px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-2); font-style: italic; }
.set-prize { display: block; margin-top: 2px; font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.set-count { margin-top: 10px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.set-header .progress { margin-top: 10px; }

/* --- Carte --- */

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card {
  position: relative;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  animation: cardIn 300ms var(--t) both;
  transition: transform var(--t), border-color var(--t);
}
.card[data-owned] { cursor: pointer; }
.card[data-owned]:hover { border-color: var(--tier); }
.card[data-owned]:active { transform: scale(0.97); }
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--tier);
  opacity: 0.9;
}
.card-image { position: relative; aspect-ratio: 3 / 4; background: #0e0c14; }
.card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.locked .card-image {
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 22px;
  background: repeating-linear-gradient(45deg, #13111b, #13111b 6px, #16131f 6px, #16131f 12px);
}
.card.locked { border-style: dashed; }
.card.locked::before { opacity: 0.25; }
.stars { display: none; }
.copies {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(11, 10, 16, 0.82);
  border: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}
.card-label { padding: 8px; }
.card-label span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-2);
}
.card.locked .card-label span { color: var(--text-3); }

/* Un riflesso lento solo sulle carte che lo meritano. */
.card.shiny .card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.22) 50%, transparent 60%);
  transform: translateX(-120%);
  animation: shiny 4.5s ease-in-out 1.5s infinite;
}

/* --- Classifiche --- */

.group {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.group + .group { margin-top: 10px; }
.group-title { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.group-rank { margin: 2px 0 12px; font-size: 12px; color: var(--text-3); }
.group-rank b { color: var(--gold); font-weight: 600; }
.top-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  font-size: 14px;
}
.top-row + .top-row { margin-top: 2px; }
.top-row.me { background: var(--gold-veil); }
.top-rank { min-width: 22px; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.top-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.top-row.me .name { color: var(--text); }
.top-row .pts { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- Ultime pesche --- */

.recent {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.recent + .recent { margin-top: 8px; }
.recent img { width: 44px; height: 56px; flex: none; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line-strong); }
.recent-copy { flex: 1; min-width: 0; }
.recent-title { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tier-soft);
  color: var(--tier);
  font-size: 11px;
  font-weight: 600;
}
.points {
  flex: none;
  min-width: 44px;
  text-align: center;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.05);
}
.points.plus { color: var(--plus); background: rgba(73, 201, 138, 0.12); }
.points.minus { color: var(--minus); background: rgba(242, 89, 110, 0.12); }

/* --- Regole --- */

.rule-title { margin: 20px 0 6px; font-size: 14px; font-weight: 650; color: var(--text); }
.rule-title:first-child { margin-top: 0; }
.rule-text { margin: 0 0 6px; font-size: 14px; color: var(--text-2); }
.rule-text b { color: var(--text); font-weight: 600; }
.rule-list { margin: 0; padding-left: 18px; font-size: 14px; color: var(--text-2); }
.rule-list li { margin-bottom: 6px; }
.rule-list b { color: var(--text); font-weight: 600; }
.rule-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.rule-chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--tier-soft);
  color: var(--tier);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
}
.rule-chip b { font-weight: 700; }
.rule-credits {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-3);
}
.rule-credits b { color: var(--text-2); font-weight: 600; display: block; margin-bottom: 4px; }

/* --- Contenitori, stati vuoti --- */

.view { animation: viewIn 220ms var(--t); }
.view[hidden] { display: none; }
.paper { margin-top: 28px; }
.empty {
  margin: 0;
  padding: 24px 16px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-strong);
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
}
.center { text-align: center; }
.skeleton {
  height: 220px;
  border-radius: var(--r-md);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 45%, var(--surface) 60%) 0 0 / 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

.brand-footer {
  margin: 36px 0 0;
  padding-top: 8px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* --- Carta a tutto schermo --- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  padding: 24px 12px calc(24px + env(safe-area-inset-bottom));
  background: rgba(7, 6, 11, 0.94);
  backdrop-filter: blur(8px);
  animation: fade 180ms var(--t);
}
.viewer[hidden] { display: none; }
.viewer-card {
  grid-column: 2;
  margin: 0;
  animation: pop 220ms var(--t);
}
.viewer-image {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #0e0c14;
}
.viewer-image img { display: block; width: 100%; max-height: 64vh; object-fit: contain; }
.viewer-card figcaption { margin-top: 14px; text-align: center; }
.viewer-card figcaption strong { display: block; font-size: 17px; font-weight: 600; line-height: 1.3; }
.viewer-meta { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; color: var(--text-3); }
.viewer-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: 16px;
}
.viewer-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
}
.viewer-arrow.prev { grid-column: 1; }
.viewer-arrow.next { grid-column: 3; }
.viewer-arrow[disabled] { opacity: 0.2; }
.viewer-hint { grid-column: 1 / -1; margin: 16px 0 0; text-align: center; font-size: 12px; color: var(--text-3); }

/* --- Barra in basso --- */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 10;
  width: min(560px, 100%);
  display: flex;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(11, 10, 16, 0.88);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.nav-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  color: var(--text-3);
  font-size: 17px;
  line-height: 1;
  transition: color var(--t);
}
.nav-item small {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
}
.nav-item.active { color: var(--text); }
.nav-item.active::before {
  content: "";
  position: absolute;
  top: -8px;
  width: 24px;
  height: 2px;
  border-radius: 0 0 3px 3px;
  background: var(--gold);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  z-index: 30;
  max-width: 88%;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes shiny { 0% { transform: translateX(-120%); } 35%, 100% { transform: translateX(120%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* --- Tema chiaro --- */

[data-theme="light"] {
  --bg: #f6f4fa;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1edf7;
  --line: rgba(26, 21, 34, 0.09);
  --line-strong: rgba(26, 21, 34, 0.16);
  --text: #171320;
  --text-2: #554e68;
  --text-3: #837b95;
  --gold: #a5741a;
  --gold-deep: #c69a3d;
  --gold-veil: rgba(198, 154, 61, 0.16);
  --cta-bg: #f0c765;
  --cta-text: #2a1d04;
  --plus: #147c4d;
  --minus: #c02b45;
  --shadow-1: 0 1px 2px rgba(20, 16, 30, 0.06);
  --shadow-2: 0 12px 32px rgba(20, 16, 30, 0.14);
}
[data-theme="light"] body {
  background: radial-gradient(120% 80% at 50% -10%, #ffffff 0%, transparent 55%), var(--bg);
}
[data-theme="light"] .tier-comune { --tier: #55687f; --tier-soft: rgba(85, 104, 127, 0.12); }
[data-theme="light"] .tier-halloween { --tier: #c25a00; --tier-soft: rgba(194, 90, 0, 0.12); }
[data-theme="light"] .tier-natale { --tier: #c0262d; --tier-soft: rgba(192, 38, 45, 0.12); }
[data-theme="light"] .tier-anime { --tier: #0b8b80; --tier-soft: rgba(11, 139, 128, 0.12); }
[data-theme="light"] .tier-forziere { --tier: #8f6200; --tier-soft: rgba(143, 98, 0, 0.12); }
[data-theme="light"] .tier-raro { --tier: #2272c4; --tier-soft: rgba(34, 114, 196, 0.12); }
[data-theme="light"] .tier-epico { --tier: #7d3fc0; --tier-soft: rgba(125, 63, 192, 0.12); }
[data-theme="light"] .tier-leggendario { --tier: #a97c10; --tier-soft: rgba(169, 124, 16, 0.14); }
[data-theme="light"] .tier-staff { --tier: #c93d3d; --tier-soft: rgba(201, 61, 61, 0.12); }
[data-theme="light"] .tier-maledetto { --tier: #2f7d45; --tier-soft: rgba(47, 125, 69, 0.12); }
[data-theme="light"] .tier-niente { --tier: #6f6880; --tier-soft: rgba(111, 104, 128, 0.12); }
[data-theme="light"] .card-image { background: #efecf5; }
[data-theme="light"] .card.locked .card-image {
  background: repeating-linear-gradient(45deg, #f3f0f8, #f3f0f8 6px, #ece8f3 6px, #ece8f3 12px);
}
[data-theme="light"] .viewer { background: rgba(246, 244, 250, 0.94); }
[data-theme="light"] .viewer-image { background: #efecf5; }
[data-theme="light"] .bottom-nav { background: rgba(255, 255, 255, 0.9); }
[data-theme="light"] .points { background: rgba(23, 19, 32, 0.05); }
[data-theme="light"] .progress, [data-theme="light"] .set-line { background: rgba(23, 19, 32, 0.08); }
[data-theme="light"] .ring-track { stroke: rgba(23, 19, 32, 0.1); }
[data-theme="light"] .copies { background: rgba(255, 255, 255, 0.9); color: var(--text); }
[data-theme="light"] .skeleton {
  background: linear-gradient(100deg, #f1eef7 30%, #f8f6fb 45%, #f1eef7 60%) 0 0 / 200% 100%;
}

/* Missioni personali: nessuna variazione alle carte e alle sezioni esistenti. */
.mission-panel { margin: 24px 0; padding: 20px; border: 1px solid #b895593d; border-radius: 22px; background: linear-gradient(145deg,#b8955912,transparent); }
.mission-heading { display:flex; align-items:center; gap:14px; }
.mission-heading h2 { margin:0; font-size:19px; }
.mission-heading small { opacity:.65; }
.commemorative-avatar { width:54px; height:54px; border-radius:50%; display:grid; place-items:center; font-weight:800; font-size:24px; border:2px solid #b8955944; flex-shrink:0; }
.commemorative-avatar.framed { border:3px double #b89559; box-shadow:0 0 0 4px #b8955925,inset 0 0 0 3px #b8955920; }
.mission-panel p { font-size:13px; line-height:1.6; opacity:.8; }
.mission-days { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:5px; margin-top:18px; }
.mission-day { display:flex; flex-direction:column; align-items:center; padding:8px 0; border-radius:10px; border:1px solid #8883; }
.mission-day small { font-size:10px; opacity:.65; }
.mission-day b { font-size:20px; }
.mission-day.good { color:#3eae84; background:#3eae8412; }
.mission-day.broken { color:#ce6e69; background:#ce6e6912; }
.mission-day.provisional { border-style:dashed; }
.mission-score strong { font-size:24px; }
.mission-earned { padding:12px; border-radius:12px; background:#b8955920; }
.mission-panel details { margin-top:14px; padding-top:12px; border-top:1px solid #8883; }
.mission-panel summary { cursor:pointer; font-size:14px; font-weight:600; }
.mission-showcase ul { list-style:none; padding:0; }
.mission-showcase li { display:flex; justify-content:space-between; gap:12px; padding:8px 0; font-size:12px; }
.mission-showcase li small { opacity:.7; white-space:nowrap; }

.recognition-badges { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin:18px 0; }
.recognition-badges[hidden] { display:none; }
.recognition-badge { display:flex; flex-direction:column; align-items:center; gap:6px; padding:12px 8px; border:1px solid var(--line-strong); border-radius:var(--r-lg); background:var(--surface); text-align:center; text-decoration:none; color:var(--text); }
.recognition-badge img { display:block; width:74px; height:82px; }
.recognition-badge strong { font-size:12px; line-height:1.35; }
.recognition-badge small { font-size:10px; color:var(--text-2); }

.manual-medal{background:#15213c;color:#fff}.manual-medal strong{color:#fff;overflow-wrap:anywhere;white-space:pre-line}.mission-showcase li.manual-medal{display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px;border-radius:14px}

.manual-badges{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:8px 0 14px}.manual-badges[hidden]{display:none}.manual-badges .manual-medal{padding:8px 4px;gap:5px;border-radius:12px}.manual-badges .manual-medal img{width:52px;height:58px;object-fit:contain}.manual-badges .manual-medal strong{font-size:10px;line-height:1.3;max-width:100%}

.manual-medal .manual-name{display:block;color:#fff;font-size:10px;line-height:1.3;overflow-wrap:anywhere}.manual-medal .manual-caption{display:block;color:#fff;font-size:9px;line-height:1.3;white-space:pre-line;overflow-wrap:anywhere}

/* Opzione C: medaglie compatte e barra delle campagne. */
.manual-badges{gap:4px;margin:3px 0 10px}
.manual-badges .manual-medal{background:transparent;border:0;border-radius:0;padding:2px;gap:2px}
.manual-badges .manual-medal img{width:26px;height:28px}
.manual-badges .manual-medal .manual-name{font-size:9px;line-height:1.2}
.manual-badges .manual-medal .manual-caption{font-size:8px;line-height:1.2}
.campaign-ribbons{display:flex;justify-content:center;gap:8px;margin:10px 0;padding:8px;border:1px solid var(--line-strong);border-radius:10px;background:var(--surface)}
.campaign-ribbons[hidden]{display:none}
.campaign-award{flex:1;min-width:0;max-width:150px;display:flex;flex-direction:column;align-items:center;gap:3px;text-align:center;color:var(--text);text-decoration:none}
.campaign-ribbon{display:block;width:100%;height:20px;border:1px solid #bfa168;border-radius:2px;box-shadow:inset 0 2px 2px #fff4,inset 0 -3px 3px #0006,0 2px 5px #0005;color:#f4d779;text-shadow:0 1px 2px #000;font-size:15px;line-height:18px}
.ribbon-frame{background:linear-gradient(90deg,#6a2441 0 18%,#ddb955 18% 27%,#144f48 27% 73%,#ddb955 73% 82%,#6a2441 82%)}
.ribbon-tenacity{background:linear-gradient(90deg,#22395e 0 14%,#d2d7dc 14% 21%,#244c76 21% 43%,#d2d7dc 43% 57%,#244c76 57% 79%,#d2d7dc 79% 86%,#22395e 86%)}
.campaign-award strong{font-size:9px;line-height:1.2}
.campaign-award .ribbon-user{color:#fff;font-size:10px;line-height:1.2;overflow-wrap:anywhere;max-width:100%}
.campaign-award small{font-size:8px;line-height:1.2;color:var(--text-2)}
.campaign-ribbons{background:#16131f;color:#f5f2f8}
.campaign-award{color:#f5f2f8}
.campaign-award small{color:#aaa3b5}
html[data-theme="light"] .manual-badges{background:#16131f;border-radius:10px;padding:4px}

.campaign-ribbons{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:start}
.campaign-award{width:100%;max-width:none}
.campaign-ribbons{grid-template-columns:repeat(auto-fit,minmax(90px,1fr))}

/* Medaglie con alloro approvate: dimensioni compatte, senza nastro. */
.manual-badges .manual-medal img{width:30px;height:30px}

/* Medaglie della vetrina: fila e posizione come classi (la CSP vieta gli attributi style). */
.manual-badges .medal-row-1{grid-row:1}.manual-badges .medal-row-2{grid-row:2}
.manual-badges .medal-col-1{grid-column:1}.manual-badges .medal-col-2{grid-column:2}.manual-badges .medal-col-3{grid-column:3}
.manual-badges .manual-medal img{object-fit:contain}
/* Sfida settimanale: progresso di oggi. */
.mission-panel .mission-today{margin:12px 0 0;padding:10px 12px;border-radius:12px;border:1px solid #8883;opacity:1}
.mission-panel .mission-today b{margin-right:4px}
.mission-today.good{color:#3eae84;background:#3eae8412;border-color:#3eae8440}
.mission-today.broken{color:#ce6e69;background:#ce6e6912;border-color:#ce6e6940}
.mission-panel .mission-preview{padding:10px 12px;border-radius:12px;background:#b8955920;opacity:1}
/* Tenacia settimanale: striscia lunedi-domenica con i tentativi del giorno. */
.mission-panel .mission-tenacity{margin-top:18px;padding-top:14px;border-top:1px solid #8883}
.mission-tenacity h3{margin:0;font-size:16px}
.mission-tenacity .mission-day b{font-size:16px;line-height:24px;font-variant-numeric:tabular-nums}
.mission-day.off,.mission-day.future{opacity:.45}

/* Periodi delle edizioni: il set rimane sfogliabile dopo la chiusura. */
.set-period { display:flex; flex-wrap:wrap; justify-content:center; gap:4px 10px; margin:7px 0; font-size:12px; line-height:1.5; }
.set-period strong { border:1px solid currentColor; border-radius:12px; padding:0 8px; }
.set-period.closed { color:var(--text-2); }
/* Set predisposto ma non ancora aperto: caselle attenuate e «In arrivo» al centro. */
.card-grid-wrap { position:relative; }
.card-grid-wrap.upcoming .card-grid { opacity:.35; filter:saturate(.4); pointer-events:none; }
.upcoming-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; }
.upcoming-badge { display:flex; flex-direction:column; align-items:center; gap:4px; padding:14px 22px; border-radius:16px; border:1px solid var(--gold); background:var(--surface); box-shadow:0 10px 30px rgba(0,0,0,.35); text-align:center; }
.upcoming-badge strong { font-size:22px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--gold); }
.upcoming-badge span { font-size:13px; color:var(--text-2); }
[data-theme="light"] .upcoming-badge { box-shadow:0 8px 24px rgba(30,20,60,.18); }

/* Archivio personale: le carte ritirate restano leggibili anche su schermi stretti. */
.retired-piece { display:flex; align-items:center; gap:.65rem; }
.retired-piece img { flex:0 0 48px; object-fit:cover; border-radius:8px; }
.retired-piece span { min-width:0; overflow-wrap:anywhere; }
.retired-piece small { display:block; opacity:.72; margin-top:.25rem; }
.recent-placeholder { width:48px; text-align:center; font-size:1.7rem; }
.recent.lost img { filter: grayscale(1); opacity: .55; }
/* Livelli delle carte (copie possedute): cornice e medaglia, dopo i gradi così hanno la precedenza. */
.card.level-bronzo, .card.level-bronzo.grade { border: 2px solid #b8763c; }
.card.level-argento, .card.level-argento.grade { border: 2px solid #c9ced8; }
.card.level-oro, .card.level-oro.grade { border: 2px solid #f2c14e; box-shadow: 0 0 12px rgba(242, 193, 78, 0.45); }
.copies.level-bronzo { border-color: #b8763c; }
.copies.level-argento { border-color: #c9ced8; }
.copies.level-oro { border-color: #f2c14e; color: #f2c14e; }
[data-theme="light"] .card.level-argento, [data-theme="light"] .card.level-argento.grade { border-color: #9aa1ad; }
[data-theme="light"] .card.level-oro, [data-theme="light"] .card.level-oro.grade { border-color: #d4a017; box-shadow: 0 0 10px rgba(212, 160, 23, 0.35); }
[data-theme="light"] .copies.level-oro { color: #a07405; border-color: #d4a017; }
.level-legend { margin: 10px 2px 0; font-size: 12px; color: var(--text-3); text-align: center; }
.recent.lost .recent-title { text-decoration: line-through; }

/* Info: pulsante verso il canale di stato dei bot, prima di «Come si gioca». */
.status-entry { margin: 4px 0 18px; }
a.status-button { width: 100%; min-height: 44px; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--gold); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--gold-veil); font-size: 13px; font-weight: 600; }
a.status-button:hover { color: var(--gold); filter: brightness(1.06); }
.status-button svg { flex: 0 0 auto; }
.status-button > span:nth-child(2) { margin-right: auto; }
.status-button > :last-child { font-size: 20px; line-height: 1; }

/* Gradi delle carte dentro un set (Natale 2026): colore della cornice, delle stelle e del ? delle caselle vuote. */
.grade-comune { --grade: #c3c9d4; --grade-soft: rgba(195, 201, 212, 0.4); }
.grade-rara { --grade: #4f9dff; --grade-soft: rgba(79, 157, 255, 0.45); }
.grade-epica { --grade: #b26bff; --grade-soft: rgba(178, 107, 255, 0.45); }
.grade-leggendaria { --grade: #ffc23d; --grade-soft: rgba(255, 194, 61, 0.45); }
.grade-mitica { --grade: #ff4fa3; --grade-soft: rgba(255, 79, 163, 0.5); }
.card.grade { border-color: var(--grade-soft); }
.card.grade::before { background: var(--grade); }
.card.grade[data-owned]:hover { border-color: var(--grade); }
.card.locked.grade::before { opacity: 0.7; }
.card.locked.grade .card-image { color: var(--grade); font-weight: 700; text-shadow: 0 0 14px var(--grade-soft); }
.grade-tag {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(11, 10, 16, 0.82);
  border: 1px solid var(--grade);
  color: var(--grade);
  font-size: 10px;
  line-height: 16px;
  letter-spacing: 1px;
}
/* La mitica ha la cornice che cambia colore, anche quando manca. */
.card.grade-mitica::before {
  height: 3px;
  opacity: 1;
  background: linear-gradient(90deg, #ff4fa3, #ffc23d, #4f9dff, #b26bff, #ff4fa3);
  background-size: 200% 100%;
  animation: mythic 3s linear infinite;
}
@keyframes mythic { to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) { .card.grade-mitica::before { animation: none; } }
/* Caselle vuote dei set con i gradi: bordo, fondo e ? del colore del grado, ben distinguibili.
   Nei set «in arrivo» la griglia non si spegne, altrimenti i colori non si vedono. */
.grade-comune { --grade-tint: rgba(195, 201, 212, 0.16); }
.grade-rara { --grade-tint: rgba(79, 157, 255, 0.2); }
.grade-epica { --grade-tint: rgba(178, 107, 255, 0.2); }
.grade-leggendaria { --grade-tint: rgba(255, 194, 61, 0.2); }
.grade-mitica { --grade-tint: rgba(255, 79, 163, 0.22); }
[data-theme="light"] .grade-comune { --grade-tint: rgba(107, 114, 128, 0.12); }
[data-theme="light"] .grade-rara { --grade-tint: rgba(29, 111, 216, 0.14); }
[data-theme="light"] .grade-epica { --grade-tint: rgba(139, 63, 217, 0.14); }
[data-theme="light"] .grade-leggendaria { --grade-tint: rgba(183, 121, 31, 0.16); }
[data-theme="light"] .grade-mitica { --grade-tint: rgba(214, 38, 111, 0.15); }
.card.locked.grade { border: 1.5px dashed var(--grade); }
.card.locked.grade .card-image,
[data-theme="light"] .card.locked.grade .card-image { background: var(--grade-tint); font-size: 30px; font-weight: 800; }
.card-grid-wrap.upcoming.graded .card-grid { opacity: 0.9; filter: none; }
.viewer-card.grade .stars { color: var(--grade); }
.recent.grade .badge { color: var(--grade); }
[data-theme="light"] .grade-comune { --grade: #6b7280; --grade-soft: rgba(107, 114, 128, 0.4); }
[data-theme="light"] .grade-rara { --grade: #1d6fd8; --grade-soft: rgba(29, 111, 216, 0.4); }
[data-theme="light"] .grade-epica { --grade: #8b3fd9; --grade-soft: rgba(139, 63, 217, 0.4); }
[data-theme="light"] .grade-leggendaria { --grade: #b7791f; --grade-soft: rgba(183, 121, 31, 0.45); }
[data-theme="light"] .grade-mitica { --grade: #d6266f; --grade-soft: rgba(214, 38, 111, 0.45); }
[data-theme="light"] .grade-tag { background: rgba(255, 255, 255, 0.92); }

/* --- I Lestofanti: avviso di furto di un pezzo unico ------------------------------------------
   Notturno e cinematografico: nero, grigio-blu e ambra, titolo in serif, niente neon. Vive sopra
   ogni altra cosa e rispetta le aree sicure dello schermo. */
.theft {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 14px) 14px calc(env(safe-area-inset-bottom) + 14px);
  background: rgba(3, 4, 8, .86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow-y: auto;
}
.theft[hidden] { display: none; }
.theft-sheet {
  position: relative;
  width: min(430px, 100%);
  margin: auto;
  border-radius: 18px;
  border: 1px solid rgba(201, 162, 77, .42);
  background: linear-gradient(180deg, #0a0c12 0%, #0c0e15 46%, #08090e 100%);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 255, 255, .03);
  overflow: hidden;
  text-align: center;
  color: #e8e3d8;
  animation: theft-in .34s ease-out both;
}
@keyframes theft-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .theft-sheet { animation: none; } }
.theft-art { position: relative; line-height: 0; }
.theft-art img { width: 100%; height: auto; display: block; }
/* L'illustrazione sfuma nel foglio: niente taglio netto fra immagine e testo. */
.theft-art::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(10, 12, 18, 0) 0%, rgba(10, 12, 18, .72) 58%, #0a0c12 100%);
  pointer-events: none;
}
.theft-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 77, .5);
  background: rgba(8, 9, 14, .64);
  color: #d8cdb4;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.theft-close:hover { background: rgba(8, 9, 14, .85); }
.theft-title {
  margin: -14px 18px 0;
  position: relative;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: .012em;
  line-height: 1.12;
  text-transform: uppercase;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .8);
}
.theft-title span { display: block; font-size: 20px; color: #cfc6b4; }
.theft-title em {
  display: block;
  font-style: normal;
  font-size: 25px;
  color: #fbf4e6;
  padding-bottom: 10px;
  background: radial-gradient(60% 4px at 50% 100%, rgba(176, 28, 28, .95), rgba(176, 28, 28, 0) 72%) no-repeat bottom;
}
.theft-item {
  margin: 14px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 86%;
}
.theft-item[hidden] { display: none; }
.theft-item img {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(201, 162, 77, .55);
  flex: none;
}
.theft-item figcaption {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  color: #e2d6bb;
  text-align: left;
  overflow-wrap: anywhere;
}
.theft-body {
  margin: 14px 22px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14.5px;
  line-height: 1.58;
  color: #cdc6ba;
}
.theft-rule { margin: 16px auto 0; display: flex; align-items: center; justify-content: center; gap: 10px; width: 72%; }
.theft-rule::before, .theft-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(201, 162, 77, 0), rgba(201, 162, 77, .55), rgba(201, 162, 77, 0));
}
/* Il buco della serratura, disegnato: nessuna icona in piu' da caricare. */
.theft-rule span { position: relative; width: 9px; height: 13px; flex: none; }
.theft-rule span::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border-radius: 50%;
  background: #c9a24d;
}
.theft-rule span::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  margin-left: -2px;
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  border-bottom: 8px solid #c9a24d;
}
.theft-quote {
  margin: 14px 24px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 14px;
  line-height: 1.55;
  color: #b9ab8c;
}
.theft-where {
  margin: 12px 24px 0;
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #7e8698;
}
.theft-where:empty { display: none; }
.theft-ok {
  margin: 18px auto calc(20px + env(safe-area-inset-bottom) / 2);
  display: block;
  min-width: 190px;
  padding: 12px 34px;
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 77, .72);
  background: linear-gradient(180deg, #4a1016 0%, #2c0a0e 100%);
  color: #f3e7cf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  letter-spacing: .1em;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 220, 160, .2);
}
.theft-ok:hover { background: linear-gradient(180deg, #5b141b 0%, #350c11 100%); }
.theft-ok:disabled { opacity: .6; cursor: default; }
@media (max-width: 360px) {
  .theft-title span { font-size: 18px; }
  .theft-title em { font-size: 22px; }
  .theft-body, .theft-quote { margin-left: 16px; margin-right: 16px; }
}

/* Indicatore narrativo sui pezzi unici posseduti: protetto, oppure gia' nel mirino. */
.card .watch {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid rgba(201, 162, 77, .5);
  background: rgba(8, 9, 14, .78);
  color: #d9cdb0;
}
.card .watch.seen { border-color: rgba(176, 28, 28, .65); color: #f0c9c0; }
