/* Mr White: schermate. */

/* ---------- barra in alto ---------- */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 14px; }
.topbar .ttl { flex: 1; min-width: 0; font-weight: 900; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-chip { font-weight: 900; letter-spacing: 0.25em; padding: 6px 12px 6px 16px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; font-size: 1.05rem; box-shadow: 0 3px 0 var(--deep); }
.round-chip { background: var(--lemon); color: var(--ink); }

/* ---------- home ---------- */
.hero { position: relative; height: 230px; margin: 10px 0 8px; }
.hero .c {
  position: absolute; top: 14px; left: 50%; width: 138px; height: 184px; border-radius: 18px; border: 4px solid var(--ink);
  background: var(--paper); color: var(--ink); display: grid; place-items: center; box-shadow: 0 6px 0 var(--deep);
  font-family: var(--serif); font-weight: 900; font-size: 2rem; transform-origin: 50% 120%;
}
.hero .c1 { margin-left: -150px; transform: rotate(-14deg); background: var(--mint); animation: sway 5s ease-in-out infinite; }
.hero .c2 { margin-left: 12px; transform: rotate(13deg); background: var(--tang); animation: sway 5s ease-in-out -1.7s infinite; }
.hero .c3 { margin-left: -69px; transform: rotate(-1deg); z-index: 2; font-size: 5.4rem; border-style: dashed; animation: sway 6s ease-in-out -3s infinite; }
@keyframes sway { 50% { transform: rotate(calc(var(--r0, 0deg) + 3deg)) translateY(-6px); } }
.hero .c1 { --r0: -14deg; } .hero .c2 { --r0: 13deg; } .hero .c3 { --r0: -1deg; }
.logo { text-align: center; margin-bottom: 4px; }
.logo small { display: block; margin-top: 8px; color: var(--muted); font-weight: 700; font-size: 1rem; }
.mode { text-align: left; align-items: center; justify-content: flex-start; gap: 14px; min-height: 84px; }
.mode .ic { font-size: 2rem; }
.mode b { display: block; font-size: 1.2rem; }
.mode small { font-weight: 600; opacity: 0.8; font-size: 0.88rem; line-height: 1.25; display: block; margin-top: 2px; }

/* ---------- carta della parola ---------- */
.flip { perspective: 1100px; }
.flip-in { position: relative; height: 330px; transform-style: preserve-3d; transition: transform 0.65s cubic-bezier(.2,.9,.3,1.2); cursor: pointer; }
.flip.shown .flip-in { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 28px; border: 4px solid var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center;
  box-shadow: 0 8px 0 var(--deep);
}
.face.front {
  background: repeating-linear-gradient(45deg, var(--grape) 0 14px, #9a79f5 14px 28px); color: var(--ink);
}
.face.front .q { font-size: 5rem; font-family: var(--serif); font-weight: 900; line-height: 1; }
.face.front b { font-size: 1.2rem; max-width: 14ch; }
.face.back { transform: rotateY(180deg); background: var(--paper); color: var(--ink); }
.face.back .word { font-family: var(--serif); font-weight: 900; font-size: clamp(2.2rem, 11vw, 3.2rem); line-height: 1.05; word-break: break-word; hyphens: auto; }
.face.back.blank { background: var(--paper); border-style: dashed; }
.face.back.blank .ghost { font-size: 6rem; font-family: var(--serif); font-weight: 900; color: #d9d2ec; line-height: 1; }

/* ---------- banner e ruoli speciali ---------- */
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; border: 3px solid var(--ink); background: var(--bg-3); box-shadow: 0 4px 0 var(--deep); }
.banner .ic { font-size: 1.9rem; }
.banner b { display: block; }
.banner.sun { background: var(--lemon); color: var(--ink); }
.banner.love { background: var(--pink); color: var(--ink); }
.banner.mint { background: var(--mint); color: var(--ink); }
.banner.sky { background: var(--sky); color: var(--ink); }

/* ---------- attesa / blocco "passa il telefono" ---------- */
.lock { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 10px 0 30px; }
.lock .big { font-size: 2rem; font-weight: 900; }
.wait { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 10px; text-align: center; }
.dots::after { content: ""; display: inline-block; width: 1.4em; text-align: left; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---------- risultato ---------- */
.reveal { text-align: center; padding: 22px 16px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: pop 0.55s cubic-bezier(.3,1.5,.5,1); }
@keyframes pop { 0% { transform: scale(0.7) rotate(-4deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.reveal .who { font-size: 1.9rem; font-weight: 900; }
.reveal.civilian { background: var(--civ); color: var(--ink); }
.reveal.undercover { background: var(--und); color: var(--ink); }
.reveal.white { background: var(--paper); color: var(--ink); }
.reveal.saved { background: var(--sky); color: var(--ink); }
.reveal .role, .reveal .chip { background: var(--paper); color: var(--ink); }
.extras { display: flex; flex-direction: column; gap: 8px; }
.extra { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; border: 3px solid var(--ink); background: var(--bg-3); }
details.tally summary { cursor: pointer; font-weight: 800; list-style: none; padding: 6px 0; color: var(--muted); }
details.tally summary::-webkit-details-marker { display: none; }
.tally .line { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-top: 2px dashed rgba(255,255,255,0.12); font-size: 0.95rem; }
.tally .line b { margin-left: auto; }

/* ---------- fine partita ---------- */
.win { text-align: center; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.win .trophy { font-size: 4rem; line-height: 1; animation: pop 0.7s cubic-bezier(.3,1.5,.5,1); }
.win h2 { font-size: 2rem; }
.win.civilians { background: var(--civ); color: var(--ink); }
.win.infiltrators { background: var(--und); color: var(--ink); }
.win.white { background: var(--paper); color: var(--ink); }
.win.none, .win.ended { background: var(--bg-3); }
.words { display: flex; gap: 10px; }
.words > div { flex: 1; padding: 12px; border-radius: 16px; border: 3px solid var(--ink); text-align: center; color: var(--ink); }
.words .w { font-family: var(--serif); font-weight: 900; font-size: 1.5rem; word-break: break-word; }
.score { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.score .bar { flex: 1; height: 14px; border-radius: 99px; background: var(--deep); border: 2px solid var(--ink); overflow: hidden; }
.score .bar i { display: block; height: 100%; background: var(--lemon); border-radius: 99px; }
.pts { font-weight: 900; min-width: 3.2ch; text-align: right; }
.pts.up { color: var(--mint); }
.pts.down { color: var(--coral); }

/* ---------- varie ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(8, 6, 28, 0.82); display: flex; align-items: flex-end; justify-content: center; }
.sheet > div { width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto; background: var(--bg); border: 3px solid var(--ink); border-radius: 26px 26px 0 0; padding: 20px 16px calc(24px + var(--safe-b)); }
.rules h3 { margin: 18px 0 6px; }
.rules p, .rules li { color: #e5e0ff; }
.rules ul { margin: 6px 0; padding-left: 1.2em; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110dvh) rotate(720deg); } }
.link { background: none; border: 0; padding: 0; color: var(--sky); text-decoration: underline; font-weight: 700; }

/* ---------- barra delle fasi ---------- */
.stages { list-style: none; display: flex; gap: 6px; margin: -4px 0 18px; padding: 0; }
.stages li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 800; color: var(--muted); text-align: center; position: relative; }
.stages li b { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--ink); background: var(--bg-2); display: grid; place-items: center; font-size: 0.85rem; color: var(--muted); }
.stages li.done b { background: var(--mint); color: var(--ink); }
.stages li.now { color: var(--text); }
.stages li.now b { background: var(--lemon); color: var(--ink); transform: scale(1.2); box-shadow: 0 3px 0 var(--deep); }
.stages li:not(:first-child)::before { content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 3px; background: var(--bg-3); z-index: -1; }
.stages li.done:not(:first-child)::before, .stages li.now:not(:first-child)::before { background: var(--mint); }
.prow.done { opacity: 0.55; }

/* ---------- timer ---------- */
.timer { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.timer-text { font-size: 3.4rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.timer .bar { height: 16px; border-radius: 99px; background: var(--deep); border: 3px solid var(--ink); overflow: hidden; }
.timer .bar i { display: block; height: 100%; background: var(--mint); border-radius: 99px; transition: width 0.3s linear; }
.timer.late { background: var(--coral); color: var(--ink); animation: throb 1s ease-in-out infinite; }
.timer.late .muted { color: var(--ink); font-weight: 800; }
.timer.late .bar i { background: var(--ink); }
@keyframes throb { 50% { transform: scale(1.03); } }

/* ---------- annuncio di fase ---------- */
.splash { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; text-align: center; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(60, 46, 150, 0.96), rgba(12, 10, 38, 0.97)); animation: splash 1.5s ease forwards; }
.splash .ic { font-size: 4.5rem; line-height: 1; animation: pop 0.5s cubic-bezier(.3,1.6,.5,1); }
.splash h2 { font-size: 2.4rem; margin: 8px 0; }
.splash .chip { margin: 4px 0; }
@keyframes splash { 0% { opacity: 0; } 12% { opacity: 1; } 72% { opacity: 1; } 100% { opacity: 0; } }
