/* ==========================================================================
   Messenger — pelle "lucida" in stile messaggistica anni 2000
   Vetro azzurro, pulsanti gel, cornici di stato, scene personalizzabili.
   Si carica dopo app.css e ne ridefinisce solo l'aspetto.
   ========================================================================== */
:root {
  --gel-hi: linear-gradient(to bottom, rgba(255,255,255,.95) 0%, rgba(255,255,255,.55) 48%, rgba(255,255,255,0) 50%, rgba(255,255,255,0) 100%);
  --gel-blue: linear-gradient(to bottom, #8fd0ff 0%, #4ea6f5 49%, #2a83e6 51%, #3f9af4 100%);
  --gel-blue-b: #1f6cc9;
  --gel-orange: linear-gradient(to bottom, #ffe2a8 0%, #ffc368 49%, #ffa630 51%, #ffbb52 100%);
  --gel-silver: linear-gradient(to bottom, #ffffff 0%, #f1f6fc 49%, #e1ebf7 51%, #edf3fb 100%);
  --title-glass: linear-gradient(to bottom, rgba(255,255,255,.92) 0%, rgba(232,243,255,.85) 50%, rgba(208,229,252,.85) 51%, rgba(222,238,255,.9) 100%);
  --pane-glass: linear-gradient(to bottom, rgba(255,255,255,.88), rgba(244,250,255,.82));
  --row-hover: linear-gradient(to bottom, #f4faff, #e3f1ff);
  --row-sel: linear-gradient(to bottom, #e6f3ff 0%, #cfe6ff 50%, #c2dffe 51%, #d6ebff 100%);
  --frame-online: linear-gradient(160deg, #c7f7a9 0%, #5ccf4a 45%, #2b9e36 100%);
  --frame-busy: linear-gradient(160deg, #ffc1bd 0%, #ef5350 45%, #b8232a 100%);
  --frame-away: linear-gradient(160deg, #ffe6a6 0%, #ffad33 45%, #d97706 100%);
  --frame-offline: linear-gradient(160deg, #f2f5f8 0%, #c3ccd7 45%, #8e9aa9 100%);
  --frame-plain: linear-gradient(160deg, #ffffff 0%, #d7e6f6 50%, #a9c5e6 100%);
}
html.dark {
  --gel-silver: linear-gradient(to bottom, #2c4366 0%, #233a5c 49%, #1b3152 51%, #213a5e 100%);
  --title-glass: linear-gradient(to bottom, rgba(46,72,110,.95) 0%, rgba(30,52,86,.92) 50%, rgba(22,42,74,.92) 51%, rgba(28,50,84,.95) 100%);
  --pane-glass: linear-gradient(to bottom, rgba(24,38,64,.9), rgba(18,30,52,.88));
  --row-hover: linear-gradient(to bottom, #1d3355, #1a2f4f);
  --row-sel: linear-gradient(to bottom, #2a4b7a 0%, #23436f 50%, #1d3b64 51%, #234470 100%);
  --frame-plain: linear-gradient(160deg, #5c7aa6 0%, #34507a 50%, #233b5e 100%);
}

/* ---------- sfondo del "desktop" con onde di luce ---------- */
body { background: url("../img/bg-swoosh.svg") center bottom / cover no-repeat fixed, var(--bg); }
html.dark body { background: url("../img/bg-swoosh.svg") center bottom / cover no-repeat fixed, var(--bg); background-blend-mode: soft-light, normal; }

/* ---------- barra del titolo in vetro ---------- */
.topbar { background: var(--title-glass); border: 1px solid rgba(255,255,255,.95); box-shadow: 0 1px 0 rgba(120,170,230,.5), 0 6px 18px rgba(40,92,160,.12); position: relative; overflow: visible; }
.topbar::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(80,150,240,.6), transparent); }
html.dark .topbar { border-color: rgba(255,255,255,.08); }
.brand span { background: linear-gradient(to bottom, #3e9bff, #1559c4); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 1px 0 rgba(255,255,255,.9)); }
html.dark .brand span { background: linear-gradient(to bottom, #9fd0ff, #4f9df7); -webkit-background-clip: text; background-clip: text; filter: none; }

/* ---------- pannelli come finestre ---------- */
.pane { background: var(--pane-glass); border: 1px solid rgba(255,255,255,.95); box-shadow: 0 0 0 1px rgba(120,170,230,.35), 0 8px 28px rgba(40,92,160,.14); }
html.dark .pane { border-color: rgba(255,255,255,.06); box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35); }
.card { border-color: #d2e3f6; box-shadow: inset 0 1px 0 #fff, 0 1px 3px rgba(40,92,160,.08); }
html.dark .card { border-color: var(--border); box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }

/* ---------- pulsanti gel ---------- */
.iconbtn, .softbtn, .toolbtn, .btn, .tab {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--gel-silver); border: 1px solid #a9c6e8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(30,80,150,.18);
  border-radius: 12px; transition: filter .12s, transform .06s, box-shadow .12s;
}
.iconbtn:hover, .softbtn:hover, .toolbtn:hover, .btn:hover, .tab:hover {
  background: linear-gradient(to bottom, #ffffff 0%, #e6f3ff 49%, #cfe6ff 51%, #e3f1ff 100%); border-color: #6aaef2;
  box-shadow: inset 0 1px 0 #fff, 0 0 0 3px rgba(90,170,255,.18), 0 1px 3px rgba(30,80,150,.2);
}
.iconbtn:active, .softbtn:active, .toolbtn:active, .btn:active, .tab:active { filter: brightness(.95); box-shadow: inset 0 2px 4px rgba(30,80,150,.25); }
html.dark .iconbtn, html.dark .softbtn, html.dark .toolbtn, html.dark .btn, html.dark .tab { border-color: #39598a; box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 2px rgba(0,0,0,.4); }
html.dark .iconbtn:hover, html.dark .softbtn:hover, html.dark .toolbtn:hover, html.dark .btn:hover, html.dark .tab:hover { background: linear-gradient(to bottom, #3a5a88 0%, #30507d 49%, #284670 51%, #2f4f7b 100%); border-color: #5b8fd6; }

.btn.primary, .sendbtn, .board-btn { background: var(--gel-blue); border: 1px solid var(--gel-blue-b); color: #fff; text-shadow: 0 -1px 0 rgba(0,40,110,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 6px rgba(42,123,228,.4); }
.btn.primary:hover { background: linear-gradient(to bottom, #a6dbff 0%, #62b3f8 49%, #3590ee 51%, #4ea6f7 100%); border-color: var(--gel-blue-b); }
.toolbtn.nudge, .tab.on { background: var(--gel-orange); border-color: #e39a35; color: #8a3f00; text-shadow: 0 1px 0 rgba(255,255,255,.6); }
.tab.on .ic, .toolbtn.nudge .ic { color: #b45400; }
.toolbtn.nudge:hover, .tab.on:hover { background: linear-gradient(to bottom, #fff0c9 0%, #ffd083 49%, #ffb447 51%, #ffc666 100%); border-color: #d98a20; }
html.dark .toolbtn.nudge, html.dark .tab.on { background: linear-gradient(to bottom, #6b4a1c 0%, #5a3d15 49%, #4a3110 51%, #573a14 100%); border-color: #a0702a; color: #ffd08a; text-shadow: none; }
html.dark .tab.on .ic, html.dark .toolbtn.nudge .ic { color: #ffb75c; }

.sendbtn { border-radius: 50%; position: relative; overflow: hidden; }
.sendbtn::before, .cbtn::before { content: ""; position: absolute; left: 12%; right: 12%; top: 4%; height: 46%; border-radius: 50% / 60% 60% 40% 40%; background: linear-gradient(rgba(255,255,255,.75), rgba(255,255,255,.08)); pointer-events: none; }
.cbtn { position: relative; overflow: hidden; }
.cbtn.red { background: radial-gradient(circle at 50% 120%, #ff8a8a, #e5484d 55%, #b3242a); }
.cbtn.green { background: radial-gradient(circle at 50% 120%, #8bf09a, #2cbf4a 55%, #1b8a33); }

/* ---------- avatar con cornice di stato lucida ---------- */
.avatar {
  --frame: var(--frame-plain); --bw: 3px;
  border: var(--bw) solid transparent;
  background: linear-gradient(140deg, var(--a1, #5ab8ff), var(--a2, #1f6fe0)) padding-box, var(--frame) border-box;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.85), 0 2px 6px rgba(30,80,150,.28);
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.avatar.img { background: var(--img) center / cover no-repeat padding-box, var(--frame) border-box; }
.avatar::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,.42) 0%, rgba(255,255,255,.12) 45%, rgba(255,255,255,0) 50%); }
.avatar[data-status]::after { display: none; }
.avatar[data-status=online]  { --frame: var(--frame-online); }
.avatar[data-status=busy]    { --frame: var(--frame-busy); }
.avatar[data-status=away]    { --frame: var(--frame-away); }
.avatar[data-status=offline] { --frame: var(--frame-offline); }
.avatar.sm { --bw: 2px; }
.avatar.md { --bw: 3px; }
.avatar.xl { --bw: 4px; border-radius: 20px; }
.avatar.hero { --bw: 6px; border-radius: 30px; box-shadow: inset 0 0 0 3px rgba(255,255,255,.9), 0 10px 26px rgba(30,80,150,.32); }
.contact.offline .avatar { filter: saturate(.35) brightness(1.04); opacity: .9; }

/* sfere di stato lucide */
.dot { width: 14px; height: 14px; position: relative; border: 1px solid rgba(0,0,0,.18); box-shadow: inset 0 -2px 3px rgba(0,0,0,.15); }
.dot::before { content: ""; position: absolute; left: 2px; right: 3px; top: 1px; height: 45%; border-radius: 50%; background: linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.1)); }
.dot.busy::after { content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; margin-top: -1px; background: #fff; border-radius: 1px; }
.dot.away::after { content: ""; position: absolute; left: 50%; top: 3px; width: 3px; height: 4px; border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff; }
.dot.invisible { background: transparent; border: 1.5px dashed #8e9aa9; box-shadow: none; }
.dot.invisible::before { display: none; }

/* ---------- scena dietro il proprio profilo ---------- */
.scene-wrap { position: relative; border-radius: 16px; padding: 46px 10px 10px; background: var(--scene, url("../img/scenes/cielo.svg")) center / cover;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 2px 8px rgba(30,80,150,.18); }
.scene-wrap .me-card { background: rgba(255,255,255,.78); backdrop-filter: blur(10px) saturate(1.4); -webkit-backdrop-filter: blur(10px) saturate(1.4); border-color: rgba(255,255,255,.9); }
html.dark .scene-wrap .me-card { background: rgba(18,32,56,.72); border-color: rgba(255,255,255,.1); }
.scene-edit { position: absolute; top: 9px; right: 9px; width: 30px; height: 30px; border-radius: 9px; border: 1px solid rgba(255,255,255,.8); background: rgba(255,255,255,.45); color: #fff;
  display: grid; place-items: center; backdrop-filter: blur(6px); box-shadow: 0 1px 3px rgba(0,0,0,.15); opacity: .85; }
.scene-edit:hover { opacity: 1; background: rgba(255,255,255,.7); color: var(--blue); }
.me-name { text-shadow: 0 1px 0 rgba(255,255,255,.8); }
html.dark .me-name { text-shadow: none; }

.scene-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scene-grid button { height: 74px; border-radius: 12px; border: 2px solid transparent; background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 1px 3px rgba(0,0,0,.15); position: relative; }
.scene-grid button span { position: absolute; left: 6px; bottom: 5px; color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.scene-grid button.on { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(240,140,26,.3); }

/* ---------- ricerca e schede ---------- */
.topsearch input, .search-field input { background: linear-gradient(#ffffff, #f7fbff); border-color: #a9c6e8; box-shadow: inset 0 1px 2px rgba(30,80,150,.12); border-radius: 20px; }
html.dark .topsearch input, html.dark .search-field input { background: #142540; border-color: #2f4c76; }

/* ---------- lista amici ---------- */
.group-h { background: none; padding: 6px 4px 4px; border-radius: 0; border-bottom: 1px solid #cfe2f7; color: #1f5fae; font-size: 15px; margin: 8px 4px 4px; }
.group-h::before { border-top-color: #3d8ef0; }
html.dark .group-h { color: #8fc2ff; border-bottom-color: var(--border); }
.contact { border: 1px solid transparent; margin: 1px 0; transition: background .12s; }
.contact:hover { background: var(--row-hover); border-color: #cfe4fb; }
.contact.on { background: var(--row-sel); border-color: #8fc0f2; box-shadow: inset 0 1px 0 rgba(255,255,255,.8); }
html.dark .contact:hover { border-color: #2c4a74; }
html.dark .contact.on { border-color: #4a78b5; box-shadow: none; }
.contact .name { color: var(--text); }
.badge { background: linear-gradient(#ffb547, #f07d00); border: 1px solid #d36c00; box-shadow: inset 0 1px 0 rgba(255,255,255,.5); text-shadow: 0 -1px 0 rgba(0,0,0,.2); }

/* ---------- intestazione chat con la scena dell'amico ---------- */
.chat-head { position: relative; overflow: hidden; background: none; border-bottom: 1px solid #b9d4f1; min-height: 92px; }
.chat-scene { position: absolute; inset: 0; z-index: 0; background: var(--scene, url("../img/scenes/cielo.svg")) center / cover; }
.chat-scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.88) 0%, rgba(255,255,255,.72) 45%, rgba(255,255,255,.2) 100%); }
html.dark .chat-scene::after { background: linear-gradient(90deg, rgba(14,26,46,.9) 0%, rgba(14,26,46,.72) 45%, rgba(14,26,46,.25) 100%); }
.chat-head > *:not(.chat-scene) { position: relative; z-index: 1; }
.chat-title h2 { text-shadow: 0 1px 0 rgba(255,255,255,.9); }
html.dark .chat-title h2 { text-shadow: none; }
.chat-actions .softbtn { background: rgba(255,255,255,.75); backdrop-filter: blur(6px); }
html.dark .chat-actions .softbtn { background: rgba(30,50,80,.7); }

/* ---------- messaggi ---------- */
.bubble { box-shadow: inset 0 1px 0 rgba(255,255,255,.85), 0 1px 2px rgba(30,80,150,.1); }
.msg.out .bubble { box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 2px rgba(30,80,150,.12); }
html.dark .bubble, html.dark .msg.out .bubble { box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.bubble .who { display: none; }
.msg-event.nudge { background: var(--gel-orange); border-color: #e39a35; color: #8a3f00; box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 2px 6px rgba(240,140,26,.25); }
html.dark .msg-event.nudge { background: linear-gradient(#5a3d15, #4a3110); color: #ffc278; }

/* stile classico: "Sofia dice:" con il testo sotto, niente fumetti */
.messages.classic #msgList { gap: 2px; }
.messages.classic .msg, .messages.classic .msg.out { max-width: 100%; align-self: stretch; flex-direction: row; gap: 0; animation: none; }
.messages.classic .msg .avatar { display: none; }
.messages.classic .bubble, .messages.classic .msg.out .bubble { background: none; border: 0; box-shadow: none; padding: 4px 0 0; border-radius: 0; flex: 1; font-size: 16px; }
.messages.classic .bubble .who { display: block; color: #6f7f96; font-size: 14px; margin: 6px 0 1px; }
.messages.classic .msg.cont .who { display: none; }
.messages.classic .bubble .text, .messages.classic .bubble > a, .messages.classic .bubble > img, .messages.classic .bubble > .att-audio, .messages.classic .bubble > .game-invite { margin-left: 16px; }
.messages.classic .bubble .text { display: inline; }
.messages.classic .stamp { float: none; margin: 0 0 0 10px; font-size: 12px; opacity: .8; }
.messages.classic .bubble.jumbo { font-size: 32px; }
.messages.classic .att-img { margin-left: 16px; }

/* carattere e colore dei messaggi */
.ff-tahoma    { font-family: Tahoma, Verdana, "DejaVu Sans", sans-serif; }
.ff-trebuchet { font-family: "Trebuchet MS", "Lucida Grande", sans-serif; }
.ff-georgia   { font-family: Georgia, "Times New Roman", serif; }
.ff-comic     { font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", cursive; }
.ff-courier   { font-family: "Courier New", Courier, monospace; }
.fb { font-weight: 700; } .fi { font-style: italic; }
.fc-blu { color: #1747b5; } .fc-azzurro { color: #0a85c9; } .fc-verde { color: #1a8a2e; } .fc-oliva { color: #6b7d12; }
.fc-viola { color: #6b3fc2; } .fc-fucsia { color: #c2187a; } .fc-rosso { color: #c62828; } .fc-arancio { color: #d26200; }
.fc-marrone { color: #7a4a1e; } .fc-grigio { color: #5d6b7c; } .fc-nero { color: #111; }
html.dark .fc-blu { color: #8fb4ff; } html.dark .fc-azzurro { color: #6fd0ff; } html.dark .fc-verde { color: #7fe08f; } html.dark .fc-oliva { color: #cddc6a; }
html.dark .fc-viola { color: #c3a6ff; } html.dark .fc-fucsia { color: #ff8acb; } html.dark .fc-rosso { color: #ff8f8f; } html.dark .fc-arancio { color: #ffb36b; }
html.dark .fc-marrone { color: #e0b48a; } html.dark .fc-grigio { color: #b3c0d0; } html.dark .fc-nero { color: #fff; }

/* ---------- composer ---------- */
.composer { background: linear-gradient(to bottom, #f4f9ff, #e6f1fd); border-top: 1px solid #c4dbf4; box-shadow: inset 0 1px 0 #fff; }
html.dark .composer { background: linear-gradient(to bottom, #172a48, #12233d); border-top-color: var(--border); box-shadow: none; }
textarea#input { background: #fff; border-color: #a9c6e8; box-shadow: inset 0 1px 3px rgba(30,80,150,.12); border-radius: 12px; }
html.dark textarea#input { background: #0f1d33; border-color: #2f4c76; }
.toolbtn .aa { font-family: Georgia, serif; font-weight: 700; font-size: 20px; color: #1f5fae; line-height: 1; }
.toolbtn .aa small { font-size: 14px; color: #e5484d; }
html.dark .toolbtn .aa { color: #8fc2ff; }
.emoji-pop, .font-pop { background: linear-gradient(#ffffff, #f2f8ff); border: 1px solid #a9c6e8; box-shadow: 0 10px 30px rgba(30,80,150,.25); }
html.dark .emoji-pop, html.dark .font-pop { background: linear-gradient(#1c3150, #162a46); border-color: var(--border); }
.font-pop { position: absolute; bottom: calc(100% - 6px); left: 70px; width: 330px; max-width: calc(100% - 28px); border-radius: 14px; padding: 12px; z-index: 20; }
.font-pop label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.font-pop select { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid #a9c6e8; background: var(--card); color: var(--text); margin-bottom: 10px; }
.font-pop .colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; }
.font-pop .colors button { height: 26px; border-radius: 7px; border: 2px solid transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 2px rgba(0,0,0,.2); }
.font-pop .colors button.on { border-color: var(--orange); }
.font-pop .colors .auto { background: linear-gradient(135deg, #fff 45%, #11243d 55%); }
.font-pop .row { display: flex; gap: 8px; align-items: center; }
.font-pop .row .btn { padding: 6px 12px; } .font-pop .row .btn.on { background: var(--gel-blue); color: #fff; border-color: var(--gel-blue-b); }
.font-pop .preview { margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--card); border: 1px dashed var(--border-strong); font-size: 16px; }

/* ---------- pannello destro ---------- */
.info-head { position: relative; border-radius: 16px; overflow: hidden; padding: 22px 10px 14px; }
.info-scene { position: absolute; inset: 0 0 auto 0; height: 128px; background: var(--scene, url("../img/scenes/cielo.svg")) center / cover; }
.info-scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,255,255,0) 40%, var(--pane-fade, rgba(248,252,255,1))); }
html.dark .info-scene::after { --pane-fade: rgba(20,34,58,1); }
.info-head > *:not(.info-scene) { position: relative; }
.section h4 { color: #1f5fae; }
html.dark .section h4 { color: #8fc2ff; }
.games-card { background: linear-gradient(to bottom, #ffffff, #eef6ff); }
html.dark .games-card { background: linear-gradient(to bottom, #1d3355, #172b48); }
.me-mini { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.me-mini small { display: block; color: var(--muted); font-size: 12px; }
.me-mini b { font-size: 15px; }

/* ---------- modali, menu, notifiche "toast" ---------- */
.modal { padding: 0 22px 22px; border: 1px solid rgba(255,255,255,.95); box-shadow: 0 0 0 1px rgba(80,140,210,.35), 0 24px 60px rgba(20,60,120,.35); }
.modal > h3:first-child { margin: 0 -22px 16px; padding: 12px 14px 12px 22px; background: var(--title-glass); border-bottom: 1px solid #c4dbf4; border-radius: 20px 20px 0 0; font-size: 18px; color: #17426f; }
html.dark .modal { border-color: rgba(255,255,255,.08); box-shadow: 0 24px 60px rgba(0,0,0,.6); }
html.dark .modal > h3:first-child { color: #d6e8ff; border-bottom-color: var(--border); }
.modal > h3:first-child .close { width: 32px; height: 32px; }
.modal.bare { padding: 0; border: 0; box-shadow: none; }
.menu { background: linear-gradient(#ffffff, #f3f8ff); border-color: #a9c6e8; }
.menu button:hover { background: var(--row-sel); }
html.dark .menu { background: linear-gradient(#1c3150, #162a46); border-color: var(--border); }

.toast { background: linear-gradient(to bottom, #ffffff 0%, #eef6ff 55%, #dcecff 100%); border: 1px solid #8fc0f2; box-shadow: inset 0 1px 0 #fff, 0 10px 30px rgba(30,80,150,.3); border-radius: 14px; }
.toast.t-err { background: linear-gradient(#fff6f6, #ffe3e3); border-color: #f2a3a3; }
html.dark .toast { background: linear-gradient(#24406a, #1b3255); border-color: #4a78b5; }

/* ---------- login ---------- */
.auth-card { padding: 0 30px 30px; overflow: hidden; border: 1px solid rgba(255,255,255,.95); box-shadow: 0 0 0 1px rgba(80,140,210,.35), 0 24px 60px rgba(20,60,120,.25); }
.auth-brand { margin: 0 -30px 20px; padding: 26px 20px 18px; background: url("../img/scenes/cielo.svg") center / cover; position: relative; }
.auth-brand::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(255,255,255,0) 30%, rgba(246,251,255,.95)); }
html.dark .auth-brand { background-image: url("../img/scenes/notte.svg"); }
html.dark .auth-brand::after { background: linear-gradient(to bottom, rgba(20,32,54,0) 30%, rgba(20,32,54,.96)); }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand img { width: 88px; height: 88px; padding: 10px; border-radius: 22px; border: 4px solid transparent;
  background: linear-gradient(#ffffff, #eaf4ff) padding-box, var(--frame-online) border-box; box-shadow: inset 0 0 0 2px #fff, 0 8px 20px rgba(30,80,150,.3); }
.auth-brand h1 { background: linear-gradient(to bottom, #3e9bff, #1559c4); -webkit-background-clip: text; background-clip: text; color: transparent; }
html.dark .auth-brand h1 { background: linear-gradient(to bottom, #9fd0ff, #4f9df7); -webkit-background-clip: text; background-clip: text; }
.seg { background: linear-gradient(#dcebfb, #e8f2fd); box-shadow: inset 0 1px 2px rgba(30,80,150,.15); }
.seg a.on { background: var(--gel-silver); border: 1px solid #a9c6e8; }

/* ---------- chiamate ---------- */
.callview { background: radial-gradient(circle at 50% 25%, #2f63a3, #10233f 60%, #081428); }
.incoming { background: linear-gradient(160deg, #2f63a3, #142c50); border: 1px solid rgba(255,255,255,.25); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 20px 60px rgba(0,0,0,.45); }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .scene-wrap { border-radius: 0; padding: 40px 10px 10px; margin: -10px -10px 0; }
  .chat-head { min-height: 64px; }
  .font-pop { left: 10px; }
}

/* ---------- chat segrete ---------- */
.chat-status { min-width: 0; }
.chat-actions { position: relative; z-index: 2; flex: none; }
.secret-badge { min-width: 0; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; margin-left: 10px; padding: 2px 10px; border-radius: 20px; font-size: 13px; color: #fff; background: linear-gradient(#8b6cf2, #6a45d8); border: 1px solid #5a37c4; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); white-space: nowrap; }
.secret-badge b { font-weight: 700; }
#btnSecret.on { background: linear-gradient(to bottom, #d9ccff 0%, #b9a3ff 49%, #9c80f7 51%, #b39af9 100%); border-color: #7a5ce0; }
#btnSecret.on .ic { color: #3b1f9c; }
.chat-wrap.secret-on .composer { background: linear-gradient(to bottom, #f6f2ff, #ebe3ff); border-top-color: #cdbdf7; }
.chat-wrap.secret-on textarea#input { border-color: #b7a2f2; }
html.dark .chat-wrap.secret-on .composer { background: linear-gradient(to bottom, #241c44, #1c1638); }
.bubble.secret { border-color: #c9b8f6 !important; }
.msg.out .bubble.secret { background: linear-gradient(#efe9ff, #e2d8ff); }
html.dark .msg.out .bubble.secret { background: linear-gradient(#3a2d6e, #30255d); border-color: #5a47a0 !important; }
.stamp .lock { font-size: 11px; }
.bubble .muted { color: var(--muted); }
.bubble .warn { color: var(--red); }
.msg-event.secret-ev, .msg-event.key-warn { color: #5b3cc4; font-style: normal; font-weight: 600; font-size: 13px; background: #f3efff; border: 1px solid #d9ccff; border-radius: 12px; padding: 6px 14px; }
html.dark .msg-event.secret-ev, html.dark .msg-event.key-warn { color: #c9b8ff; background: #241c44; border-color: #3d2f78; }
.msg-event.key-warn { color: #9a3412; background: #fff4e5; border-color: #fbc98a; }
.safety-code { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 12px; font-family: "Courier New", monospace; font-size: 20px; font-weight: 700; letter-spacing: 1px; text-align: center; padding: 14px; border-radius: 14px; background: linear-gradient(#f6f2ff, #ece4ff); border: 1px solid #d0c1fa; color: #3b1f9c; margin: 8px 0; }
html.dark .safety-code { background: #241c44; border-color: #3d2f78; color: #d6c9ff; }
.note-list { font-size: 13px; color: var(--muted); padding-left: 18px; }
.note-list li { margin: 4px 0; }
@media (max-width: 760px) { .secret-badge { font-size: 11px; padding: 1px 8px; margin-left: 6px; } .chat-actions #btnSecret { width: 42px; } }

/* ---------- fase 1: risposte, reazioni, fissati, anteprime ---------- */
.msg { position: relative; }
.msg-tools { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%; border: 1px solid #b9d4f1; background: rgba(255,255,255,.95);
  color: var(--blue); display: grid; place-items: center; opacity: 0; transition: opacity .12s; box-shadow: 0 1px 4px rgba(30,80,150,.2); }
.msg-tools .ic { width: 16px; height: 16px; }
.msg:not(.out) .msg-tools { right: -38px; } .msg.out .msg-tools { left: -38px; }
.msg:hover .msg-tools, .msg-tools:focus { opacity: 1; }
html.dark .msg-tools { background: #1c3150; border-color: var(--border); }
@media (hover: none) { .msg-tools { display: none; } }
.messages.classic .msg-tools { right: 4px; left: auto; }
.react-row { display: flex; gap: 2px; font-size: 22px; padding: 2px 0; }
.react-row span { cursor: pointer; padding: 2px 4px; border-radius: 8px; transition: transform .1s; }
.react-row span:hover { transform: scale(1.3); background: var(--blue-soft); }
#menu button:has(.react-row) { padding: 4px 6px; } #menu button:has(.react-row):hover { background: none; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; clear: both; }
.reacts button { border: 1px solid #c9dcf3; background: #fff; border-radius: 12px; padding: 1px 8px; font-size: 14px; line-height: 1.5; }
.reacts button.mine { border-color: var(--blue-2); background: #e3f0ff; }
html.dark .reacts button { background: #1c3150; border-color: var(--border); } html.dark .reacts button.mine { background: #24406a; border-color: #4a78b5; }
.quote { border-left: 3px solid var(--blue-2); background: rgba(77,155,242,.1); border-radius: 6px; padding: 4px 8px; margin: 0 0 6px; font-size: 14px; cursor: pointer; max-width: 100%; }
.quote b { display: block; color: var(--blue); font-size: 13px; } .quote span { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bubble.deleted em { color: var(--muted); }
.stamp .edited { font-style: italic; margin-right: 4px; }
.stamp > span[title] { margin-right: 3px; font-size: 11px; }
.reply-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid var(--blue-2); background: rgba(255,255,255,.75); border-radius: 8px; }
.reply-bar div { flex: 1; min-width: 0; font-size: 14px; } .reply-bar b { display: block; color: var(--blue); font-size: 13px; }
.reply-bar span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.dark .reply-bar { background: rgba(20,36,62,.8); }
.pinned-bar { border-bottom: 1px solid #c4dbf4; background: linear-gradient(#fffdf3, #fff7dc); padding: 4px 14px; max-height: 96px; overflow-y: auto; }
.pin-item { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 3px 0; cursor: pointer; }
.pin-item div { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .pin-item b { color: #a35a00; }
html.dark .pinned-bar { background: linear-gradient(#2b2614, #241f10); border-color: var(--border); } html.dark .pin-item b { color: #ffc278; }
.link-prev a { display: flex; gap: 10px; margin-top: 8px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.7); border: 1px solid #d2e3f6; text-decoration: none; color: inherit; max-width: 360px; }
.link-prev img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; flex: none; }
.link-prev div { min-width: 0; font-size: 13px; } .link-prev small { color: var(--muted); display: block; } .link-prev b { display: block; color: var(--blue); font-size: 14px; }
.link-prev span { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html.dark .link-prev a { background: rgba(10,20,40,.4); border-color: var(--border); }
.ttl-badge { margin-left: 8px; font-size: 13px; color: #8a5a00; background: #fff4d6; border: 1px solid #f3cf7a; border-radius: 12px; padding: 1px 8px; white-space: nowrap; }
html.dark .ttl-badge { background: #3a2f12; border-color: #7a5e20; color: #ffd27a; }
.ttl-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.msg.highlight .bubble { box-shadow: 0 0 0 3px #ffc84a !important; }

/* ---------- fase 2: gruppi ---------- */
.sender { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.messages.classic .sender { display: none; }
.chat-wrap.is-group .chat-status .dot { display: none; }
.pick-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.pick { display: flex !important; align-items: center; gap: 10px; padding: 6px 8px !important; margin: 0 !important; border-radius: 8px; cursor: pointer; color: var(--text) !important; font-size: 15px !important; }
.pick:hover { background: var(--blue-soft); } .pick span { flex: 1; } .pick input { width: 18px; height: 18px; }
.member-list { display: flex; flex-direction: column; gap: 2px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.member span { flex: 1; font-weight: 500; }
.admin-tag { color: #1a8a2e; background: #e7f7ea; border: 1px solid #b6e3bf; border-radius: 10px; padding: 1px 8px; font-size: 12px; }
html.dark .admin-tag { background: #173523; border-color: #2c6b40; color: #9fe3b0; }
.sm-btn { width: 32px; height: 32px; }
.row-inline { display: flex; gap: 8px; } .row-inline input { flex: 1; }
.sc-small { font-size: 12px; color: var(--muted); }
.row2 > .btn { padding: 11px 8px; font-size: 14px; }
/* chiamata di gruppo */
.groupcall { position: fixed; inset: 0; z-index: 300; background: radial-gradient(circle at 50% 25%, #2f63a3, #10233f 60%, #081428); color: #fff; display: flex; flex-direction: column; align-items: center; }
.gc-top { text-align: center; padding: max(18px, env(safe-area-inset-top)) 10px 8px; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.gc-top h2 { margin: 0; font-size: 24px; } .gc-top p { margin: 4px 0 0; opacity: .85; }
.gc-grid { flex: 1; width: 100%; max-width: 1200px; display: grid; gap: 10px; padding: 10px 14px 110px; grid-template-columns: 1fr; }
.gc-grid[data-n="2"] { grid-template-columns: 1fr 1fr; }
.gc-grid[data-n="3"], .gc-grid[data-n="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.gc-tile { position: relative; background: #0b1a30; border-radius: 16px; overflow: hidden; min-height: 140px; border: 2px solid rgba(255,255,255,.15); display: grid; place-items: center; }
.gc-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.gc-tile.has-video video { opacity: 1; }
.gc-tile[data-tile="me"] video { transform: scaleX(-1); }
.gc-tile .gc-av { width: 96px; height: 96px; border-radius: 24px; font-size: 34px; }
.gc-tile.has-video .gc-av { display: none; }
.gc-name { position: absolute; left: 10px; bottom: 8px; background: rgba(0,0,0,.5); padding: 2px 10px; border-radius: 10px; font-size: 14px; }
.groupcall .call-bar { position: absolute; bottom: max(22px, env(safe-area-inset-bottom)); }
@media (max-width: 760px) { .gc-grid[data-n="2"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } .gc-tile .gc-av { width: 70px; height: 70px; font-size: 26px; } }

/* ---------- fase 3: nostalgia ---------- */
.emo-a { width: 28px; height: 28px; vertical-align: -7px; }
.bubble.jumbo .emo-a { width: 64px; height: 64px; }
.emo-tabs { grid-column: 1 / -1; display: flex; gap: 6px; margin-bottom: 4px; }
.emo-tabs button { font-size: 13px !important; padding: 4px 10px !important; border: 1px solid var(--border) !important; border-radius: 12px !important; }
.emo-tabs button.on { background: var(--blue-soft) !important; border-color: var(--blue-2) !important; color: var(--blue); font-weight: 600; }
.emo-anim { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emo-anim img { width: 34px; height: 34px; }
.sparkle { font-size: 18px; line-height: 1; }
.me-music { border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 2px 6px; margin-left: -6px; outline: none; width: 100%; font-size: 13px; color: #7b4fe0; }
.me-music:hover { border-color: var(--border); } .me-music:focus { border-color: var(--blue-2); background: var(--card-soft); }
html.dark .me-music { color: #c3a6ff; }
.music-line { display: block; font-size: 14px; color: #7b4fe0; margin-top: 4px; font-style: normal; }
.anim-msg { display: flex; align-items: center; gap: 12px; } .anim-msg .ai { font-size: 34px; }
.anim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.anim-grid button { border: 1px solid var(--border); background: var(--card-soft); border-radius: 14px; padding: 14px 8px; font-weight: 600; color: var(--text); }
.anim-grid button span { display: block; font-size: 34px; } .anim-grid button.on { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(240,140,26,.25); }
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 400; pointer-events: none; }
.fx-canvas.dark { background: rgba(5,15,40,.35); }
.ink-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.ink-c { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #9fb3c8; }
.ink-c.on { box-shadow: 0 0 0 3px var(--orange); }
.ink-s { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); display: grid; place-items: center; }
.ink-s i { background: var(--text); border-radius: 50%; } .ink-s.on { border-color: var(--blue-2); background: var(--blue-soft); }
.ink-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.ink-b { padding: 5px 10px !important; font-size: 13px; } .ink-b.on { background: var(--gel-blue); color: #fff; }
.ink-canvas { width: 100%; aspect-ratio: 900 / 560; border-radius: 12px; border: 1px solid var(--border-strong); background: #fff; touch-action: none; cursor: crosshair; display: block; }
.game-pick { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; }
.modal.game-modal { width: min(760px, 100%); }
/* dama */
.dama { display: grid; grid-template-columns: repeat(8, 1fr); width: min(440px, 100%); margin: 8px auto; border: 6px solid #8a5a2b; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.dc { aspect-ratio: 1; background: #f3dfb8; display: grid; place-items: center; position: relative; }
.dc.dark { background: #a8743f; } .dc.can { cursor: pointer; } .dc.sel { background: #e8b54a; } .dc.last { box-shadow: inset 0 0 0 3px rgba(255,255,255,.55); }
.dc.tgt { cursor: pointer; } .dc.tgt::after { content: ""; width: 34%; height: 34%; border-radius: 50%; background: rgba(60,220,120,.85); box-shadow: 0 0 0 3px rgba(255,255,255,.6); }
.pc { width: 78%; height: 78%; border-radius: 50%; display: grid; place-items: center; color: #ffd84a; font-size: 18px; box-shadow: inset 0 -4px 6px rgba(0,0,0,.35), inset 0 3px 4px rgba(255,255,255,.4), 0 2px 4px rgba(0,0,0,.4); }
.pc.p1 { background: radial-gradient(circle at 35% 30%, #ff9a8a, #d1342c 60%, #8f1c17); }
.pc.p2 { background: radial-gradient(circle at 35% 30%, #6b7380, #2b2f36 60%, #111); }
.pc.mini { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }
/* battaglia navale */
.nav-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .nav-wrap h4 { margin: 4px 0 6px; font-size: 15px; } .nav-wrap small { color: var(--muted); font-weight: 400; }
.navgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; background: #1c5a8f; padding: 4px; border-radius: 8px; }
.nc { aspect-ratio: 1; background: linear-gradient(#5aa8f5, #3d8ef0); border-radius: 2px; position: relative; }
.nc.ship { background: linear-gradient(#9aa6b5, #6b7787); }
.nc.sunk { background: linear-gradient(#7a3b3b, #4d2020); }
.nc.miss::after { content: ""; position: absolute; inset: 35%; border-radius: 50%; background: rgba(255,255,255,.85); }
.nc.hit::after { content: "✸"; position: absolute; inset: 0; display: grid; place-items: center; color: #ffde4a; font-size: 13px; text-shadow: 0 0 4px #e5484d; }
.nc.aim { cursor: crosshair; } .nc.aim:hover { background: #ffe08a; }
@media (max-width: 760px) { .nav-wrap { grid-template-columns: 1fr; } }
/* impiccato */
.hang { display: flex; gap: 20px; align-items: center; justify-content: center; flex-wrap: wrap; }
.gallows { width: 150px; stroke: var(--text); stroke-width: 4; fill: none; stroke-linecap: round; } .gallows .post { stroke: #8a5a2b; stroke-width: 5; }
.word { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.word span { width: 30px; height: 40px; border-bottom: 3px solid var(--text); display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.word span.sp { border: 0; width: 14px; }
.keys { display: grid; grid-template-columns: repeat(13, 1fr); gap: 4px; margin-top: 12px; }
.key { padding: 8px 0; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--gel-silver); font-weight: 700; color: var(--text); }
.key.ok { background: #d9f7df; border-color: #6ccf7f; color: #1a6b2c; } .key.no { background: #ffe1e1; border-color: #f2a3a3; color: #a12a2a; }
.key[disabled] { opacity: .65; }
@media (max-width: 760px) { .keys { grid-template-columns: repeat(7, 1fr); } }

@media (max-width: 1500px) and (min-width: 761px) { .toolbtn.nudge span { display: none; } .toolbtn.nudge { padding: 0 12px; } .tools { gap: 8px; } .toolbtn { min-width: 44px; } }
