/* Interfaccia giocatore (smartphone) */
body {
  background: radial-gradient(130% 70% at 50% 0%, var(--bg-top) 0%, var(--bg) 62%) fixed, var(--bg);
  overscroll-behavior: none;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px);
}
#app { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; min-height: 100%; min-height: 100dvh; display: flex; flex-direction: column; }
#view { flex: 1; display: flex; flex-direction: column; padding: max(18px, env(safe-area-inset-top)) 18px 18px; }
#app.with-tabs #view { padding-bottom: 92px; }

/* --- comuni --- */
.stack > * + * { margin-top: 14px; }
.spacer { flex: 1; min-height: 16px; }
.center { text-align: center; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.45; }
.big { font-family: var(--px); font-size: 15px; line-height: 1.6; }
.chip { font-family: var(--px); font-size: 9px; display: inline-block; padding: 8px 11px; border-radius: 8px; background: var(--panel); border: 2px solid var(--line); color: var(--gold); }
.field {
  width: 100%; font-size: 18px; font-weight: 700; padding: 14px 16px; border-radius: 14px;
  border: 3px solid var(--line); background: #191449; outline: none;
}
.field:focus { border-color: var(--b); box-shadow: 0 0 0 4px rgba(79, 216, 246, .22); }
.field.code { font-family: var(--px); font-size: 14px; letter-spacing: 5px; text-align: center; text-transform: uppercase; }
.btn {
  display: block; width: 100%; font-family: var(--px); font-size: 13px; padding: 17px; border-radius: 14px;
  color: #241806; background: var(--gold); box-shadow: 0 6px 0 var(--gold2), 0 10px 24px rgba(255, 217, 90, .25);
  text-align: center;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--gold2); }
.btn:disabled { opacity: .5; }
.btn.alt { background: var(--panel); color: var(--ink); box-shadow: 0 6px 0 #17124a; border: 2px solid var(--line); }
.err { font-size: 13px; color: var(--ko); font-weight: 700; min-height: 18px; }

/* --- header / hud --- */
.hud { display: flex; justify-content: space-between; align-items: center; font-family: var(--px); font-size: 9px; color: var(--muted); gap: 8px; }
.hud b { color: var(--gold); font-weight: 400; }

/* --- accesso --- */
.hero { position: relative; margin: -18px -18px 0; height: 210px; overflow: hidden; }
.hero img.photo { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; filter: saturate(1.1); }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(31, 26, 85, .1) 0%, rgba(31, 26, 85, .55) 55%, var(--bg) 100%); }
.hero img.logo { position: absolute; z-index: 1; left: 50%; bottom: 6px; width: 120px; transform: translateX(-50%); filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .6)); }
.join-title { font-size: 17px; margin-top: 10px; }
.join-title .sub { font-size: 12px; margin-top: 8px; }
.tagline { font-family: var(--px); font-size: 8px; color: var(--b); letter-spacing: 2px; text-align: center; margin-top: 12px; line-height: 1.8; }

/* --- lobby --- */
.avatar {
  width: 88px; height: 88px; margin: 0 auto; border-radius: 22px; display: grid; place-items: center;
  font-family: var(--px); font-size: 24px; background: linear-gradient(135deg, var(--b), #8d72ff);
  box-shadow: 0 6px 0 #4b38b0, 0 0 30px rgba(79, 216, 246, .45); animation: bob 2s ease-in-out infinite;
}
.church-card { border-radius: 16px; overflow: hidden; border: 2px solid var(--line); position: relative; height: 110px; }
.church-card img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; opacity: .85; }
.church-card span { position: absolute; left: 12px; bottom: 10px; font-family: var(--px); font-size: 8px; background: rgba(20, 16, 60, .75); padding: 6px 8px; border-radius: 6px; }

/* --- domanda --- */
.timer { height: 12px; border-radius: 8px; background: #191449; overflow: hidden; margin-top: 12px; border: 2px solid var(--line); }
.timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--d), var(--gold), var(--a)); transition: width .2s linear; }
.secs { font-family: var(--px); font-size: 10px; text-align: right; margin-top: 6px; color: var(--muted); }
.qtext { font-size: 19px; font-weight: 800; line-height: 1.35; margin: 14px 2px 0; }
.qimg { width: 100%; max-height: 150px; object-fit: cover; border-radius: 14px; margin-top: 12px; border: 2px solid var(--line); }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.answers .ans { min-height: 112px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; font-size: 15px; line-height: 1.25; }
.answers .ans .L { width: 34px; height: 34px; font-size: 15px; }
.status { text-align: center; margin-top: 16px; font-family: var(--px); font-size: 10px; line-height: 1.7; color: var(--b); min-height: 20px; }
.status.ko { color: var(--ko); }
.countdown { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; }
.countdown b { font-family: var(--px); font-size: 74px; font-weight: 400; color: var(--gold); text-shadow: 0 6px 0 var(--gold2), 0 0 30px rgba(255, 217, 90, .5); animation: pop .5s cubic-bezier(.2, 1.8, .4, 1); }

.bonus-banner {
  font-family: var(--px); font-size: 9px; color: #2b1a00; text-align: center; padding: 9px 10px; border-radius: 8px;
  background: linear-gradient(90deg, var(--gold), #fff2b0, var(--gold)); background-size: 200% 100%; animation: shine 2s linear infinite;
}

/* --- risultato --- */
.result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding-top: 10px; animation: fadeUp .3s; }
.msg { font-family: var(--px); font-size: 22px; line-height: 1.45; }
.msg.ok { color: var(--ok); text-shadow: 0 0 18px rgba(92, 255, 163, .6), 0 4px 0 #157a45; }
.msg.ko { color: var(--ko); text-shadow: 0 0 18px rgba(255, 107, 127, .5), 0 4px 0 #7a1527; }
.pts { font-family: var(--px); font-size: 30px; color: var(--gold); text-shadow: 0 4px 0 var(--gold2); animation: pop .6s cubic-bezier(.2, 1.8, .4, 1) both; }
.pill { font-family: var(--px); font-size: 10px; padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); line-height: 1.6; }
.correct-box { background: var(--panel2); border: 2px solid var(--line); border-radius: 14px; padding: 14px; font-size: 15px; font-weight: 700; width: 100%; }
.correct-box .L { font-family: var(--px); font-size: 11px; color: var(--ok); }

.clue {
  width: 100%; text-align: left; position: relative; border-radius: 14px; padding: 16px 16px 16px 54px;
  background: linear-gradient(135deg, #fff6dc, #f3e1b0); color: #3b2a10; font-weight: 700; font-size: 15px; line-height: 1.4;
  box-shadow: 0 6px 0 #b99a55, 0 10px 30px rgba(255, 217, 90, .25); animation: pop .6s .2s cubic-bezier(.2, 1.6, .4, 1) both;
}
.clue::before { content: '🔍'; position: absolute; left: 14px; top: 14px; font-size: 26px; }
.clue small { display: block; font-family: var(--px); font-size: 8px; color: #8a6a2a; margin-bottom: 6px; letter-spacing: 1px; }

/* --- classifica giocatore --- */
.rank-big { font-family: var(--px); font-size: 44px; color: var(--gold); text-shadow: 0 5px 0 var(--gold2); }
.mini-lb { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.mini-lb div { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; font-weight: 800; }
.mini-lb div.me { border-color: var(--gold); }
.mini-lb .r { font-family: var(--px); font-size: 10px; width: 26px; color: var(--muted); }
.mini-lb .s { margin-left: auto; font-family: var(--px); font-size: 10px; color: var(--gold); }

/* --- indizi e storico --- */
.list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.empty { text-align: center; color: var(--muted); margin-top: 40px; line-height: 1.6; }
.hcard { background: var(--panel2); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.hcard .top { display: flex; justify-content: space-between; font-family: var(--px); font-size: 8px; color: var(--muted); margin-bottom: 8px; }
.hcard .q { font-weight: 800; }
.hcard .opts { margin-top: 8px; display: grid; gap: 4px; font-size: 13px; }
.hcard .opts span { padding: 4px 8px; border-radius: 8px; color: var(--muted); }
.hcard .opts span.mine { color: var(--ko); background: rgba(255, 107, 127, .12); }
.hcard .opts span.right { color: var(--ok); background: rgba(92, 255, 163, .12); font-weight: 800; }
.hcard.ok { border-left: 6px solid var(--ok); }
.hcard.ko { border-left: 6px solid var(--ko); }
.hcard.star { border-left: 6px solid var(--gold); }
.hcard .hclue { margin-top: 8px; color: #ffe9a8; font-weight: 700; }

/* --- tab bar --- */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 5;
  display: flex; gap: 8px; padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(20, 16, 60, .95) 30%);
}
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 18px; padding: 9px 0; border-radius: 12px; background: #221c5e; color: var(--muted); border: 2px solid transparent; }
.tabs button span { font-family: var(--px); font-size: 7px; }
.tabs button.on { background: var(--panel); color: var(--ink); border-color: var(--line); box-shadow: inset 0 -3px 0 var(--b); }
.tabs button .badge { position: absolute; }
