/* PAPAGALL — stile. Festa scura, colori pieni, bottoni grossi da pollice. */
@font-face { font-family: 'Lilita One'; src: url(../fonts/lilita.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(../fonts/nunito.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; }

:root {
  --ink: #fff7ec; --dim: #cbb8e6; --bg: #2a1240; --card: rgba(30, 12, 52, 0.78); --card2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.14); --hot: #ff5a5f; --hot2: #ff9f1c; --gold: #ffd23f; --green: #3ccf6e; --blue: #3a86ff;
  --purple: #7b5cff; --teal: #2ec4b6; --pink: #ff5fa2; --red: #e63946; --r: 18px;
  --display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--body); font-weight: 700; overscroll-behavior: none; }
body { overflow: hidden; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
#bg { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#ui { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; padding: env(safe-area-inset-top) 16px 0; display: flex; flex-direction: column; align-items: stretch; max-width: 560px; margin: 0 auto; -webkit-overflow-scrolling: touch; }
#ui > * { flex: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: default; }
h3 { font-family: var(--display); font-weight: 400; font-size: 21px; margin: 0 0 10px; letter-spacing: 0.3px; }
p { margin: 6px 0; line-height: 1.4; }
.small { font-size: 14px; color: var(--dim); font-weight: 600; }
.center { text-align: center; justify-content: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.row > .btn { flex: 1; }
.row > .btn.small, .row > .btn.ghostbtn.small { flex: none; }
.grow { flex: 1 0 auto !important; display: flex; flex-direction: column; }

/* ── barra in alto ── */
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 0 6px; position: sticky; top: 0; z-index: 5; }
.tb-title { flex: 1; text-align: center; font-family: var(--display); font-size: 19px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.35); font-size: 24px; line-height: 1; display: grid; place-items: center; flex: none; }
.icon.ghost { background: none; visibility: hidden; }
.icon.del { width: 34px; height: 34px; font-size: 16px; background: rgba(230, 57, 70, 0.25); }

/* ── bottoni ── */
.btn { border: 0; border-radius: 999px; padding: 13px 20px; font-size: 17px; font-weight: 900; background: var(--card2); color: var(--ink); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); transition: transform 0.08s; min-height: 48px; }
.btn:active:not(:disabled) { transform: translateY(2px) scale(0.98); }
.btn.hot { background: linear-gradient(180deg, #ff7a5c, #ff3d6e); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), 0 6px 18px rgba(255, 61, 110, 0.35); }
.btn.blue { background: linear-gradient(180deg, #5b9dff, #2f6fe0); }
.btn.red { background: linear-gradient(180deg, #ff5a5f, #c1121f); }
.btn.big { font-family: var(--display); font-weight: 400; font-size: 23px; padding: 15px 24px; letter-spacing: 0.5px; width: 100%; }
.btn.small { padding: 9px 14px; font-size: 15px; min-height: 40px; }
.btn.ghostbtn { background: rgba(255, 255, 255, 0.1); border: 2px solid var(--line); box-shadow: none; }
.sticky { position: sticky; bottom: 0; margin-top: auto; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(26, 10, 44, 0), rgba(26, 10, 44, 0.92) 30%); z-index: 4; }
.sticky .row .btn.big:last-child:not(:first-child) { flex: 0 0 74px; }

/* ── schede ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 8px 0; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.card.form { display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); font-weight: 900; }
.say { text-align: center; font-size: 17px; margin: 6px 0; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.say.big { font-family: var(--display); font-size: 26px; font-weight: 400; }
.say.red { color: #ff8a8f; }
.spacer { position: relative; flex: none; }

/* ── titolo ── */
.parrot-hit { position: absolute; left: 20%; right: 20%; top: 0; bottom: 0; background: none; border: 0; }
.logo { font-family: var(--display); font-weight: 400; font-size: clamp(48px, 15vw, 76px); text-align: center; margin: 0; line-height: 1; letter-spacing: 1px; color: var(--gold); -webkit-text-stroke: 3px #7a0019; paint-order: stroke fill; text-shadow: 0 6px 0 #7a0019, 0 10px 24px rgba(0, 0, 0, 0.45); }
.logo span { display: inline-block; animation: bob 1.8s ease-in-out infinite; }
.logo span:nth-child(odd) { color: #ff6b5f; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.tag { text-align: center; margin: 8px 0 14px; color: var(--dim); font-size: 16px; }
.menu { display: flex; flex-direction: column; gap: 9px; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 20px; border: 0; text-align: left; background: var(--card); border: 1px solid var(--line); position: relative; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.menu-item:active { transform: scale(0.98); }
.menu-item.hot { background: linear-gradient(135deg, #ff7a5c, #ff3d6e); border: 0; box-shadow: 0 8px 22px rgba(255, 61, 110, 0.35), inset 0 -4px 0 rgba(0, 0, 0, 0.22); padding: 16px; }
.menu-item.blue { background: linear-gradient(135deg, rgba(58, 134, 255, 0.55), rgba(47, 111, 224, 0.4)); }
.menu-item.green { background: linear-gradient(135deg, rgba(60, 207, 110, 0.45), rgba(46, 196, 182, 0.3)); }
.menu-item.red { background: linear-gradient(135deg, rgba(230, 57, 70, 0.5), rgba(255, 95, 162, 0.3)); }
.menu-item.purple { background: linear-gradient(135deg, rgba(123, 92, 255, 0.5), rgba(255, 95, 162, 0.25)); }
.menu-item.teal { background: linear-gradient(135deg, rgba(46, 196, 182, 0.45), rgba(58, 134, 255, 0.25)); }
.mi-e { font-size: 30px; width: 40px; text-align: center; }
.menu-item.hot .mi-e { font-size: 36px; }
.mi-t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mi-t b { font-family: var(--display); font-weight: 400; font-size: 21px; letter-spacing: 0.4px; }
.menu-item.hot .mi-t b { font-size: 26px; }
.mi-t small { color: rgba(255, 255, 255, 0.82); font-size: 13.5px; font-weight: 700; }
.badge { font-size: 12px; font-weight: 900; background: rgba(0, 0, 0, 0.35); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge.gold { background: linear-gradient(180deg, #ffe066, #f4b400); color: #4a2a00; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 4px 0; }
.foot { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); gap: 10px; }
.langs { display: flex; gap: 6px; }
.lang { border: 2px solid var(--line); background: none; border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 900; }
.lang.on { background: var(--gold); color: #3a1a00; border-color: var(--gold); }
.ssw { color: var(--dim); font-size: 13px; text-decoration: none; }

/* ── giocatori ── */
.players { display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; background: var(--card2); }
.prow.off { opacity: 0.45; }
.prow .bn { flex: 1; }
.prow .te { font-size: 26px; }
.av { border: 0; background: rgba(255, 255, 255, 0.08); border-radius: 50%; padding: 2px; width: 58px; height: 58px; display: grid; place-items: center; flex: none; }
.av canvas { display: block; }
input.name { flex: 1; min-width: 0; border: 2px solid var(--line); background: rgba(0, 0, 0, 0.3); color: var(--ink); border-radius: 14px; padding: 12px 14px; font: inherit; font-size: 17px; outline: none; }
input.name:focus { border-color: var(--gold); }
.code-in { text-transform: uppercase; letter-spacing: 6px; font-family: var(--display) !important; font-size: 24px !important; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { border: 2px solid var(--line); background: rgba(0, 0, 0, 0.25); border-radius: 999px; padding: 8px 13px; font-size: 15px; font-weight: 800; white-space: nowrap; }
.chip.on { background: var(--gold); color: #3a1a00; border-color: var(--gold); }
.chip.mini { padding: 2px 8px; font-size: 13px; border-width: 1px; background: rgba(255, 255, 255, 0.12); }
.chip.mini.x2 { background: var(--blue); border-color: var(--blue); }
.chip.mini.red { background: rgba(230, 57, 70, 0.7); border-color: transparent; }
.chip.mini.gold { background: var(--gold); color: #3a1a00; border-color: transparent; }
.chip.mini.pink { background: var(--pink); border-color: transparent; }
.toggle { display: flex; flex-direction: row; align-items: center; gap: 10px; font-size: 16px; padding: 4px 0; }
.toggle input { width: 24px; height: 24px; accent-color: var(--hot); }
input[type=range] { width: 100%; accent-color: var(--hot); }
label { display: flex; flex-direction: column; gap: 6px; }
.look-prev { display: grid; place-items: center; padding: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.8); }
.hats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.hatb { border: 0; background: rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 4px; display: grid; place-items: center; }

/* ── suono e registrazione ── */
.card.sound { text-align: center; }
.sound-emoji { font-size: 58px; line-height: 1.1; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4)); animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pop { from { transform: scale(0.3); } to { transform: scale(1); } }
.sound-name { font-family: var(--display); font-size: 25px; margin: 4px 0 2px; line-height: 1.15; }
.sound-meta { color: var(--dim); font-size: 14px; margin-bottom: 10px; }
.diff { letter-spacing: 2px; color: var(--gold); }
canvas.graph { width: 100%; height: 110px; display: block; border-radius: 14px; background: rgba(0, 0, 0, 0.32); margin: 8px 0; }
canvas.graph.big { height: 170px; }
.mini-sound { text-align: center; font-size: 18px; color: var(--dim); margin: 4px 0 12px; }
.big-name { font-family: var(--display); font-size: clamp(42px, 13vw, 64px); text-align: center; line-height: 1; margin: 6px 0; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4); }
.turn-host { display: flex; flex-direction: column; gap: 8px; }
.rec { display: flex; flex-direction: column; gap: 8px; }
.rec-who { font-family: var(--display); font-size: 26px; text-align: center; }
.rec-graph { position: relative; }
.count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 84px; pointer-events: none; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45); }
.count.pulse { animation: cnt 0.6s ease-out; }
.count.go { color: var(--gold); animation: cnt 0.5s ease-out; }
.count.think { font-size: 56px; animation: bob 0.6s infinite; }
@keyframes cnt { from { transform: scale(1.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.meter { height: 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--gold), var(--hot)); transform: scaleX(0); transform-origin: left; transition: transform 0.06s linear; }
.meter.big { height: 20px; }
.rec-tip { text-align: center; color: var(--dim); font-size: 14px; }
.rec .btn { align-self: center; }

/* ── voto ── */
.card.result { padding: 14px; }
.score-row { display: flex; align-items: center; gap: 14px; }
.score-num { font-family: var(--display); font-size: 68px; line-height: 0.95; min-width: 98px; text-align: center; color: var(--gold); text-shadow: 0 4px 0 #7a3d00; }
.score-num.pop { animation: pop 0.45s cubic-bezier(0.2, 1.8, 0.4, 1); }
.verdict { font-family: var(--display); font-size: 23px; line-height: 1.1; }
.why { color: var(--dim); font-size: 15px; margin-top: 4px; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 112px 1fr 26px; align-items: center; gap: 8px; font-size: 14px; }
.bt { height: 10px; background: rgba(0, 0, 0, 0.35); border-radius: 999px; overflow: hidden; }
.bt i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); border-radius: 999px; transition: width 0.7s cubic-bezier(0.2, 0.9, 0.3, 1); }
.bv { text-align: right; font-weight: 900; }

/* ── palco e classifica ── */
.sheet { display: flex; flex-direction: column; gap: 6px; }
.performer { font-family: var(--display); font-size: 30px; text-align: center; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45); }
.sab-banner { text-align: center; font-family: var(--display); font-size: 20px; padding: 10px; border-radius: 14px; background: linear-gradient(90deg, #7a0019, #c1121f); animation: shake 0.5s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px) rotate(-1deg); } 40% { transform: translateX(8px) rotate(1deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.mini { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.mini::-webkit-scrollbar { display: none; }
.mchip { display: flex; align-items: center; gap: 4px; padding: 2px 9px 2px 3px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); border: 2px solid; font-size: 14px; flex: none; }
.board { display: flex; flex-direction: column; gap: 6px; }
.brow { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 14px; background: var(--card2); border-left: 5px solid transparent; }
.brow.me { background: rgba(255, 210, 63, 0.16); }
.brow .bn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.brow .bd { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.brow .bs { font-family: var(--display); font-weight: 400; font-size: 22px; min-width: 44px; text-align: right; }
.brow .rk { font-family: var(--display); width: 22px; color: var(--dim); }
.team { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.team.red { background: var(--red); } .team.blue { background: var(--blue); }
.teambar { display: flex; height: 30px; border-radius: 999px; overflow: hidden; margin: 6px 0; font-family: var(--display); font-size: 15px; }
.teambar > div { display: flex; align-items: center; padding: 0 10px; min-width: 64px; transition: width 0.6s; }
.teambar .red { background: var(--red); } .teambar .blue { background: var(--blue); justify-content: flex-end; }
.vbtn { border: 2px solid var(--line); background: rgba(0, 0, 0, 0.25); border-radius: 16px; padding: 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; }
.vbtn.on { border-color: var(--gold); background: rgba(255, 210, 63, 0.18); }
.vbtn small { font-size: 12px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.vote { padding: 10px 12px; }
.outcomes .orow { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 16px; animation: slidein 0.3s ease-out; }
@keyframes slidein { from { transform: translateX(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
.winner { text-align: center; font-size: 17px; color: var(--dim); margin: 6px 0; }
.winner b { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(36px, 11vw, 54px); color: var(--gold); text-shadow: 0 4px 0 #7a3d00; line-height: 1.1; }
.awards { display: grid; gap: 8px; }
.award { display: flex; align-items: center; gap: 12px; }
.award .ae { font-size: 30px; }
.award .at { display: flex; flex-direction: column; }
.award small { color: var(--dim); font-size: 14px; }
.fxpick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.fxb { border: 2px solid var(--line); background: rgba(255, 255, 255, 0.07); border-radius: 16px; padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 14px; }
.fxb .fe { font-size: 34px; }

/* ── biblioteca ── */
.collect { text-align: center; font-size: 15px; color: var(--gold); margin: 4px 0 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; padding-bottom: 24px; }
.tile { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 112px; }
.tile.gold { border: 2px solid var(--gold); box-shadow: 0 0 16px rgba(255, 210, 63, 0.3); }
.tile .te { font-size: 34px; }
.tile .tn { font-size: 12.5px; text-align: center; line-height: 1.2; }
.tile .tb { font-size: 12px; color: var(--gold); margin-top: auto; }
.prac { display: flex; flex-direction: column; gap: 6px; }
.dslot { font-size: 30px; }
.grid5 { text-align: center; font-size: 34px; letter-spacing: 4px; margin: 4px 0; }
.hearts { text-align: center; font-size: 22px; margin: 2px 0; }
.hearts span { font-size: 14px; color: var(--dim); }
.code { font-family: var(--display); font-size: 52px; letter-spacing: 10px; text-align: center; color: var(--gold); text-shadow: 0 4px 0 #7a3d00; }
.or { text-align: center; color: var(--dim); font-size: 14px; }
.waiting { margin-top: 8px; }
.wchip { display: flex; flex-direction: column; align-items: center; opacity: 0.5; }
.wchip.ok { opacity: 1; }

/* ── reazioni online ── */
.reacts { display: flex; justify-content: center; gap: 6px; padding: 6px 0; }
.rb { border: 0; background: rgba(0, 0, 0, 0.35); border-radius: 50%; width: 46px; height: 46px; font-size: 24px; }
.rb:active { transform: scale(1.25); }
.fly { position: fixed; bottom: 90px; font-size: 40px; pointer-events: none; z-index: 40; animation: fly 2.5s ease-out forwards; display: flex; flex-direction: column; align-items: center; }
.fly small { font-size: 11px; background: rgba(0, 0, 0, 0.5); padding: 1px 6px; border-radius: 999px; }
@keyframes fly { 0% { transform: translateY(0) scale(0.6); opacity: 0; } 15% { opacity: 1; transform: translateY(-40px) scale(1.15); } 100% { transform: translateY(-55vh) scale(0.9) rotate(12deg); opacity: 0; } }
.reconn { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: #c1121f; padding: 8px 16px; border-radius: 999px; z-index: 60; font-size: 14px; }

/* ── finestre e avvisi ── */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 2, 20, 0.7); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #3a1a5c; border: 1px solid var(--line); border-radius: 22px; padding: 18px; width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); animation: pop 0.25s cubic-bezier(0.2, 1.4, 0.4, 1); }
.modal .row { margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 20px); background: #1d0b33; border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; z-index: 70; opacity: 0; transition: 0.3s; max-width: 92vw; text-align: center; font-size: 15px; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  #ui { padding-left: 24px; padding-right: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo span, .count.think { animation: none; }
}
