/* ==========================================================================
   DSM-666 • DISAGIOMETRO & TSO TEST — LUXURY DARK NEON CLINICAL SYSTEM
   Palette: Dark Void #070a13 | Midnight #0b0f19 | Card Glass #131b2e
   Accents: Toxic Cyan, Hot Magenta, Bio Green, Warning Amber, Crimson Red
   Typography: Outfit (Headings), Inter (Body), JetBrains Mono (Codes & Data)
   ========================================================================== */

:root {
  /* Surface & Base Colors */
  --bg-dark: #070a13;
  --bg-card: rgba(19, 27, 46, 0.85);
  --bg-card-hover: rgba(26, 37, 64, 0.95);
  --bg-surface-elevated: #18223a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 242, 254, 0.25);
  --border-neon-magenta: rgba(255, 0, 127, 0.35);

  /* Text Colors */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --text-inverse: #070a13;

  /* Neon Accent Palette */
  --neon-cyan: #00f2fe;
  --neon-blue: #3b82f6;
  --neon-magenta: #ff007f;
  --neon-purple: #a855f7;
  --neon-amber: #f59e0b;
  --neon-emerald: #10b981;
  --neon-crimson: #ef4444;

  /* 7 Clinical Archetypes Color Coding */
  --color-malessere: #ef4444;
  --color-cuozzo: #f59e0b;
  --color-terapia: #a855f7;
  --color-complottista: #0284c7;
  --color-narcisista: #ec4899;
  --color-maranza: #10b981;
  --color-normale: #06b6d4;

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout & Geometry */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 9999px;
  --container-max-w: 680px;

  /* Transitions & Shadows */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-neon-cyan: 0 0 25px rgba(0, 242, 254, 0.22);
  --shadow-neon-magenta: 0 0 25px rgba(255, 0, 127, 0.25);
  --shadow-card: 0 16px 40px -10px rgba(0, 0, 0, 0.65);
}

/* ==========================================================================
   RESET & BASE STYLING
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  min-height: 100%;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   ATMOSPHERIC BACKGROUND & NOISE
   ========================================================================== */
.app-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, #151d36 0%, #070a13 70%);
}

.noise-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.22;
}

.glow-1 {
  width: 380px;
  height: 380px;
  background: var(--neon-cyan);
  top: -100px;
  right: -50px;
  animation: pulseGlow 14s ease-in-out infinite alternate;
}

.glow-2 {
  width: 420px;
  height: 420px;
  background: var(--neon-magenta);
  bottom: 5%;
  left: -80px;
  animation: pulseGlow 18s ease-in-out infinite alternate-reverse;
}

@keyframes pulseGlow {
  0% { transform: scale(1) translate(0, 0); opacity: 0.18; }
  50% { transform: scale(1.15) translate(20px, 30px); opacity: 0.28; }
  100% { transform: scale(0.95) translate(-15px, -20px); opacity: 0.18; }
}

/* ==========================================================================
   APP CONTAINER & LAYOUT
   ========================================================================== */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--container-max-w);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px 36px 16px;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TOP BAR PERSISTENTE
   ========================================================================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin: 8px 0 16px 0;
  background: rgba(11, 15, 25, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
  transition: transform 0.2s var(--ease-spring);
}

.brand-logo:hover {
  transform: scale(1.03);
}

.brand-icon {
  font-size: 1.55rem;
  filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.5));
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, var(--neon-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--neon-magenta);
}

.live-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 242, 254, 0.12);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 242, 254, 0.28);
  display: inline-block;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .live-badge {
    display: none;
  }
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-top-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  position: relative;
}

.btn-top-action:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: rgba(0, 242, 254, 0.4);
  transform: translateY(-1px);
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--neon-magenta);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 9px;
  margin-left: 2px;
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.6);
}

/* ==========================================================================
   BANNER INVITO DINAMICO (?r=XXXXXX)
   ========================================================================== */
.room-invite-banner {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.22) 0%, rgba(255, 0, 127, 0.22) 100%);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25);
  animation: slideInDown 0.4s var(--ease-spring);
}

.invite-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.invite-icon {
  font-size: 1.5rem;
  animation: pulseShake 2.5s infinite;
}

.invite-info {
  display: flex;
  flex-direction: column;
}

.invite-info strong {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: #fff;
}

.invite-sub {
  font-size: 0.78rem;
  color: #fca5a5;
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseShake {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-8deg); }
  20%, 40% { transform: rotate(8deg); }
  50% { transform: rotate(0deg); }
}

/* ==========================================================================
   SCREEN MANAGEMENT (SEZIONI CON SWITCH .active)
   ========================================================================== */
.screen {
  display: none;
  opacity: 0;
  transform: translateY(12px) scale(0.99);
  transition: opacity 0.32s var(--ease-spring), transform 0.32s var(--ease-spring);
}

.screen.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: screenFadeIn 0.35s var(--ease-spring) forwards;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   SCREEN 1: HERO & HOME
   ========================================================================== */
.hero-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta), var(--neon-amber));
}

.stamp-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 0, 127, 0.12);
  color: var(--neon-magenta);
  border: 1px dashed rgba(255, 0, 127, 0.4);
  margin-bottom: 12px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 10px;
}

.hero-highlight {
  background: linear-gradient(135deg, var(--neon-cyan) 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 22px;
}

/* Patient Config Card */
.patient-config-card {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-main);
  margin-bottom: 8px;
}

.label-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--neon-cyan);
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 50%;
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.text-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 13px 60px 13px 14px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  transition: all 0.2s var(--ease-spring);
  outline: none;
}

.text-input:focus {
  border-color: var(--neon-cyan);
  background: rgba(0, 242, 254, 0.06);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.25);
}

.text-input::placeholder {
  color: var(--text-subtle);
  font-weight: 400;
}

.char-counter {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-subtle);
  pointer-events: none;
}

/* Gender Pill Selector */
.gender-pill-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gender-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  user-select: none;
}

.gender-symbol {
  font-size: 1.15rem;
  font-weight: bold;
}

.gender-name {
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
}

.gender-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.gender-pill.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--neon-cyan);
  color: #fff;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.3);
}

.gender-hint {
  font-size: 0.74rem;
  color: var(--text-subtle);
  margin-top: 8px;
}

/* CTA Action Buttons */
.cta-actions-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cta-btn {
  width: 100%;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  text-decoration: none;
  border: none;
  position: relative;
  overflow: hidden;
}

.cta-btn small {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.85;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan) 0%, #0099ff 100%);
  color: var(--text-inverse);
  box-shadow: var(--shadow-neon-cyan);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.45);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: rgba(255, 0, 127, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 0, 127, 0.45);
  box-shadow: 0 4px 20px rgba(255, 0, 127, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 0, 127, 0.25);
  border-color: var(--neon-magenta);
  transform: translateY(-2px);
  box-shadow: var(--shadow-neon-magenta);
}

.btn-secondary:active {
  transform: translateY(1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--neon-cyan);
}

.btn-text-subtle {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s;
}

.btn-text-subtle:hover {
  color: var(--text-main);
  text-decoration: underline;
}

/* Saved Rooms Box in Home */
.saved-rooms-box {
  margin-top: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

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

.box-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.box-title {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.saved-rooms-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
}

.saved-room-item:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.3);
}

.saved-room-info {
  display: flex;
  flex-direction: column;
}

.saved-room-code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.saved-room-meta {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

/* Archetypes Teaser */
.archetypes-teaser {
  margin-top: 20px;
  padding: 14px 16px;
  background: rgba(11, 15, 25, 0.65);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.teaser-header {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.teaser-tags {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.profile-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 8px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  transition: all 0.2s var(--ease-spring);
  user-select: none;
}

.profile-tag:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.07);
}

@media (max-width: 620px) {
  .teaser-tags {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 6px;
  }
  .profile-tag {
    font-size: 0.70rem;
    padding: 8px 4px;
    letter-spacing: -0.015em;
  }
}

@media (max-width: 350px) {
  .teaser-tags {
    grid-template-columns: 1fr;
  }
}

.tag-malessere { color: var(--color-malessere); border-color: rgba(239, 68, 68, 0.35); }
.tag-cuozzo { color: var(--color-cuozzo); border-color: rgba(245, 158, 11, 0.35); }
.tag-terapia { color: var(--color-terapia); border-color: rgba(168, 85, 247, 0.35); }
.tag-complottista { color: var(--color-complottista); border-color: rgba(2, 132, 199, 0.35); }
.tag-narcisista { color: var(--color-narcisista); border-color: rgba(236, 72, 153, 0.35); }
.tag-maranza { color: var(--color-maranza); border-color: rgba(16, 185, 129, 0.35); }
.tag-caso-umano { color: #f87171; border-color: rgba(248, 113, 113, 0.35); }
.tag-vegano { color: #2dd4bf; border-color: rgba(45, 212, 191, 0.35); }
.tag-normale { color: var(--color-normale); border-color: rgba(6, 182, 212, 0.35); }

/* ==========================================================================
   SCREEN 2: SCREEN TRAP LINK
   ========================================================================== */
.trap-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 0, 127, 0.35);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  box-shadow: 0 16px 40px -10px rgba(255, 0, 127, 0.25);
  text-align: center;
}

.card-status-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 0, 127, 0.14);
  color: var(--neon-magenta);
  border: 1px solid rgba(255, 0, 127, 0.4);
  margin-bottom: 14px;
}

.trap-title {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
}

.trap-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 20px;
}

.room-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed var(--border-glow);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.code-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-subtle);
}

.code-value {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--neon-cyan);
}

.link-display-box {
  margin-bottom: 20px;
}

.trap-url-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #fff;
  text-align: center;
  user-select: all;
  outline: none;
}

.trap-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

@media (max-width: 480px) {
  .trap-actions-grid {
    grid-template-columns: 1fr;
  }
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.35);
  transition: all 0.2s var(--ease-spring);
}

.btn-whatsapp:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}

.trap-secondary-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================================
   SCREEN 3: ESECUZIONE QUIZ
   ========================================================================== */
.quiz-container-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-info-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-step-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--neon-cyan);
}

.question-category-tag {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.btn-abort {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-abort:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--neon-crimson);
  color: #fff;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  border-radius: var(--radius-pill);
  transition: width 0.35s var(--ease-spring);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.5);
}

.question-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-number-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--neon-magenta);
}

.question-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.3;
  color: #fff;
  min-height: 58px;
}

/* Options Grid */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.18s var(--ease-spring);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.option-bullet {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--text-subtle);
  transition: all 0.2s;
}

.option-text {
  flex: 1;
}

.option-btn:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.4);
  transform: translateX(4px);
}

.option-btn:hover .option-bullet {
  border-color: var(--neon-cyan);
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.selected {
  background: rgba(0, 242, 254, 0.18);
  border-color: var(--neon-cyan);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.25);
}

.option-btn.selected .option-bullet {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
}

.quiz-footer-hint {
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-subtle);
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   SCREEN 4: REFERTO CLINICO & CLASSIFICA
   ========================================================================== */
.clinical-report-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 2px solid rgba(0, 242, 254, 0.3);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  box-shadow: var(--shadow-card), 0 0 35px rgba(0, 242, 254, 0.12);
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
}

.report-watermark {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.025);
  pointer-events: none;
  white-space: nowrap;
}

.report-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
  margin-bottom: 18px;
}

.report-stamp {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 242, 254, 0.12);
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 242, 254, 0.35);
}

.patient-id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.patient-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.patient-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.severity-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.badge-critical {
  background: rgba(239, 68, 68, 0.2);
  color: var(--neon-crimson);
  border: 1px solid var(--neon-crimson);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

.badge-high {
  background: rgba(245, 158, 11, 0.2);
  color: var(--neon-amber);
  border: 1px solid var(--neon-amber);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}

.badge-medium {
  background: rgba(168, 85, 247, 0.2);
  color: var(--neon-purple);
  border: 1px solid var(--neon-purple);
}

.badge-stable {
  background: rgba(16, 185, 129, 0.2);
  color: var(--neon-emerald);
  border: 1px solid var(--neon-emerald);
}

.diagnosis-block {
  margin-bottom: 18px;
}

.diagnosis-lead {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-subtle);
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 4px;
}

.primary-diagnosis-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 6px;
}

.secondary-diagnosis-title {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--neon-magenta);
}

.description-block {
  background: rgba(0, 0, 0, 0.35);
  border-left: 3px solid var(--neon-cyan);
  padding: 12px 14px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 22px;
}

.diagnosis-description-text {
  font-size: 0.92rem;
  color: #cbd5e1;
  line-height: 1.55;
  font-style: italic;
}

/* Spectrum Breakdown Bars */
.spectrum-breakdown-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.spectrum-header {
  display: flex;
  flex-direction: column;
}

.spectrum-title {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-main);
}

.spectrum-sub {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.spectrum-bars-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spectrum-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.bar-label {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-muted);
}

.bar-pct {
  font-family: var(--font-mono);
  font-weight: 800;
  color: #fff;
}

.bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.report-footer-meta {
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.protocol-id {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-subtle);
}

.certified-stamp {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--neon-cyan);
  font-weight: 700;
}

/* Post-Result Action Buttons */
.result-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 26px;
}

@media (max-width: 520px) {
  .result-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* Room Leaderboard Section */
.room-leaderboard-section {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow-card);
}

.leaderboard-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.leaderboard-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trophy-icon {
  font-size: 1.4rem;
}

.leaderboard-title {
  font-family: var(--font-heading);
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #fff;
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-refresh:hover {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--neon-cyan);
  color: #fff;
}

.leaderboard-room-meta {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-bottom: 16px;
}

.leaderboard-room-meta strong {
  color: var(--neon-cyan);
}

.leaderboard-items-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  transition: all 0.2s var(--ease-spring);
}

.leaderboard-row:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(0, 242, 254, 0.3);
}

.leaderboard-row.rank-1 {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(255, 255, 255, 0.03) 100%);
}

.leaderboard-row.rank-2 {
  border-color: rgba(226, 232, 240, 0.3);
}

.leaderboard-row.rank-3 {
  border-color: rgba(180, 83, 9, 0.35);
}

.capo-clinica-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(245, 158, 11, 0.25) 100%);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fbbf24;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.rank-badge {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  min-width: 28px;
  text-align: center;
}

.player-info-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lead-player-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-diag-tag {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-score-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.score-pct {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--neon-cyan);
}

.score-time {
  font-size: 0.68rem;
  color: var(--text-subtle);
}

.empty-state {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-icon {
  font-size: 2rem;
}

/* ==========================================================================
   MODALE STANZE SALVATE
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s var(--ease-spring);
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background: #111827;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

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

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.btn-close-modal:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

.modal-rooms-content {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

/* Custom Scrollbar */
.modal-rooms-content::-webkit-scrollbar {
  width: 5px;
}

.modal-rooms-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), var(--shadow-neon-cyan);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s var(--ease-spring);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  margin-top: 36px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-subtle);
  line-height: 1.5;
  padding: 0 12px;
}

.footer-sub {
  font-size: 0.68rem;
  opacity: 0.75;
  margin-top: 4px;
}

/* ==========================================================================
   ANIMATIONS & UTILITIES
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   GLOBAL RESPONSIVE OPTIMIZATIONS (PC & MOBILE 60 FPS)
   ========================================================================== */
@media (max-width: 480px) {
  .app-container {
    padding: 0 12px 30px 12px;
  }

  .top-bar {
    padding: 10px 12px;
    margin: 6px 0 14px 0;
  }

  .brand-name {
    font-size: 1.02rem;
  }

  .brand-icon {
    font-size: 1.35rem;
  }

  .btn-nav-rooms {
    padding: 6px 10px;
    font-size: 0.76rem;
  }

  .home-hero-card {
    padding: 20px 14px;
    margin-bottom: 16px;
  }

  .hero-title {
    font-size: clamp(1.4rem, 6.2vw, 1.85rem);
    line-height: 1.15;
    margin-bottom: 8px;
  }

  .hero-subtitle {
    font-size: 0.86rem;
    line-height: 1.4;
    margin-bottom: 16px;
  }

  .patient-config-card {
    padding: 14px 12px;
    gap: 14px;
    margin-bottom: 16px;
  }

  .gender-pill {
    padding: 8px 4px;
  }

  .gender-symbol {
    font-size: 1.05rem;
  }

  .gender-name {
    font-size: 0.72rem;
  }

  .cta-btn {
    padding: 13px 14px;
    font-size: 0.92rem;
  }

  .quiz-container-card {
    padding: 18px 14px;
    gap: 14px;
  }

  .question-title {
    font-size: 1.15rem;
    min-height: auto;
    line-height: 1.35;
  }

  .options-grid {
    gap: 8px;
  }

  .option-btn {
    padding: 11px 12px;
    font-size: 0.88rem;
    gap: 10px;
    line-height: 1.35;
  }

  .clinical-report-card {
    padding: 20px 14px;
    margin-bottom: 16px;
  }

  .report-patient-name {
    font-size: 1.25rem;
  }

  .primary-profile-title {
    font-size: 1.35rem;
  }

  .primary-profile-desc {
    font-size: 0.85rem;
  }

  .primary-profile-quote {
    font-size: 0.86rem;
    line-height: 1.45;
  }

  .room-leaderboard-section {
    padding: 16px 12px;
  }

  .leaderboard-row {
    padding: 10px 10px;
    gap: 8px;
  }

  .lead-player-name {
    font-size: 0.88rem;
  }

  .player-diag-tag {
    font-size: 0.70rem;
  }

  .score-pct {
    font-size: 0.98rem;
  }

  .trap-card {
    padding: 20px 14px;
  }

  .trap-title {
    font-size: 1.25rem;
  }
}

@media (max-width: 360px) {
  .app-container {
    padding: 0 8px 24px 8px;
  }

  .gender-pill-selector {
    gap: 4px;
  }

  .gender-name {
    font-size: 0.68rem;
  }

  .option-btn {
    padding: 10px 10px;
    font-size: 0.84rem;
  }
}


