@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=EB+Garamond:wght@400;500;600&display=swap');

/* ── TOKENS ─────────────────────────────────────────────────────────────────── */
:root {
  --bg:       #ffffff;
  --bg2:      #f8f8f6;
  --bg3:      #f2f2ef;
  --border:   #e5e5e0;
  --border2:  #cecec6;
  --text:     #111110;
  --text2:    #666660;
  --text3:    #999994;
  --yes:      #16a34a;
  --yes-bg:   #f0fdf4;
  --yes-b:    #bbf7d0;
  --no:       #dc2626;
  --no-bg:    #fef2f2;
  --no-b:     #fecaca;
  --blue:     #2563eb;
  --blue-bg:  #eff6ff;
  --blue-b:   #bfdbfe;
  --nav-h:    54px;
  --nav-bg:   rgba(255,255,255,.95);
  --btn-bg:   #111110;
  --btn-fg:   #ffffff;
  --sb-w:     200px;
  --layout-w: 1200px;  /* larghezza totale come Polymarket — sidebar 200 + contenuto 1000 */
  --container-w: 1200px; /* container unico condiviso da tutta l'app */
  --container-pad: 24px;
  /* Sistema raggi coerente (come Polymarket: pochi valori) */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 99px;
  --r:        10px;
  --r-lg:     14px;
  --shadow:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:0 4px 14px rgba(0,0,0,.08);
}

/* ── DARK MODE (stile Polymarket) ──────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:       #0e1117;
  --bg2:      #161b22;
  --bg3:      #1c222b;
  --border:   #272d38;
  --border2:  #3a4150;
  --text:     #e6e6e3;
  --text2:    #9aa0a8;
  --text3:    #6e747d;
  --yes:      #22c55e;
  --yes-bg:   #0f2417;
  --yes-b:    #1d4a2e;
  --no:       #ef4444;
  --no-bg:    #2a1414;
  --no-b:     #4a1d1d;
  --blue:     #3b82f6;
  --blue-bg:  #0f1d33;
  --blue-b:   #1e3a5f;
  --nav-bg:   rgba(14,17,23,.95);
  --btn-bg:   #e6e6e3;
  --btn-fg:   #0e1117;
  --shadow:   0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:0 4px 14px rgba(0,0,0,.5);
}

/* ── RESET ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-pill); }

/* ── TOPNAV ──────────────────────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  /* Gestione safe-area iOS (notch): l'header si estende sotto la status bar */
  padding-top: env(safe-area-inset-top);
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center;
  padding-left: 0; padding-right: 0; padding-bottom: 0; z-index: 200;
}
/* Wrapper interno navbar — allinea con il contenuto pagina */
.nav-inner {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}
.nav-toggle {
  width: 32px; height: 32px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: background .15s; flex-shrink: 0;
}
.nav-toggle:hover { background: var(--bg2); }
.nav-toggle svg { width: 18px; height: 18px; }
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.2rem; font-weight: 400;
  letter-spacing: .22em; text-transform: uppercase;
  white-space: nowrap; color: var(--text); flex-shrink: 0;
}
.nav-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  transition: filter .2s;
}
/* In dark mode il logo (scuro) diventa chiaro, così cambia colore INSIEME alla
   scritta ARCEUS e i due appaiono come un'unica cosa coerente. Il leggero
   brightness(.93) avvicina il bianco del logo al bianco caldo del testo (#e6e6e3). */
[data-theme="dark"] .nav-logo-img { filter: brightness(0) invert(1) brightness(.93); }
.footer-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-search { flex: 1; max-width: 380px; position: relative; }
.nav-search input {
  width: 100%; padding: 7px 12px 7px 34px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: var(--bg2); font-size: 13px;
  transition: border-color .15s, background .15s;
}
.nav-search input:focus { border-color: var(--border2); background: var(--bg); }
.nav-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text3); pointer-events: none;
  display: flex; align-items: center;
}
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  z-index: 300; overflow: hidden; display: none;
}
.sr-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background .12s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--bg2); }
.sr-icon { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.sr-title { font-size: 13px; font-weight: 500; }
.sr-meta  { font-size: 11.5px; color: var(--text2); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); color: var(--text2);
  transition: all .15s; position: relative;
}
.nav-icon-btn:hover { background: var(--bg2); color: var(--text); }
.nav-icon-btn svg { width: 16px; height: 16px; }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--no); border: 1.5px solid #fff; display: none;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 320px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  z-index: 300; overflow: hidden; display: none;
}
.notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
}
.notif-item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg2); }
.notif-item.unread { background: var(--blue-bg); }
.notif-item.unread:hover { background: #dbeafe; }
.notif-dot2 { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex-shrink: 0; margin-top: 4px; }
.notif-text { font-size: 12.5px; line-height: 1.45; }
.notif-time { font-size: 11px; color: var(--text3); margin-top: 2px; }
.nav-btn { padding: 6px 14px; border-radius: var(--r-md); font-size: 13px; font-weight: 500; transition: all .15s; }
.nav-btn.outline { border: 1.5px solid var(--border); color: var(--text); }
.nav-btn.outline:hover { border-color: var(--border2); background: var(--bg2); }
.nav-btn.solid { background: var(--btn-bg); color: var(--btn-fg); }
.nav-btn.solid:hover { opacity: 1; transform: translateY(-1px); box-shadow: 0 4px 12px color-mix(in srgb, var(--blue) 30%, transparent); }
.nav-btn.solid:active { transform: translateY(0); }
.user-chip {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 10px 4px 6px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); transition: all .15s;
}
.user-chip:hover { background: var(--bg2); border-color: var(--border2); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg3); display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700;
  border: 1.5px solid var(--border); flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-balance {
  font-size: 11.5px; font-weight: 600;
  background: var(--yes-bg); color: var(--yes); padding: 2px 7px; border-radius: var(--r-pill);
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: calc(var(--nav-h) + env(safe-area-inset-top)); bottom: 0;
  left: max(0px, calc(50vw - var(--layout-w)/2));
  width: var(--sb-w); overflow-y: auto;
  border-right: 1px solid var(--border); background: var(--bg);
  padding: 10px 8px; z-index: 100;
  transition: width .2s ease, transform .2s ease, left .2s ease;
}
.sidebar.collapsed { width: 54px; }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.mobile-open { transform: translateX(0); width: var(--sb-w); box-shadow: var(--shadow-md); }
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md); cursor: pointer;
  color: var(--text2); font-size: 13.5px; font-weight: 400;
  transition: background .15s, color .15s;
  white-space: nowrap; overflow: hidden; text-decoration: none;
}
.sb-item svg { flex-shrink: 0; width: 17px; height: 17px; }
.sb-item:hover { background: var(--bg2); color: var(--text); }
.sb-item.active { background: var(--bg2); color: var(--text); font-weight: 500; }
.sb-text { transition: opacity .15s; overflow: hidden; }
.sidebar.collapsed .sb-text { opacity: 0; pointer-events: none; width: 0; }
.sb-label {
  font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text3);
  padding: 10px 10px 4px; white-space: nowrap; overflow: hidden;
  transition: opacity .15s;
}
.sidebar.collapsed .sb-label { opacity: 0; }
.sb-divider { height: 1px; background: var(--border); margin: 8px 0; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 2px; }
.cat-chip {
  padding: 5px 8px; border-radius: var(--r-sm);
  border: none; background: none;
  font-size: 12.5px; font-weight: 500; color: var(--text2);
  cursor: pointer; transition: all .15s; white-space: nowrap; text-align: left;
}
.cat-chip:hover { color: var(--text); background: var(--bg2); }
.cat-chip.active { background: var(--bg2); color: var(--text); font-weight: 600; }
.sidebar.collapsed .cat-chips { display: none; }

/* ── SHELL ───────────────────────────────────────────────────────────────────── */
.shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: var(--container-w);
  width: 100%;
  margin: 0 auto;
  padding-top: calc(var(--nav-h) + env(safe-area-inset-top));
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
  min-height: 100vh;
  box-sizing: border-box;
}
.shell.sb-collapsed { padding-left: 54px; }
@media (max-width: 768px) { .shell { padding-left: 16px; padding-right: 16px; margin: 0; max-width: 100%; } }

.page {
  padding: 16px 0 0;
  width: 100%;
  flex: 1;
  box-sizing: border-box;
}

/* ── PAGE HEADER ─────────────────────────────────────────────────────────────── */
.page-title { font-family: 'EB Garamond', serif; font-size: 1.8rem; font-weight: 500; margin-bottom: 4px; }
.page-sub   { font-size: 13px; color: var(--text2); margin-bottom: 22px; }

/* ── FILTER BAR ──────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.filter-pill {
  padding: 5px 2px; border: none; background: none;
  font-size: 13.5px; font-weight: 600; color: var(--text2);
  border-bottom: 2px solid transparent; transition: color .15s; cursor: pointer;
}
.filter-pill:hover { color: var(--text); }
.filter-pill.active { color: var(--text); border-bottom-color: var(--text); }

/* ── MARKET GRID ─────────────────────────────────────────────────────────────── */
.markets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; align-items: start; }
.markets-layout { display: flex; gap: 24px; align-items: flex-start; }
.subcat-sidebar { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; }
.subcat-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 9px 12px; border: none; background: none; border-radius: var(--r-md); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text2); text-align: left; transition: background .12s; }
.subcat-item:hover { background: var(--bg2); color: var(--text); }
.subcat-item.active { background: var(--bg3); color: var(--text); }
.subcat-nested { padding-left: 28px; font-size: 13px; font-weight: 500; color: var(--text3); }
.subcat-nested:hover { color: var(--text); }
.subcat-nested.active { color: var(--text); font-weight: 700; background: var(--bg3); }
/* Variante ORIZZONTALE — usata solo sotto "All Markets" (categoria Tutti) */
.subcat-sidebar.subcat-horizontal { width: 100%; flex-direction: row; gap: 22px; position: static; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.subcat-sidebar.subcat-horizontal::-webkit-scrollbar { display: none; }
.subcat-horizontal .subcat-item { display: inline-flex; align-items: center; gap: 6px; width: auto; flex-shrink: 0; padding: 8px 2px; background: none; border-radius: 0; border-bottom: 2px solid transparent; white-space: nowrap; justify-content: flex-start; }
.subcat-horizontal .subcat-item:hover { background: none; color: var(--text); }
.subcat-horizontal .subcat-item.active { background: none; color: var(--text); border-bottom-color: var(--blue, #2563eb); }
.subcat-count { font-size: 12px; font-weight: 600; color: var(--text3); }
.new-badge { display: inline-flex; align-items: center; gap: 3px; background: none; color: #2563eb; font-size: 11px; font-weight: 800; letter-spacing: .2px; padding: 0; vertical-align: middle; }
.new-badge svg { color: #2563eb; }
.ms-card { display: flex; flex-direction: column; }
.ms-list { margin: 8px 0 2px; }
.ms-row { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ms-row:last-child { border-bottom: none; }
.ms-name { display: flex; align-items: center; gap: 7px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-flag { width: 20px; height: 20px; border-radius: var(--r-sm); object-fit: cover; flex-shrink: 0; }
.ms-pct { font-weight: 700; font-size: 13px; min-width: 38px; text-align: right; color: var(--text2); }
.ms-yes { padding: 3px 10px; border-radius: var(--r-sm); border: 1px solid var(--yes-b); background: var(--yes-bg); color: var(--yes); font-weight: 700; font-size: 11.5px; cursor: pointer; }
.ms-no { padding: 3px 10px; border-radius: var(--r-sm); border: 1px solid var(--no-b); background: var(--no-bg); color: var(--no); font-weight: 700; font-size: 11.5px; cursor: pointer; }
.ms-more { padding: 5px 0 0; color: var(--blue); font-size: 12px; font-weight: 600; cursor: pointer; }
.ms-more:hover { text-decoration: underline; }

/* ── MARKET CARD ─────────────────────────────────────────────────────────────── */
.mcard {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
  cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
  animation: fadeUp .3s ease both; display: flex; flex-direction: column; gap: 8px;
  min-height: 190px;
}
.ms-card { height: 190px; overflow: hidden; }
.mcard:hover { border-color: var(--border2); box-shadow: 0 6px 20px rgba(0,0,0,.07); transform: translateY(-3px); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.mcard-top { display: flex; gap: 10px; align-items: flex-start; }
.mcard-icon { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--bg3); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.mcard-title { font-size: 13px; font-weight: 500; line-height: 1.4; flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; min-height: 36px; }
.mcard-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text2); }
.mcard-cat { background: var(--bg3); padding: 2px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 500; }
.prob-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.prob-label { font-size: 12px; font-weight: 700; min-width: 30px; }
.prob-label.yes { color: var(--yes); }
.prob-label.no  { color: var(--no); }
.prob-track { flex: 1; height: 6px; border-radius: var(--r-pill); background: var(--bg3); overflow: hidden; }
.prob-fill { height: 100%; border-radius: var(--r-pill); transition: width .7s cubic-bezier(.4,0,.2,1); }
.prob-fill.yes { background: linear-gradient(90deg, color-mix(in srgb, var(--yes) 78%, white), var(--yes)); box-shadow: 0 0 6px color-mix(in srgb, var(--yes) 35%, transparent); }
.prob-fill.no  { background: linear-gradient(90deg, color-mix(in srgb, var(--no) 78%, white), var(--no)); box-shadow: 0 0 6px color-mix(in srgb, var(--no) 35%, transparent); }
.prob-pct { font-size: 12.5px; font-weight: 700; min-width: 36px; text-align: right; }
.prob-pct.yes { color: var(--yes); }
.prob-pct.no  { color: var(--no); }
.card-actions { display: flex; gap: 8px; align-items: center; }
.btn-yes, .btn-no { flex: 1; padding: 7px 0; border-radius: var(--r-md); font-size: 12.5px; font-weight: 600; border: 1.5px solid; transition: all .15s; }
.btn-yes { background: var(--yes-bg); border-color: var(--yes-b); color: var(--yes); }
.btn-yes:hover { background: #dcfce7; border-color: var(--yes); }
.btn-no  { background: var(--no-bg);  border-color: var(--no-b);  color: var(--no); }
.btn-no:hover  { background: #fee2e2; border-color: var(--no); }
.btn-watch { width: 30px; height: 30px; flex-shrink: 0; border-radius: var(--r-sm); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text3); transition: all .15s; }
.btn-watch svg { width: 15px; height: 15px; display: block; }
.btn-watch:hover, .btn-watch.on { border-color: #f59e0b; color: #f59e0b; }

/* ── PANEL ───────────────────────────────────────────────────────────────────── */
.panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: 14px; }
.panel-head { padding: 13px 18px; border-bottom: 1px solid var(--border); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); }
.panel-body { padding: 18px; }

/* ── MARKET DETAIL ───────────────────────────────────────────────────────────── */
.mdetail { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .mdetail { grid-template-columns: 1fr; } .market-tabs-section { max-width: 100% !important; } }
.mdetail-title { font-family: 'EB Garamond', serif; font-size: 1.55rem; font-weight: 500; line-height: 1.3; margin-bottom: 8px; }
.mdetail-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text2); margin-bottom: 20px; }
.chart-wrap { position: relative; width: 100%; height: 300px; }

/* ── TRADE PANEL ─────────────────────────────────────────────────────────────── */
.trade-panel { position: sticky; top: calc(var(--nav-h) + 44px + 16px); align-self: start; }
.trade-tabs { display: flex; border-bottom: 1px solid var(--border); }
.trade-tab { flex: 1; padding: 10px 6px; font-size: 12px; font-weight: 600; color: var(--text2); border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; transition: all .15s; text-align: center; }
.trade-tab:hover { color: var(--text); }
.trade-tab.yes.active { color: var(--yes); border-bottom-color: var(--yes); }
.trade-tab.no.active  { color: var(--no);  border-bottom-color: var(--no); }
.trade-price { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.trade-price-label { font-size: 12px; color: var(--text2); }
.trade-price-val { font-size: 1.5rem; font-weight: 700; }
.trade-price-val.yes { color: var(--yes); }
.trade-price-val.no  { color: var(--no); }
.trade-label { font-size: 11.5px; font-weight: 600; color: var(--text2); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.trade-input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--bg2); font-size: 13.5px; color: var(--text); transition: border-color .15s; }
.trade-input:focus { border-color: var(--text); }
.amount-pills { display: flex; gap: 6px; margin-top: 8px; }
.amount-pill { flex: 1; padding: 5px 0; border: 1.5px solid var(--border); border-radius: var(--r-sm); font-size: 12px; font-weight: 600; background: var(--bg2); transition: all .15s; }
.amount-pill:hover { border-color: var(--border2); background: var(--bg); }
.trade-submit { width: 100%; padding: 11px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 700; margin-top: 14px; transition: opacity .15s, transform .1s; }
.trade-submit:active { transform: scale(.98); }
.trade-submit.yes { background: var(--yes); color: #fff; }
.trade-submit.no  { background: var(--no);  color: #fff; }
.trade-submit:hover { opacity: .86; }
.trade-note { font-size: 11.5px; color: var(--text3); text-align: center; margin-top: 10px; line-height: 1.5; }

/* ── ORDER BOOK ──────────────────────────────────────────────────────────────── */
.ob-row { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 4px 0; font-size: 12.5px; position: relative; font-variant-numeric: tabular-nums; }
.ob-bar { position: absolute; top: 0; bottom: 0; right: 0; border-radius: var(--r-sm); opacity: .1; }
.ob-row.ask .ob-bar { background: var(--no); }
.ob-row.bid .ob-bar { background: var(--yes); }
.ob-mid { text-align: center; padding: 7px 0; font-size: 13.5px; font-weight: 700; }

/* ── LEADERBOARD ─────────────────────────────────────────────────────────────── */
.lb { border: none; border-radius: 0; overflow: visible; }
.lb-head, .lb-row { display: grid; grid-template-columns: 46px 1fr 100px 100px; align-items: center; padding: 13px 6px; }
.lb-head { background: none; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text3); }
.lb-row { border-bottom: 1px solid var(--border); transition: background .12s; cursor: pointer; animation: fadeUp .3s ease both; }
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--bg2); }
.lb-rank { font-weight: 700; font-size: 13px; }
.lb-rank.gold   { color: #d97706; }
.lb-rank.silver { color: #6b7280; }
.lb-rank.bronze { color: #92400e; }
.lb-user { font-size: 13px; font-weight: 500; }
.lb-user small { display: block; font-size: 11.5px; font-weight: 400; color: var(--text2); }
.lb-profit { font-weight: 700; text-align: right; font-size: 13px; }
.lb-profit.pos { color: var(--yes); }
.lb-profit.neg { color: var(--no); }
.lb-vol { text-align: right; font-size: 12.5px; color: var(--text2); }

/* ── STATS GRID ──────────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card { background: none; border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; }
.stat-label { font-size: 11.5px; color: var(--text2); margin-bottom: 5px; }
.stat-val { font-size: 1.25rem; font-weight: 600; }
.stat-val.pos { color: var(--yes); }
.stat-val.neg { color: var(--no); }

/* ── TABS ────────────────────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 2px; }
.tab { padding: 8px 16px; font-size: 13.5px; font-weight: 500; color: var(--text2); border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; transition: all .15s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

/* ── AUTH MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--bg); border-radius: var(--r-lg); padding: 32px; width: 100%; max-width: 420px; border: 1.5px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.12); }
.modal-title { font-family: 'EB Garamond', serif; font-size: 1.6rem; font-weight: 500; margin-bottom: 4px; }
.modal-sub   { font-size: 13px; color: var(--text2); margin-bottom: 24px; }
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 11.5px; font-weight: 600; color: var(--text2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.form-input  { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--bg2); color: var(--text); font-size: 13.5px; transition: border-color .15s; }
.form-input:focus { border-color: var(--text); background: var(--bg); }
.form-select { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--bg2); color: var(--text); font-size: 13.5px; appearance: none; cursor: pointer; }
.form-submit { width: 100%; padding: 11px; background: var(--btn-bg); color: var(--btn-fg); border-radius: var(--r-md); font-size: 13.5px; font-weight: 700; margin-top: 4px; transition: opacity .15s; }
.form-submit:hover { opacity: .85; }
.form-toggle { font-size: 13px; color: var(--text2); text-align: center; margin-top: 14px; }
.form-toggle span { color: var(--blue); cursor: pointer; font-weight: 500; }
.form-toggle span:hover { text-decoration: underline; }
.google-btn { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--bg); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; transition: all .15s; cursor: pointer; text-decoration: none; color: var(--text); }
.google-btn:hover { background: var(--bg2); border-color: var(--border2); }
.or-divider { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 12px; color: var(--text2); }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── ADMIN ───────────────────────────────────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.admin-card { background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 18px; cursor: pointer; transition: all .15s; }
.admin-card:hover { border-color: var(--border2); box-shadow: var(--shadow); }
.admin-card-icon { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.admin-card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.admin-card-desc  { font-size: 12px; color: var(--text2); line-height: 1.45; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text2); letter-spacing: .05em; text-transform: uppercase; padding: 9px 14px; border-bottom: 1.5px solid var(--border); background: var(--bg2); }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg2); }
.log-row { display: flex; gap: 12px; align-items: center; padding: 7px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.log-row:last-child { border-bottom: none; }
.log-time { color: var(--text2); font-family: monospace; flex-shrink: 0; min-width: 80px; }

/* ── BADGES ──────────────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; }
.badge-green { background: var(--yes-bg); color: var(--yes); }
.badge-red   { background: var(--no-bg);  color: var(--no); }
.badge-blue  { background: var(--blue-bg); color: var(--blue); }
.badge-gray  { background: var(--bg3);    color: var(--text2); }

/* ── SWITCH ──────────────────────────────────────────────────────────────────── */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { display: none; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: var(--r-pill); cursor: pointer; transition: .3s; }
.slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.switch input:checked + .slider { background: var(--yes); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ── MISC ────────────────────────────────────────────────────────────────────── */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text2); margin-bottom: 18px; cursor: pointer; transition: color .15s; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 14px; height: 14px; }
.section-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.empty { text-align: center; padding: 48px 20px; color: var(--text2); border: 1.5px dashed var(--border); border-radius: var(--r-lg); font-size: 13.5px; line-height: 1.6; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; color: var(--text2); }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text2); line-height: 1.6; max-width: 320px; margin-bottom: 18px; }
.empty-btn { background: var(--blue, #2563eb); color: #fff; text-decoration: none; font-size: 13.5px; font-weight: 700; padding: 10px 22px; border-radius: 10px; transition: opacity .15s; }
.empty-btn:hover { opacity: .9; }
.ach-badge { display: inline-flex; align-items: center; gap: 5px; background: rgba(245,158,11,.12); color: #b45309; border: 1px solid rgba(245,158,11,.3); border-radius: 99px; padding: 5px 11px; font-size: 12px; font-weight: 700; }
.ach-badge svg { color: #f59e0b; }
.ach-badge.locked { background: var(--bg2); color: var(--text3); border-color: var(--border); opacity: .6; }
.ach-badge.locked svg { color: var(--text3); }
.top-badge { display: inline-flex; align-items: center; gap: 4px; color: #fff; border-radius: 99px; padding: 3px 10px; font-size: 11px; font-weight: 700; vertical-align: middle; }
.top-badge svg { color: #fff; }
.trade-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.trade-row:last-child { border-bottom: none; }
.t-side { font-weight: 700; }
.t-side.yes { color: var(--yes); }
.t-side.no  { color: var(--no); }
.wl-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.wl-row:last-child { border-bottom: none; }
.wl-row:hover { background: var(--bg2); }
.wl-title { flex: 1; font-size: 13.5px; font-weight: 500; }
.create-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--btn-bg); color: var(--btn-fg); border-radius: var(--r-md); font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity .15s; }
.create-btn:hover { opacity: .85; }

/* ── TOAST ───────────────────────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; background: var(--btn-bg); color: var(--btn-fg); padding: 11px 18px; border-radius: var(--r-md); font-size: 13px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.15); opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }

/* ══════════════════════════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--bg);
  border-top: 1.5px solid var(--border);
  margin-top: 60px;
  padding: 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0;
  padding: 40px 48px;
  border-bottom: 1px solid var(--border);
}
.footer-col { padding: 0 16px 24px 0; }
.footer-col-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer-col ul li a {
  font-size: 13px;
  color: var(--text2);
  transition: color .15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.footer-col ul li a:hover { color: var(--text); }
.footer-col ul li a .ext-icon {
  font-size: 10px;
  opacity: .5;
}

/* Social row */
.footer-social {
  display: flex;
  gap: 8px;
  padding: 24px 48px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.footer-social-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text2);
  margin-right: 8px;
}
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text2);
  transition: all .15s;
  cursor: pointer;
}
.social-btn:hover { border-color: var(--border2); color: var(--text); background: var(--bg2); }
.social-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Bottom bar */
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 48px;
  font-size: 12.5px;
  color: var(--text2);
}
.footer-bottom-left { display: flex; align-items: center; gap: 8px; }
.footer-bottom-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-bottom-links a { font-size: 12.5px; color: var(--text2); transition: color .15s; }
.footer-bottom-links a:hover { color: var(--text); }

/* Chain status badge */
.chain-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  border: 1.5px solid;
}
.chain-badge.on  { background: var(--yes-bg); border-color: var(--yes-b); color: var(--yes); }
.chain-badge.off { background: var(--bg3); border-color: var(--border); color: var(--text2); }

@media (max-width: 768px) {
  .footer-grid   { padding: 28px 20px; grid-template-columns: repeat(2, 1fr); }
  .footer-social { padding: 20px; }
  .footer-bottom { padding: 16px 20px; flex-direction: column; align-items: flex-start; }
  .page          { padding: 18px 14px 0; }
  .mdetail       { grid-template-columns: 1fr; }
  .lb-row, .lb-head { grid-template-columns: 36px 1fr 80px; }
  .lb-vol        { display: none; }
  .markets-grid  { grid-template-columns: 1fr; }
  .markets-layout { flex-direction: column; }
  /* Su mobile le sotto-categorie diventano una riga orizzontale scorrevole (stile Polymarket) */
  .subcat-sidebar { width: 100%; flex-direction: row; gap: 18px; position: static; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; border-bottom: 1px solid var(--border); padding-bottom: 2px; }
  .subcat-sidebar::-webkit-scrollbar { display: none; }
  .subcat-item { width: auto; flex-shrink: 0; justify-content: flex-start; white-space: nowrap; padding: 8px 2px; background: none; border-radius: 0; border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
  .subcat-item:hover { background: none; color: var(--text); }
  .subcat-item.active { background: none; color: var(--text); border-bottom-color: var(--blue, #2563eb); }
  .subcat-count { display: none; }
  /* Le sotto-opzioni annidate (es. leghe sotto Soccer) restano in linea */
  .subcat-nested { padding-left: 0; }
}

/* ── LOGO IMG ────────────────────────────────────────────────────────────────── */
.nav-logo-text {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text);
}

#footer-root { width: 100%; }

/* ── LANGUAGE SELECTOR ───────────────────────────────────────────────────────── */
.lang-selector {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0;
}
.lang-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background .12s;
  font-family: inherit;
}
.lang-btn:hover { background: var(--bg2); }
.lang-btn.active {
  background: var(--bg2);
  font-weight: 600;
}
.lang-btn.active .lang-name { color: var(--text); font-weight: 600; }
.lang-flag { font-size: 16px; flex-shrink: 0; }
.lang-name { font-size: 13px; color: var(--text2); }
.sidebar.collapsed .lang-name  { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .lang-selector { padding: 2px 2px; }

/* ── BADGE PROPOSTE AI ────────────────────────────────────────────────────── */
.pending-badge {
  display:inline-flex; align-items:center; justify-content:center;
  min-width:18px; height:18px; padding:0 5px; margin-left:6px;
  background:#dc2626; color:#fff; font-size:11px; font-weight:700;
  border-radius: var(--r-md); vertical-align:middle;
}

/* ── HOW IT WORKS BUTTON ──────────────────────────────────────────────────── */
.nav-howto:hover { opacity:.8; }
@media (max-width:640px) { .howto-text { display:none; } }

/* Leaderboard: evidenzia la riga dell'utente loggato */
.lb-row.me { background: rgba(37,99,235,.06); border-left: 3px solid var(--blue); }

/* ── MOBILE: mostra solo l'essenziale (stile Polymarket) ───────────────────── */
@media (max-width: 768px) {
  /* Nasconde l'order book: su mobile resta più pulito */
  .hide-mobile { display: none !important; }
  /* Il menu dei tipi d'ordine RESTA visibile su mobile (Split, Conditional, DCA, Combo) */
  .pm-ordertype-select { display: block !important; width: 100%; margin-bottom: 8px; padding: 10px; font-size: 14px; }
  /* Pannello di trading a tutta larghezza, non sticky su mobile */
  .trade-panel { position: static !important; }
  /* Pulsanti Yes/No più grandi e comodi al tocco */
  .pm-tab { font-size: 14px; padding: 12px 0; }
  .page { padding: 12px 0 0; }
}

/* ── RIFINITURE MOBILE (esperienza su telefono) ──────────────────────────────── */
@media (max-width: 640px) {
  /* La barra di ricerca è nascosta su mobile (libera spazio nell'header) */
  .nav-search { display: none; }
  .nav-logo-text { display: none; }            /* su telefono solo il logo-immagine */
  .nav-inner { padding: 0 12px; gap: 8px; justify-content: space-between; }
  /* Area tap minima comoda (44px) per i pulsanti principali */
  .pm-submit { padding: 14px 0 !important; font-size: 15px !important; }
  .form-submit, .create-btn { min-height: 42px; }
  /* Campi input più grandi (evita lo zoom automatico di iOS sotto i 16px) */
  .pm-input, .form-input, input[type="number"], input[type="text"], input[type="email"], input[type="password"], textarea { font-size: 16px !important; }
  /* Titoli mercato più compatti */
  .mdetail-title { font-size: 1.3rem; }
  /* Le card combo/parlay e i pannelli non sforano lo schermo */
  .panel { max-width: 100% !important; }
  /* Il selettore lingua e i pulsanti nav non vanno a capo male */
  .nav-howto { display: none; }                /* "How it works" via menu, libera spazio */
  /* Pickers emoji/gif dei commenti a tutta larghezza */
  #gif-results, #dm-gif-results { grid-template-columns: repeat(2, 1fr) !important; }
}
/* Evita lo scroll orizzontale accidentale su tutto il sito */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  img, svg, video { max-width: 100%; height: auto; }
}

/* ── BOTTOM NAV (solo mobile, stile Polymarket) ────────────────────────────── */
.bottom-nav { display: none; }
@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 58px;
    background: var(--bg);
    border-top: 1.5px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text3);
    text-decoration: none;
    transition: color .15s;
  }
  .bn-item.active { color: var(--text); }
  .bn-item:active { opacity: .6; }
  /* Spazio in fondo alle pagine per non finire sotto la barra */
  .shell { padding-bottom: 70px; }
  /* Nasconde la sidebar laterale su mobile: la bottom nav la sostituisce */
  .sidebar { display: none !important; }
}

/* ── CONTROLLI GRAFICO PREZZO (stile Polymarket) ───────────────────────────── */
.ch-out, .ch-range {
  background: none; border: 1px solid var(--border); color: var(--text2);
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: var(--r-sm); cursor: pointer;
  transition: all .12s;
}
.ch-out:hover, .ch-range:hover { color: var(--text); border-color: var(--text3); }
.ch-out.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.ch-range { padding: 5px 9px; }
.ch-range.on { background: var(--bg2); color: var(--text); border-color: var(--text); }

/* ── ORDINAMENTO COMMENTI ──────────────────────────────────────────────────── */
.cm-sort {
  background: none; border: 1px solid var(--border); color: var(--text2);
  font-size: 12.5px; font-weight: 600; padding: 5px 14px; border-radius: var(--r-md); cursor: pointer;
  transition: all .12s;
}
.cm-sort:hover { color: var(--text); border-color: var(--text3); }
.cm-sort.on { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }

/* ── RULES + CONTEXT affiancati (mobile: una colonna) ──────────────────────── */
@media (max-width: 768px) {
  .rules-context { grid-template-columns: 1fr !important; gap: 20px !important; }
}

/* ── SCHEDE Rules / Market Context ─────────────────────────────────────────── */
.rc-tab {
  background: none; border: none; padding: 8px 0; font-size: 14px; font-weight: 600;
  color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.rc-tab:hover { color: var(--text2); }
.rc-tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ── ORDER BOOK professionale ──────────────────────────────────────────────── */
.ob-card { padding: 0; margin-bottom: 24px; }
.ob-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center;
  padding: 7px 6px; font-size: 12.5px; position: relative;
  font-variant-numeric: tabular-nums; border-radius: var(--r-sm);
}
.ob-row:hover { background: var(--bg2); }
.ob-mid {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 6px; margin: 6px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 14px; font-variant-numeric: tabular-nums;
}
.ob-tab {
  background: none; border: none; padding: 7px 14px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; color: var(--text3); cursor: pointer;
  border: 1px solid var(--border); transition: all .12s;
}
.ob-tab:hover { color: var(--text2); }
.ob-tab.active { background: var(--bg2); color: var(--text); border-color: var(--text3); }

/* ── BARRA CATEGORIE STICKY (sotto la navbar/ricerca) ──────────────────────── */
.cat-nav {
  position: sticky; top: calc(var(--nav-h) + env(safe-area-inset-top)); z-index: 150;
  background: var(--nav-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
/* Frecce di scorrimento della barra categorie */
.cat-nav-arrow {
  position: absolute; top: 0; bottom: 1px; width: 44px; z-index: 2;
  display: none; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-size: 22px; font-weight: 700;
  color: var(--text); line-height: 1; padding: 0;
}
.cat-nav-arrow-left {
  left: 0;
  background: linear-gradient(to right, var(--nav-bg) 55%, transparent);
  justify-content: flex-start; padding-left: 10px;
}
.cat-nav-arrow-right {
  right: 0;
  background: linear-gradient(to left, var(--nav-bg) 55%, transparent);
  justify-content: flex-end; padding-right: 10px;
}
.cat-nav-arrow:hover { color: var(--blue, #2563eb); }
.cat-nav-inner {
  max-width: var(--container-w); margin: 0 auto;
  display: flex; gap: 22px; overflow-x: auto; padding: 10px var(--container-pad);
  scrollbar-width: none; -ms-overflow-style: none;
}
.cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-link {
  background: none; border: none; white-space: nowrap; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text2);
  padding: 4px 0; border-bottom: 2px solid transparent; transition: color .12s;
}
.cat-link:hover { color: var(--text); }
.cat-link.active { color: var(--text); border-bottom-color: var(--text); }

/* ── AVATAR + DROPDOWN MENU UTENTE (stile Polymarket) ──────────────────────── */
.avatar-btn {
  background: none; border: none; cursor: pointer; padding: 0; border-radius: 50%;
  display: flex; align-items: center; transition: opacity .12s;
}
.avatar-btn:hover { opacity: .85; }
.user-menu {
  position: absolute; top: calc(100% + 10px); right: 0; min-width: 220px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: 0 8px 28px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
  padding: 6px; z-index: 300;
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.user-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.user-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; }
.user-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 500;
  color: var(--text); text-decoration: none; background: none; border: none;
  cursor: pointer; text-align: left; transition: background .12s;
}
.user-menu-item:hover { background: var(--bg2); }
.user-menu-item svg { color: var(--text3); flex-shrink: 0; }

/* ── OPZIONI CONDIVISIONE SOCIAL ───────────────────────────────────────────── */
.share-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .12s;
}
.share-opt:hover { background: var(--bg); border-color: var(--text3); }

/* ── RAFFINAMENTI ESTETICI (transizioni e hover coerenti) ──────────────────── */
/* Tutti i bottoni hanno una transizione fluida di default */
button { transition: background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease, transform .1s ease; }
button:active { transform: scale(.97); }

/* I pannelli/card hanno bordi più sottili e raggi coerenti */
.panel {
  border-width: 1px;
  border-radius: var(--r-lg);
}

/* Hover più curato sulle righe interattive */
.sr-item { transition: background .12s ease; }
.sr-item:hover { background: var(--bg2); }

/* Link con transizione colore morbida */
a { transition: color .12s ease; }

/* Skeleton di caricamento (shimmer) per gli stati di attesa */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--border) 37%, var(--bg2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Focus state accessibile e pulito su input */
input:focus, select:focus, textarea:focus {
  border-color: var(--blue) !important;
}

/* ── FILTRI LEADERBOARD ────────────────────────────────────────────────────── */
.lb-filter {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; outline: none;
}
.lb-search {
  flex: 1; min-width: 140px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 14px; font-size: 13px; color: var(--text); outline: none;
}
.lb-search:focus { border-color: var(--blue); }



/* ── RULES + MARKET CONTEXT affiancati (sotto Order Book, come Polymarket) ──── */

/* ── HOME: News Feed + Hot Topics (stile Polymarket) ── */
.pm-top { display: grid; grid-template-columns: 1fr 320px; gap: 20px; margin: 8px 0 22px; }
.pm-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pm-sec-head h2 { font-family: 'EB Garamond', serif; font-size: 1.5rem; font-weight: 500; margin: 0; }
.pm-sec-link { font-family: 'EB Garamond', serif; font-size: 1rem; color: var(--blue, #2563eb); font-weight: 500; }
.pm-news-list { display: flex; flex-direction: column; gap: 10px; }
.pm-news-item { display: flex; gap: 12px; padding: 11px 10px; border: 1px solid var(--border); border-radius: var(--r-md); transition: background .14s, transform .14s, border-color .14s, box-shadow .14s; border-left: 3px solid transparent; }
.pm-news-item:hover { background: var(--bg2); transform: translateX(2px); border-left-color: var(--blue); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.pm-news-num { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex-shrink: 0; font-size: 13px; font-weight: 800; color: var(--blue); background: var(--blue-bg); border-radius: 50%; }
.pm-news-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pm-news-title { display: -webkit-box; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text); -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pm-news-title:hover { color: var(--blue); }
.pm-news-src { font-size: 11.5px; color: var(--text3); }
.pm-news-mkt { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--blue); background: var(--blue-bg); border: 1px solid var(--blue-b); padding: 3px 10px; border-radius: var(--r-pill); transition: background .12s, filter .12s; }
.pm-news-mkt:hover { filter: brightness(0.95); }
.pm-hot-bar { height: 4px; background: var(--bg3); border-radius: 99px; margin: 5px 0 4px; overflow: hidden; }
.pm-hot-fill { height: 100%; background: var(--blue, #2563eb); border-radius: 99px; }
.pm-hot-chg { font-weight: 700; }
.pm-hot-chg.up { color: var(--yes, #16a34a); }
.pm-hot-chg.down { color: var(--no, #dc2626); }
.pm-hot-list { display: flex; flex-direction: column; gap: 8px; }
.pm-hot-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--r-md); transition: background .12s; }
.pm-hot-item:hover { background: var(--bg2); }
.pm-hot-item img, .pm-hot-ph { width: 34px; height: 34px; border-radius: var(--r-sm); object-fit: cover; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--bg3); font-size: 17px; }
.pm-hot-body { min-width: 0; }
.pm-hot-title { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pm-hot-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.pm-empty { font-size: 13px; color: var(--text3); padding: 16px; text-align: center; }

@media (max-width: 860px) {
 .pm-top { grid-template-columns: 1fr; }
}

/* ── LIVE CHAT pubblica per mercato ── */
.chat-warn { font-size: 12px; color: #b45309; background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); border-radius: var(--r-md); padding: 9px 12px; margin-bottom: 12px; }
.chat-messages { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px; }
.chat-empty, .chat-login { color: var(--text3); font-size: 14px; text-align: center; padding: 24px; }
.chat-msg { display: flex; gap: 10px; }
.chat-av { width: 34px; height: 34px; border-radius: 50%; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.chat-av img { width: 100%; height: 100%; object-fit: cover; }
.chat-body { min-width: 0; flex: 1; }
.chat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.chat-name { font-size: 13px; font-weight: 700; }
.chat-cred { font-size: 11px; font-weight: 700; color: var(--yes, #16a34a); background: rgba(22,163,74,.1); padding: 1px 7px; border-radius: 99px; }
.chat-time { font-size: 11px; color: var(--text3); }
.chat-actions { margin-left: auto; display: flex; gap: 4px; }
.chat-actions button { background: none; border: none; cursor: pointer; font-size: 12px; opacity: .5; padding: 2px 4px; }
.chat-actions button:hover { opacity: 1; }
.chat-text { font-size: 14px; line-height: 1.4; word-break: break-word; }
.chat-inputbar { display: flex; gap: 8px; margin-top: 14px; }
.chat-field { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--text); font-size: 14px; }
.chat-field:focus { outline: none; border-color: var(--blue, #2563eb); }
.chat-send { padding: 10px 20px; border: none; border-radius: var(--r-pill); background: var(--blue, #2563eb); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }

/* ── Nastro animato di loghi brand (pagina Luxwear) ── */
.lux-marquee {
  margin: 4px 0 20px;
  padding: 6px 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* I loghi sfumano ai due lati invece di tagliarsi netti */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.lux-track {
  display: flex;
  gap: 38px;
  width: max-content;
  align-items: center;
  will-change: transform;
}
.lux-track-left  { animation: lux-scroll-left  42s linear infinite; }
.lux-track-right { animation: lux-scroll-right 50s linear infinite; }
.lux-marquee:hover .lux-track { animation-play-state: paused; }   /* si ferma al passaggio del mouse */
@keyframes lux-scroll-left  { from { transform: translateX(0); }      to { transform: translateX(-50%); } }
@keyframes lux-scroll-right { from { transform: translateX(-50%); }   to { transform: translateX(0); } }
.lux-logo {
  flex-shrink: 0;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .55;
  transition: opacity .2s, transform .2s;
}
.lux-logo:hover { opacity: 1; transform: scale(1.12); }
.lux-logo img {
  max-height: 34px;
  max-width: 90px;
  object-fit: contain;
}
/* Le favicon sono già colorate e visibili anche su sfondo scuro: nessuna inversione */
[data-theme="dark"] .lux-logo img { opacity: .9; }
/* Rispetta chi preferisce ridurre le animazioni */
@media (prefers-reduced-motion: reduce) {
  .lux-track-left, .lux-track-right { animation: none; }
}

/* Timeline mercato: su schermi molto stretti riduce leggermente il testo per non comprimere le date */
@media (max-width: 560px) {
  .invite-btn-text { display: none; }
  .invite-btn { padding: 6px 10px !important; }
}
@media (max-width: 420px) {
  #tl-collapse > div:last-child > div { font-size: 11px !important; }
  #tl-collapse > div:last-child > div > div:first-child { font-size: 11.5px !important; }
  /* Pulsanti header un po' più compatti per non affollare su schermi stretti */
  .nav-btn { padding: 6px 11px; font-size: 12.5px; }
  .nav-right { gap: 6px; }
}


