/* ====================== PLAYER (mobile) ====================== */
html, body { overflow-x: hidden; }
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 18px; }

.screen { flex: 1; display: flex; flex-direction: column; animation: fade .35s both; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.grow { flex: 1; }
.center-col { align-items: center; justify-content: center; text-align: center; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.brand { font-weight: 900; letter-spacing: .12em; color: var(--accent); display: flex; gap: 8px; align-items: center; }
.me { font-weight: 800; font-size: .85rem; color: var(--txt-dim); }
.me b { color: var(--txt); }

/* ---- Join ---- */
.join-hero { text-align: center; margin: 6vh 0 4vh; }
.join-emoji { font-size: 64px; }
.join-title { font-size: 2.1rem; font-weight: 900; margin-top: 10px; line-height: 1.1; }
.join-title .hl { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.join-sub { color: var(--txt-dim); margin-top: 10px; font-weight: 600; }
.join-form { display: flex; flex-direction: column; gap: 14px; margin-top: auto; }
.join-form input { padding: 1rem; font-size: 1.1rem; text-align: center; font-weight: 800; }
.join-form .btn { padding: 1.05rem; font-size: 1.1rem; }

/* ---- Lobby / waiting ---- */
.status-emoji { font-size: 72px; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.status-title { font-size: 1.7rem; font-weight: 900; margin-top: 14px; }
.status-sub { color: var(--txt-dim); margin-top: 8px; font-weight: 600; max-width: 320px; }
.spinner { width: 46px; height: 46px; border-radius: 50%; margin-top: 22px;
  border: 5px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Question ---- */
.q-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.q-counter { font-weight: 800; color: var(--txt-dim); font-size: .9rem; }
.q-timer { font-weight: 900; font-size: 1.3rem; min-width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border); }
.q-timer.warn { color: var(--gold); border-color: var(--gold); }
.q-timer.danger { color: var(--red); border-color: var(--red); animation: pulse2 .8s infinite; }
@keyframes pulse2 { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.q-text { font-size: 1.45rem; font-weight: 900; line-height: 1.2; margin-bottom: 16px; }

.options { display: grid; gap: 14px; margin-top: auto; }
.opt-btn { display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 20px 18px; border-radius: 16px; font-size: 1.2rem; font-weight: 800; color: #fff;
  border: none; box-shadow: 0 8px 20px rgba(0,0,0,.3); transition: transform .08s ease, opacity .2s; }
.opt-btn:active { transform: scale(.97); }
.opt-btn .tag { width: 44px; height: 44px; flex: none; border-radius: 11px; display: grid; place-items: center;
  font-size: 1.3rem; font-weight: 900; background: rgba(0,0,0,.22); }
.opt-btn[data-k="0"] { background: var(--opt-a); }
.opt-btn[data-k="1"] { background: var(--opt-b); }
.opt-btn[data-k="2"] { background: var(--opt-c); }
.opt-btn[data-k="3"] { background: var(--opt-d); }
.opt-btn[data-k="4"] { background: var(--opt-e); }
.opt-btn[data-k="5"] { background: var(--opt-f); }
.opt-btn.dim { opacity: .35; }
.opt-btn.sel { outline: 4px solid #fff; outline-offset: 2px; }

/* ---- Reveal feedback ---- */
.feedback { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.fb-emoji { font-size: 90px; animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fb-correct { color: var(--green); }
.fb-wrong { color: var(--red); }
.fb-title { font-size: 2rem; font-weight: 900; margin-top: 10px; }
.fb-score { margin-top: 18px; padding: 14px 22px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 800; }
.fb-score b { color: var(--gold); font-size: 1.3rem; }

/* ---- Won (HAI VINTO lampeggiante) ---- */
.won { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 16px; z-index: 30; animation: flash .7s steps(1) infinite; }
@keyframes flash {
  0%   { background: linear-gradient(160deg, #ffd23f, #ff2d75); }
  50%  { background: linear-gradient(160deg, #7b2ff7, #19e3c5); }
  100% { background: linear-gradient(160deg, #ffd23f, #ff2d75); }
}
.won-trophy { font-size: 90px; animation: bob 1.2s ease-in-out infinite; }
.won-title { font-size: 3.4rem; font-weight: 900; color: #fff; letter-spacing: .02em; text-shadow: 0 6px 24px rgba(0,0,0,.4); }
.won-sub { font-size: 1.2rem; font-weight: 800; color: #fff; background: rgba(0,0,0,.25); padding: 8px 18px; border-radius: 999px; }

/* ---- Lost / final ---- */
.final-rank { font-size: 3rem; font-weight: 900; color: var(--gold); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(40px);
  background: #000; color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 700; font-size: .9rem;
  opacity: 0; transition: all .3s ease; z-index: 60; border: 1px solid var(--border); max-width: 86%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
