@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@600;700&display=swap');

:root {
  --bg-deep: #09050d;
  --bg-surface: #140d1c;
  --panel: rgba(25, 17, 34, 0.75);
  --panel-active: rgba(38, 26, 52, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #f7f2fb;
  --muted: #9584a5;
  --purple: #b784fc;
  --purple-glow: rgba(183, 132, 252, 0.4);
  --pink: #f43f7a;
  --pink-glow: rgba(244, 63, 122, 0.5);
  --mint: #34d399;
  --amber: #fbbf24;
  --radius-pill: 999px;
  --radius-lg: 28px;
  --radius-md: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: 
    radial-gradient(circle at 50% 0%, rgba(183, 132, 252, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(244, 63, 122, 0.1) 0%, transparent 50%),
    var(--bg-deep);
  color: var(--ink);
  font: 14px/1.4 'Plus Jakarta Sans', -apple-system, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button {
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

button:active {
  transform: scale(0.97);
}

/* App Container (Mobile centered layout) */
.app-container {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 95px;
  position: relative;
}

/* Minimal Top Bar */
.top-bar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 5, 13, 0.85);
  backdrop-filter: blur(16px);
}

.brand-logo {
  font: 700 22px 'Space Grotesk', sans-serif;
  letter-spacing: -1px;
}

.brand-logo span {
  color: var(--purple);
}

.actor-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
}

.actor-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
}

/* Stage & Doll */
.stage-hero {
  padding: 10px 20px 18px;
  text-align: center;
  position: relative;
}

.doll-card {
  background: 
    radial-gradient(circle at 50% 30%, #2b1b3b 0%, #130a1c 80%),
    linear-gradient(180deg, #1d1226 0%, #0d0614 100%);
  border: 1px solid rgba(183, 132, 252, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px 20px 24px;
  position: relative;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  touch-action: pan-y;
  perspective: 1000px;
}

.doll-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.doll-name-tag {
  font: 700 18px 'Space Grotesk', sans-serif;
  color: #fff;
}

.flip-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.flip-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.doll-viewport {
  width: 230px;
  height: 290px;
  margin: 6px auto;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
  cursor: grab;
  user-select: none;
}

.doll-viewport:active {
  cursor: grabbing;
}

.doll-viewport.flipping-3d {
  animation: dollFlip3d 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes dollFlip3d {
  0% {
    transform: perspective(1000px) rotateY(0deg) scale(1);
  }
  50% {
    transform: perspective(1000px) rotateY(90deg) scale(0.92);
    filter: brightness(0.7);
  }
  100% {
    transform: perspective(1000px) rotateY(0deg) scale(1);
    filter: brightness(1);
  }
}

.doll-viewport svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.5));
}

/* ✨ ANIMAZIONI DELLA BAMBOLA ✨ */
.sim-head { transform-origin: 150px 132px; }
.sim-body { transform-origin: 150px 240px; }
.sim-leg  { transform-origin: 184px 296px; }

.react-headache .sim-head { animation: headache 2s ease; }
.react-neck .sim-head     { animation: neck 2s ease; }
.react-back .sim-body     { animation: back 2s ease; }
.react-foot .sim-leg      { animation: foot 2s ease; }
.react-hand .sim-body     { animation: arm-twitch 1.8s ease; }
.react-arm .sim-body      { animation: arm-twitch 1.8s ease; }

@keyframes neck {
  0%, 100% { transform: rotate(0); }
  20%, 65% { transform: rotate(24deg); }
  40%, 80% { transform: rotate(15deg); }
}

@keyframes headache {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-6px) rotate(-4deg); }
  30%, 60%, 90% { transform: translateX(6px) rotate(4deg); }
}

@keyframes back {
  0%, 100% { transform: rotate(0); }
  25%, 65% { transform: rotate(14deg) translateX(6px); }
  45%, 85% { transform: rotate(8deg); }
}

@keyframes foot {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-24deg); }
  40%, 80% { transform: rotate(18deg); }
}

@keyframes arm-twitch {
  20%, 60% { transform: rotate(-12deg) translateX(4px); }
  40%, 80% { transform: rotate(12deg) translateX(-4px); }
  100%     { transform: rotate(0); }
}

.spark-ring {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 140px;
  height: 140px;
  border: 2px dashed rgba(244, 63, 122, 0.7);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: ring 1.5s ease forwards;
}

@keyframes ring {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  30%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
}

/* 📍 REALISTICO SPILLO 3D CON METALLO CROMATO E CAPOCCHIA SFERICA CON RIFLESSI 📍 */
.real-pin {
  position: absolute;
  transform-origin: bottom center;
  z-index: 20;
  cursor: pointer;
  filter: drop-shadow(4px 8px 12px rgba(0, 0, 0, 0.8));
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s ease;
}

.real-pin:hover, .real-pin.selected-pin {
  filter: drop-shadow(0 0 16px var(--pink-glow)) brightness(1.2);
  z-index: 30;
}

/* Animazione spillo conficcato */
.real-pin.pin-stabbing {
  animation: pinStabIn 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pinStabIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -180%) scale(1.6) rotate(-20deg);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, -90%) scale(0.95);
  }
  80% {
    transform: translate(-50%, -105%) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
  }
}

/* Stelo / Ago d'acciaio 3D affilato */
.real-pin-needle {
  width: 5px;
  height: 62px;
  background: linear-gradient(90deg, 
    #7a889b 0%, 
    #ffffff 35%, 
    #cbd5e1 65%, 
    #475569 100%
  );
  border-radius: 3px 3px 1px 1px;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.5);
  position: relative;
}

/* Punta affilata d'acciaio */
.real-pin-needle::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 0;
  border-left: 2.5px solid transparent;
  border-right: 2.5px solid transparent;
  border-top: 5px solid #475569;
}

/* Capocchia Sferica 3D (Perla con riflesso e ombra realistica) */
.real-pin-head {
  position: absolute;
  top: -16px;
  left: -8px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, 
    #ffffff 0%, 
    #ff8eb1 25%, 
    #f43f7a 55%, 
    #88082e 88%,
    #420013 100%
  );
  box-shadow: 
    inset -2px -2px 5px rgba(0,0,0,0.6),
    0 4px 10px rgba(244, 63, 122, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

/* Spillo Dorato 3D Rimbalzo x2 */
.real-pin.rebound .real-pin-head {
  background: radial-gradient(circle at 30% 28%, 
    #ffffff 0%, 
    #ffe885 25%, 
    #fbbf24 55%, 
    #926600 88%,
    #4a3300 100%
  );
  box-shadow: 
    inset -2px -2px 5px rgba(0,0,0,0.6),
    0 4px 12px rgba(251, 191, 36, 0.8);
}

/* 📜 BOTTOM POPUP MODAL (Il messaggio esce senza nascondere la bambola!) */
.pin-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.pin-sheet-modal {
  width: 100%;
  max-width: 440px;
  background: #191024;
  border-top: 1px solid rgba(183, 132, 252, 0.35);
  border-radius: 28px 28px 0 0;
  padding: 24px 20px 32px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Badge Statistiche Condivisibili Instagram */
.ig-stats-bar {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
}

.stat-pill.pinned {
  border-color: rgba(244, 63, 122, 0.4);
  color: #ffb3c7;
}

.stat-pill.blocked {
  border-color: rgba(52, 211, 153, 0.4);
  color: #a7f3d0;
}

.btn-share-ig {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  margin: 14px auto 0;
  box-shadow: 0 4px 15px rgba(220, 39, 67, 0.4);
}

/* Hotspots per toccare e mirare */
.hotspot {
  position: absolute;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 10;
  display: grid;
  place-items: center;
}

.hotspot::after {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

.hotspot:hover::after, .hotspot[aria-selected="true"]::after {
  transform: scale(2);
  background: var(--pink);
  border-color: #fff;
  box-shadow: 0 0 16px var(--pink);
}

/* Compose Action Sheet / Form essenziale */
.action-sheet {
  padding: 0 20px;
}

.compact-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  backdrop-filter: blur(12px);
  margin-bottom: 14px;
}

.target-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  outline: none;
  width: 100%;
}

.mini-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  font-size: 13.5px;
  outline: none;
  resize: none;
  margin-top: 8px;
}

.mini-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(183, 132, 252, 0.2);
}

.quick-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0 2px;
}

.quick-chip {
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  color: var(--muted);
}

.quick-chip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-strike {
  width: 100%;
  background: linear-gradient(135deg, var(--purple) 0%, #944afb 100%);
  color: #120424;
  font-weight: 700;
  font-size: 15px;
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 25px rgba(183, 132, 252, 0.35);
  margin-top: 6px;
}

.btn-strike:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Bottom Nav Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(12, 7, 18, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(20px);
  z-index: 50;
}

.bottom-nav-inner {
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  padding: 8px 10px 14px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  position: relative;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.nav-item[aria-selected="true"] {
  color: var(--purple);
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: 10px;
  background: var(--pink);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

/* Clean Inbox Feed */
.inbox-list {
  padding: 0 20px;
}

.inbox-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.inbox-card:hover {
  background: var(--panel-active);
  border-color: rgba(183, 132, 252, 0.3);
}

.pin-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(183, 132, 252, 0.12);
  border: 1px solid rgba(183, 132, 252, 0.25);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.quote-box {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--purple);
  padding: 14px 16px;
  border-radius: 0 12px 12px 0;
  font-size: 14.5px;
  color: #eee;
  margin: 16px 0;
}

.suspect-pill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.suspect-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.suspect-pill:hover {
  background: rgba(183, 132, 252, 0.2);
  border-color: var(--purple);
}

/* Persona Switcher Bar in alto */
.actor-switcher-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 9, 20, 0.6);
}

.actor-avatar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.actor-avatar-btn[aria-pressed="true"] {
  background: rgba(183, 132, 252, 0.2);
  border-color: var(--purple);
  color: #fff;
}
