:root {
  --bg:      #040f1e;
  --bg2:     #ffffff12;
  --bg3:     #0d2040;
  --bg4:     #0f2848;
  --border:  #1a3050;
  --border2: #1e3a6a;
  --blue:    #2563eb;
  --blue2:   #3b82f6;
  --blue3:   #60a5fa;
  --accent:  #38bdf8;
  --gold:    #f59e0b;
  --text:    #ffffff;
  --text2:   #6b8aaa;
  --radius:  14px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; min-height: 100vh; overflow-x: hidden; }

/* BACKGROUND GRID */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: linear-gradient(rgba(37,99,235,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(37,99,235,.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* PARTICLES */
#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.particle { position: absolute; border-radius: 50%; animation: pfloat linear infinite; opacity: 0; }
@keyframes pfloat { 0%{transform:translateY(100vh) translateX(0);opacity:0}10%{opacity:.5}90%{opacity:.1}100%{transform:translateY(-5vh) translateX(var(--dx,0));opacity:0} }

/* NAVBAR */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; height: 64px;
  background: rgba(4,15,30,.96); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border2);
  box-shadow: 0 1px 0 rgba(255,255,255,.12), 0 4px 20px rgba(0,0,0,.3);
}
.nav-logo { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.nav-logo img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; box-shadow: 0 0 14px rgba(37,99,235,.5); }
.nav-logo span { font-weight: 800; font-size: 1rem; color: var(--text); letter-spacing: .03em; }
.nav-links { display: flex; gap: 0; list-style: none; }
.nav-links a {
  position: relative; padding: .42rem .95rem; border-radius: 6px;
  color: var(--text2); text-decoration: none; font-size: .83rem; transition: color .2s;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -2px; left: .95rem; right: .95rem;
  height: 2px; background: linear-gradient(90deg, var(--blue2), var(--accent));
  transform: scaleX(0); transition: transform .25s; border-radius: 2px;
}
.nav-links a:hover { color: var(--blue3); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--blue3); }
.nav-right { display: flex; align-items: center; gap: .6rem; }
.nav-socials { display: flex; gap: .35rem; }
.nav-social {
  width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); text-decoration: none; transition: all .2s;
}
.nav-social:hover { border-color: var(--blue2); color: var(--blue2); background: rgba(37,99,235,.1); }
#btn-login {
  display: none; align-items: center; gap: .4rem;
  padding: .42rem 1rem; border-radius: 7px;
  background: var(--blue); color: #fff;
  font-weight: 600; font-size: .8rem; border: none; cursor: pointer; transition: all .2s;
  box-shadow: 0 0 12px rgba(37,99,235,.3);
}
#btn-login:hover { background: var(--blue2); box-shadow: 0 0 20px rgba(37,99,235,.5); }
#user-bar { display: none; align-items: center; gap: .55rem; }
.u-av { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--blue2); }
.u-nm { font-size: .78rem; }
.u-pt { color: var(--accent); font-weight: 700; font-size: .78rem; }
.u-out { background: none; border: 1px solid var(--border2); color: var(--text2); padding: .25rem .5rem; border-radius: 5px; cursor: pointer; font-size: .7rem; transition: all .2s; }
.u-out:hover { border-color: #e74c3c; color: #e74c3c; }

/* PAGE */
.page-wrap { position: relative; z-index: 1; padding-top: 64px; }
.section-inner { max-width: 1100px; margin: 0 auto; padding: 4rem 2rem; }
.section-head { margin-bottom: 3rem; text-align: center; }
.section-title { font-size: clamp(2.5rem,6vw,4rem); font-weight: 900; background: linear-gradient(135deg, #fff 0%, #bfdbfe 50%, var(--accent) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 1rem; font-family: Georgia, serif; }
.section-divider { width: 6rem; height: 3px; margin: 0 auto 1rem; background: linear-gradient(90deg, transparent, var(--blue2), var(--accent), transparent); border-radius: 3px; }
.section-sub { color: var(--text2); font-size: 1rem; }

/* RANK SEPARATOR */
.rank-separator { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin-bottom: 2rem; }
.sep-line-left  { flex: 1; height: 2px; background: linear-gradient(to right, transparent, currentColor); max-width: 250px; }
.sep-line-right { flex: 1; height: 2px; background: linear-gradient(to left, transparent, currentColor); max-width: 250px; }
.rank-badge-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 2.5rem; border-radius: 16px; border: 2px solid;
  background: rgba(2,13,26,.9); backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  position: relative; overflow: hidden;
}
.rank-badge-header::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 0%, var(--glow-color,rgba(37,99,235,.2)) 0%, transparent 70%); }
.rank-badge-icon { font-size: 1.6rem; position: relative; z-index: 1; }
.rank-badge-name { font-size: 1.5rem; font-weight: 800; font-family: Georgia, serif; letter-spacing: .04em; position: relative; z-index: 1; }

/* MEMBER CARDS */
.members-flex { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; }
.mc-wrap { width: 170px; }
.member-card {
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  padding: 1.5rem; width: 170px; border-radius: 24px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15);
  transition: all .3s; cursor: default; position: relative; overflow: hidden;
}
.member-card::after { content: ''; position: absolute; inset: 0; border-radius: 24px; opacity: 0; transition: opacity .3s; background: radial-gradient(circle at 50% 30%, var(--card-glow,rgba(37,99,235,.12)) 0%, transparent 70%); }
.member-card:hover { border-color: rgba(59,130,246,.3); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.member-card:hover::after { opacity: 1; }
.member-img-wrap { position: relative; }
.member-glow { position: absolute; inset: 0; border-radius: 16px; opacity: 0; transition: opacity .3s; background: radial-gradient(circle, var(--glow,rgba(37,99,235,.6)) 0%, transparent 70%); filter: blur(12px); z-index: -1; }
.member-card:hover .member-glow { opacity: .6; }
.member-img { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; border: 1px solid rgba(255,255,255,.1); transition: border-color .3s; image-rendering: pixelated; }
.member-card:hover .member-img { border-color: rgba(59,130,246,.4); }
.member-no-pic { width: 96px; height: 96px; border-radius: 16px; background: var(--bg3); border: 1px solid var(--border2); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; opacity: .3; }
.member-name { font-weight: 600; font-size: .9rem; text-align: center; color: #e2e8f0; line-height: 1.3; }

/* NEWS */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.nc { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15); border-radius: var(--radius); padding: 1.3rem 1.4rem; cursor: pointer; transition: all .2s; display: flex; flex-direction: column; gap: .6rem; }
.nc:hover { border-color: rgba(59,130,246,.2); transform: translateY(-2px); background: rgba(6,20,40,.9); }
.nc-meta { display: flex; gap: .9rem; font-size: .76rem; color: var(--text2); }
.nc-title { font-size: .9rem; font-weight: 600; line-height: 1.4; }
.nc-excerpt { color: var(--text2); font-size: .82rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nc-rm { color: var(--blue3); font-size: .82rem; font-weight: 600; display: flex; align-items: center; gap: .3rem; margin-top: auto; transition: gap .2s; }
.nc:hover .nc-rm { gap: .55rem; }
.nc-img { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; }

/* PROJECTS */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.pc { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: all .2s; }
.pc:hover { transform: translateY(-2px); border-color: rgba(59,130,246,.2); }
.pc-img { width: 100%; height: 145px; object-fit: cover; }
.pc-body { padding: 1rem 1.1rem; }
.pc-title { font-weight: 700; font-size: .9rem; margin-bottom: .35rem; }
.pc-desc { color: var(--text2); font-size: .8rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.status-badge { display: inline-block; padding: .1rem .5rem; border-radius: 4px; font-size: .65rem; font-weight: 700; margin-bottom: .45rem; }
.s-in_corso    { background: rgba(46,204,113,.1); color: #2ecc71; }
.s-completato  { background: rgba(56,189,248,.1); color: var(--accent); }
.s-pianificato { background: rgba(245,158,11,.1); color: var(--gold); }

/* SHOP */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.shc { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: all .2s; }
.shc:hover { border-color: rgba(59,130,246,.2); transform: translateY(-2px); }
.shc-img { width: 100%; height: 145px; object-fit: cover; }
.shc-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: .35rem; }
.shc-name { font-weight: 700; font-size: .9rem; }
.shc-desc { color: var(--text2); font-size: .8rem; flex: 1; line-height: 1.5; }
.shc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; }
.shc-price { font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.shc-old { font-size: .72rem; color: var(--text2); text-decoration: line-through; margin-left: .25rem; }
.disc-b { background: rgba(56,189,248,.1); color: var(--accent); font-size: .65rem; padding: .08rem .32rem; border-radius: 3px; font-weight: 700; }
.btn-buy { padding: .4rem .9rem; border-radius: 6px; background: var(--blue); color: #fff; font-weight: 700; font-size: .78rem; border: none; cursor: pointer; transition: all .2s; box-shadow: 0 0 10px rgba(37,99,235,.3); }
.btn-buy:hover { background: var(--blue2); box-shadow: 0 0 16px rgba(37,99,235,.5); }
.btn-buy:disabled { opacity: .3; cursor: not-allowed; box-shadow: none; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.3rem; border-radius: 8px; font-weight: 600; font-size: .85rem; cursor: pointer; border: none; text-decoration: none; transition: all .2s; }
.btn:hover { transform: translateY(-1px); }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 0 14px rgba(37,99,235,.3); }
.btn-blue:hover { background: var(--blue2); box-shadow: 0 0 22px rgba(37,99,235,.5); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border2); }
.btn-outline:hover { border-color: var(--blue2); color: var(--blue3); }
.btn-accent { background: linear-gradient(135deg, var(--blue), var(--accent)); color: #fff; box-shadow: 0 0 14px rgba(56,189,248,.3); }
.btn-accent:hover { box-shadow: 0 0 24px rgba(56,189,248,.5); }

/* MODALS */
.mo { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.88); backdrop-filter: blur(8px); display: none; align-items: flex-start; justify-content: center; padding: 2rem 1rem; overflow-y: auto; }
.mo.open { display: flex; }
.mb { background: rgba(255,255,255,.1); backdrop-filter:blur(20px); border: 1px solid rgba(255,255,255,.2); border-radius: 18px; width: 100%; max-width: 680px; position: relative; margin: auto; animation: min .24s ease-out; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
@keyframes min { from{opacity:0;transform:scale(.97) translateY(10px)}to{opacity:1;transform:none} }
.mcl { position: absolute; top: .9rem; right: .9rem; background: var(--bg3); border: 1px solid var(--border2); color: var(--text2); width: 32px; height: 32px; border-radius: 50%; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s; z-index: 1; }
.mcl:hover { border-color: #e74c3c; color: #e74c3c; }
.mhi { width: 100%; max-height: 300px; object-fit: cover; border-radius: 18px 18px 0 0; }
.mcon { padding: 1.8rem; }
.mmeta { font-size: .78rem; color: var(--text2); margin-bottom: .8rem; display: flex; gap: .9rem; flex-wrap: wrap; }
.mtitle { font-size: 1.4rem; font-weight: 800; margin-bottom: .9rem; line-height: 1.3; }
.mbody { color: var(--text2); line-height: 1.85; font-size: .92rem; white-space: pre-wrap; }
.mact { display: flex; gap: .65rem; margin-top: 1.3rem; padding-top: 1.3rem; border-top: 1px solid var(--border); }
.btn-del { padding: .45rem 1.1rem; border-radius: 6px; background: rgba(192,57,43,.12); color: #e74c3c; border: 1px solid rgba(192,57,43,.25); font-weight: 600; font-size: .8rem; cursor: pointer; transition: all .2s; }
.btn-del:hover { background: rgba(192,57,43,.22); }

/* MC MODAL */
.mc-modal { position: fixed; inset: 0; z-index: 250; background: rgba(0,0,0,.88); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; padding: 1rem; }
.mc-modal.open { display: flex; }
.mcb { background: rgba(255,255,255,.1); backdrop-filter:blur(20px); border: 1px solid rgba(255,255,255,.2); border-radius: 16px; padding: 1.8rem; width: 100%; max-width: 390px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.mcb h2 { color: var(--blue3); margin-bottom: .35rem; font-size: 1.1rem; }
.mcb p { color: var(--text2); font-size: .85rem; margin-bottom: 1.2rem; line-height: 1.6; }
.field { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: 8px; color: var(--text); padding: .62rem .95rem; font-size: .88rem; outline: none; transition: border-color .15s; margin-bottom: .55rem; }
.field:focus { border-color: var(--blue2); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.ferr { color: #e74c3c; font-size: .8rem; margin-bottom: .5rem; display: none; }

/* TOAST */
#toast { position: fixed; bottom: 1.6rem; right: 1.6rem; z-index: 300; background: rgba(255,255,255,.12); backdrop-filter:blur(16px); border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: .6rem 1rem; font-size: .82rem; transform: translateY(70px); opacity: 0; transition: all .28s; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
#toast.show { transform: none; opacity: 1; }

/* FADE IN */
.fade-in { opacity: 0; transform: translateY(20px); transition: all .55s ease; }
.fade-in.visible { opacity: 1; transform: none; }

/* STATUTO */
.statuto-card { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15); border-radius: 14px; padding: 1.5rem; display: flex; align-items: center; gap: 1.25rem; margin-bottom: 3rem; cursor: pointer; transition: all .2s; text-decoration: none; color: inherit; }
.statuto-card:hover { border-color: rgba(59,130,246,.3); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(37,99,235,.1); }

/* FOOTER */
footer { border-top: 1px solid rgba(255,255,255,.1); padding: 3rem 2rem; position: relative; z-index: 1; text-align: center; background: rgba(255,255,255,.04); }
footer a { color: var(--text2); text-decoration: none; transition: color .2s; }
footer a:hover { color: var(--blue3); }

@media (max-width: 768px) {
  nav { padding: 0 1rem; }
  .nav-links { display: none; }
  .section-inner { padding: 3rem 1rem; }
  .members-flex { gap: .75rem; }
  .member-card { width: 140px; padding: 1rem; }
}
