/* Brio Game · stile comune */
:root {
  --bg: #07060e;
  --bg2: #0e0c1c;
  --card: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .10);
  --txt: #f3f1ff;
  --mut: #a7a3c4;
  --vio: #8b5cf6;
  --pink: #ff3d81;
  --lime: #b8ff3c;
  --cyan: #38e1ff;
  --amber: #ffb547;
  --red: #ff5470;
  --grad: linear-gradient(100deg, var(--cyan), var(--vio) 45%, var(--pink));
  --r: 22px;
  --font-d: 'Unbounded', system-ui, sans-serif;
  --font-b: 'Outfit', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font-family: var(--font-b); font-size: 18px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--vio); color: #fff; }

.wrap { width: min(1180px, 100% - 40px); margin-inline: auto; }

/* ── barra in alto ── */
.top {
  position: fixed; inset: 0 0 auto; z-index: 50;
  transition: background .3s, backdrop-filter .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.top.solid { background: rgba(7, 6, 14, .72); backdrop-filter: blur(14px); border-color: var(--line); }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-d); font-weight: 800; letter-spacing: .02em; font-size: 19px; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad); box-shadow: 0 0 24px rgba(139, 92, 246, .6);
}
.logo-mark svg { width: 20px; height: 20px; }
.beta {
  font-family: var(--font-d); font-size: 10px; font-weight: 700; letter-spacing: .14em;
  padding: 4px 8px; border-radius: 99px; color: #0b0a12; background: var(--lime);
  box-shadow: 0 0 16px rgba(184, 255, 60, .55); animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 4px rgba(184, 255, 60, .2); } }
.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav a.l { text-decoration: none; color: var(--mut); padding: 8px 14px; border-radius: 99px; font-weight: 500; transition: color .2s, background .2s; }
.nav a.l:hover { color: var(--txt); background: rgba(255, 255, 255, .06); }

.btn {
  --b: var(--grad);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  font-family: var(--font-d); font-weight: 700; font-size: 15px; letter-spacing: .03em;
  padding: 14px 24px; border-radius: 14px; color: #fff; background: var(--b);
  box-shadow: 0 10px 30px -10px rgba(139, 92, 246, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); box-shadow: 0 16px 40px -12px rgba(255, 61, 129, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.ghost { background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.btn.sm { padding: 9px 16px; font-size: 13px; border-radius: 11px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; border-radius: 99px;
  background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; font-size: 15px;
}
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-d); font-size: 13px; font-weight: 800; background: var(--grad); }

/* ── campi ── */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 600; color: var(--mut); letter-spacing: .02em; }
.field input {
  width: 100%; padding: 15px 16px; border-radius: 13px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35); font-size: 18px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--vio); box-shadow: 0 0 0 4px rgba(139, 92, 246, .25); }
.msg { min-height: 24px; font-size: 15px; font-weight: 600; margin: 2px 0 10px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--lime); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.glass {
  background: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

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

/* ── lingue: selettore con bandierine ── */
html[lang=zh] { --font-d: 'Unbounded', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', system-ui, sans-serif; --font-b: 'Outfit', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', system-ui, sans-serif; }
.flag { width: 22px; height: 15px; border-radius: 4px; flex: none; display: block; box-shadow: 0 0 0 1px rgba(255, 255, 255, .22), 0 2px 8px rgba(0, 0, 0, .35); }
.lang { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 9px; border: 0; cursor: pointer; border-radius: 99px;
  background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px var(--line); font-family: var(--font-d); font-weight: 700; font-size: 12px; letter-spacing: .08em;
  transition: background .2s, box-shadow .2s;
}
.lang-btn:hover, .lang.open .lang-btn { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .55), 0 0 20px -4px rgba(139, 92, 246, .6); }
.lang-chev { width: 14px; height: 14px; opacity: .7; transition: transform .25s; }
.lang.open .lang-chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; list-style: none; margin: 0; padding: 6px; min-width: 196px;
  border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(30, 26, 58, .96), rgba(14, 12, 28, .97));
  backdrop-filter: blur(18px); box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .9), 0 0 0 1px rgba(139, 92, 246, .12);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97); transform-origin: top right; transition: opacity .2s, transform .25s cubic-bezier(.3, 1.4, .5, 1), visibility .2s;
}
.lang.open .lang-menu { opacity: 1; visibility: visible; transform: none; }
.lang-menu button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 12px; background: none; cursor: pointer;
  font-family: var(--font-b); font-size: 16px; font-weight: 600; color: var(--mut); text-align: left; transition: background .15s, color .15s;
}
.lang-menu button:hover, .lang-menu button:focus-visible { background: rgba(139, 92, 246, .18); color: var(--txt); outline: none; }
.lang-menu button[aria-selected=true] { color: var(--txt); background: rgba(255, 255, 255, .06); }
.lang-menu button span { flex: 1; }
.lang-ok { width: 16px; height: 16px; color: var(--lime); }
@media (max-width: 520px) { .lang-code { display: none; } .lang-btn { padding: 0 8px; gap: 6px; } }
@media (max-width: 520px) { #navUser .chip { white-space: nowrap; max-width: 108px; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 30px; padding: 3px 10px 3px 4px; } #navUser .chip .avatar { display: inline-grid; vertical-align: middle; margin-right: 6px; } }

/* modalità leggera (veloce.js mette html.lite sui dispositivi lenti): le sfocature dietro i pannelli sono la cosa più pesante per i tablet vecchi */
html.lite *, html.lite *::before, html.lite *::after, html.lite dialog::backdrop { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html.lite .top.solid { background: rgba(7, 6, 14, .94); }
html.lite .glass { background: linear-gradient(160deg, rgba(30, 26, 58, .97), rgba(14, 12, 28, .98)); }
html.lite .beta { animation: none; }
/* 12 lingue (29/11/2026): menu su due colonne, una sola sul telefono stretto */
.lang-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; min-width: 360px; }
.lang-menu button { font-size: 15px; padding: 9px 11px; }
@media (max-width: 520px) { .lang-menu { grid-template-columns: 1fr; min-width: 190px; max-height: 70vh; overflow-y: auto; } }
html[dir=rtl] .lang-menu { right: auto; left: 0; transform-origin: top left; }
html[dir=rtl] .lang-menu button { text-align: right; }
