@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700;900&display=swap');

/* ═══ RESET & VARIABILI ═══ */
:root {
  color-scheme: dark;
  --bg:           #0e1d30;
  --panel:        #18293f;
  --panel-alt:    #142236;
  --panel-hover:  #1e324d;
  --text:         #ede0c8;
  --muted:        #91a8c4;
  --line:         #2c435e;
  --accent:       #d4920e;
  --accent-dark:  #b87a0b;
  --accent-light: #f5c842;
  --accent-glow:  rgba(212,146,14,0.16);
  --warn:         #cc4444;
  --good:         #2da86e;
  --shadow:       0 4px 20px rgba(0,0,0,0.5);
  --shadow-gold:  0 0 28px rgba(212,146,14,0.14);
  --navbar-h:     62px;
  --bottom-nav-h: 60px;
  --r:            10px;
  --r-sm:         7px;
}

/* CRITICO: [hidden] batte sempre display da CSS */
[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 10% 0%,   rgba(212,146,14,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 100%, rgba(0,30,80,0.5)     0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-top: var(--navbar-h);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; font-family: 'Cinzel', serif; }
h1 { font-size: 26px; font-weight: 900; line-height: 1; letter-spacing: 0.04em; }
h2 { font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }


/* ═══ NAVBAR ═══ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  background: rgba(6,12,24,0.97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(212,146,14,0.2), 0 4px 24px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: none;
  background: none;
  padding: 4px 0;
  cursor: pointer;
  flex-shrink: 0;
  text-align: left;
}

.navbar-brand h1 {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 50%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity 0.15s;
}
.navbar-brand:hover h1 { opacity: 0.8; }

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.view-tab {
  width: 132px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  padding: 0 18px;
  font-weight: 700;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.view-tab:hover { color: var(--accent); border-color: rgba(212,146,14,0.25); }
.view-tab.active { background: linear-gradient(135deg,#e8a820,#c4841a); color: #060c18; border-color: transparent; }

.navbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.navbar-account-btn {
  min-width: 96px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  font-family: 'Cinzel', serif;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.navbar-account-btn:hover {
  color: var(--accent);
  border-color: rgba(212,146,14,0.4);
  background: rgba(212,146,14,0.06);
}

.navbar-icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.navbar-icon-btn:hover { color: var(--accent); border-color: rgba(212,146,14,0.4); background: rgba(212,146,14,0.06); }

.toast {
  position: fixed;
  right: 18px;
  top: calc(var(--navbar-h) + 14px);
  z-index: 1200;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid rgba(212,146,14,0.36);
  border-radius: var(--r-sm);
  background: rgba(14,24,40,0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px;
}


/* ═══ BOTTONI ═══ */
.primary-button, .ghost-button {
  min-height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.primary-button {
  background: linear-gradient(135deg,#e8a820,#c4841a);
  color: #060c18;
  border-color: #e8a820;
  font-weight: 800;
}
.primary-button:hover { background: linear-gradient(135deg,var(--accent-light),var(--accent)); box-shadow: 0 0 18px rgba(212,146,14,0.4); }

.ghost-button { background: transparent; color: var(--text); border-color: var(--line); }
.ghost-button:hover { border-color: var(--accent); color: var(--accent); background: rgba(212,146,14,0.06); }

.primary-button:disabled,
.ghost-button:disabled   { cursor: not-allowed; opacity: 0.35; }

.danger-button       { color: var(--warn); }
.danger-button:hover { border-color: var(--warn); color: var(--warn); background: rgba(204,68,68,0.07); }

.wide { width: 100%; }

.icon-button {
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--warn);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.icon-button:hover { border-color: var(--warn); background: rgba(204,68,68,0.08); }


/* ═══ SETTINGS DRAWER ═══ */
.settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  justify-content: flex-end;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  border: none;
  cursor: pointer;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.settings-panel {
  position: relative;
  z-index: 1;
  width: min(360px, 90vw);
  height: 100%;
  background: #0a1424;
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.settings-header h2 { font-size: 16px; }

.settings-body {
  flex: 1;
  overflow: auto;
  padding: 8px 0;
}

.settings-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.settings-section:last-child { border-bottom: none; }

.admin-users-list {
  display: grid;
  gap: 8px;
}
.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel-alt);
  font-size: 12px;
}
.admin-user-row strong { color: var(--text); }
.admin-user-row span { color: var(--muted); }

.settings-section-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-family: 'Cinzel', serif;
}


/* ═══ LAYOUT PRINCIPALE ═══ */
.layout {
  padding: 24px 28px 60px;
  max-width: 1600px;
  margin: 0 auto;
}


/* ═══ BREADCRUMB ═══ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumb-home {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}
.breadcrumb-home:hover { opacity: 0.7; }
.breadcrumb-sep { color: var(--line); }


/* ═══ HOMEPAGE ═══ */
.home-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--navbar-h) - 60px);
  padding: 20px 0;
  gap: 32px;
}

.home-hero {
  display: flex;
  align-items: center;
  gap: 20px;
}
.home-hero-img {
  height: 72px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(212,146,14,0.4));
}
.home-hero-text {
  display: grid;
  gap: 2px;
}
.home-hero-text .eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.home-hero-title {
  font-family: 'Cinzel', serif;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0.02em;
}

.home-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  grid-auto-rows: 1fr;
  gap: 20px;
  width: 100%;
  max-width: 860px;
}

.home-card {
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(145deg,#0e1828 0%,#091018 100%);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 32px 28px;
  min-height: 178px;
  height: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.home-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 110%, rgba(212,146,14,0.1) 0%, transparent 65%);
  pointer-events: none;
}

.home-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow), var(--shadow-gold);
  transform: translateY(-3px);
}

.home-card-icon {
  font-size: 44px; line-height: 1; flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(212,146,14,0.5));
}

.home-card-body { display: grid; gap: 6px; flex: 1; min-width: 0; }

.home-card strong {
  font-size: 24px; line-height: 1.15;
  font-family: 'Cinzel', serif; font-weight: 700;
  color: var(--text);
}

.home-card-desc { color: var(--muted); font-size: 13px; line-height: 1.5; font-style: normal; }

.home-card-arrow {
  color: var(--accent); font-size: 22px; flex-shrink: 0;
  opacity: 0; transform: translateX(-6px);
  transition: opacity 0.2s, transform 0.2s;
}
.home-card:hover .home-card-arrow { opacity: 1; transform: translateX(0); }


/* ═══ METRICS ═══ */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 12px;
}

.metric {
  padding: 16px 18px;
  background: linear-gradient(135deg,#0e1828,#0b1420);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.metric:hover { border-color: rgba(212,146,14,0.35); box-shadow: var(--shadow-gold); }

.metric span {
  display: block; color: var(--muted);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.metric strong {
  display: block; font-size: 22px; font-weight: 800; line-height: 1.1;
  color: var(--accent); font-family: 'Cinzel', serif;
}


/* ═══ PANEL BASE ═══ */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}

.panel-heading {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}

.filters-toggle-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 7px 12px;
  background: var(--panel-alt); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--muted);
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.filters-toggle-btn:hover { border-color: var(--accent); color: var(--text); }
.filters-toggle-btn.open  { border-color: var(--accent); color: var(--accent); }
.filters-toggle-icon { font-size: 11px; transition: transform .2s; }
.filters-toggle-btn.open .filters-toggle-icon { transform: rotate(180deg); }

.deck-filters { display: grid; gap: 8px; }

.table-wrap {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); overflow: auto;
}


/* ═══ COLLEZIONE ═══ */
/* ═══ SEARCH PAGE ═══ */
.search-page { display: grid; gap: 0; }

.search-page-layout {
  display: grid;
  grid-template-columns: 260px minmax(0,1fr);
  grid-template-rows: auto 1fr;
  gap: 14px;
  align-items: start;
}

.search-filters-panel {
  grid-column: 1; grid-row: 1;
  position: sticky;
  top: calc(var(--navbar-h) + 12px);
}

.add-panel {
  grid-column: 1; grid-row: 2;
  display: grid; gap: 14px;
}

.search-results-grid {
  grid-column: 2; grid-row: 1 / 3;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  align-content: start;
}

/* Card risultato (verticale, con immagine prominente) */
.result-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-alt); overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.result-card:hover { border-color: rgba(212,146,14,0.5); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.4); }
.result-card-inner {
  display: flex; flex-direction: column;
  background: none; border: none; padding: 0;
  text-align: left; cursor: pointer; width: 100%;
}
.result-card-img-wrap {
  position: relative; overflow: hidden;
}
.result-card-img-wrap img {
  width: 100%; aspect-ratio: 5/7; object-fit: cover; object-position: top;
  display: block; cursor: zoom-in;
  transition: transform .2s;
}
.result-card:hover .result-card-img-wrap img { transform: scale(1.03); }
.result-card-info {
  padding: 7px 8px; display: flex; flex-direction: column; gap: 3px;
  flex: 1;
}
.result-card-name  { font-size: 11px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-card-meta  { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-card-price { font-size: 10px; color: var(--accent); font-weight: 700; margin-top: 2px; }

/* Badge lingua sul risultato */
.lang-badge {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,0.7); color: var(--text);
  font-size: 9px; font-weight: 800; letter-spacing: 0.05em;
  padding: 2px 5px; border-radius: 3px;
}
.lang-badge.jp { background: rgba(204,68,68,0.85); }

/* Panel "aggiungi" — visibile solo dopo selezione */
.add-panel .selected-preview {
  display: grid; grid-template-columns: 80px minmax(0,1fr);
  gap: 10px; align-items: start;
  padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.add-panel .selected-thumb {
  width: 80px; height: 112px; border-radius: 4px; object-fit: cover; object-position: top;
}
.add-panel .selected-copy { display: grid; gap: 5px; }
.add-panel .selected-copy strong { font-size: 13px; font-family: 'Cinzel', serif; }
.add-panel .selected-copy span   { font-size: 11px; color: var(--muted); }

/* ═══ COLLECTION (solo tabella) ═══ */
.collection-layout { display: grid; gap: 14px; }

/* hover tooltip immagine (desktop) */
.card-hover-tooltip {
  position: fixed; z-index: 1000;
  pointer-events: none;
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 0 1px var(--line);
  transition: opacity .12s;
}
.card-hover-tooltip img {
  width: 200px; display: block;
}

/* zoom overlay mobile/click */
.img-zoom-overlay {
  position: fixed; inset: 0; z-index: 1001;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  backdrop-filter: blur(4px);
}
.img-zoom-overlay img {
  max-width: min(90vw, 360px);
  max-height: 90dvh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  object-fit: contain;
}

.print-proxy-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.section-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 14px 18px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r);
}

.section-title { font-size: 15px; font-family: 'Cinzel', serif; }

.toolbar-filters {
  display: grid;
  grid-template-columns: minmax(160px,1fr) minmax(110px,150px) minmax(90px,130px);
  gap: 8px;
  width: min(100%, 580px);
}


/* ═══ FORM ═══ */
.stack { display: grid; gap: 12px; }

label {
  display: grid; gap: 5px;
  color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
}

.checkbox-line {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 10px;
  border-radius: var(--r-sm); cursor: pointer;
  text-transform: none; letter-spacing: 0; font-size: 13px;
}
.checkbox-line input { width: 18px; min-height: 18px; accent-color: var(--accent); }
.checkbox-line:hover { background: rgba(212,146,14,0.06); }

input, select, textarea {
  width: 100%; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: #060e1c;
  color: var(--text); min-height: 40px; padding: 8px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select option { background: var(--panel); color: var(--text); }
textarea { resize: vertical; }
input::placeholder { color: var(--muted); opacity: 0.55; }

input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,146,14,0.12);
}

.inline-fields { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.filter-row    { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.help-text     { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.muted         { margin: 4px 0 0; color: var(--muted); font-size: 13px; }


/* ═══ SEARCH RESULTS (legacy, kept for any remaining use) ═══ */
.search-results { display: grid; gap: 8px; }


/* ═══ SELECTED PREVIEW ═══ */
.selected-preview {
  display: grid; grid-template-columns: 170px minmax(0,1fr); gap: 14px;
  align-items: center; padding: 14px;
  border: 1px solid var(--accent); border-radius: var(--r);
  background: rgba(212,146,14,0.06);
}
.selected-thumb {
  width: 170px; height: 238px; border: 1px solid var(--line); border-radius: 6px;
  background: #0a1220; object-fit: cover; object-position: top;
}
.selected-copy          { display: grid; gap: 8px; }
.selected-copy strong   { font-size: 16px; font-family: 'Cinzel', serif; }
.selected-copy span     { color: var(--muted); font-size: 13px; }


/* ═══ THUMBNAILS ═══ */
.thumb, .card-thumb {
  border: 1px solid var(--line); background: #0a1220;
  object-fit: cover; object-position: top;
}
.thumb      { width: 112px; height: 156px; border-radius: 4px; }
.card-thumb { width: 96px;  height: 134px; border-radius: 4px; }

.thumb-placeholder { display: grid; place-items: center; color: var(--muted); font-size: 11px; }

.card-with-thumb { display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 12px; align-items: center; }


/* ═══ TABLE ═══ */
table { width: 100%; border-collapse: collapse; min-width: 760px; }

th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }

th {
  color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; font-family: 'Cinzel', serif; white-space: nowrap;
  background: rgba(6,12,24,0.7); position: sticky; top: 0; z-index: 1;
}
td { font-size: 14px; color: var(--text); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(212,146,14,0.03); }

.card-title        { display: grid; gap: 3px; }
.card-title strong { overflow-wrap: anywhere; }
.tagline           { color: var(--muted); font-size: 12px; }

.mobile-price-summary { display: none; }

.lang-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 18px; margin-right: 6px; padding: 0 5px;
  border-radius: 4px; font-size: 10px; font-weight: 800; vertical-align: 1px;
}
.lang-badge.en { background: rgba(40,100,220,0.18); color: #6fa8f5; border: 1px solid rgba(40,100,220,0.25); }
.lang-badge.jp { background: rgba(200,40,40,0.15);  color: #e88080; border: 1px solid rgba(200,40,40,0.25); }

.muted-cell     { color: var(--muted); }
.delta-positive { color: var(--good); font-weight: 700; }
.delta-negative { color: var(--warn); font-weight: 700; }


/* ═══ DECK LAYOUT ═══ */
.deck-layout { display: grid; gap: 0; }
.proxy-layout { display: grid; gap: 14px; }
.proxy-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.proxy-toolbar h2 { margin: 0; }
.proxy-list-panel {
  max-height: calc(100vh - var(--navbar-h) - 160px);
  overflow: auto;
}


/* ── Deck manager (lista deck, full-width) ── */
.deck-manager-view { display: grid; gap: 16px; }

.deck-manager-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.deck-manager-header h2 { font-size: 16px; }
.deck-manager-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.deck-create-form {
  display: flex; gap: 8px; align-items: center;
}
.deck-create-form input { min-width: 200px; flex: 1; }
.deck-create-form .primary-button { white-space: nowrap; }

/* Griglia di card deck */
.deck-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 14px;
}

.deck-grid-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel-alt);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  cursor: pointer;
}
.deck-grid-card:hover {
  border-color: rgba(212,146,14,0.4);
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}
.deck-grid-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(212,146,14,0.15);
}

.deck-grid-thumb {
  width: 100%; height: 130px;
  overflow: hidden; position: relative;
  background: #070d1a;
}
.deck-grid-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
  display: block;
}
.deck-grid-thumb .thumb-placeholder {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: var(--muted); font-size: 11px;
}

.deck-grid-info {
  padding: 10px 12px 8px;
  display: grid; gap: 3px; flex: 1;
}
.deck-grid-info strong { font-size: 13px; font-weight: 700; overflow-wrap: anywhere; color: var(--text); }
.deck-grid-info span   { font-size: 11px; color: var(--muted); }

.deck-grid-actions {
  display: grid; grid-template-columns: 1fr auto;
  gap: 6px; padding: 8px 12px 12px;
  border-top: 1px solid var(--line);
}
.deck-grid-actions button { min-height: 30px; font-size: 12px; }


/* ── Deck editor (2 colonne + tab) ── */
.deck-editor { display: grid; gap: 14px; }

.deck-editor-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 12px 16px;
}

.deck-toolbar-left {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0;
}

.deck-name-group { display: flex; align-items: center; gap: 6px; }
.deck-name-group input { width: 180px; min-height: 34px; }

.deck-toolbar-right {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0;
}

.deck-status-text { margin: 0; font-size: 12px; color: var(--muted); }

.deck-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Ricerca: sticky — lo scroll avviene solo sul div risultati, non sul pannello intero */
.deck-search-panel {
  position: sticky;
  top: calc(var(--navbar-h) + 12px);
  max-height: calc(100vh - var(--navbar-h) - 24px);
  overflow: visible;
  display: flex; flex-direction: column;
  transition: all .2s;
}

.search-panel-heading {
  display: flex; align-items: center; justify-content: space-between;
}

.search-collapse-btn {
  display: none; /* solo mobile, mostrato nel @media ≤640px */
}

/* pannello collassato */
.deck-search-panel.collapsed .search-collapse-btn { transform: rotate(180deg); }
.deck-search-panel.collapsed .stack { display: none; }

.deck-search-results {
  flex: 1; overflow-y: auto;
  max-height: calc(100vh - var(--navbar-h) - 220px);
  display: flex; flex-direction: column; gap: 8px;
}
.deck-cards, .leader-slot, .recommendation-list { display: grid; gap: 8px; }

/* Tab bar */
.deck-content-area { display: flex; flex-direction: column; min-width: 0; }

.deck-tab-bar {
  display: flex;
  gap: 0;
  background: #070d1a;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r) var(--r) 0 0;
  overflow: hidden;
}

.deck-tab {
  flex: 1;
  min-height: 62px;
  border: none;
  border-right: 1px solid var(--line);
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  cursor: pointer;
}

.deck-tab:last-child { border-right: none; }

.deck-tab:hover:not(.active) {
  background: rgba(212,146,14,0.07);
  color: var(--text);
}

.deck-tab.active {
  background: linear-gradient(180deg, rgba(212,146,14,0.18) 0%, rgba(212,146,14,0.05) 100%);
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.deck-tab-icon {
  font-size: 20px;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 0 6px rgba(212,146,14,0));
  transition: filter 0.2s;
}
.deck-tab.active .deck-tab-icon {
  filter: drop-shadow(0 0 8px rgba(212,146,14,0.6));
}

.deck-tab-label {
  font-size: 9px;
  letter-spacing: 0.12em;
}

.tab-badge {
  font-size: 10px; font-weight: 800; font-family: ui-sans-serif, system-ui, sans-serif;
  padding: 1px 7px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.6;
}
.deck-tab.active .tab-badge {
  background: rgba(212,146,14,0.15);
  border-color: rgba(212,146,14,0.4);
  color: var(--accent);
}
.tab-badge.legal {
  background: rgba(45,168,110,0.15);
  border-color: rgba(45,168,110,0.4);
  color: var(--good);
}

/* Tab panels */
.deck-tab-panel {
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  background: var(--panel);
  overflow: auto;
  max-height: calc(100vh - 250px);
  display: grid; gap: 8px;
  padding: 16px;
}

/* Leader card evidenziata nella lista */
#leaderSlot .deck-card-row {
  background: linear-gradient(135deg, rgba(212,146,14,0.10), rgba(212,146,14,0.02));
  border-color: rgba(212,146,14,0.35);
}
#leaderSlot .deck-thumb { width: 80px; height: 112px; }

/* TopDecks tab */
.topdecks-toolbar {
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.topdecks-toolbar select { max-width: 220px; }
.topdecks-body { display: grid; gap: 8px; }

/* Stats tab */
.deck-stats-panel { overflow: auto; }
.deck-section-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.section-actions { display: flex; align-items: center; gap: 8px; }
.section-actions select { min-width: 110px; }



/* ── Carte deck ── */
/* card result wrapper — positions the info button */
.card-result-wrap {
  display: grid;
  grid-template-columns: 36px minmax(0,1fr) 54px;
  align-items: stretch;
  min-height: 110px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-alt);
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
  flex-shrink: 0;
}
.card-result-wrap:hover { border-color: var(--accent); background: rgba(212,146,14,0.04); }
.official-card-result {
  display: grid; grid-template-columns: 92px minmax(0,1fr);
  gap: 12px; align-items: center; width: 100%;
  min-height: 136px;
  padding: 9px; text-align: left; background: none; border: none;
}
/* colonna destra: info btn + quick-add centrati */
.card-result-side {
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  background: rgba(0,0,0,0.08);
}

.card-result-wrap > .card-result-info-btn {
  border-right: 1px solid var(--line);
  background: rgba(0,0,0,0.08);
  border-radius: 0;
  width: 36px;
  height: auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-result-info-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(212,146,14,0.18); border: none;
  color: var(--accent); font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.card-result-info-btn:hover { background: rgba(212,146,14,0.35); }

.official-card-result span, .deck-card-copy { display: grid; gap: 5px; min-width: 0; }
.official-card-result strong, .deck-card-copy strong { color: var(--text); overflow-wrap: anywhere; font-size: 12px; }
.official-card-result small, .deck-card-copy span   { color: var(--muted); font-size: 10px; }
.official-card-result em,    .deck-card-copy small  { color: var(--muted); font-size: 10px; font-style: normal; }

.deck-card-row {
  display: grid; grid-template-columns: 66px minmax(0,1fr) auto;
  gap: 10px; align-items: center; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-alt); padding: 7px; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

/* info button on deck card rows */
.deck-card-info-btn {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: rgba(212,146,14,0.12); border: 1px solid rgba(212,146,14,0.2);
  color: var(--accent); font-size: 11px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

.deck-thumb {
  width: 54px; height: 76px; border: 1px solid var(--line); border-radius: 4px;
  background: #0a1220; object-fit: cover; object-position: top; flex-shrink: 0;
}
.official-card-thumb { width: 92px; height: 128px; border-radius: 6px; }
.deck-card-row .deck-thumb { width: 66px; height: 92px; }


.mini-button, .qty-pill, .count-badge {
  min-width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-alt); font-size: 12px; font-weight: 800;
  transition: border-color 0.15s, color 0.15s;
}
.mini-button:hover     { border-color: var(--accent); color: var(--accent); }
.qty-pill, .count-badge { color: var(--accent); }
.count-badge.legal      { background: rgba(45,168,110,0.12); border-color: rgba(45,168,110,0.35); color: var(--good); }

.empty-slot {
  border: 1px dashed var(--line); border-radius: var(--r-sm);
  padding: 18px; color: var(--muted); text-align: center; font-size: 13px;
}


/* ── Deck stats ── */
.stats-validity {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600;
  margin-bottom: 14px;
}
.stats-validity.ok   { background: rgba(45,168,110,0.12); border: 1px solid rgba(45,168,110,0.28); color: #4dcf8e; }
.stats-validity.warn { background: rgba(204,68,68,0.12);  border: 1px solid rgba(204,68,68,0.28);  color: #e07070; }
.stats-validity-icon { font-size: 16px; flex-shrink: 0; }
.stats-validity ul { margin: 4px 0 0; padding: 0 0 0 16px; }
.stats-validity li { margin-bottom: 2px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 16px;
}
.stat-grid div {
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 8px; background: var(--panel-alt); text-align: center;
}
.stat-grid span   { display: block; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.stat-grid strong { font-size: 18px; font-weight: 900; color: var(--accent); font-family: 'Cinzel', serif; }

.stats-charts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.stats-charts .bar-list:last-child:nth-child(odd) { grid-column: 1 / -1; }

.bar-list { display: grid; gap: 5px; background: var(--panel-alt); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.bar-list h3 { margin: 0 0 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; font-family: 'Cinzel', serif; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.bar-row { display: grid; grid-template-columns: 52px minmax(0,1fr) 22px; gap: 6px; align-items: center; font-size: 11px; color: var(--text); }
.bar-row div { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.07); overflow: hidden; }
.bar-row i   { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-light), var(--accent)); }
.bar-row strong { font-size: 11px; font-weight: 700; color: var(--accent); text-align: right; }


/* ── Recommendation ── */
.recommendation-card { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-alt); overflow: hidden; transition: border-color 0.15s; }
.recommendation-card:hover { border-color: rgba(212,146,14,0.3); }
.recommendation-card summary { display: block; cursor: pointer; padding: 10px 12px; }
.recommendation-card summary::-webkit-details-marker { display: none; }
.recommendation-card[open] summary { border-bottom: 1px solid var(--line); background: rgba(212,146,14,0.04); }
.recommendation-summary { display: grid; gap: 3px; padding-right: 18px; position: relative; }
.recommendation-summary::after { content: "+"; position: absolute; right: 0; top: 0; color: var(--accent); font-weight: 900; font-size: 14px; }
.recommendation-card[open] .recommendation-summary::after { content: "−"; }
.recommendation-card strong, .recommendation-card span, .recommendation-card small, .recommendation-meta { display: block; }
.recommendation-card small { color: var(--muted); margin-top: 3px; }
.recommendation-body { display: grid; gap: 10px; padding: 12px; }
.recommendation-meta { color: var(--muted); font-size: 12px; }
.recommendation-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px,1fr)); gap: 8px; max-height: 340px; overflow: auto; }
.recommended-card-preview { position: relative; display: grid; gap: 3px; min-width: 0; }
.recommended-card-preview img, .recommended-card-preview .thumb-placeholder { width: 100%; aspect-ratio: 5/7; border: 1px solid var(--line); border-radius: 4px; background: #0a1220; object-fit: cover; object-position: top; }
.recommended-card-preview small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: 10px; color: var(--muted); }
.recommended-qty { position: absolute; top: 3px; right: 3px; min-width: 22px; border-radius: 999px; background: rgba(212,146,14,0.92); color: #060c18; font-size: 10px; font-weight: 900; line-height: 18px; text-align: center; z-index: 1; }


/* ═══ MOBILE BOTTOM NAV ═══ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  height: var(--bottom-nav-h);
  background: rgba(6,12,24,0.97);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  grid-template-columns: repeat(4,1fr);
  align-items: stretch;
}

.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; border: none; background: none; color: var(--muted);
  padding: 6px 4px; transition: color 0.15s;
  font-weight: 700;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-icon  { font-size: 20px; line-height: 1; }
.bottom-nav-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }


/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,146,14,0.4); }


/* ═══ RESPONSIVE — TABLET (≤ 1100px) ═══ */
@media (max-width: 1100px) {
  .deck-editor-grid {
    grid-template-columns: 260px minmax(0,1fr) 240px;
  }
}

@media (max-width: 900px) {
  .layout { padding-left: 18px; padding-right: 18px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .search-page-layout { grid-template-columns: 1fr; }
  .search-filters-panel { position: static; }
  .add-panel { grid-column: 1; grid-row: auto; }
  .search-results-grid { grid-column: 1; grid-row: auto; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); }
  .deck-editor-grid { grid-template-columns: 1fr; }
  .deck-search-panel { position: static; max-height: none; overflow: visible; }
  .deck-search-results { max-height: none; }
  .deck-tab-panel { max-height: none; overflow: visible; }
  .deck-library-grid { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); }
  .home-choice { max-width: 100%; }
}


/* ═══ RESPONSIVE — MOBILE (≤ 640px) ═══ */
@media (max-width: 640px) {
  :root { --navbar-h: 54px; }
  body { padding-bottom: var(--bottom-nav-h); }

  .navbar { padding: 0 14px; }
  .navbar-brand h1 { font-size: 22px; }
  .navbar-nav { display: none !important; }

  .bottom-nav { display: grid; }

  .layout { padding: 14px 14px 24px; }

  .home-page { min-height: auto; padding: 20px 0 10px; }
  .home-choice { grid-template-columns: 1fr; gap: 12px; }
  .home-card { padding: 20px 16px; gap: 14px; }
  .home-card-icon { font-size: 34px; }
  .home-card strong { font-size: 20px; }
  .home-card-arrow { display: none; }

  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metric strong { font-size: 18px; }

  .section-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar-filters { grid-template-columns: 1fr; width: 100%; }
  .inline-fields { grid-template-columns: 1fr; }
  .filter-row    { grid-template-columns: 1fr; }

  .search-results-grid { grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); gap: 8px; }

  /* Collection table -> compact card list on mobile */
  .collection-layout .table-wrap {
    background: none;
    border: none;
    overflow: visible;
    padding: 0;
  }
  .collection-layout table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .collection-layout thead { display: none; }
  .collection-layout tbody { display: grid; gap: 10px; }
  .collection-layout tr {
    display: block;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow: hidden;
    position: relative;
    cursor: pointer;
  }
  .collection-layout tr td:first-child {
    display: block;
    padding: 0;
    border-bottom: 0;
  }
  /* hide desktop price columns, but keep delete button (last-child) visible */
  .collection-layout tr td:nth-child(2),
  .collection-layout tr td:nth-child(3),
  .collection-layout tr td:nth-child(4),
  .collection-layout tr td:nth-child(5),
  .collection-layout tr td:nth-child(6) { display: none; }
  .collection-layout tr td:last-child {
    grid-column: 2; grid-row: 1;
    display: flex; align-items: flex-start; justify-content: flex-end;
    padding: 8px 10px;
  }
  .collection-layout tr.collection-empty-row td:first-child {
    display: block;
    padding: 16px;
  }
  .collection-layout .card-with-thumb {
    grid-template-columns: 78px minmax(0,1fr);
    gap: 10px;
    align-items: stretch;
  }
  .collection-layout .card-thumb {
    width: 78px;
    height: 110px;
    border-radius: 0;
  }
  .collection-layout .card-title {
    min-width: 0;
    align-content: center;
    padding: 10px 12px 10px 0;
  }
  .collection-layout .card-title strong {
    display: block;
    font-size: 13px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .collection-layout .tagline { display: none; }
  .mobile-price-summary {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
  }
  .mobile-price-summary strong {
    color: var(--accent);
    font-size: 15px;
    font-weight: 800;
  }

  input, select, textarea { min-height: 46px; font-size: 16px; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats-charts { grid-template-columns: 1fr; }
  .stats-charts .bar-list:last-child:nth-child(odd) { grid-column: auto; }

  .deck-create-form { flex-direction: row; }
  .deck-create-form .primary-button { width: 100%; justify-content: center; }
  .deck-manager-header { align-items: stretch; }
  .deck-manager-header-right { width: 100%; }
  .deck-manager-header-right .deck-create-form { width: 100%; }
  .deck-library-grid { grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 10px; }

  .deck-editor-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .deck-toolbar-left, .deck-toolbar-right { flex-wrap: wrap; }
  .deck-name-group input { width: 100%; }

  .official-card-result {
    grid-template-columns: 72px minmax(0,1fr);
    min-height: 120px;
    padding: 8px;
  }
  .official-card-thumb {
    width: 72px;
    height: 100px;
  }

  .deck-card-row { grid-template-columns: 56px minmax(0,1fr) auto; }
  .deck-thumb { width: 56px; height: 78px; }

  .deck-section-heading { flex-wrap: wrap; }

  .breadcrumb { margin-bottom: 12px; }

  /* Bottone collapse — solo mobile */
  .search-collapse-btn {
    display: flex;
    width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
    background: var(--panel-hover); border: 1px solid var(--line);
    color: var(--muted); font-size: 10px;
    align-items: center; justify-content: center;
    cursor: pointer; transition: transform .2s, color .15s;
  }
  .search-collapse-btn:hover { color: var(--accent); border-color: var(--accent); }

  /* Su mobile i risultati non hanno max-height fissa: scorrono con la pagina */
  .deck-search-results { max-height: none; overflow-y: visible; }
}

/* ═══ MODALE ═══ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow), var(--shadow-gold);
  width: 100%; max-width: 520px;
  max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 20px 0;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; margin-top: 4px; }

.modal-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 18px;
}

.modal-section { display: flex; flex-direction: column; gap: 8px; }
.modal-section label { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.03em; display: flex; flex-direction: column; gap: 6px; }
.modal-section label span.label-hint { font-size: 11px; font-weight: 400; color: var(--muted); }
.modal-section input { width: 100%; }

.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-confirm { max-width: 420px; }
.modal-auth { max-width: 440px; }
.confirm-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.auth-form {
  display: grid;
  gap: 12px;
}
.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-logged-panel {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel-alt);
}
.auth-logged-panel strong { color: var(--text); }
.auth-logged-panel span { color: var(--muted); font-size: 13px; }
.danger-confirm-button {
  background: rgba(204,68,68,0.16);
  border-color: rgba(204,68,68,0.42);
  color: #ff8a8a;
}
.danger-confirm-button:hover {
  background: rgba(204,68,68,0.26);
  border-color: rgba(204,68,68,0.7);
  color: #ffb0b0;
}

.modal-leader-results {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 260px; overflow-y: auto;
}

.modal-leader-item {
  display: grid; grid-template-columns: 54px minmax(0,1fr);
  gap: 10px; align-items: center;
  padding: 8px 10px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.modal-leader-item:hover { border-color: var(--accent); background: var(--panel-hover); }
.modal-leader-item.selected { border-color: var(--accent); background: rgba(212,146,14,0.1); }
.modal-leader-item img { width: 54px; height: 76px; object-fit: cover; border-radius: 4px; }
.modal-leader-item-info strong { display: block; font-size: 13px; }
.modal-leader-item-info small { color: var(--muted); font-size: 11px; }

.modal-selected-leader {
  display: grid; grid-template-columns: 80px minmax(0,1fr);
  gap: 12px; align-items: center;
  padding: 12px;
  background: rgba(212,146,14,0.08);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
}
.modal-selected-leader img { width: 80px; height: 112px; object-fit: cover; border-radius: 6px; }
.modal-selected-leader strong { display: block; font-size: 14px; margin-bottom: 4px; }
.modal-selected-leader small { color: var(--muted); font-size: 12px; }
.modal-selected-leader .change-leader-btn {
  margin-top: 8px; font-size: 11px; padding: 4px 10px;
  background: transparent; border: 1px solid var(--line);
  border-radius: 20px; color: var(--muted); cursor: pointer;
}
.modal-selected-leader .change-leader-btn:hover { border-color: var(--accent); color: var(--accent); }

/* leader bloccato nel deck editor */
#leaderSlot .deck-card-row {
  border-color: var(--accent) !important;
  background: linear-gradient(90deg, rgba(212,146,14,0.14) 0%, transparent 100%) !important;
  grid-template-columns: 80px minmax(0,1fr) auto;
}
.leader-locked-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 20px;
  background: var(--accent); color: #000;
}

/* ═══ MODALE STATISTICHE ═══ */
.modal-stats { max-width: 680px; }

/* ═══ MODALE INFO CARTA ═══ */
.modal-card-info {
  max-width: 680px;
  overflow: hidden;
}
.modal-card-info .modal-header { padding-bottom: 0; }
.card-info-body {
  display: grid;
  grid-template-columns: 200px minmax(0,1fr);
  gap: 0;
  overflow: hidden;
  max-height: calc(100dvh - 120px);
}
.card-info-img-wrap {
  display: flex; align-items: flex-start; justify-content: center;
  padding: 16px 12px 16px 20px;
}
.card-info-img-wrap img {
  width: 176px; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  object-fit: contain;
}
.card-info-details {
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.card-info-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.card-info-stat {
  background: var(--panel-alt); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 10px;
}
.card-info-stat span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.card-info-stat strong { font-size: 14px; color: var(--text); }
.card-info-effect {
  background: var(--panel-alt); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 12px; line-height: 1.6; color: var(--text);
  white-space: pre-wrap;
}
.card-info-effect:empty { display: none; }
.card-info-trigger {
  background: rgba(212,146,14,0.08); border: 1px solid rgba(212,146,14,0.3);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 12px; line-height: 1.6; color: var(--accent-light);
}
.card-info-trigger:empty { display: none; }
.card-info-trigger::before { content: "TRIGGER  "; font-weight: 900; letter-spacing: 0.08em; font-size: 10px; }

@media (max-width: 560px) {
  .card-info-body { grid-template-columns: 1fr; }
  .card-info-img-wrap img { width: 140px; }
}

/* ═══ MODALE DETTAGLIO COLLEZIONE ═══ */
.modal-collection-item { max-width: 620px; }

.collection-item-body {
  display: grid;
  grid-template-columns: 180px minmax(0,1fr);
  gap: 0;
  overflow: hidden;
  flex: 1;
}

.collection-item-preview {
  background: #0a1525;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 16px; padding: 16px 12px;
  overflow-y: auto;
}

.collection-item-preview img {
  width: 150px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  object-fit: contain; flex-shrink: 0;
}

/* il form editabile riusa gli stili add-col-form */
#collectionItemForm { padding: 16px 20px 20px; overflow-y: auto; }

@media (max-width: 560px) {
  .collection-item-body { grid-template-columns: 1fr; }
  .collection-item-preview { flex-direction: row; align-items: flex-start; padding: 12px; }
  .collection-item-preview img { width: 90px; }
}

/* ═══ MODALE AGGIUNGI ALLA COLLEZIONE ═══ */
.modal-add-collection { max-width: 620px; }

.add-col-body {
  display: grid;
  grid-template-columns: 160px minmax(0,1fr);
  gap: 0;
  overflow: hidden;
  flex: 1;
}

.add-col-preview {
  background: #0a1525;
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 16px 12px;
  overflow-y: auto;
}

.add-col-preview img {
  width: 136px; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  object-fit: contain;
}

.add-col-prices {
  width: 100%;
  display: flex; flex-direction: column; gap: 4px;
}

.price-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.price-row:last-child { border-bottom: none; }
.price-label { color: var(--muted); font-size: 11px; }

.add-col-form {
  overflow-y: auto; padding: 16px 20px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.add-col-form label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.03em; display: flex; flex-direction: column; gap: 5px;
}
.add-col-form input,
.add-col-form select,
.add-col-form textarea {
  width: 100%; font-size: 14px;
}
.add-col-form textarea { resize: vertical; min-height: 48px; }

@media (max-width: 560px) {
  .add-col-body { grid-template-columns: 1fr; }
  .add-col-preview { flex-direction: row; align-items: flex-start; padding: 12px; }
  .add-col-preview img { width: 90px; }
  .add-col-prices { flex: 1; }
}

/* ═══ QUICK-ADD BAR orizzontale (ricerca collezione) ═══ */
.quick-add-bar {
  display: flex; align-items: stretch;
  height: 34px; margin-top: 6px;
}
.quick-add-bar .quick-add-btn {
  width: 36px; font-size: 18px; font-weight: 700;
  background: var(--panel-hover); border: 1px solid var(--line);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s; line-height: 1; padding: 0;
  flex-shrink: 0;
}
.quick-add-bar .quick-add-btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.quick-add-bar .quick-add-btn:last-child  { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.quick-add-bar .quick-add-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.quick-add-bar .quick-add-count {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--accent);
  background: var(--panel-alt);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.quick-add-bar.zero .quick-add-btn-minus,
.quick-add-bar.zero .quick-add-count { display: none; }
.quick-add-bar.zero .quick-add-btn-plus {
  flex: 1; border-radius: var(--r-sm); width: auto;
}
.quick-add-bar.submitting .quick-add-btn,
.quick-add-bar.submitting .quick-add-count { opacity: 0.5; pointer-events: none; }

/* ═══ QUICK-ADD BAR (nella colonna laterale, verticale) ═══ */
.result-quick-add {
  display: flex; flex-direction: column; align-items: stretch;
  justify-content: center;
  width: 34px;
}

.result-quick-add .quick-add-btn {
  width: 34px; height: 28px; font-size: 16px; font-weight: 700;
  background: var(--panel-hover); border: 1px solid var(--line);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  line-height: 1; padding: 0;
}
.result-quick-add .quick-add-btn:first-child { border-radius: var(--r-sm) var(--r-sm) 0 0; } /* + in alto */
.result-quick-add .quick-add-btn:last-child  { border-radius: 0 0 var(--r-sm) var(--r-sm); } /* − in basso */
.result-quick-add .quick-add-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }

.result-quick-add .quick-add-count {
  width: 34px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--panel-alt);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  color: var(--accent);
}

.result-quick-add.zero .quick-add-btn-minus,
.result-quick-add.zero .quick-add-count { display: none; }
.result-quick-add.zero .quick-add-btn-plus {
  border-radius: var(--r-sm);
  height: 34px;
}

.result-quick-add.submitting .quick-add-btn,
.result-quick-add.submitting .quick-add-count { opacity: 0.5; pointer-events: none; }

/* ═══ DECK card actions ═══ */
.deck-card-actions {
  display: grid;
  grid-template-columns: 24px 34px 34px;
  align-items: center;
  justify-items: center;
  gap: 6px;
  width: 110px;
}
.deck-card-actions.leader-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
}
.leader-actions .deck-card-qty-group {
  width: auto;
}
.deck-card-qty-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: 34px;
}
.deck-card-qty-group .mini-button,
.deck-card-qty-group .qty-pill {
  width: 34px;
  min-width: 34px;
  height: 28px;
  border-radius: 0;
  line-height: 1;
}
.deck-card-qty-group .mini-button:first-child {
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.deck-card-qty-group .qty-pill {
  border-top: 0;
  border-bottom: 0;
}
.deck-card-qty-group .mini-button:last-child {
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}
